forked from christianmahardhika/nomad-consul-development
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·79 lines (61 loc) · 2.1 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# Download Nomad Linux
sudo apt-get update && \
sudo apt-get install wget gpg coreutils && \
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list && \
sudo apt-get update && \
sudo apt-get install nomad
## set time to sleep 1 second
sleep 1
# Verify nomad installation
nomad -v && \
if [ $? -eq 0 ]; then
echo "Nomad is installed"
else
echo "Nomad is not installed"
fi
## set time to sleep 1 second
sleep 1
# Post installation
curl -L -o cni-plugins.tgz "https://github.com/containernetworking/plugins/releases/download/v1.0.0/cni-plugins-linux-$( [ $(uname -m) = aarch64 ] && echo arm64 || echo amd64)"-v1.0.0.tgz && \
sudo mkdir -p /opt/cni/bin && \
sudo tar -C /opt/cni/bin -xzf cni-plugins.tgz
echo 1 | sudo tee /proc/sys/net/bridge/bridge-nf-call-arptables && \
echo 1 | sudo tee /proc/sys/net/bridge/bridge-nf-call-ip6tables && \
echo 1 | sudo tee /proc/sys/net/bridge/bridge-nf-call-iptables
sudo sysctl -w net.bridge.bridge-nf-call-arptables=1
sudo sysctl -w net.bridge.bridge-nf-call-ip6tables=1
sudo sysctl -w net.bridge.bridge-nf-call-iptables=1
## set time to sleep 1 second
sleep 1
# Download Consul Linux
sudo apt install consul
## set time to sleep 1 second
sleep 1
# Verify consul installation
consul -v && \
if [ $? -eq 0 ]; then
echo "Consul is installed"
else
echo "Consul is not installed"
fi
# Download Vault Linux
sudo apt install vault
## set time to sleep 1 second
sleep 1
# Verify vault installation
vault -v && \
if [ $? -eq 0 ]; then
echo "Vault is installed"
else
echo "Vault is not installed"
fi
# start consul agent in dev mode to connect to nomad in background
consul agent -config-dir=./consul -dev &
## set time to sleep 1 second
sleep 1
# Start vault server in dev mode in background
vault server -dev &
# run nomad agent to connect to consul
nomad agent -config nomad/config.hcl -dev &