Let's Build Nomad from Source!
Posted on August 11, 2016
Want to help a community you love? Testing new features and bugfixing is a great way to do so! During the 0.3.2
to 0.4.x
dev cycle, I felt the need to run a few tests on Nomad. Here is the helper script I wrote to improve my experience building and releasing an archive I could deploy on a staging cluster for testing.
#!/bin/sh
# here is a helper script which sets up the go dependencies for nomad,
# builds the project executable, and packages that up in a zip file for
# distribution through your own channels. This zip can be push to S3,
# hosted on CM (salt), etc
# modify $VERSION, though that's just a surface detail
# install dependencies as root or with sudo
#apt-get update
#apt-get install -y build-essential curl \
# git-core mercurial bzr \
# libpcre3-dev pkg-config \
# zip default-jre qemu \
# libc6-dev-i386 \
# silversearcher-ag jq \
# htop vim unzip
# make sure you have $GOPATH and $GOROOT set correctly, and $PATH updated
export GOPATH=$HOME/.go
export GOROOT=/opt/go
export PATH="$PATH:$GOROOT/bin:$GOPATH/bin"
VERSION="0.4.1-dev"
HASHI_GIT="$GOPATH/src/github.com/hashicorp"
NOMAD_SRC="$HASHI_GIT/nomad"
ZIP_FILE="$HOME/nomad_${VERSION}_linux_amd64.zip"
mkdir -p $HASHI_GIT
git clone https://github.com/hashicorp/nomad $NOMAD_SRC
cd $NOMAD_SRC
make bootstrap
make dev
cd bin
zip $ZIP_FILE nomad
sha512sum $ZIP_FILE