Integration in the Cloudy ecosystem » History » Version 11

Version 10 (Luca Baldesi, 06/19/2018 11:53 AM) → Version 11/12 (Luca Baldesi, 07/24/2018 02:31 PM)

h1. Integration in the Cloudy ecosystem

"Cloudy":http://cloudy.community is a project for service discovery and provisioning in community networks.

PeerStreamer-ng can be shipped for the Cloudy ecosystem easily through docker images.

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.

h2. Cloudy node setup

# Install a debian based distribution; by the time of writing debian 9 (Stretch) works just fine (even in the raspbian flavor).
# Install cloudy installation dependencies:
<pre>
apt-get update; apt-get install -y curl lsb-release vim tmux git
</pre>
# Install cloudy (you can find more detail on "cDistro repo":https://github.com/netCommonsEU/cDistro)
<pre>
sudo su
curl -k https://raw.githubusercontent.com/Clommunity/cloudynitzar/master/cloudynitzar.sh | bash -
</pre>
# Setup a serf bootstrap node (otherwise "Serf":http://serf.io will not even start):
** Edit /etc/avahi-ps-serf.conf
** Change the parameter SERF_JOIN
** Optionally (but recommended) you can specify in the same file the interface serf has to use, e.g.,
<pre>
SERF_INTERFACE=eth0
</pre>
**
In case you need, you can start a serf node to be used as bootstrap one with:
<pre>
serf agent -iface <net_interface> -bind <ip_addr>:<port>
</pre>
** In case you have several ip addresses on the serf interface, edit /etc/init.d/serf, changing the line
<pre>
PUBLIC_IP=$(ip -4 -o addr show up primary scope global $SERF_INTERFACE | sed 's/ */ /g' | cut -d '/' -f1 | grep -o '[^ ]*$')
</pre>with
<pre>
if [ -z "$PUBLIC_IP" ]; then PUBLIC_IP=$(ip -4 -o addr show up primary scope global $SERF_INTERFACE | sed 's/ */ /g' | cut -d '/' -f1 | grep -o '[^ ]*$'); fi
</pre> and initialize a PUBLIC_IP variable in the /etc/avahi-ps-serf.conf file.
** Browse localhost:7000 and go to Search->serf to start the Serf service
# Setup docker
* Browse localhost:7000 and go to Enterprise->docker, then click get docker
* Repeat the previous step to install docker
* Add PeerStreamer-ng docker image coordinates by editing var/local/cDistro/plug/resources/docker/containers/PeerStreamer-ng_latest.json:
<pre>
{
"appname": "PeerStreamer-ng",
"description": "P2P live video streaming",
"arch": "<arch>",
"image": "--net host lbaldesi/peerstreamer",
"name": "peerstreamer"
}
</pre>
* Change "<arch>" in the with your machine architecture (e.g., armhf, amd64)
* Browse localhost:7000 and go to Enterprise->docker, then click "add predefined image" to select and install PeerStreamer-ng
(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)

h2. PeerStreamer on docker

PeerStreamer-ng assumes a running instance of Serf is already setup, which goes reasonably well in the Cloudy environment.
Serf is needed as PeerStreamer-ng uses it for channel discovery and advertisement.

To build the docker image from scratch:
<pre>
git clone https://github.com/netCommonsEU/PeerStreamer-docker.git
cd peerstreamer_docker
sudo docker build -t lbaldesi/psng_<arch> .
</pre>

If you want to push it to docker hub:
<pre>
sudo docker login
sudo docker push lbaldesi/psng_<arch>
</pre>

If you want to create a multiarch peerstreamer image ("tutorial":https://container-solutions.com/multi-arch-docker-images/):
<pre>
git clone https://github.com/estesp/manifest-tool.git
cd manifest-tool/
sudo make build
</pre>
write the following specification file (spec.yml):
<pre>
image: lbaldesi/peerstreamer
manifests:
- image: lbaldesi/psng_amd64
platform:
architecture: amd64
os: linux
- image: lbaldesi/psng_arm
platform:
architecture: arm
os: linux
</pre>
Then push
<pre>
sudo ./manifest-tool push from-spec spec.yml
</pre>