Skip to content

filopedraz/hello-world-nomad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hello World Nomad

Testing Nomad as Cross Platform Orchestrator

Getting Started

Install Nomad on Mac

brew tap hashicorp/tap
brew install hashicorp/tap/nomad
nomad -v

Create a Nomad Cluster with one node Locally

sudo nomad agent -dev

In another terminal

export NOMAD_ADDR=http://localhost:4646
nomad node status

Visit the UI: http://localhost:4646/ui/jobs

Running Nomad as a Binary (Tauri Sidecar)

  1. Download the latest version for your OS here

  2. Run the following commands

    mv nomad /usr/local/bin
    chmod +x /usr/local/bin/nomad
  3. Verify the installation

    nomad -v
  4. Start the Nomad Agent

    sudo nomad agent -dev 

Nomad Example App

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

Check Nomad Stats

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

About

Testing Nomad as Cross Platform Orchestrator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages