Comment on page
Using the App Template
This documentation explains how to develop an application for AuterionOS. An application is a set of Docker containers that can interact together and with Auterion software. Tools are provided in order for you to build, deploy and run your application on top of AuterionOS for development, and then package it into an update archive to deploy it to Skynode-powered vehicles. Attached to this documentation there are four example applications written in C++ and Python that use mavlink (MavSDK) to get flight controller telemetry or interact with Auterion Payload Manager. At the end of the documentation you will find a section listing the most important commands to know in order to interact with an application installed on your device.
You can also first develop and prototype by just using ssh to connect to Skynode. See the section on USB-C Networking on Skynode for further details.
An application is composed of:
app.yml
: A YAML file that describes your applicationsrc
: A folder that contains application source code and DockerfileMakefile
: One makefile that contains build and install instructionstools
: A folder that contains tools needed in order to build and deploy your application
The
app.yml
is the file that describes and configures your application. This file follows the Compose file format and should define every service that composes your application.
A minimal app.yml
should contain at least:version: '3.7'
services:
service1:
image: service1
container_name: service1
restart: unless-stopped
network_mode: host
volumes:
- '/data/app/myapp/data:/data'
Where
service1
is the name of your docker container and myapp
is the name of your application.For a multiple containers application, app.yml should contain at least:
version: '3.7'
services:
service1:
image: service1
container_name: service1
restart: unless-stopped
network_mode: host
volumes:
- '/data/app/myapp/data:/data'
service2:
image: service2
container_name: service2
restart: unless-stopped
network_mode: host
volumes:
- '/data/app/myapp/data:/data'
Where
service1
is the name of your first docker container, service2
is the name of your second docker container and myapp
is the name of your application.Network
By adding
network_mode: host
to your service definition in app.yml
you will be able to expose your service to the network.Volumes
By adding
- '/persistent/shared_container_dir:/shared_container_dir'
to the list of volumes of your service definition in app.yml
, you will be able to access to the WiFi and LTE configuration files.By adding the following volumes to the list of volumes of your service definition in app.yml, you will be able to access pictures taken by Auterion Payload Manager:
- '/data/shared_photos:/shared_photos'
- '/data/photos:/data/photos'
- '/dev/media:/dev/media'
You are actually free to architecture your application as you want. One way to architecture your
src
folder is:/src
/service1
/Dockerfile
/src
/service2
/Dockerfile
/src
In order to drive the build and deployment processes you can define a Makefile with the following rules:
appName ?= myapp
toolsPath = ./tools
​
ifneq ($(artifactPath),)
artifactPath=$(artifactPath)
else
artifactPath=./output/$(appName).auterionos
endif
​
build-myapp-service1:
docker build ./src/service1 -t service1
​
build-myapp-service2:
docker build ./src/service2 -t service2
​
build: build-myapp-service1 build-myapp-service2
mkdir -p output
docker save service1 service2 | gzip > output/$(appName).image
$(toolsPath)/package_app.sh --app=$(appName)
​
install:
$(toolsPath)/update.py --artifact $(artifactPath)
Where
service1
is the name of your first docker container, service2
is the name of your second docker container and myapp
is the name of your application.The
build
target will build every service and generate the application artifact in output/<myapp>.auterionos
. The install
target will upload and install the artifact on your device (via USB-C).The tools folder is important because it contains the scripts you will need to package an application and to deploy it to your device. You will need to copy the following scripts from
tools
and copy them to the root of your application workspace:tools/package_app.sh
tools/mender-artifact
Manufactuers refer to Pre-install Apps for a guide on how to package your app into an AuterionOS base image. The process can be used to include Apps directly in AuterionOS images.
A good way to start developing applications for AuterionOS is to experiment with the example applications provided by Auterion.
In case your deployment fails you can find useful information in the following logs:
/var/log/apache2/error.log
/data/<APP_NAME>.log
In case you cannot package an artifact or build an application, you can execute the script
./setup/sanity_check.sh
in order to verify that your setup is configured correctly. This script will give you additional information in order to fix your setup issue.Depending on which Linux distribution the development environment is installed, the
make
command may need to be executed with sudo
. The package script uses mounts in order to copy files in the artifact, which may require elevated privileges.Last modified 8mo ago