Last active
December 5, 2022 09:02
-
-
Save jonaskahn/e035e11357686237ab18c982acafd7d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
sudo apt install -y unzip zip | |
export NOMAD_VERSION=1.4.3 | |
printf "Download & install nomad v${NOMAD_VERSION}\n" | |
curl --silent --remote-name https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_linux_amd64.zip | |
unzip nomad_${NOMAD_VERSION}_linux_amd64.zip | |
sudo chown root:root nomad | |
sudo mv nomad /usr/local/bin/ | |
nomad version | |
nomad -autocomplete-install | |
complete -C /usr/local/bin/nomad nomad | |
sudo mkdir --parents /opt/nomad | |
sudo useradd --system --home /etc/nomad.d --shell /bin/false nomad | |
sudo rm -rf /etc/systemd/system/nomad.service | |
echo " | |
[Unit] | |
Description=Nomad | |
Documentation=https://www.nomadproject.io/docs/ | |
Wants=network-online.target | |
After=network-online.target | |
Wants=consul.service | |
After=consul.service | |
[Service] | |
User=nomad | |
Group=nomad | |
ExecReload=/bin/kill -HUP $MAINPID | |
ExecStart=/usr/local/bin/nomad agent -config /etc/nomad.d | |
KillMode=process | |
KillSignal=SIGINT | |
LimitNOFILE=65536 | |
LimitNPROC=infinity | |
Restart=on-failure | |
RestartSec=2 | |
TasksMax=infinity | |
OOMScoreAdjust=-1000 | |
[Install] | |
WantedBy=multi-user.target | |
" | sudo tee -a /etc/systemd/system/nomad.service | |
sudo rm -rf nomad_${NOMAD_VERSION}_linux_amd64.zip | |
sudo mkdir --parents /etc/nomad.d | |
sudo chmod 700 /etc/nomad.d | |
sudo touch /etc/nomad.d/nomad.hcl && \ | |
sudo touch /etc/nomad.d/server.hcl && \ | |
sudo touch /etc/nomad.d/client.hcl && \ | |
sudo touch /etc/nomad.d/consul.hcl | |
sudo systemctl enable nomad | |
sudo chown --recursive nomad:nomad /etc/nomad.d | |
sudo chown --recursive nomad:nomad /opt/nomad | |
sudo usermod -aG docker nomad |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bash -c "$(curl -fsSL https://gist.github.com/tuyendev/e035e11357686237ab18c982acafd7d7/raw/e8e4ca6be32bbe0728b9f6b19b7abce07864fa83/install-nomad.sh)"