Skip to main content

Service creation

Service creation

Introductions

An AosEdge service is a lightweight container with customizable restrictions by CPU, RAM, storage, etc.

The main idea is that the base root filesystem layer is the OS rootfs. Other file system layers are acquired from AosCloud or taken with services.

AosEdge services must comply with the OCI specifications: image-spec and runtime-spec.

Services need a simple image configuration in YAML format.

All service files (binaries, libs, config, files) must be provided in the rootfs folder and be in the rootfs tree structure.

Tree structure

.
├── meta
│ ├── config.yaml
│ ├── state.dat
│ ├── aos-user-sp.p12
└── src
├── /usr/bin/services
│ └── hello_world.py
└──/etc/hello.cfg

AosEdge Service creation workflow

loading...

Configuration file transformation workflow

config.yaml(reference) → OCI image manifest + OCI image config + AosEdge service configurationOCI runtime spec

Based on the provided config YAML file, AosCloud generates an OCI image manifest, an OCI image configuration and an AosEdge service config.

AosCloud sends an archive with the next structure to the device:

├── blobs
| └── sha256
| ├── a1c2dc0436ebd2a8c85aac010c5002b907780ef21c921e67bf68052e316bdbd5 -- config
| ├── a1c2dc0436ebd2a8c85aac010c5002b907780ef21c921e67bf68052e316bd777 -- service_config.json
│ └── a6d503001157aedc826853f9b67f26d35966221b158bff03849868ae4a821116 -- service rootfs layer
└── manifest.json -- image manifest

The service manager generates the OCI runtime spec. See Conversion to OCI Runtime Configuration for more info.

OCI specAosEdge deviation
OCI image manifestCurrently, AosEdge supports limited platforms and architectures: Linux as the platform and amd64 and arm as the architecture.
OCI image configurationUser — will be ignored.
Entrypoint — will be ignored.
Volumes — will be ignored.
StopSignal — currently not supported.
rootfs — not required and is ignored.
OCI layerWhiteouts — currently not supported.
OCI runtime specificationRuntime specifications are mostly supported by runc.
process — the consoleSize parameters are always false.
apparmorProfile — currently not supported.
selinuxLabel — currently not supported.
User — is ignored