Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
vms:webdev:fabric [2017/03/17 00:47]
admin [NVM (node version manager)]
vms:webdev:fabric [2017/03/17 19:06] (current)
admin [Fabric Components]
Line 13: Line 13:
 Having experienced weird "​permission denied"​ installation errors using the ''​root user'',​ we'll try to proceed to installation as sysadmin when possible. Having experienced weird "​permission denied"​ installation errors using the ''​root user'',​ we'll try to proceed to installation as sysadmin when possible.
  
-===== NVM (node version manager) =====+===== NVM (Node.js Version Manager) =====
 https://​www.digitalocean.com/​community/​tutorials/​how-to-install-node-js-on-debian-8 https://​www.digitalocean.com/​community/​tutorials/​how-to-install-node-js-on-debian-8
  
Line 27: Line 27:
 === Install Node.js === === Install Node.js ===
 <​code>​ <​code>​
-+nvm ls-remote 
 +... 
 +         ​v6.9.3 ​  (LTS: Boron) 
 +         ​v6.9.4 ​  (LTS: Boron) 
 +         ​v6.9.5 ​  (LTS: Boron) 
 +         ​v6.10.0 ​ (Latest LTS: Boron) 
 +         ​v7.0.0 ​  
 +... 
 +</​code>​ 
 + 
 +Since Fabric Composer requires Node.js 6.x, and doesn'​t support 7, let's go for v6.10.0: 
 +<​code>​ 
 +> nvm install 6.10.0 
 +########################################################################​ 100.0% 
 +Computing checksum with sha256sum 
 +Checksums matched! 
 +Now using node v6.10.0 (npm v3.10.10) 
 +Creating default alias: default -> 6.10.0 (-> v6.10.0) 
 +</​code>​ 
 + 
 +We are supposed to use npm 4.0.x, 3.10.10 was installed, let's upgrade it as explained on [[https://​docs.npmjs.com/​getting-started/​installing-node|the npmjs.com]] website: 
 +<​code>​ 
 +> npm show npm@* version 
 +... 
 +npm@4.0.3 '​4.0.3'​ 
 +npm@4.0.5 '​4.0.5'​ 
 +npm@4.1.0 '​4.1.0'​ 
 +... 
 +> npm install -g npm@4.0.5 
 +</​code>​ 
 + 
 +===== Docker ===== 
 + 
 +==== Docker Engine ==== 
 +From the [[https://​docs.docker.com/​engine/​installation/​linux/​debian/#​uninstall-old-versions|Docker documentation]]:​ 
 + 
 +=== Repository version === 
 +<​code>​ 
 +> sudo apt-get install apt-transport-https ca-certificates curl software-properties-common 
 +> curl -fsSL https://​download.docker.com/​linux/​debian/​gpg | sudo apt-key add - 
 +OK 
 + 
 +> sudo nano /​etc/​apt/​sources.list.d/​docker.list 
 +ADD 
 +deb https://​apt.dockerproject.org/​repo debian-jessie main 
 + 
 +> sudo apt-get update 
 +> apt-cache madison docker-engine 
 +... 
 + ​docker-engine | 1.13.0-0~debian-jessie | https://​apt.dockerproject.org/​repo/​ debian-jessie/​main amd64 Packages 
 +docker-engine | 1.12.6-0~debian-jessie | https://​apt.dockerproject.org/​repo/​ debian-jessie/​main amd64 Packages 
 +docker-engine | 1.12.5-0~debian-jessie | https://​apt.dockerproject.org/​repo/​ debian-jessie/​main amd64 Packages 
 +... 
 +> sudo apt-get install docker-engine=1.12.6-0~debian-jessie 
 +</​code>​ 
 + 
 +=== Complementary actions === 
 +Now, as we do not want to //​automatically upgrade// the ''​docker-engine''​ package when using ''​apt-get upgrade'',​ we'll **put the package on hold**: 
 +<​code>​ 
 +> sudo apt-mark hold docker-engine 
 +</​code>​ 
 + 
 +To remove the hold: 
 +<​code>​ 
 +> sudo apt-mark unhold docker-engine 
 +</​code>​ 
 + 
 +Start and Autostart Docker: 
 +<​code>​ 
 +> sudo systemctl start docker 
 +> sudo systemctl enable docker 
 +Synchronizing state for docker.service with sysvinit using update-rc.d... 
 +Executing /​usr/​sbin/​update-rc.d docker defaults 
 +Executing /​usr/​sbin/​update-rc.d docker enable 
 +</​code>​ 
 + 
 +Docker status: 
 +<​code>​ 
 +> systemctl status docker 
 +● docker.service - Docker Application Container Engine 
 +   ​Loaded:​ loaded (/​lib/​systemd/​system/​docker.service;​ enabled) 
 +   ​Active:​ active (running) since Fri 2017-03-17 02:03:28 CET; 11min ago 
 +     Docs: https://​docs.docker.com 
 + Main PID: 10340 (dockerd) 
 +   ​CGroup:​ /​system.slice/​docker.service 
 +           ​├─10340 /​usr/​bin/​dockerd -H fd:// 
 +           ​└─10344 docker-containerd -l unix:///​var/​run/​docker/​libcontainerd/​docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 -... 
 +</​code>​ 
 + 
 +=== Check Docker is functioning === 
 +<​code>​ 
 +> sudo docker run hello-world 
 +... 
 +Hello from Docker! 
 +This message shows that your installation appears to be working correctly. 
 +... 
 +</​code>​ 
 +==== Docker Compose ==== 
 +From [[https://​www.linuxbabe.com/​linux-server/​install-docker-on-debian-8-jessie-server|linuxable.com]].\\ 
 +For a list of Docker-compose versions, see [[https://​github.com/​docker/​compose/​releases|this GitHub page]]. 
 + 
 +<​code>​ 
 +> su 
 +> curl -L https://​github.com/​docker/​compose/​releases/​download/​1.8.1/​docker-compose-`uname -s`-`uname -m` > /​usr/​local/​bin/​docker-compose 
 +> chmod +x /​usr/​local/​bin/​docker-compose 
 +> docker-compose --version 
 +docker-compose version 1.8.1, build 878cff1 
 +> exit 
 +</​code>​ 
 + 
 +==== GIT ==== 
 + 
 +<​code>​ 
 +> sudo apt-get install git-core 
 +</​code>​ 
 + 
 +===== Fabric Components ===== 
 + 
 +=== Command line tools === 
 +<​code>​ 
 +> npm install -g composer-cli 
 +</​code>​ 
 + 
 +There was a problem with this install command: hashtable blocked the process.\\ 
 +A suggested solution on the Fabric Chat: 
 +> So ... the root cause of my installation issues with `node-gyp` was the self-signed certificate in the chain 
 +`node-gyp` doesn'​t honour the `strict-ssl=false` setting in `.npmrc` 
 +> The workaround to get composer-cli to install was to run the following:​ 
 +<​code>​ 
 +export NODE_TLS_REJECT_UNAUTHORIZED=0 
 +</​code>​ 
 +before 
 +<​code>​ 
 +npm install -g composer-cli 
 +</​code>​ 
 + 
 +=== Clone and install the Sample Applications === 
 +<​code>​ 
 +> git clone https://​github.com/​fabric-composer/​sample-applications.git 
 +> cd sample-applications/​packages/​getting-started 
 +> npm install 
 +</​code>​ 
 + 
 +Had to run the ''​npm-install''​ command as root, otherwise couldn'​t connect to docker deamon:\\ 
 +> docker pull hyperledger/​fabric-baseimage:​x86_64-0.1.0 
 +> Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon. Is the docker daemon running on this host?). Using system default: https://​index.docker.io/​v1/​ 
 +> Cannot connect to the Docker daemon. Is the docker daemon running on this host? 
 + 
 +This required to add the following in ''/​root/​.bashrc'':​ 
 +<​code>​ 
 +export NVM_DIR="/​home/​sysadmin/​.nvm"​ 
 +[ -s "​$NVM_DIR/​nvm.sh"​ ] && . "​$NVM_DIR/​nvm.sh" ​ # This loads nvm 
 +</​code>​ 
 + 
 +Also had to run a few commands //​manually//​ before I got it running (root in ''/​home/​sysadmin/​sample-applications/​packages/​getting-started''​):​ 
 +<​code>​ 
 +> docker pull hyperledger/​fabric-baseimage:​x86_64-0.1.0 
 +> scripts/​download-hyperledger.sh 
 +> scripts/​start-hyperledger.sh 
 +> npm run deployNetwork /​home/​sysadmin/​sample-applications/​packages/​getting-started
 </​code>​ </​code>​