Create
Create a Docker App
A Docker App is a standard docker container and is created and developed like any normal container for docker and Kuberenetes.
You can build for both x86_64 and arm64 devices.
At a minimum to be compatible with Kelvin, you need two files.
For this example we will get ready for deploying a stock Node Red Server to the edge which can then be accessed on the local LAN network at port 1880 in any modern broswer.
The app.yaml is the main configuration file that holds both Kelvin SmartApps™ definition as well as the deployment/runtime configuration.
For our example it would look like this;
app:
docker:
args: []
context: .
dockerfile: Dockerfile
type: docker
info:
description: Local Node Red Server Demo
name: local-node-red-server-demo
title: Local Node Red Server Demo
version: 1.0.0
spec_version: 4.11.0
system:
ports:
- name: http
type: host
host:
port: 1880
privileged: false
volumes:
- name: data
target: /data
type: persistent
It is composed by the following sections:
-
The
spec_versionsection is automatically injected and specifies Kelvin SmartApps™ JSON Schema (latest) version which both defines and validates theapp.yamlstructure.spec_version: 4.11.0 -
The
infosection holds Kelvin SmartApps™ basic information required to make itself uploadable to Kelvin's App Registry.info: description: Local Node Red Server Demo name: local-node-red-server-demo title: Local Node Red Server Demo version: 1.0.0The
nameis the Docker App's unique identifier. Thetitleanddescriptionwill appear in App Registry on the Kelvin UI once the Docker App is uploaded.Info
The
versionshould be bumped every time Kelvin SmartApps™ gets an update, and before it gets uploaded to the App Registry. -
The
app:dockercan be considered theapp.yaml"main" section. It defines the docker configurations and arguments for building the container.app: type: docker docker: args: [] context: . dockerfile: DockerfileInfo
This is the minimum information that you need to give.
-
The
systemsection is [optional] and can be used to set different system requirements/constraints within the Docker App's running environment. i.e. Resources, Environment Variables, Volumes, Ports, etc:system: ports: - name: http type: host host: port: 1880 privileged: false volumes: - name: data target: /data type: persistent -
In cases where you want to limit resources a container uses you can add
resourceswhich defines the reserved (requests) andlimitsthe resources allocated to the Docker App:system: resources: requests: # Reserved cpu: 100m memory: 256Mi limits: # Limits cpu: 200m memory: 512Mi -
environment_varsis used to define Environment Variables available within the Docker App container. i.e.:system: environment_vars: - name: KELVIN_GW_MODE value: SOCKETSInfo
KELVIN_GW_MODEis an Environment Variable that is [required] by Kelvin's platform. Others can optionally be added. -
Mounted
volumesare [optional] and their main purpose is to share and persist data generated by Kelvin SmartApps™ or used by it in a specific place. They act like a shared folder between the Docker App and the host. Kelvin supports directory volumes, such as folders or serial ports, persistent, and file/test volumes:system: volumes: # Folder Volume - name: serial-rs232 target: /dev/rs232 # Container path type: host host: source: /dev/ttyS0 # Host path # Persistent Volume - name: extremedb target: /extremedb/data type: persistent # File/Text Volume - name: model-parameters target: /opt/kelvin/data/parameters.bin type: text # Renders data into a file text: base64: true encoding: utf-8 data: |- SGVsbG8gUHJvZHVjdCBHdWlsZCwgZnJvbSB0aGUgRW5naW5lZXJpbmcgR3VpbGQhCg== -
portsis [optional] and used to define network port mappings. i.e.:system: ports: - name: http type: host host: port: 1880 - name: opcua type: service # Exposed as a service for other containers service: port: 48010 exposed_port: 30120 -
privilegedis [optional] and used to grant extended privileges to Kelvin SmartApps™, allowing it to access any devices on the host, such as a Serial device:system: privileged: true
The Dockerfile is a script used to define the instructions and configuration for building a Docker image. It specifies the base image, installation of software, file copying, and other setup tasks needed to create a reproducible and isolated environment for running Kelvin SmartApps™ in Docker containers.
For example if you wanted to create a basic Node Red Server for deployment to the edge, your Dockerfile can look something like this;
FROM nodered/node-red
