Skip to content

Instantly share code, notes, and snippets.

View shantanugadgil's full-sized avatar
🙂
🤔 😀 👋

Shantanu Gadgil shantanugadgil

🙂
🤔 😀 👋
  • Pune, Maharashtra, India
View GitHub Profile
@shantanugadgil
shantanugadgil / install_consul_nomad
Last active September 22, 2020 16:10
Install Consul and Nomad onto the machine
# install the Consul binary
wget https://releases.hashicorp.com/consul/1.8.4/consul_1.8.4_linux_amd64.zip -O consul.zip
unzip -o consul.zip
sudo chown root:root consul
sudo mv -fv consul /usr/sbin/
# install the Nomad binary
wget https://releases.hashicorp.com/nomad/0.12.5/nomad_0.12.5_linux_amd64.zip -O nomad.zip
unzip -o nomad.zip
sudo chown root:root nomad
@shantanugadgil
shantanugadgil / setup_consul_nomad_server
Last active June 17, 2019 13:47
Setup the server for Consul and Nomad
### On the server machine ...
### Consul
sudo mkdir -p /etc/consul/
sudo wget https://raw.githubusercontent.com/shantanugadgil/hashistack/master/config/consul/server.hcl -O /etc/consul/server.hcl
### Edit Consul's server.hcl file and setup the fields 'encrypt' and 'retry_join' as per your cluster.
sudo vim /etc/consul/server.hcl
### Nomad
@shantanugadgil
shantanugadgil / setup_consul_nomad_loadbalancer
Last active June 17, 2019 13:47
Setup the load-balancer machine
### On the load-balancer machine ...
### for Consul
sudo mkdir -p /etc/consul/
sudo wget https://raw.githubusercontent.com/shantanugadgil/hashistack/master/config/consul/client.hcl -O /etc/consul/client.hcl
### Edit Consul's client.hcl file and setup the fields 'name', 'encrypt', 'retry_join' as per your cluster.
sudo vim /etc/consul/client.hcl
### for Nomad ...
@shantanugadgil
shantanugadgil / setup_consul_nomad_client
Last active November 9, 2022 13:45
Setup the client (worker) machine
### On the client (worker) machine ...
### Consul
sudo mkdir -p /etc/consul/
sudo wget https://raw.githubusercontent.com/shantanugadgil/hashistack/master/config/consul/client.hcl -O /etc/consul/client.hcl
### Edit Consul's client.hcl file and setup the fields 'name', 'encrypt', 'retry_join' as per your cluster.
sudo vim /etc/consul/client.hcl
### Nomad
Node Address Status Type Build Protocol DC Segment
srv1 192.168.1.11:8301 alive server 1.5.1 2 dc1 <all>
client1 192.168.1.201:8301 alive client 1.5.1 2 dc1 <default>
client2 192.168.1.202:8301 alive client 1.5.1 2 dc1 <default>
lb1 192.168.1.101:8301 alive client 1.5.1 2 dc1 <default>
Name Address Port Status Leader Protocol Build Datacenter Region
srv1.global 192.168.1.11 4648 alive true 2 0.9.3 dc1 global
ID DC Name Class Address Version Drain Eligibility Status
ID = 1a6a5587
Eval ID = bb140467
Name = fabio_docker.fabio[0]
Node ID = 621f4411
Node Name = lb1
Job ID = fabio_docker
Job Version = 0
Client Status = running
Client Description = Tasks are running
Desired Status = run
==> Monitoring evaluation "bb140467"
Evaluation triggered by job "fabio_docker"
Allocation "1a6a5587" created: node "621f4411", group "fabio"
Evaluation status changed: "pending" -> "complete"
==> Evaluation "bb140467" finished with status "complete"
==> Monitoring evaluation "a994bbf0"
Evaluation triggered by job "foo_docker"
Allocation "7794b538" created: node "9bab72b1", group "gowebhello"
Allocation "eecceffc" modified: node "37daf354", group "gowebhello"
Evaluation status changed: "pending" -> "complete"
==> Evaluation "a994bbf0" finished with status "complete"
ID = 7794b538
Eval ID = a994bbf0
Name = foo_docker.gowebhello[1]
Node ID = 9bab72b1
Node Name = client1
Job ID = foo_docker
Job Version = 1
Client Status = running
Client Description = Tasks are running
Desired Status = run
==> Monitoring evaluation "075076bc"
Evaluation triggered by job "bar_docker"
Allocation "9f16354b" created: node "9bab72b1", group "gowebhello"
Allocation "b86d8946" created: node "37daf354", group "gowebhello"
Evaluation status changed: "pending" -> "complete"
==> Evaluation "075076bc" finished with status "complete"