mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-18 07:18:14 +00:00
integrate with busybox init system
busybox's init uses /etc/inittab for configuration just like sysvinit, however it doesn't use any runlevels. the tty part of inittab is appended to "/dev/", and it becomes connected to the stdout of the spawned process Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
This commit is contained in:
29
entry.sh
29
entry.sh
@ -1,45 +1,22 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -o errexit
|
||||||
|
|
||||||
[ -d /dev/net ] ||
|
[ -d /dev/net ] ||
|
||||||
mkdir -p /dev/net
|
mkdir -p /dev/net
|
||||||
[ -c /dev/net/tun ] ||
|
[ -c /dev/net/tun ] ||
|
||||||
mknod /dev/net/tun c 10 200
|
mknod /dev/net/tun c 10 200
|
||||||
|
|
||||||
cd /app
|
|
||||||
|
|
||||||
mkdir -p /var/log/supervisor && touch /var/log/supervisor/supervisord.log
|
|
||||||
mkdir -p /var/run/resin
|
|
||||||
mount -t tmpfs -o size=1m tmpfs /var/run/resin
|
mount -t tmpfs -o size=1m tmpfs /var/run/resin
|
||||||
|
|
||||||
if [ -z "$GOSUPER_SOCKET" ]; then
|
|
||||||
export GOSUPER_SOCKET=/var/run/resin/gosuper.sock
|
|
||||||
fi
|
|
||||||
if [ -z "$DOCKER_SOCKET" ]; then
|
|
||||||
export DOCKER_SOCKET=/run/docker.sock
|
|
||||||
fi
|
|
||||||
if [ -z "$HOST_PROC" ]; then
|
|
||||||
export HOST_PROC=/mnt/root/proc
|
|
||||||
fi
|
|
||||||
|
|
||||||
export DBUS_SYSTEM_BUS_ADDRESS="unix:path=/mnt/root/run/dbus/system_bus_socket"
|
|
||||||
|
|
||||||
# If DOCKER_ROOT isn't set then default it
|
# If DOCKER_ROOT isn't set then default it
|
||||||
if [ -z "${DOCKER_ROOT}" ]; then
|
if [ -z "${DOCKER_ROOT}" ]; then
|
||||||
DOCKER_ROOT=/mnt/root/var/lib/rce
|
DOCKER_ROOT=/mnt/root/var/lib/rce
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Mount the DOCKER_ROOT path equivalent in the container fs
|
# Mount the DOCKER_ROOT path equivalent in the container fs
|
||||||
DOCKER_LIB_PATH=${DOCKER_ROOT#/mnt/root}
|
DOCKER_LIB_PATH=${DOCKER_ROOT#/mnt/root}
|
||||||
|
|
||||||
if [ ! -d "${DOCKER_LIB_PATH}" ]; then
|
if [ ! -d "${DOCKER_LIB_PATH}" ]; then
|
||||||
ln -s "${DOCKER_ROOT}" "${DOCKER_LIB_PATH}"
|
ln -s "${DOCKER_ROOT}" "${DOCKER_LIB_PATH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
|
|
||||||
|
|
||||||
supervisorctl start resin-supervisor
|
|
||||||
supervisorctl start go-supervisor
|
|
||||||
|
|
||||||
tail -F \
|
|
||||||
/var/log/supervisor/supervisord.log \
|
|
||||||
/var/log/resin_supervisor_stdout.log
|
|
||||||
|
7
inittab
Normal file
7
inittab
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# busybox inittab
|
||||||
|
# format: tty:ignored:action:command
|
||||||
|
|
||||||
|
stdout::sysinit:/usr/src/app/entry.sh
|
||||||
|
|
||||||
|
stdout::respawn:/usr/src/app/run.sh node /usr/src/app/src/app.js
|
||||||
|
stdout::respawn:/usr/src/app/run.sh /usr/src/app/gosuper
|
@ -3,8 +3,7 @@
|
|||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "./entry.sh",
|
"start": "./entry.sh",
|
||||||
"lint": "resin-lint src/",
|
"lint": "resin-lint src/"
|
||||||
"start": "./entry.sh"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"JSONStream": "^1.1.2",
|
"JSONStream": "^1.1.2",
|
||||||
|
22
run.sh
Executable file
22
run.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -z "$GOSUPER_SOCKET" ]; then
|
||||||
|
export GOSUPER_SOCKET=/var/run/resin/gosuper.sock
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$DOCKER_SOCKET" ]; then
|
||||||
|
export DOCKER_SOCKET=/run/docker.sock
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$HOST_PROC" ]; then
|
||||||
|
export HOST_PROC=/mnt/root/proc
|
||||||
|
fi
|
||||||
|
|
||||||
|
export DBUS_SYSTEM_BUS_ADDRESS="unix:path=/mnt/root/run/dbus/system_bus_socket"
|
||||||
|
|
||||||
|
# If DOCKER_ROOT isn't set then default it
|
||||||
|
if [ -z "${DOCKER_ROOT}" ]; then
|
||||||
|
DOCKER_ROOT=/mnt/root/var/lib/rce
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec $@
|
Reference in New Issue
Block a user