Skip to content

Instantly share code, notes, and snippets.

View pranavcode's full-sized avatar

Pranav Kulkarni pranavcode

View GitHub Profile
@pranavcode
pranavcode / consul-srv-service-entries
Created March 10, 2019 08:20
Velotio - HashiCorp Consul Part 1 - Consul DNS SRV Service Entries
$ dig @127.0.0.1 -p 8600 web.service.consul SRV
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> @127.0.0.1 -p 8600 web.service.consul SRV
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 712
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 3
;; WARNING: recursion requested but not available
@pranavcode
pranavcode / consul-dns-service-discovery
Created March 10, 2019 08:18
Velotio - HashiCorp Consul Part 1 - Consul DNS Service Discovery
$ dig @127.0.0.1 -p 8600 web.service.consul
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> @127.0.0.1 -p 8600 web.service.consul
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51488
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 2
;; WARNING: recursion requested but not available
@pranavcode
pranavcode / consul-agent-dev-config
Created March 10, 2019 08:16
Velotio - HashiCorp Consul Part 1 - Consul Agent Configuration
$ consul agent -dev -config-dir=./consul.d
==> Starting Consul agent...
==> Consul agent running!
Version: 'v1.4.2'
Node ID: '810f4804-dbce-03b1-056a-a81269ca90c1'
Node name: 'devcube'
Datacenter: 'dc1' (Segment: '<all>')
Server: true (Bootstrap: false)
Client Addr: [127.0.0.1] (HTTP: 8500, HTTPS: -1, gRPC: 8502, DNS: 8600)
@pranavcode
pranavcode / consul-service-definition
Created March 10, 2019 08:14
Velotio - HashiCorp Consul Part 1 - Consul Service Definition
$ echo '{"service": {"name": "web", "tags": ["django"], "port": 80}}' \
> ./consul.d/web.json
@pranavcode
pranavcode / consul-config-directory
Created March 10, 2019 08:13
Velotio - HashiCorp Consul Part 1 - Consul Config Directory
$ mkdir ./consul.d
@pranavcode
pranavcode / consul-dns
Created March 10, 2019 08:11
Velotio - HashiCorp Consul Part 1 - Consul DNS Check
$ dig @127.0.0.1 -p 8600 devcube.node.consul
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> @127.0.0.1 -p 8600 devcube.node.consul
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42215
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 2
;; WARNING: recursion requested but not available
@pranavcode
pranavcode / consul-http-api
Created March 10, 2019 08:10
Velotio - HashiCorp Consul Part 1 - Consul HTTP API
$ curl localhost:8500/v1/catalog/nodes
[
{
"ID": "ef46ebb7-3496-346f-f67a-30117cfec0ad",
"Node": "devcube",
"Address": "127.0.0.1",
"Datacenter": "dc1",
"TaggedAddresses": {
"lan": "127.0.0.1",
@pranavcode
pranavcode / consul-members
Created March 10, 2019 08:09
Velotio - HashiCorp Consul Part 1 - Consul Members
$ consul members
Node Address Status Type Build Protocol DC Segment
devcube 127.0.0.1:8301 alive server 1.4.0 2 dc1 <all>
@pranavcode
pranavcode / run-consul-dev-mode
Created March 10, 2019 08:06
Velotio - HashiCorp Consul Part 1 - Run Consul in dev mode
$ consul agent -dev
==> Starting Consul agent...
==> Consul agent running!
Version: 'v1.4.2'
Node ID: 'ef46ebb7-3496-346f-f67a-30117cfec0ad'
Node name: 'devcube'
Datacenter: 'dc1' (Segment: '<all>')
Server: true (Bootstrap: false)
Client Addr: [127.0.0.1] (HTTP: 8500, HTTPS: -1, gRPC: 8502, DNS: 8600)
@pranavcode
pranavcode / update-path-add-consul
Last active March 10, 2019 13:45
Velotio - HashiCorp Consul Part 1 - Update PATH
$ export PATH="$PATH:/path/to/consul"