Integration in the Cloudy ecosystem » History » Version 9

« Previous - Version 9/12 (diff) - Next » - Current version
Luca Baldesi, 06/19/2018 11:53 AM


Integration in the Cloudy ecosystem

Cloudy 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.

Cloudy node setup

  1. Install a debian based distribution; by the time of writing debian 9 (Stretch) works just fine (even in the raspbian flavor).
  2. Install cloudy installation dependencies:
    apt-get update; apt-get install -y curl lsb-release vim tmux git
    
  3. Install cloudy (you can find more detail on cDistro repo)
    sudo su
    curl -k https://raw.githubusercontent.com/Clommunity/cloudynitzar/master/cloudynitzar.sh | bash -
    
  4. Setup a serf bootstrap node (otherwise Serf will not even start):
    • Edit /etc/avahi-ps-serf.conf
    • Change the parameter SERF_JOIN
    • In case you need, you can start a serf node to be used as bootstrap one with:
       serf agent -iface <net_interface> -bind <ip_addr>:<port> 
       
    • In case you have several ip addresses on the serf interface, edit /etc/init.d/serf, changing the line
       PUBLIC_IP=$(ip -4 -o addr show up primary scope global $SERF_INTERFACE | sed 's/  */ /g' | cut -d '/' -f1 | grep -o '[^ ]*$')
      
      with
      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
      
      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
  5. 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:
            {
               "appname": "PeerStreamer-ng",
               "description": "P2P live video streaming",
               "arch": "<arch>",
               "image": "--net host lbaldesi/peerstreamer",
               "name": "peerstreamer" 
              }
      
    • 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)

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:

git clone    https://github.com/netCommonsEU/PeerStreamer-docker.git
cd peerstreamer_docker
sudo docker build -t lbaldesi/psng_<arch> .

If you want to push it to docker hub:

sudo docker login
sudo docker push lbaldesi/psng_<arch>

If you want to create a multiarch peerstreamer image (tutorial):

git clone https://github.com/estesp/manifest-tool.git
cd manifest-tool/
sudo make build

write the following specification file (spec.yml):
image: lbaldesi/peerstreamer:testing
manifests:
  - image: lbaldesi/psng_amd64:testing
    platform:
      architecture: amd64
      os: linux
  - image: lbaldesi/psng_arm:testing
    platform:
      architecture: arm
      os: linux

Then push
sudo ./manifest-tool push from-spec spec.yml