From c84494b36b1873b697276cfd21588b7b3d793fdb Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Fri, 8 Dec 2017 17:01:24 +0100 Subject: [PATCH 1/4] Update Vagrantfile to xenial (16.04 LTS) Note default username changed from vagrant to ubuntu in the base image. --- Vagrantfile | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index ea8042360..1864d2e93 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -2,7 +2,7 @@ # vi: set ft=ruby : Vagrant.configure("2") do |config| - config.vm.box = "ubuntu/trusty64" + config.vm.box = "ubuntu/xenial64" config.vm.provider "virtualbox" do |v| v.memory = 4096 @@ -11,29 +11,30 @@ Vagrant.configure("2") do |config| config.vm.provision "shell", inline: <<-SHELL apt-get update - apt-get install -y --no-install-recommends wget curl jq shellcheck bsdmainutils psmisc + apt-get install -y --no-install-recommends git wget curl jq \ + make shellcheck bsdmainutils psmisc wget -qO- https://get.docker.com/ | sh usermod -a -G docker vagrant apt-get autoremove -y - apt-get install -y --no-install-recommends git curl -O https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz tar -xvf go1.9.linux-amd64.tar.gz rm -rf /usr/local/go mv go /usr/local rm -f go1.9.linux-amd64.tar.gz - mkdir -p /home/vagrant/go/bin - echo 'export PATH=$PATH:/usr/local/go/bin:/home/vagrant/go/bin' >> /home/vagrant/.bash_profile - echo 'export GOPATH=/home/vagrant/go' >> /home/vagrant/.bash_profile - echo 'export LC_ALL=en_US.UTF-8' >> /home/vagrant/.bash_profile + mkdir -p /home/ubuntu/go/bin + echo 'export PATH=$PATH:/usr/local/go/bin:/home/ubuntu/go/bin' >> /home/ubuntu/.bash_profile + echo 'export GOPATH=/home/ubuntu/go' >> /home/ubuntu/.bash_profile - mkdir -p /home/vagrant/go/src/github.com/tendermint - ln -s /vagrant /home/vagrant/go/src/github.com/tendermint/tendermint + echo 'export LC_ALL=en_US.UTF-8' >> /home/ubuntu/.bash_profile - chown -R vagrant:vagrant /home/vagrant/go + mkdir -p /home/ubuntu/go/src/github.com/tendermint + ln -s /vagrant /home/ubuntu/go/src/github.com/tendermint/tendermint - su - vagrant -c 'cd /home/vagrant/go/src/github.com/tendermint/tendermint && make get_vendor_deps' + chown -R ubuntu:ubuntu /home/ubuntu/go + + su - ubuntu -c 'cd /home/ubuntu/go/src/github.com/tendermint/tendermint && make get_vendor_deps' SHELL end From 5bcd95f01f7c23d8f6cf889ea807af4b70cd6db6 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Fri, 8 Dec 2017 18:09:57 +0100 Subject: [PATCH 2/4] Use apt-get/ppa instead of tarballs for golang/docker Minor cleanup and comments --- Vagrantfile | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 1864d2e93..a3dd9449a 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -10,22 +10,27 @@ Vagrant.configure("2") do |config| end config.vm.provision "shell", inline: <<-SHELL + # add docker repo + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - + add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" + + # and golang 1.9 support + # add-apt-repository ppa:gophers/archive + add-apt-repository ppa:longsleep/golang-backports + + # install base requirements apt-get update - apt-get install -y --no-install-recommends git wget curl jq \ + apt-get install -y --no-install-recommends wget curl jq \ make shellcheck bsdmainutils psmisc + apt-get install -y docker-ce golang-1.9-go - wget -qO- https://get.docker.com/ | sh - usermod -a -G docker vagrant - apt-get autoremove -y - - curl -O https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz - tar -xvf go1.9.linux-amd64.tar.gz - rm -rf /usr/local/go - mv go /usr/local - rm -f go1.9.linux-amd64.tar.gz + # needed for go + apt-get install -y git + # needed for docker + usermod -a -G docker ubuntu mkdir -p /home/ubuntu/go/bin - echo 'export PATH=$PATH:/usr/local/go/bin:/home/ubuntu/go/bin' >> /home/ubuntu/.bash_profile + echo 'export PATH=$PATH:/usr/lib/go-1.9/bin:/home/ubuntu/go/bin' >> /home/ubuntu/.bash_profile echo 'export GOPATH=/home/ubuntu/go' >> /home/ubuntu/.bash_profile echo 'export LC_ALL=en_US.UTF-8' >> /home/ubuntu/.bash_profile @@ -35,6 +40,7 @@ Vagrant.configure("2") do |config| chown -R ubuntu:ubuntu /home/ubuntu/go - su - ubuntu -c 'cd /home/ubuntu/go/src/github.com/tendermint/tendermint && make get_vendor_deps' + # get all deps and tools, ready to install/test + su - ubuntu -c 'cd /home/ubuntu/go/src/github.com/tendermint/tendermint && make get_vendor_deps && make tools' SHELL end From c771964a40245b2350861832df08b3a780cbc520 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Fri, 8 Dec 2017 18:36:58 +0100 Subject: [PATCH 3/4] Add vagrant_test to Makefile for integration tests --- Makefile | 6 ++++++ Vagrantfile | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 2ed827ed5..4c835a8f5 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,12 @@ test_release: test100: @for i in {1..100}; do make test; done +vagrant_test: + vagrant up + vagrant ssh -c 'make install' + vagrant ssh -c 'make test_race' + vagrant ssh -c 'make test_integrations' + draw_deps: # requires brew install graphviz or apt-get install graphviz go get github.com/RobotsAndPencils/goviz diff --git a/Vagrantfile b/Vagrantfile index a3dd9449a..c81f9d06f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -29,16 +29,20 @@ Vagrant.configure("2") do |config| # needed for docker usermod -a -G docker ubuntu - mkdir -p /home/ubuntu/go/bin - echo 'export PATH=$PATH:/usr/lib/go-1.9/bin:/home/ubuntu/go/bin' >> /home/ubuntu/.bash_profile - echo 'export GOPATH=/home/ubuntu/go' >> /home/ubuntu/.bash_profile - - echo 'export LC_ALL=en_US.UTF-8' >> /home/ubuntu/.bash_profile + # use "EOF" not EOF to avoid variable substitution of $PATH + cat << "EOF" >> /home/ubuntu/.bash_profile +export PATH=$PATH:/usr/lib/go-1.9/bin:/home/ubuntu/go/bin +export GOPATH=/home/ubuntu/go +export LC_ALL=en_US.UTF-8 +cd go/src/github.com/tendermint/tendermint +EOF + mkdir -p /home/ubuntu/go/bin mkdir -p /home/ubuntu/go/src/github.com/tendermint ln -s /vagrant /home/ubuntu/go/src/github.com/tendermint/tendermint chown -R ubuntu:ubuntu /home/ubuntu/go + chown ubuntu:ubuntu /home/ubuntu/.bash_profile # get all deps and tools, ready to install/test su - ubuntu -c 'cd /home/ubuntu/go/src/github.com/tendermint/tendermint && make get_vendor_deps && make tools' From 2112299586ec3f8a2f5020629b6890c7ab38ae3e Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Fri, 8 Dec 2017 19:17:17 +0100 Subject: [PATCH 4/4] Cleanup apt-get ala PR comments --- Vagrantfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index c81f9d06f..80d44f9c7 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -15,6 +15,7 @@ Vagrant.configure("2") do |config| add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" # and golang 1.9 support + # official repo doesn't have race detection runtime... # add-apt-repository ppa:gophers/archive add-apt-repository ppa:longsleep/golang-backports @@ -24,8 +25,6 @@ Vagrant.configure("2") do |config| make shellcheck bsdmainutils psmisc apt-get install -y docker-ce golang-1.9-go - # needed for go - apt-get install -y git # needed for docker usermod -a -G docker ubuntu