Use docker-compose instead of Azure IoT Edge

Reading Time: 7 minutes

Sometimes our users don’t want to create an Azure account or use the Microsoft cloud for their Vizi-AI. This guide shows users how to use Vizi Apps without Azure IoT Hub.

Disclaimer: The user experience is very different from this point forwards.

Prerequisites: You need to ensure before following this guide that you have:

  1. Enabled SSH on your Vizi-AI. The instructions to do this can be found here – Enable SSH on my Vizi-AI
    *might be a good idea to make a note of your Vizi’s IP address at this point also*
  2. Installed a suitable SSH client, I recommend installing Putty – Install PuTTY on my host PC
  3. Ensure you have a clear mechanism for transferring files from your host PC to Vizi-AI. I use Filezilla but it is my preference, instructions for installation are located here – Installing FileZilla.
  4. Ran the following commands to ensure that your Vizi is up to date:
     sudo apt update
     sudo apt upgrade

5. Installed curl and unzip by running these commands:

sudo apt install curl
sudo apt install unzip

Once you have ensured that the prerequisites have been met then we can start on the journey to enabling you to create and execute the vizi-ai-starter-kit profile as a docker-compose file.

Uninstalling 3rd Party software

As we originally planned to use Azure IoT Edge for deployment of our software, we pre-loaded your Vizi-AI with the software needed to do this.

So as not to break licensing terms with Microsoft we need to uninstall IoT Edge and the Moby Docker Engine that it uses.

Open your SSH client and connect to your Vizi. Login with the following credentials:

Once logged in you will see the below in your terminal window.

Once logged in we first check the status of IoT Edge and then Docker. Use the commands:

sudo systemctl status iotedge
sudo systemctl status docker

You will see that docker is running and that IoT Edge is not.

Now we will start the process of removing both from your Vizi. Type in the following commands in the terminal windows.

sudo apt-get remove --purge iotedge
sudo apt-get remove --purge moby-cli
sudo apt-get remove --purge moby-engine

You have now removed IoT Edge and Moby Docker from your Vizi, running the same commands previously to show the status of these services will validate this.

Installing Docker and Docker Compose

Its good practice just to ensure a completely clean environment to run a remove command for all docker components as some may have been left behind in the previous uninstall. To do this, run this command.

sudo apt-get remove docker docker-engine docker.io containerd runc

You can install docker in multiple ways but this method will show you how to install it via the docker repository.

sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

Next we need to add Docker’s official security key to our Vizi installation.

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

Next we need to add the docker repository for Debian to our Vizi.

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"

As we have just added the Docker repository to our Vizi we also need to update the packages that we can now discover.

sudo apt-get update

Next we install the Docker packages to Vizi.

sudo apt-get install docker-ce docker-ce-cli containerd.io

That is Docker now installed on our Vizi.

Next we need to install Docker Compose. Docker Compose allows us to run a script that will pull all of the Vizi apps and apply configurations to them in one go.

To install Docker Compose simply run the following commands:

We will be downloading to current stable release of docker-compose, using this command.

sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Next we need to make sure that the permissions are set correctly.

sudo chmod +x /usr/local/bin/docker-compose

That is the software installed on your Vizi. To check it is working run the command below.

docker-compose --version

You will see on screen a result similar to the one below.

Generating a docker-compose file

Now we have docker and docker-compose installed on your Vizi-AI we need to generate the file for you to run. In the 2.2 release of profile builder the facility to take a profile and generate a docker-compose file instead of having to deploy to Azure IoT Hub was added.

This section will guide you through the process of how to do this and how to execute the file on your Vizi-AI.

  1. Open the “Projects” tab
  2. Click “Create project” and choose a “Project Title” and “Description” for your profile. You can choose anything you like, but let’s use “project-1” as Title and click “Create”. The newly created project appears in the list “Projects”.
  3. Select the Project you have just created and click “Add profile”.
  4. To download the vizi-ai-starter-kit simply click “Download profile” then select the ‘vizi-ai-starter-kit profile’ from the list of ADLINK-templates and click download
  5. Select the profile created in Step 2 and click “Download”

You will then see the status bar showing the download of your profile, it is worth remembering that the speed of this is dependent on your internet connection speed.

Once the profile has finished downloading you will be presented with a download report. Click “Finish” to continue.

You will then be taken back to the profiles module of Profile Builder where you will see the vizi-ai-starter-kit profile that you have just downloaded.

Click on the name of the profile to open it.

Here we don’t want to make any changes so we will not be opening any of the apps, our goal is to deploy this profile now to a docker-compose file.

Click on the Deploy button in the top right hand corner.

You will then be presented with the available options to deploy your profile. In this case select to download as a docker-compose file and Click Next.

Your docker-compose file will immediately be downloaded to your normal downloads space, which is configured within your browser.

As you can see on the screenshot below it has downloaded in the bottom left of my browser. Click Finish.

If you navigate to your Downloads area you will see the .zip file.

Next we have to move the zip file to your Vizi-AI. As mentioned previously, I use Filezilla for this purpose but you can use whatever method you want to do this.

Next connect to your Vizi by entering the IP address of your Vizi, the username (root) and password (root) and specify Port 22 then click Quickconnect.

Once you are connected you will see a view of your Vizi as shown below. Click on the folder with a question mark on to navigate to the top level of the Vizi’s file structure.

You will then see the top level folder structure as shown in Green. You will also see on the left the file structure on your host PC.

If you select the vizi-ai-starter-kit.zip file as shown below.

Right click on the vizi-ai-starter-kit.zip and select upload. This will upload your .zip file to the folder you are in on the Vizi on the right.

You will see that the file has been transferred on the bottom of the screen.

If you also scroll down in the right hand pane you will see the .zip at the bottom in the Vizi folder structure.

With the file on the Vizi we need to now close Filezilla and reopen Putty to execute the commands we require to unzip and execute the docker-compose files.

Provided all pre-requisite steps have been followed then it is relatively straightforward to execute you docker-compose file.

To check you are in the correct location in Putty, type “ls” if you do not get any results then type “cd ..” and rerun “ls” keep following that in a loop until you see your vizi-ai-starter-kit.zip file in the results that are returned.

Next step is to unzip the vizi-ai-starter-kit. To do this run the following command.

sudo unzip vizi-ai-starter-kit.zip -d /vizi-ai-starter-kit/

We use the -d option to indicate to unzip to create this into a directory and then we provide the target directory name.

You will immediately see that the files are being inflated from the zip and saved into the /vizi-ai-starter-kit folder.

Once the files have been unzipped navigate into the folder with the command:

cd vizi-ai-starter-kit

Then to execute the docker-compose file in this location simply run the following command:

docker-compose up -d

You will then see docker start to pull all of the apps specified.

Once it has finished pulling all of the apps it will then create them and show you the results.

This is your Vizi-AI apps all running. To view their status enter the command:

sudo docker ps -a

Alternatively, you can open Portainer to view the logs, to setup Portainer the instructions are located here How to use Portainer to debug a Vizi-AI application.

However, as you are not using our platform to deploy the apps and register the device then you will need to manually navigate to Portainer before going through the instructions. To navigate to Portainer, open a web browser and go to the URL http://<your-vizi-ip-address>:9000.

Next Steps…

To view the inferenced results being now generated by your Vizi-AI you will need to install VMLINK which is our solution to view all the outputs from the system.

Select the Operating system you are using:

Stay in touch

Sign up to our email list to be notified of the latest industry news