094fa23df6
This commit reworks the Vagrantfile for Nomad in order to support straightforward testing on more than one operating system, whilst retaining the ability to stand up a test cluster running Ubuntu. The following changes are made: - Scripts have been extracted from the Vagrantfile into their own shell script files, in order that editors lint them. - All scripts have been edited to lint with no warnings or errors for their respective shells. - Scripts are named according to the operating system and privilege level which they run. We prefer to run a whole shell script as root versus prefixing (essentially) every command with `sudo` or an equivalent. - The Linux development box has been separated from the test cluster, removing some of the more gnarly (and less portable) logic. The Linux development box is still primary and autostarts. - A FreeBSD target has been added. The base box works for both Virtualbox and VMWare Fusion. - A target is added to the GNUmakefile to stand up a test cluster, using the default provider, or overriding the provider by setting the PROVIDER variable in make: - `make testcluster` - `make testcluster PROVIDER=vmware_fusion` - Machines in the test cluster have Avahi configured for zeroconf discovery. Each machine can ping each other machine at `hostname.local` - for example `nomad-server02.local`, `nomad-client03.local`.
36 lines
690 B
Bash
Executable file
36 lines
690 B
Bash
Executable file
#!/bin/sh
|
|
|
|
chown vagrant:wheel \
|
|
/opt/gopath \
|
|
/opt/gopath/src \
|
|
/opt/gopath/src/github.com \
|
|
/opt/gopath/src/github.com/hashicorp
|
|
|
|
mkdir -p /usr/local/etc/pkg/repos
|
|
|
|
cat <<EOT > /usr/local/etc/pkg/repos/FreeBSD.conf
|
|
FreeBSD: {
|
|
url: "pkg+http://pkg.FreeBSD.org/\${ABI}/latest"
|
|
}
|
|
EOT
|
|
|
|
pkg update
|
|
|
|
pkg install -y \
|
|
editors/vim-lite \
|
|
devel/git \
|
|
devel/gmake \
|
|
lang/go \
|
|
security/ca_root_nss \
|
|
shells/bash
|
|
|
|
chsh -s /usr/local/bin/bash vagrant
|
|
chsh -s /usr/local/bin/bash root
|
|
|
|
cat <<EOT >> /home/vagrant/.profile
|
|
export GOPATH=/opt/gopath
|
|
export PATH=\$GOPATH/bin:\$PATH
|
|
|
|
cd /opt/gopath/src/github.com/hashicorp/nomad
|
|
EOT
|