Skip to content

Instantly share code, notes, and snippets.

View mohak1712's full-sized avatar

Mohak Puri mohak1712

View GitHub Profile
public class App {
private static Consul consul;
private static final String SERVICE_ID = "ping-pong-1-id";
public static void main(String[] args) {
port(8000);
consul = Consul.builder().withHostAndPort(HostAndPort.fromParts(System.getenv("host"), 8500))
.build();
AgentClient agentClient = consul.agentClient();
registerOnConsul(agentClient);
:profiles {:dev {:dependencies [[figwheel-sidecar "0.5.18"]
[cider/piggieback "0.4.0"]]
:source-paths ["src" "env/dev"]
:cljsbuild {:builds [
{:id "ios"
:source-paths ["src" "env/dev"]
:figwheel true
:compiler {:output-to "target/ios/index.js"
:main "env.ios.main"
:output-dir "target/ios"
(defn app-root []
(let [greeting (subscribe [:get-greeting])]
(fn []
[view {:style {:flex-direction "column" :margin 40 :align-items "center"}}
[text {:style {:font-size 30 :font-weight "100" :margin-bottom 20 :text-align "center"}} @greeting]
[image {:source logo-img
:style {:width 80 :height 80 :margin-bottom 30}}]
[touchable-highlight {:style {:background-color "#13DD1C" :padding 10 :border-radius 5}
:on-press #(alert "Hello from clojure!")}
[text {:style {:color "white" :text-align "center" :font-weight "bold"}} "press me"]]])))
clusters:
- name: ping_pong_service
connect_timeout: 0.25s
type: logical_dns
http2_protocol_options: {}
lb_policy: round_robin
hosts: [{ socket_address: { address: host.docker.internal, port_value: 8080 }}]
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- match: { prefix: "/" }
route:
cluster: ping_pong_service
max_grpc_timeout: 0s
cors:
allow_origin:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 9090 }
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 0.0.0.0, port_value: 9901 }
var grpc = require('grpc');
var pingPongProto = grpc.load('ping_pong.proto');
var server = new grpc.Server();
server.addService(pingPongProto.pingpong.PingPongService.service, {
pingPong: function(call,callback) {
console.log("Request")
return callback(null,{pong:"Pong"})
}
});
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 0.0.0.0, port_value: 9901 }
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 9090 }
FROM envoyproxy/envoy-dev:latest
COPY ./envoy.yaml /etc/envoy/envoy.yaml
CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml -l trace --log-path /tmp/envoy_info.log