Skip to content

Commit

Permalink
Merge pull request cosmos#350 from cosmos/feature/vagrant
Browse files Browse the repository at this point in the history
Working Vagrantfile
  • Loading branch information
ebuchman authored Jan 18, 2018
2 parents 48cc398 + 88171a8 commit 7ce6c7c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 19 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
*.swp
*.swo
vendor
.vagrant
merkleeyes.db
build
docs/guide/*.sh
tools/bin/*
examples/build/*

### Vagrant ###
.vagrant/
*.box
*.log
vagrant
50 changes: 32 additions & 18 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,51 @@
# 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
v.cpus = 2
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
# official repo doesn't have race detection runtime...
#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 wget curl jq shellcheck bsdmainutils psmisc zip
apt-get upgrade -y
apt-get install -y --no-install-recommends wget curl jq \
make shellcheck bsdmainutils psmisc golang-1.9-go docker-ce
wget -qO- https://get.docker.com/ | sh
usermod -a -G docker vagrant
apt-get autoremove -y
# needed for docker
usermod -a -G docker ubuntu
curl -O https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
tar -xvf go1.8.linux-amd64.tar.gz
rm -rf /usr/local/go
mv go /usr/local
rm -f go1.8.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
# cleanup
apt-get autoremove -y
echo 'export LC_ALL=en_US.UTF-8' >> /home/vagrant/.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/cosmos/cosmos-sdk
EOF
mkdir -p /home/vagrant/go/src/github.com/tendermint
ln -s /vagrant /home/vagrant/go/src/github.com/tendermint/basecoin
mkdir -p /home/ubuntu/go/bin
mkdir -p /home/ubuntu/go/src/github.com/cosmos
ln -s /vagrant /home/ubuntu/go/src/github.com/cosmos/cosmos-sdk
chown -R vagrant:vagrant /home/vagrant/go
chown -R ubuntu:ubuntu /home/ubuntu/go
chown ubuntu:ubuntu /home/ubuntu/.bash_profile
rm -rf /home/vagrant/go/src/github.com/tendermint/basecoin/vendor
su - ubuntu -c 'cd /home/ubuntu/go/src/github.com/cosmos/cosmos-sdk && make get_tools'
SHELL
end

0 comments on commit 7ce6c7c

Please sign in to comment.