Alex Vitorino

Alex Vitorino

Running Hashicorp Nomad on Raspberry

Hi everyone, in this post I explain the Hashicorp Nomad installation process to manage Docker containers on my Raspberry Pi.

Definition of Nomad "A simple and flexible workload orchestrator to deploy and manage containers and non-containerized applications across on-prem and clouds at scale." according to the website.

I have been using the Raspberry Pi OS 64 bits on a Raspberry Pi 4, this OS is based on Debian 10 for arch arm64 at the time of writing this article.

The first step is to get the single binary and copy it to folder /usr/local/bin

The binary can be downloaded from Nomad website.

Unzip the binary, change the permission and move it to /usr/local/bin

sudo chown root:root nomad

sudo mv nomad /usr/local/bin

After that, you need to create a SystemD script to enable and start a service.

sudo touch /etc/systemd/system/nomad.service

And add the following content.

[Unit]
Description=Nomad
Documentation=https://www.nomadproject.io/docs/
Wants=network-online.target
After=network-online.target

# When using Nomad with Consul it is not necessary to start Consul first. These
# lines start Consul before Nomad as an optimization to avoid Nomad logging
# that Consul is unavailable at startup.
#Wants=consul.service
#After=consul.service

[Service]
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

## Configure unit start rate limiting. Units which are started more than
## *burst* times within an *interval* time span are not permitted to start any
## more. Use `StartLimitIntervalSec` or `StartLimitInterval` (depending on
## systemd version) to configure the checking interval and `StartLimitBurst`
## to configure how many starts per interval are allowed. The values in the
## commented lines are defaults.

# StartLimitBurst = 5

## StartLimitIntervalSec is used for systemd versions >= 230
# StartLimitIntervalSec = 10s

## StartLimitInterval is used for systemd versions < 230
# StartLimitInterval = 10s

TasksMax=infinity
OOMScoreAdjust=-1000

[Install]
WantedBy=multi-user.target

Add a nomad config file to /etc/nomad.d/nomad.hcl

data_dir = "/opt/nomad/data"
bind_addr = "0.0.0.0"

server {
  enabled = true
  bootstrap_expect = 1
}

client {
  enabled = true
  servers = ["127.0.0.1:4646"]
}

Enable and start a service, check the service status.

sudo systemctl enable nomad

sudo systemctl start nomad

sudo systemctl status nomad

Finally, access the http://localhost:4646 and the see ui manager of Nomad Hashicorp.

References