Skip to content

Commit 0e5bec3

Browse files
committed
FAB-6193 Update dev environment to latest tools
The versions of many tools have been upgraded for the master branch. The following updates were made: - Update to Go 1.9 - Update to the official Docker repo (for now this will install 17.06.2-ce) - Remove out of date Docker config options - Use nvm to manage multiple versions of Node.js (8.4 is the default but 6.9.5 is also installed) - modified a few test files to use the os.TempDir() rather than relative paths in the source tree as Go 1.9 did not like it with Vagrant and VirtualBox Change-Id: I3140790f420da8dddb7ac3c2630c948962649fbd Signed-off-by: Gari Singh <gari.r.singh@gmail.com>
1 parent 3f83afc commit 0e5bec3

File tree

5 files changed

+39
-37
lines changed

5 files changed

+39
-37
lines changed

core/scc/scc_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package scc
1818

1919
import (
2020
"fmt"
21+
"os"
2122
"testing"
2223

2324
"github.com/hyperledger/fabric/core/common/ccprovider"
@@ -30,6 +31,7 @@ import (
3031

3132
func init() {
3233
viper.Set("chaincode.system", map[string]string{"lscc": "enable", "a": "enable"})
34+
viper.Set("peer.fileSystemPath", os.TempDir())
3335
ccprovider.RegisterChaincodeProviderFactory(&ccprovider2.MockCcProviderFactory{})
3436
RegisterSysCCs()
3537
}

devenv/Vagrantfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ set -x
2525
2626
echo "127.0.0.1 couchdb" | tee -a /etc/hosts
2727
28-
export DOCKER_STORAGE_BACKEND="#{ENV['DOCKER_STORAGE_BACKEND']}"
29-
3028
cd #{SRCMOUNT}/devenv
3129
./setup.sh
3230

devenv/install_nvm.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
#
3+
# Copyright IBM Corp. All Rights Reserved.
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
9+
set -e
10+
set -x
11+
12+
# ----------------------------------------------------------------
13+
# Install nvm to manage multiple NodeJS versions
14+
# ----------------------------------------------------------------
15+
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | bash
16+
export NVM_DIR="$HOME/.nvm"
17+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
18+
19+
# ----------------------------------------------------------------
20+
# Install NodeJS
21+
# ----------------------------------------------------------------
22+
nvm install v6.9.5
23+
nvm install v8.4
24+
nvm alias default v8.4 #set default to v8.4

devenv/setup.sh

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -28,50 +28,30 @@ apt-get install -y build-essential git make curl unzip g++ libtool
2828
# Install Docker
2929
# ----------------------------------------------------------------
3030

31-
# Storage backend logic
32-
case "${DOCKER_STORAGE_BACKEND}" in
33-
aufs|AUFS|"")
34-
DOCKER_STORAGE_BACKEND_STRING="aufs" ;;
35-
btrfs|BTRFS)
36-
# mkfs
37-
apt-get install -y btrfs-tools
38-
mkfs.btrfs -f /dev/sdb
39-
rm -Rf /var/lib/docker
40-
mkdir -p /var/lib/docker
41-
. <(sudo blkid -o udev /dev/sdb)
42-
echo "UUID=${ID_FS_UUID} /var/lib/docker btrfs defaults 0 0" >> /etc/fstab
43-
mount /var/lib/docker
44-
45-
DOCKER_STORAGE_BACKEND_STRING="btrfs" ;;
46-
*) echo "Unknown storage backend ${DOCKER_STORAGE_BACKEND}"
47-
exit 1;;
48-
esac
49-
5031
# Update system
5132
apt-get update -qq
5233

5334
# Prep apt-get for docker install
5435
apt-get install -y apt-transport-https ca-certificates
55-
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
36+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
5637

5738
# Add docker repository
58-
echo deb https://apt.dockerproject.org/repo ubuntu-xenial main > /etc/apt/sources.list.d/docker.list
39+
add-apt-repository \
40+
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
41+
$(lsb_release -cs) \
42+
stable"
5943

6044
# Update system
6145
apt-get update -qq
6246

6347
# Install docker
64-
apt-get install -y linux-image-extra-$(uname -r) apparmor docker-engine
48+
#apt-get install -y docker-ce=17.06.2~ce~0~ubuntu # in case we need to set the version
49+
apt-get install -y docker-ce
6550

6651
# Install docker-compose
67-
curl -L https://github.com/docker/compose/releases/download/1.8.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
52+
curl -L https://github.com/docker/compose/releases/download/1.14.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
6853
chmod +x /usr/local/bin/docker-compose
6954

70-
# Configure docker
71-
DOCKER_OPTS="-s=${DOCKER_STORAGE_BACKEND_STRING} -r=true --api-cors-header='*' -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock ${DOCKER_OPTS}"
72-
sed -i.bak '/^DOCKER_OPTS=/{h;s|=.*|=\"'"${DOCKER_OPTS}"'\"|};${x;/^$/{s||DOCKER_OPTS=\"'"${DOCKER_OPTS}"'\"|;H};x}' /etc/default/docker
73-
74-
service docker restart
7555
usermod -a -G docker ubuntu # Add ubuntu user to the docker group
7656

7757
# Test docker
@@ -80,7 +60,7 @@ docker run --rm busybox echo All good
8060
# ----------------------------------------------------------------
8161
# Install Golang
8262
# ----------------------------------------------------------------
83-
GO_VER=1.7.5
63+
GO_VER=1.9
8464
GO_URL=https://storage.googleapis.com/golang/go${GO_VER}.linux-amd64.tar.gz
8565

8666
# Set Go environment variables needed by other scripts
@@ -99,12 +79,9 @@ mkdir -p $GOROOT
9979
curl -sL $GO_URL | (cd $GOROOT && tar --strip-components 1 -xz)
10080

10181
# ----------------------------------------------------------------
102-
# Install NodeJS
82+
# Install nvm and Node.js
10383
# ----------------------------------------------------------------
104-
NODE_VER=6.9.5
105-
NODE_URL=https://nodejs.org/dist/v$NODE_VER/node-v$NODE_VER-linux-x64.tar.gz
106-
107-
curl -sL $NODE_URL | (cd /usr/local && tar --strip-components 1 -xz )
84+
runuser -l ubuntu -c '/hyperledger/devenv/install_nvm.sh'
10885

10986
# ----------------------------------------------------------------
11087
# Install Behave

orderer/common/server/util_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package server
88

99
import (
1010
"os"
11+
"path/filepath"
1112
"testing"
1213

1314
config "github.com/hyperledger/fabric/orderer/common/localconfig"
@@ -25,7 +26,7 @@ func TestCreateLedgerFactory(t *testing.T) {
2526
{"RAM", "ram", "", "", false},
2627
{"JSONwithPathSet", "json", "test-dir", "", false},
2728
{"JSONwithPathUnset", "json", "", "test-prefix", false},
28-
{"FilewithPathSet", "file", "test-dir", "", false},
29+
{"FilewithPathSet", "file", filepath.Join(os.TempDir(), "test-dir"), "", false},
2930
{"FilewithPathUnset", "file", "", "test-prefix", false},
3031
}
3132

0 commit comments

Comments
 (0)