How can I setup Nomad to act the same as it's development mode, but instead to run this as a production setup so it persists data? So that is nomad agent -dev
.
Do I run the client / server processes repeatedly? Or can I configure it to run both?
So essentially a one node nomad cluster
Since the other answer is valid in its criticism but didn't bother answering the question, here is what you can do for linux:
This assumes you have nomad installed at /usr/local/bin/nomad
Create the following config.hcl
inside /etc/nomad.d
.
Make sure to replace the value of name
from example config.
client {
enabled = true
}
server {
enabled = true
bootstrap_expect = 1
}
datacenter = "dc1"
data_dir = "/opt/nomad"
name = "YOUR_NOMAD_NAME_HERE"
The data will be persisted in data_dir
(/opt/nomad
in this example config)
Then create a service nomad.service
inside /etc/systemd/system/
:
[Unit]
Description=Nomad
Documentation=https://nomadproject.io/docs/
Wants=network-online.target
After=network-online.target
[Service]
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/local/bin/nomad agent -config /etc/nomad.d
KillMode=process
KillSignal=SIGINT
LimitNOFILE=infinity
LimitNPROC=infinity
Restart=on-failure
RestartSec=2
StartLimitBurst=3
TasksMax=infinity
[Install]
WantedBy=multi-user.target
And finally start it with systemctl enable nomad && systemctl start nomad
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With