Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Configure Skywire Node on Alpine Containers in a Docker Swarm Cluster
#1
Information 
NOTICE: This was made in a VMware Virtual Environment but it should work also on a cluster made of Orange Pi's or Raspberry Pi's as well!!!!!

Prerequisites/Environment:
 - Ubuntu installed (or armbian/raspbian for a cluster made from boards)
 - Static IP addresses set on all nodes

1. Install and Configure Docker Swarm

1.1. Install Docker

First we need to install Docker. Installation methods may differ depending on the platform you've choose, Orange Pi, Raspberry Pi etc., see the guidance written here on how to install on different platforms and also look on the internet for more.

Login with your user, not necessary root and input the following commands to install Docker
(Do this on every node/machine)

Code:
# FOR UBUNTU ONLY

sudo apt-get update
sudo apt-get install \
   apt-transport-https \
   ca-certificates \
   curl \
   software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
  "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) \
  stable"
sudo apt-get update
sudo apt-get install docker-ce

# FOR ARMBIAN AND RASPBIAN ONLY

sudo curl -sSL https://get.docker.com | sh

or

sudo apt-get update && apt-get install docker.io

If any error like this is received: 
"E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?"
Just remove the lock like this "sudo rm /var/lib/dpkg/lock"

1.2. Post-installation tasks

Add the user to Docker group so you wont have to use "sudo" before each command.
This can be used also on Armbian and Raspbian and must be done on all nodes.

Code:
sudo usermod -aG docker $USER

# INSTEAD OF $USER WRITE THE NAME OF THE USER YOU WANT TO ADD

Configure Docker to start on boot.
This can be used also on Armbian and Raspbian and must be done on all nodes.

Code:
sudo systemctl enable docker

1.3. Create Docker Swarm

Create the Swarm only on the Master (Manager) node the rest of the node will connect to it afterwards.
This can be used also on Armbian and Raspbian and must be done only on the Manager node.

Code:
docker swarm init --advertise-addr your_ip_address

# WHERE "your_ip_address" IS THE ADDRESS OF THE MANAGER NODE, YOU CAN FIND IT WITH "ifconfig" COMMAND

After creating the Swarm you should receive a message which will contain the swarm join token, write it in a document.
It should look like this:


Code:
docker swarm join --token SWMTKN-1-1uimcnt6xmnil016rtlvs77znqjwy3pg48mgp8xh8ev7f7ua3h-5t4z2gx54f7bugr4skcjgc080 192.168.0.224:2377

1.4. Join nodes to the Swarm Cluster

Go on each node that you want to be joined to the Swarm and enter the command written in the document earlier.
This can be used also on Armbian and Raspbian and must be done only on the Wroker nodes (all the nodes that you want to connect to the Swarm).

Code:
docker swarm join --token SWMTKN-1-< your_token > your_ip_address:2377

# WHERE "your_token" IS THE LOONG STRING RECEIVED AT THE SWARM CREATION

* After connecting all the nodes write the following command on the Manager node to see the nodes that are connected to it.

Code:
docker node ls

2. Pull Alpine image, install Skycoin/Skywire and start them

2.1. Pull Alpine and install Skycoin/Skywire

The following steps must be performed on all the nodes and it can also be done in Armbian/Raspbian.


Code:
docker pull alpine
docker run -it --net host alpine /bin/sh
apk update
apk add go git musl-dev make
cd
mkdir -p go/src/github.com/skycoin
go get -u github.com/skycoin/skywire/cmd/...
vi /etc/profile

# Add the following line "export GOPATH=$HOME/go" and save. Type "i" to write and after adding that line press "ESC" key then ":" and write "wq" to save and exit
 
2.3. Start Skywire Manager

The following steps must be performed only on the Manager node and it can also be done in Armbian/Raspbian.

Start the Skywire Manager like so:

Code:
sh -l
cd $GOPATH/bin
nohup ./manager -web-dir ${GOPATH}/src/github.com/skycoin/skywire/static/skywire-manager > /dev/null 2>&1 & echo $! > manager.pid

Press "CTRL+P & CTRL+Q" so you can exit the session without closing the previously command of Skywire Manager.

2.4. Start first Skywire node and connect to the Manager

The following steps must be performed only on the Manager node and it can also be done in Armbian/Raspbian.

Code:
# Open a new terminal to the same container:

docker exec -it <container_id> /bin/sh

# Start the Skywire node and connect it to the manager

sh -l
cd $GOPATH/bin
nohup ./node -connect-manager -manager-address :5998 -manager-web :8000 -discovery-address discovery.skycoin.net:5999-034b1cd4ebad163e457fb805b3ba43779958bba49f2c5e1e8b062482904bacdb68 -address :5000 -web-port :6001 > /dev/null 2>&1 & echo $! > node.pid

Press again "CTRL+P & CTRL+Q" so you can exit the session without closing the previously command of Skywire Node.

2.5. Start the rest of the nodes and connect them to the Manager

The following steps must be performed on all of the other nodes and it can also be done in Armbian/Raspbian.

Code:
sh -l
cd $GOPATH/bin
./node -connect-manager -manager-address "pri_node_ip":5998 -manager-web "pri_node_ip":8000 -discovery-address messenger.skycoin.net:5999 -address :5000 -web-port :6001

# Where "pri_node_ip" is the IP of the primary node where the Manager is running.

Press again "CTRL+P & CTRL+Q" so you can exit the session without closing the previously command of Skywire Node.

###################################################### End of the guide


This should be considered as a draft as its my first atempt on running Docker and all the findings and additions to that everyone have and are noted in the comments bellow will be added to this guide after they will be tested.
So please feel free to contribute to this document.
Also please note that its missing the steps on how to save the containers

Many thanks to @tajacobsen for pointing me to a better way of installing Skycoin/Skywire on Alpine Linux.
[-] The following 4 users say Thank You to asxtree for this post:
  • BigOokie, I Am You, magicstone1412, skyguy
1
Reply
#2
Thank you for taking the time to document this. It's extremely helpful  Thumbsup
Reply
#3
(02-26-2018, 06:01 AM)skyguy Wrote: Thank you for taking the time to document this. It's extremely helpful  Thumbsup

Yes but its missing the most crucial thing and that is commiting new images of the containers created with the soft inside. If this is not done after a reboot you will not have the container on which the sky sw was installed and some other tweaks but when i will find some time because now im making a full manual for diy
[-] The following 1 user says Thank You to asxtree for this post:
  • Lancek
Reply
#4
(02-26-2018, 05:47 PM)asxtree Wrote:
(02-26-2018, 06:01 AM)skyguy Wrote: Thank you for taking the time to document this. It's extremely helpful  Thumbsup

Yes but its missing the most crucial thing and that is commiting new images of the containers created with the soft inside. If this is not done after a reboot you will not have the container on which the sky sw was installed and some other tweaks but when i will find some time because now im making a full manual for diy
Thanks a lot. This is really helping me.




Sent from my iPhone using Tapatalk
Reply
#5
(03-11-2018, 09:34 PM)Lancek Wrote:
(02-26-2018, 05:47 PM)asxtree Wrote:
(02-26-2018, 06:01 AM)skyguy Wrote: Thank you for taking the time to document this. It's extremely helpful  Thumbsup

Yes but its missing the most crucial thing and that is commiting new images of the containers created with the soft inside. If this is not done after a reboot you will not have the container on which the sky sw was installed and some other tweaks but when i will find some time because now im making a full manual for diy
Thanks a lot. This is really helping me.




Sent from my iPhone using Tapatalk
Your welcome Hakuna Matata  Big Grin
Reply
#6
What are the benefits and/or disadvantages to using Alpine Containers, and Docker Swarm?
I am a content creator  Fire Fire  
Send me SKY --> PoYvKmychuqg5BPRJMz2kNMwo8NVEUX39h
d a t w a y
Reply
#7
What would be the advantage of this approach? You still have to type the individual commands on all the nodes so no time savings here. I do like docker so willing to dig into it deeper if there are advantages.
Reply
#8
Could you please share auto start script in Alpine Linux? Thank you so much @axstree
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)