Testing Nomad as Cross Platform Orchestrator
brew tap hashicorp/tap
brew install hashicorp/tap/nomad
nomad -v
sudo nomad agent -dev
In another terminal
export NOMAD_ADDR=http://localhost:4646
nomad node status
Visit the UI: http://localhost:4646/ui/jobs
-
Download the latest version for your OS here
-
Run the following commands
mv nomad /usr/local/bin chmod +x /usr/local/bin/nomad
-
Verify the installation
nomad -v
-
Start the Nomad Agent
sudo nomad agent -dev
Run a database and the web app
cd ./jobs
nomad job run pytechco-redis.nomad.hcl
nomad job run pytechco-web.nomad.hcl
Check the status of the jobs
nomad node status -verbose \
$(nomad job allocs pytechco-web | grep -i running | awk '{print $2}') | \
grep -i ip-address | awk -F "=" '{print $2}' | xargs | \
awk '{print "http://"$1":5000"}'
Submit the setup job to reset the db
nomad job run pytechco-setup.nomad.hcl
Dispatch the setup job by providing a value for budget.
nomad job dispatch -meta budget="200" pytechco-setup
Submit the employee job
nomad job run pytechco-employee.nomad.hcl
Stop the employee job
nomad job stop -purge pytechco-redis
You can check resource allocation for each job, node and the entire cluster using Nomad APIs.
# get nomad system status
curl http://localhost:4646/v1/status/leader
curl http://localhost:4646/v1/status/peers
# get nomad services
curl http://localhost:4646/v1/services
# get nomad process metrics
curl http://localhost:4646/v1/metrics