Setting Up A Nomad Playground
One thing that I’ve been looking to do at my home is to use a more sophisticated container orchestrator. Nomad works well with Hashicorp Vault and that allows for a lot of automated security setup with containers. Setting up Nomad wasn’t difficult and working with a development server is fairly easy. I use Ubuntu so if you have another flavor of linux or another OS altogether, please use this link directly from the documentation.
Add Repository and Install
Run the following to add the repository:
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install nomad
Start Dev Server
Starting the development server is a simple command. Then you can interact with it for learning/testing purposes.
sudo nomad agent -dev -bind 0.0.0.0 -log-level INFO
In another terminal you will be able to interact using the nomad
command.
Basic Commands
Monitor logs on the server
nomad server monitor
See members of the cluster
nomad server members
Initialize a Job file
nomad job init
Run a Job
nomad job run /path/to/job/file
Vagrant Dev Environment
Hashicorp has a Vagrantfile for a development environment. Run the following to setup the environment.
curl -O https://raw.githubusercontent.com/hashicorp/nomad/master/demo/vagrant/Vagrantfile
vagrant up
Vagrant Cluster
I wanted to get a more realistic test environment for learning how Nomad works. I made a Vagrantfile that creates a cluster for a learning environment. The GitHub respository can be found here.
Here are the commands needed to start up the Nomad cluster.
git clone https://github.com/xadlien/nomad-cluster.git
cd nomad-cluster
vagrant up