Integration in the Cloudy ecosystem » History » Version 2

Luca Baldesi, 02/16/2018 02:20 PM

1 1 Luca Baldesi
h1. Integration in the Cloudy ecosystem
2 1 Luca Baldesi
3 1 Luca Baldesi
"Cloudy":http://cloudy.community is a project for service discovery and provisioning in community networks.
4 1 Luca Baldesi
5 1 Luca Baldesi
PeerStreamer-ng can be shipped for the Cloudy ecosystem easily through docker images.
6 1 Luca Baldesi
7 1 Luca Baldesi
The first part of this page will deal with the setup of a Cloudy node, while the second part with the creation of the PeerStreamer-ng docker image.
8 1 Luca Baldesi
9 1 Luca Baldesi
h2. Cloudy node setup
10 1 Luca Baldesi
11 1 Luca Baldesi
# Install a debian based distribution; by the time of writing debian 9 (Stretch) works just fine (even in the raspbian flavor).
12 1 Luca Baldesi
# Install cloudy installation dependencies:
13 1 Luca Baldesi
<pre>
14 1 Luca Baldesi
apt-get update; apt-get install -y curl lsb-release vim tmux git
15 1 Luca Baldesi
</pre> 
16 1 Luca Baldesi
# Install cloudy (you can find more detail on "cDistro repo":https://github.com/netCommonsEU/cDistro)
17 1 Luca Baldesi
<pre>
18 1 Luca Baldesi
sudo su
19 1 Luca Baldesi
curl -k https://raw.githubusercontent.com/Clommunity/cloudynitzar/master/cloudynitzar.sh | bash -
20 1 Luca Baldesi
</pre>
21 1 Luca Baldesi
# Setup a serf bootstrap node (otherwise "Serf":http://serf.io will not even start):
22 1 Luca Baldesi
** Edit /etc/avahi-ps-serf.conf
23 1 Luca Baldesi
** Change the parameter SERF_JOIN
24 1 Luca Baldesi
** In case you need, you can start a serf node to be used as bootstrap one with:
25 1 Luca Baldesi
 <pre>
26 1 Luca Baldesi
 serf agent -iface <net_interface> -bind <ip_addr>:<port> 
27 1 Luca Baldesi
 </pre> 
28 1 Luca Baldesi
** Browse localhost:7000 and go to Search->serf to start the Serf service
29 1 Luca Baldesi
# Setup docker
30 1 Luca Baldesi
* Browse localhost:7000 and go to Enterprise->docker, then click get docker
31 1 Luca Baldesi
* Repeat the previous step to install docker
32 1 Luca Baldesi
* Add PeerStreamer-ng docker image coordinates by editing var/local/cDistro/plug/resources/docker/containers/PeerStreamer-ng_latest.json:
33 1 Luca Baldesi
<pre>
34 1 Luca Baldesi
      {
35 1 Luca Baldesi
         "appname": "PeerStreamer-ng",
36 1 Luca Baldesi
         "description": "P2P live video streaming",
37 1 Luca Baldesi
         "arch": "<arch>",
38 1 Luca Baldesi
         "image": "--net host lbaldesi/peerstreamer:devel",
39 1 Luca Baldesi
         "name": "peerstreamer"
40 1 Luca Baldesi
        }
41 1 Luca Baldesi
</pre>
42 1 Luca Baldesi
* Change "<arch>" in the with your machine architecture (e.g., armhf, amd64)
43 1 Luca Baldesi
* Browse localhost:7000 and go to Enterprise->docker, then click "add predefined image" to select and install PeerStreamer-ng
44 1 Luca Baldesi
(it may take some time and the web interface does not show any progress; wait few minutes or check "top" to be sure the command failed) 
45 1 Luca Baldesi
46 1 Luca Baldesi
h2. PeerStreamer on docker
47 1 Luca Baldesi
48 1 Luca Baldesi
PeerStreamer-ng assumes a running instance of Serf is already setup, which goes reasonably well in the Cloudy environment.
49 1 Luca Baldesi
Serf is needed as PeerStreamer-ng uses it for channel discovery and advertisement.
50 1 Luca Baldesi
51 1 Luca Baldesi
To build the docker image from scratch:
52 1 Luca Baldesi
<pre>
53 1 Luca Baldesi
git clone	git@github.com:netCommonsEU/PeerStreamer-docker.git 
54 1 Luca Baldesi
cd PeerStreamer-docker/
55 2 Luca Baldesi
git checkout multiarch
56 1 Luca Baldesi
sudo docker build -t lbaldesi/psng_<arch>:devel .
57 1 Luca Baldesi
</pre>
58 1 Luca Baldesi
59 1 Luca Baldesi
60 1 Luca Baldesi
If you want to push it to docker hub:
61 1 Luca Baldesi
<pre>
62 1 Luca Baldesi
sudo docker login
63 1 Luca Baldesi
sudo docker push lbaldesi/psng_<arch>:devel
64 1 Luca Baldesi
</pre>
65 1 Luca Baldesi
66 1 Luca Baldesi
If you want to create a multiarch peerstreamer image ("tutorial":https://container-solutions.com/multi-arch-docker-images/):
67 1 Luca Baldesi
<pre>
68 1 Luca Baldesi
image: lbaldesi/peerstreamer:devel
69 1 Luca Baldesi
manifests:
70 1 Luca Baldesi
  - image: lbaldesi/psng_amd64:devel
71 1 Luca Baldesi
    platform:
72 1 Luca Baldesi
      architecture: amd64
73 1 Luca Baldesi
      os: linux
74 1 Luca Baldesi
  - image: lbaldesi/psng_arm:devel
75 1 Luca Baldesi
    platform:
76 1 Luca Baldesi
      architecture: arm
77 1 Luca Baldesi
      os: linux
78 1 Luca Baldesi
</pre>