|
2 | 2 |
|
3 | 3 | function nomad-install() {
|
4 | 4 |
|
5 |
| -# ensure localstack is running |
6 |
| -echo -e '\e[38;5;198m'"++++ Ensure Consul is running.." |
7 |
| -sudo bash /vagrant/hashicorp/consul.sh |
| 5 | + if pgrep -x "consul" >/dev/null |
| 6 | + then |
| 7 | + echo "Consul is running" |
| 8 | + else |
| 9 | + echo -e '\e[38;5;198m'"++++ Ensure Consul is running.." |
| 10 | + sudo bash /vagrant/hashicorp/consul.sh |
| 11 | + fi |
8 | 12 |
|
9 |
| -arch=$(lscpu | grep "Architecture" | awk '{print $NF}') |
10 |
| -if [[ $arch == x86_64* ]]; then |
| 13 | + arch=$(lscpu | grep "Architecture" | awk '{print $NF}') |
| 14 | + if [[ $arch == x86_64* ]]; then |
11 | 15 | ARCH="amd64"
|
12 |
| -elif [[ $arch == aarch64 ]]; then |
| 16 | + elif [[ $arch == aarch64 ]]; then |
13 | 17 | ARCH="arm64"
|
14 |
| -fi |
15 |
| -echo -e '\e[38;5;198m'"CPU is $ARCH" |
| 18 | + fi |
| 19 | + echo -e '\e[38;5;198m'"CPU is $ARCH" |
16 | 20 |
|
17 |
| -sudo DEBIAN_FRONTEND=noninteractive apt-get --assume-yes install curl unzip jq |
18 |
| -yes | sudo docker system prune -a |
19 |
| -yes | sudo docker system prune --volumes |
20 |
| -mkdir -p /etc/nomad |
| 21 | + sudo DEBIAN_FRONTEND=noninteractive apt-get --assume-yes install curl unzip jq |
| 22 | + yes | sudo docker system prune -a |
| 23 | + yes | sudo docker system prune --volumes |
| 24 | + mkdir -p /etc/nomad |
21 | 25 | cat <<EOF | sudo tee /etc/nomad/server.conf
|
22 | 26 | data_dir = "/var/lib/nomad"
|
23 | 27 |
|
@@ -115,26 +119,26 @@ EOF
|
115 | 119 | nomad server members
|
116 | 120 | nomad node status
|
117 | 121 | fi
|
118 |
| -cd /vagrant/hashicorp/nomad/jobs; |
119 |
| -#nomad plan --address=http://localhost:4646 countdashboard.nomad |
120 |
| -#nomad run --address=http://localhost:4646 countdashboard.nomad |
121 |
| -#nomad plan --address=http://localhost:4646 countdashboardtest.nomad |
122 |
| -#nomad run --address=http://localhost:4646 countdashboardtest.nomad |
123 |
| -nomad plan --address=http://localhost:4646 fabio.nomad |
124 |
| -nomad run --address=http://localhost:4646 fabio.nomad |
125 |
| -nomad plan --address=http://localhost:4646 traefik.nomad |
126 |
| -nomad run --address=http://localhost:4646 traefik.nomad |
127 |
| -nomad plan --address=http://localhost:4646 traefik-whoami.nomad |
128 |
| -nomad run --address=http://localhost:4646 traefik-whoami.nomad |
129 |
| -# curl -v -H 'Host: fabio.service.consul' http://${VAGRANT_IP}:9999/ |
130 |
| -echo -e '\e[38;5;198m'"++++ Nomad http://localhost:4646" |
131 |
| -echo -e '\e[38;5;198m'"++++ Nomad Documentation http://localhost:3333/#/hashicorp/README?id=nomad" |
132 |
| -echo -e '\e[38;5;198m'"++++ Fabio Dashboard http://localhost:9998" |
133 |
| -echo -e '\e[38;5;198m'"++++ Fabio Loadbalancer http://localhost:9998" |
134 |
| -echo -e '\e[38;5;198m'"++++ Fabio Documentation http://localhost:3333/#/hashicorp/README?id=fabio-load-balancer-for-nomad" |
135 |
| -echo -e '\e[38;5;198m'"++++ Treafik Dashboard http://localhost:8181" |
136 |
| -echo -e '\e[38;5;198m'"++++ Traefik Loadbalancer: http://localhost:8080" |
137 |
| -echo -e '\e[38;5;198m'"++++ Traefik Documentation: http://localhost:3333/#/hashicorp/README?id=traefik-load-balancer-for-nomad" |
| 122 | + cd /vagrant/hashicorp/nomad/jobs; |
| 123 | + #nomad plan --address=http://localhost:4646 countdashboard.nomad |
| 124 | + #nomad run --address=http://localhost:4646 countdashboard.nomad |
| 125 | + #nomad plan --address=http://localhost:4646 countdashboardtest.nomad |
| 126 | + #nomad run --address=http://localhost:4646 countdashboardtest.nomad |
| 127 | + nomad plan --address=http://localhost:4646 fabio.nomad |
| 128 | + nomad run --address=http://localhost:4646 fabio.nomad |
| 129 | + nomad plan --address=http://localhost:4646 traefik.nomad |
| 130 | + nomad run --address=http://localhost:4646 traefik.nomad |
| 131 | + nomad plan --address=http://localhost:4646 traefik-whoami.nomad |
| 132 | + nomad run --address=http://localhost:4646 traefik-whoami.nomad |
| 133 | + # curl -v -H 'Host: fabio.service.consul' http://${VAGRANT_IP}:9999/ |
| 134 | + echo -e '\e[38;5;198m'"++++ Nomad http://localhost:4646" |
| 135 | + echo -e '\e[38;5;198m'"++++ Nomad Documentation http://localhost:3333/#/hashicorp/README?id=nomad" |
| 136 | + echo -e '\e[38;5;198m'"++++ Fabio Dashboard http://localhost:9998" |
| 137 | + echo -e '\e[38;5;198m'"++++ Fabio Loadbalancer http://localhost:9998" |
| 138 | + echo -e '\e[38;5;198m'"++++ Fabio Documentation http://localhost:3333/#/hashicorp/README?id=fabio-load-balancer-for-nomad" |
| 139 | + echo -e '\e[38;5;198m'"++++ Treafik Dashboard http://localhost:8181" |
| 140 | + echo -e '\e[38;5;198m'"++++ Traefik Loadbalancer: http://localhost:8080" |
| 141 | + echo -e '\e[38;5;198m'"++++ Traefik Documentation: http://localhost:3333/#/hashicorp/README?id=traefik-load-balancer-for-nomad" |
138 | 142 | }
|
139 | 143 |
|
140 | 144 | nomad-install
|
0 commit comments