-
Notifications
You must be signed in to change notification settings - Fork 0
Lifecycle Backends
Lifecycle backends are serpgen plugins that generate supervisor and init configurations for managing SERP processes. When serpgen generate-workspace runs, it generates the lifecycle config for each process according to the launcher field on its domain.
Set launcher in the domain configuration inside a deployment spec:
domains:
service:
launcher: systemd # systemd | initd | android_init | script
install:
prefix: /opt/myapp
user: myapp
group: myapp
restart_policy: on-failureGenerates .service unit files. The standard choice for modern embedded Linux.
Generated output (gen/deployments/<deployment>/lifecycle/<process>.service):
[Unit]
Description=ClimateHal process
After=dbus.service
[Service]
Type=simple
ExecStart=/opt/myapp/bin/climate_hal_app
User=myapp
Group=myapp
Restart=on-failure
RestartSec=2
[Install]
WantedBy=multi-user.targetProcess ordering from start_after in the deployment spec is translated to After= directives in the unit file.
Installation:
sudo cp gen/deployments/multiprocess_dbus/lifecycle/*.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now climate_hal_appUse for: Linux with systemd — most modern embedded Linux distributions, automotive-grade Linux (AGL), Yocto-based systems.
Generates traditional SysVinit shell scripts under /etc/init.d/. No systemd dependency.
Generated output: A shell script per process with start, stop, restart, and status commands following the LSB init script convention.
Use for: Older embedded Linux targets that predate systemd, or distributions that explicitly use SysVinit.
Generates .rc files for the Android Init system. The Android Init language is the standard process management mechanism on Android and Android Automotive OS.
Generated output (gen/deployments/<deployment>/lifecycle/<process>.rc):
service climate_hal_app /opt/myapp/bin/climate_hal_app
class main
user myapp
group myapp
restart_period 2
Use for: AAOS (Android Automotive OS) targets. The .rc files are placed into the Android build system as part of the system image.
Generates simple shell start/stop scripts with no OS-level supervisor dependency. Processes are started directly and managed by the script, not by systemd or init.
Use for:
- macOS development (systemd is not available)
- Quick iteration and debugging
- Environments where a supervisor is not desired or available
The generated script handles process ordering based on start_after by waiting for each dependency process to be ready before starting the next.
domains:
service:
launcher: systemd # Which backend to use
install:
prefix: /opt/myapp # Binary installation prefix
user: myapp # OS user to run the process as
group: myapp # OS group
restart_policy: on-failure # Restart behavior hint passed to the backend
logging:
strategies: [file]
file_dir: /var/log/myapp
file_rotation_size_mb: 10
file_rotation_count: 5
hmi_session:
launcher: script
logging:
strategies: [console, file]| Value | Plugin | Platform |
|---|---|---|
systemd |
serp_lifecycle_systemd |
Linux with systemd |
initd |
serp_lifecycle_initd |
Linux with SysVinit |
android_init |
serp_lifecycle_android_init |
AAOS / Android |
script |
Built-in | macOS, Linux (development) |
Passed through to the generated supervisor config. Common values:
| Value | Behavior |
|---|---|
on-failure |
Restart the process only if it exits with a non-zero status |
always |
Always restart regardless of exit code |
no |
Do not restart |
-
Deployment Specs — full deployment spec syntax including
domainsandprocesses - Deployment Configurations — choosing between monolith, DBus, and gRPC
-
Generator Overview — how
serpgeninvokes lifecycle plugins
Getting Started
The Development Model
Architecture Language
Code Generator
- Generator Overview
- Generated Code Layout
- Deployment Configurations
- Lifecycle Backends
- CMake Integration
Framework Internals
- Core Concepts
- Services & Lifecycle
- Methods
- Properties
- Notifications
- Timers & Watchdog
- Promises & Async
- Streams
- Commands
- Logging
- Test Engine
- Transports
- Runtime & Debug Tools
VS Code Plugin
Examples