Link Search Menu Expand Document

Demo: person detection system at the edge, with notifications to the cloud


Let’s setup a scenario for an edge device (NuvlaEdge) with a USB camera attached, and a VM running in the cloud.

We’ll deploy, from Nuvla:

  • a message broker application to the cloud VM, and
  • a video analysis app to the NuvlaEdge, that publishes notifications to the message broker running in the cloud.

Finally, we can even install an app in our phone, to subscribe to the message broker running in the cloud, so that we receive the notifications from the NuvlaEdge, no matter where we are.

This scenario is pictured in the image below.


DIY: Step by step guide

You can run this demo by yourself. Simply go through the following steps:

1: You’ll need

  • one or more Linux VMs, with a public IP, running Docker in Swarm mode
  • an edge device (RaspberryPi, Laptop, etc.) with Docker and Docker Compose installed, and Swarm mode enabled
  • an internet connection
  • a account
  • one USB webcam

2: Setup your Cloud infrastructure

  1. SSH into a master node (VM) from your Docker Swarm cluster. Take note of the IP of that node
  2. To secure the connection with Nuvla, we need to set/get some TLS credentials for your Docker socket in that cluster. Check systemctl status docker and see if there are any --tls* arguments in the dockerd process
    1. IF YOU HAVE THOSE, then please make note of CERT (as –tlscert), KEY (as –tlskey) and CA (as –tlscacert). Also make a note of the TCP PORT being used (by default it should be 2376)
    2. IF YOU DON’T HAVE TLS SETUP, then please:
      1. run docker run -d --rm -p 5000:5000 -v /var/run/docker.sock:/var/run/docker.sock -e HOST=${HOSTNAME} --name ne-compute-api --entrypoint api sixsq/nuvlaedge:2.12.2
      2. Wait about 60sec, or until the command docker logs ne-compute-api shows:

        mode of ‘/opt/nuvlaedge/cert.pem’ changed to 0444 (r–r–r–)

      3. take note of:

        CERT - from docker exec ne-compute-api cat /srv/nuvlaedge/shared/cert.pem
        KEY - from docker exec ne-compute-api cat /srv/nuvlaedge/shared/key.pem
        CA - from docker exec ne-compute-api cat /srv/nuvlaedge/shared/ca.pem

      4. also take note of PORT=5000
  3. go to, login, and select Infrastructures, on the left sidebar
  4. click “+add” (top left), and select Swarm
  5. fill in the form and click “create” (replace the IP and PORT with the values from steps 1. and 2. above)


  6. now that you see your infrastructure listed, go to Credentials on the left sidebar
  7. we need to tell Nuvla how to authenticate with your cluster, so click “+add” and select Swarm/Kubernetes
  8. fill in the form and click “create” (replace the CA, CERT, and KEY with the saved values from step 2. above)


3: Launching your Message Broker

  1. go to the Nuvla Marketplace (Apps on the left sidebar)
  2. let’s deploy an MQTT broker to your Swarm cluster…find the app “RabbitMQ”
  3. click “launch
  4. select the credential you’ve created before, and click “launch
  5. you’ll be redirected to your dashboard…wait until the app has “STARTED” and you can see a green button on the app card (this can take a few minutes the 1st time you do it, cause your Docker Swarm cluster will have to download this Docker image)


  6. click on the card, and you’ll see a detailed page with information about your deployment. Make note of the URL called “mqtt”

4: Get the NuvlaEdge into your edge device

  1. in, go the Edge panel (left sidebar)
  2. let’s create a NuvlaEdge. Click “+add
  3. fill in the form and click “create


  4. you’ll be given a NuvlaEdgeID, please take note
  5. SSH into your edge device
    1. make sure you’re logged in with a user that can manage Docker - test it by running docker ps
  6. setup the environment by running export NUVLAEDGE_UUID=NuvlaEdgeID where NuvlaEdgeID is the NuvlaEdgeID from step 4.
  7. download the NuvlaEdge Engine software installer. Run wget
  8. now just execute docker compose up -d
    1. it will just take a few seconds for you to see your NuvlaEdge become green (online) in You can follow the installation and lifecycle process by running docker compose logs
    2. after a couple of minutes, you’ll also see a new infrastructure (of the type NuvlaEdge) and credential appear in
  9. if not yet plugged in, plug your USB camera into the NuvlaEdge (edge device)
    1. in, if you go to Edge and select your NuvlaEdge, you’ll see the USB camera automatically listed as a peripheral

5: Deploy the AI app to the edge

  1. in, go to the Marketplace and find the app called “Motion Detector to MQTT”. Click “launch
  2. a panel with appear - select your NuvlaEdge credential from there
  3. click on the environment tab and paste the “mqtt” URL that you saved above


  4. click “launch” and wait
  5. once the deployment is ready, you’ll the the green button with the link to your Motion Detector endpoint - click on it
  6. you’ll be redirected to a new tab on your browser, pointing to your NuvlaEdge via a SixSq VPN IP that has been assigned automatically to your NuvlaEdge
    1. PLEASE note that you’ll only be able to access your NuvlaEdge via this IP if you have a SixSq VPN client configuration running on your computer. If you don’t have one, please drop us an email at Support
    2. if you don’t want to use SixSq’s VPN service, you can also access the Motion Detector endpoint directly via the NuvlaEdge’s IP (check ifconfig in your NuvlaEdge to get the IP)
  7. you are now be able to see the video feed, coming from your webcam. If you move, you’ll see some video processing happening
  8. connect to the MQTT broker running in your Docker Swarm cluster in the cloud, you’ll get a notification every time there’s movement! You can use whatever MQTT client you prefer (mosquitto_sub or even an Android/iPhone app)
    1. for example, if using mosquitto_sub, you can simply execute mosquitto_sub -h URL.IP -p URL.PORT -t video_analysis/message, where URL.IP and URL.PORT are the URL and port number taken from your “mqtt” URL in step 3. above