Skip to content

Commit cedf0c6

Browse files
committed
Add core-next and service-relay services to composition.
These services enable async host OS updates. When the release is installed, the `core-next` takes over the running supervisor and intercepts all communications between the supervisor and the API and other services, allowing the progressive take over of new supervisor features. Change-type: major
1 parent a7ed71f commit cedf0c6

2 files changed

Lines changed: 73 additions & 4 deletions

File tree

docker-compose.test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ services:
2020
- mock-systemd
2121
volumes:
2222
- dbus:/shared/dbus
23-
- tmp:/mnt/root/tmp/balena-supervisor/services
23+
- services:/mnt/root/tmp/balena-supervisor/services
2424
- ./test/data/root:/mnt/root
2525
- ./test/data/root/mnt/boot:/mnt/boot
2626
- ./test/lib/wait-for-it.sh:/wait-for-it.sh
@@ -78,7 +78,7 @@ services:
7878
stop_grace_period: 3s
7979
volumes:
8080
- dbus:/shared/dbus
81-
- tmp:/mnt/root/tmp/balena-supervisor/services
81+
- services:/mnt/root/tmp/balena-supervisor/services
8282
# Set required supervisor configuration variables here
8383
environment:
8484
DOCKER_HOST: tcp://docker:2375
@@ -110,7 +110,7 @@ volumes:
110110
driver_opts:
111111
type: tmpfs
112112
device: tmpfs
113-
tmp:
113+
services:
114114
driver_opts:
115115
type: tmpfs
116116
device: tmpfs

docker-compose.yml

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
version: '2.3'
22

3+
x-helios-image: &helios-image
4+
image: ghcr.io/balena-io/helios:0.25.21
5+
36
services:
47
# This service can only be named `main`, `balena-supervisor` or `core`
58
# in a multi-container supervisor, the API `supervisor_release` needs to be able to
@@ -8,10 +11,76 @@ services:
811
core:
912
build: ./
1013
privileged: true
11-
tty: true
14+
tty: false
1215
restart: always
1316
network_mode: host
1417
labels:
1518
io.balena.features.balena-api: '1'
1619
io.balena.features.dbus: '1'
1720
io.balena.features.balena-socket: '1'
21+
22+
# This is the next generation supervisor service. When started, it becomes a proxy
23+
# for calls between the existing supervisor and the balenaAPI and containers
24+
core-next:
25+
<<: *helios-image
26+
restart: on-failure
27+
# required to distinguish between stderr/stdout, the supervisor defaults to true
28+
tty: false
29+
labels:
30+
# Needed to get access to supervisor api variables
31+
# and credentials
32+
io.balena.features.supervisor-api: '1'
33+
# Needed for access to DOCKER_HOST
34+
io.balena.features.balena-socket: '1'
35+
# Needed to stop the supervisor service
36+
io.balena.features.dbus: '1'
37+
# Needed to get access to the API credentials
38+
io.balena.features.balena-api: '1'
39+
# Needed to get Host OS metadata
40+
io.balena.features.host-os.board-rev: '1'
41+
environment:
42+
- DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket
43+
# Needed for locks and balenahup. This needs to match the device
44+
# used for the `runtime` volume
45+
- BALENA_HOST_RUNTIME_DIR=/tmp/balena-supervisor
46+
volumes:
47+
# Critical configurations
48+
- config:/config/helios
49+
# Request caching
50+
- cache:/cache/helios
51+
# Persistent system state data that can be reconstructed from
52+
# the target state
53+
- state:/local/helios
54+
# Runtime directory. Data here does not persist after reboots
55+
- runtime:/tmp/run
56+
57+
# The service below relays requests between tcp port 48484 and the socket exposed by
58+
# the core-next service
59+
service-relay:
60+
<<: *helios-image
61+
command: socat TCP-LISTEN:48484,reuseaddr,fork UNIX-CONNECT:/tmp/run/helios.sock
62+
# required to distinguish between stderr/stdout, the supervisor defaults to true
63+
tty: false
64+
ports:
65+
- 48484
66+
depends_on:
67+
- core
68+
volumes:
69+
- runtime:/tmp/run
70+
healthcheck:
71+
test: ['CMD', 'wget', '-O', '-', '-q', 'http://127.0.0.1:48484/ping']
72+
73+
volumes:
74+
config:
75+
state:
76+
labels:
77+
# the database version, can be bumped to re-create the state
78+
io.balena.private.db-version: 0
79+
cache:
80+
runtime:
81+
driver: local
82+
driver_opts:
83+
type: none
84+
o: bind
85+
# XXX: this directory needs to exist on the host before the container is started
86+
device: /tmp/balena-supervisor

0 commit comments

Comments
 (0)