Skip to content

Commit

Permalink
Update the vagrant dev environment
Browse files Browse the repository at this point in the history
- Remove GOPATH in favor of modules
- Move to Ubuntu 20.04
- Remove docker-compose as it's unnecessary for build and test

Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
  • Loading branch information
sykesm authored and Brett Logan committed May 6, 2020
1 parent 56642ec commit b049276
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 36 deletions.
2 changes: 1 addition & 1 deletion vagrant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ The source code from the host machine is mounted inside the Vagrant virtual
machine so changes to the code can be made on the host or inside the VM.

```console
vagrant@ubuntu-xenial:~/go/src/github.com/hyperledger/fabric$ make clean && make
vagrant@ubuntu-xenial:~/fabric$ make clean && make
```
6 changes: 2 additions & 4 deletions vagrant/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

Vagrant.require_version ">= 1.7.4"
Vagrant.configure('2') do |config|
config.vm.box = "bento/ubuntu-18.04"
config.vm.synced_folder "..", "/home/vagrant/go/src/github.com/hyperledger/fabric"
config.vm.box = "bento/ubuntu-20.04"
config.vm.synced_folder "..", "/home/vagrant/fabric"
config.ssh.forward_agent = true

config.vm.provider :virtualbox do |vb|
Expand All @@ -18,7 +18,6 @@ Vagrant.configure('2') do |config|
end

config.vm.provision :shell, name: "essentials", path: "essentials.sh"
config.vm.provision :shell, name: "srcdir", path: "srcdir.sh"
config.vm.provision :shell, name: "docker", path: "docker.sh"
config.vm.provision :shell, name: "golang", path: "golang.sh"
config.vm.provision :shell, name: "limits", path: "limits.sh"
Expand All @@ -28,4 +27,3 @@ end

# -*- mode: ruby -*-
# vi: set ft=ruby :

19 changes: 1 addition & 18 deletions vagrant/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,15 @@
#
# SPDX-License-Identifier: Apache-2.0

COMPOSE_VERSION=1.24.0

export DEBIAN_FRONTEND=noninteractive

# ----------------------------------------------------------------
# Configure apt repository
# ----------------------------------------------------------------
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

# ----------------------------------------------------------------
# Install docker
# ----------------------------------------------------------------
apt-get -qq update
apt-get install -y docker-ce
apt-get install -y docker.io

# ----------------------------------------------------------------
# Allow vagrant user to access docker
# ----------------------------------------------------------------
usermod -a -G docker vagrant

# ----------------------------------------------------------------
# Install docker-compose
# ----------------------------------------------------------------
curl -sL "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
2 changes: 1 addition & 1 deletion vagrant/golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# SPDX-License-Identifier: Apache-2.0

GOROOT='/opt/go'
GO_VERSION=1.14.1
GO_VERSION=1.14.2

# ----------------------------------------------------------------
# Install Golang
Expand Down
10 changes: 0 additions & 10 deletions vagrant/srcdir.sh

This file was deleted.

4 changes: 2 additions & 2 deletions vagrant/user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ softhsm2-util --init-token --slot 0 --label "ForFabric" --so-pin 1234 --pin 9876

cat <<EOF >>/home/vagrant/.bashrc
export PKCS11_LIB="$(find /usr/lib -name libsofthsm2.so)"
export PKCS11_LIB="$(find /usr/lib -name libsofthsm2.so | head -1)"
export PKCS11_PIN=98765432
export PKCS11_LABEL="ForFabric"
EOF
Expand All @@ -20,5 +20,5 @@ cat <<EOF >>/home/vagrant/.bashrc
export GOPATH=\$HOME/go
export PATH=\$PATH:\$HOME/go/bin
cd \$GOPATH/src/github.com/hyperledger/fabric/
cd \$HOME/fabric
EOF

0 comments on commit b049276

Please sign in to comment.