-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclient.sh
49 lines (41 loc) · 1.17 KB
/
client.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
#!/bin/bash -v
apt-get update
apt-get install -qq curl unzip
#enable nomad
mkdir -p /var/lib/nomad
wget https://releases.hashicorp.com/nomad/NOMAD_VERSION/nomad_NOMAD_VERSION_linux_amd64.zip
unzip nomad_NOMAD_VERSION_linux_amd64.zip -d /usr/local/bin
rm nomad_NOMAD_VERSION_linux_amd64.zip
private_ip=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
cat <<EOF > /etc/nomad
region = "AWS_REGION"
datacenter = "dc1"
bind_addr = "$private_ip"
log_level = "INFO"
data_dir = "/var/lib/nomad"
client {
enabled = true
servers = ["s1.SERVER_DOMAIN","s2.SERVER_DOMAIN","s3.SERVER_DOMAIN"]
options {
"driver.raw_exec.enable" = "1"
}
}
EOF
cat <<EOF > /lib/systemd/system/nomad.service
[Unit]
Description=Nomad
Documentation=https://nomadproject.io/docs/
[Service]
ExecStart=/usr/local/bin/nomad agent -config /etc/nomad
ExecReload=/bin/kill -HUP \$MAINPID
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
EOF
systemctl enable nomad
systemctl start nomad
#Fix memory.limit_in_bytes issue on debian8
#https://github.com/hashicorp/nomad/issues/1664
echo "GRUB_CMDLINE_LINUX_DEFAULT=\"quiet cgroup_enable=memory swapaccount=1\"" >> /etc/default/grub
update-grub
reboot