mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-21 02:01:35 +00:00
Merge pull request #1140 from balena-io/balenaos-in-container
Switch to balenaos-in-container
This commit is contained in:
commit
ff5292cd91
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -1,3 +1,3 @@
|
||||
[submodule "tools/dind/resinos-in-container"]
|
||||
path = tools/dind/resinos-in-container
|
||||
url = https://github.com/balena-os/resinos-in-container.git
|
||||
[submodule "tools/dind/balenaos-in-container"]
|
||||
path = tools/dind/balenaos-in-container
|
||||
url = https://github.com/balena-os/balenaos-in-container.git
|
||||
|
10
Makefile
10
Makefile
@ -25,9 +25,9 @@
|
||||
# * PRELOADED_IMAGE: If true, will preload user app image from tools/dev/apps.json and bind mount apps.json into the docker-in-docker supervisor
|
||||
# * MOUNT_DIST: If true, mount the dist folder into the docker-in-docker supervisor
|
||||
# * MOUNT_NODE_MODULES: If true, mount the node_modules folder into the docker-in-docker supervisor
|
||||
# * CONTAINER_NAME: For run-supervisor, specify the container name for the docker-in-docker container (default: supervisor which produces container resinos-in-container-supervisor)
|
||||
# * CONTAINER_NAME: For run-supervisor, specify the container name for the docker-in-docker container (default: supervisor which produces container balena-container-supervisor)
|
||||
# * CONFIG_FILENAME: For run-supervisor, specify the filename to mount as config.json, relative to tools/dind/ (default: config.json)
|
||||
# * DIND_IMAGE: For run-supervisor, specify the resinOS image to use (default: resin/resinos:2.12.5_rev1-intel-nuc)
|
||||
# * DIND_IMAGE: For run-supervisor, specify the balenaOS image to use (default: resin/resinos:2.12.5_rev1-intel-nuc)
|
||||
#
|
||||
|
||||
# Based on https://stackoverflow.com/a/8540718/2549019
|
||||
@ -128,7 +128,7 @@ supervisor-dind: supervisor-tar supervisor-conf
|
||||
|
||||
run-supervisor: supervisor-dind
|
||||
cd tools/dind \
|
||||
&& ./resinos-in-container/resinos-in-container.sh \
|
||||
&& ./balenaos-in-container/balenaos-in-container.sh \
|
||||
--detach \
|
||||
--config "$(CONFIG_FILENAME)" \
|
||||
--image $(DIND_IMAGE) \
|
||||
@ -136,8 +136,8 @@ run-supervisor: supervisor-dind
|
||||
--extra-args "${SUPERVISOR_DIND_MOUNTS}"
|
||||
|
||||
stop-supervisor:
|
||||
-docker stop resinos-in-container-$(CONTAINER_NAME) > /dev/null || true
|
||||
-docker rm -f --volumes resinos-in-container-$(CONTAINER_NAME) > /dev/null || true
|
||||
-docker stop balena-container-$(CONTAINER_NAME) > /dev/null || true
|
||||
-docker rm -f --volumes balena-container-$(CONTAINER_NAME) > /dev/null || true
|
||||
|
||||
supervisor-image:
|
||||
ifneq ($(DOCKER_GE_17_05),true)
|
||||
|
@ -7,7 +7,7 @@ The supervisor is a Node.js program.
|
||||
## Running a supervisor locally
|
||||
|
||||
This process will allow you to run a development instance of the supervisor on your local computer. It is not recommended for production scenarios, but allows someone developing on the supervisor to test changes quickly.
|
||||
The supervisor is run inside a resinOS instance running in a container, so effectively it's a Docker-in-Docker instance (or more precisely, [balenaEngine](https://github.com/resin-os/balena-engine)-in-Docker).
|
||||
The supervisor is run inside a balenaOS instance running in a container, so effectively it's a Docker-in-Docker instance (or more precisely, [balenaEngine](https://github.com/resin-os/balena-engine)-in-Docker).
|
||||
|
||||
### Set up `config.json`
|
||||
|
||||
|
10
dindctl
10
dindctl
@ -20,8 +20,8 @@
|
||||
# Options:
|
||||
# --arch | -a [arch] architecture of the supervisor to build (default: amd64 )
|
||||
# --image | -i [image] image name for supervisor image to build/use ( default: balena/$ARCH-supervisor:master )
|
||||
# --dind-image [image] image to use for the resinos-in-container host (default: resin/resinos:2.12.5_rev1-intel-nuc)
|
||||
# --dind-container [name] container name suffix for the dind host container ( default: "supervisor", which will produce a container named resinos-in-container-supervisor)
|
||||
# --dind-image [image] image to use for the balenaos-in-container host (default: resin/resinos:2.12.5_rev1-intel-nuc)
|
||||
# --dind-container [name] container name suffix for the dind host container ( default: "supervisor", which will produce a container named balena-container-supervisor)
|
||||
# --mount-dist bind-mount './dist/' (where webpack stores the built js) from local development environment into supervisor container.
|
||||
# --mount-nm bind-mount './node_modules/' from local development environment into supervisor container.
|
||||
# --mount-backup bind-mount './tools/dind/backup.tgz' to simulate a migration backup.
|
||||
@ -132,11 +132,11 @@ function buildSupervisorSrc {
|
||||
function refreshSupervisorSrc {
|
||||
buildSupervisorSrc
|
||||
echo "Restarting the supervisor container"
|
||||
docker exec -ti resinos-in-container-$CONTAINER_NAME systemctl restart resin-supervisor
|
||||
docker exec -ti balena-container-$CONTAINER_NAME systemctl restart resin-supervisor
|
||||
}
|
||||
|
||||
function runDind {
|
||||
if [ ! -f "$SUPERVISOR_BASE_DIR/tools/dind/resinos-in-container/resinos-in-container.sh" ]; then
|
||||
if [ ! -f "$SUPERVISOR_BASE_DIR/tools/dind/balenaos-in-container/balenaos-in-container.sh" ]; then
|
||||
(cd $SUPERVISOR_BASE_DIR; git submodule update --init)
|
||||
fi
|
||||
if [ "$MOUNT_DIST" = "true" ]; then
|
||||
@ -178,7 +178,7 @@ function cleanDind {
|
||||
}
|
||||
|
||||
function logs {
|
||||
docker exec -ti resinos-in-container-$CONTAINER_NAME journalctl $@
|
||||
docker exec -ti balena-container-$CONTAINER_NAME journalctl $@
|
||||
}
|
||||
|
||||
action="$1"
|
||||
|
@ -17,7 +17,7 @@ On devices running supervisor 7.22.0 and higher, the lockfile is located at `/tm
|
||||
|
||||
On older devices (with v4.0.0 <= supervisor version < v7.22.0) the lock is located at `/tmp/resin/resin-updates.lock`. The latest supervisor versions still take the lock at this legacy path for backwards compatibility.
|
||||
|
||||
Legacy supervisors (< v4.0.0) have the lock at `/data/resin-updates.lock`. This lock is only supported on devices running resinOS 1.X.
|
||||
Legacy supervisors (< v4.0.0) have the lock at `/data/resin-updates.lock`. This lock is only supported on devices running balenaOS 1.X.
|
||||
This old lock has the problem that the supervisor has to clear whenever it starts up to avoid deadlocks. If the user app
|
||||
has taken the lock before the supervisor starts up, the lock will be cleared and the app can operate under the false
|
||||
assumption that updates are locked (see [issue #20](https://github.com/resin-io/resin-supervisor/issues/20)). We therefore strongly recommend switching to the new lock location as soon as possible.
|
||||
|
@ -141,7 +141,7 @@ export default class ConfigJsonConfigBackend {
|
||||
// Older 1.X versions have config.json here
|
||||
return '/mnt/conf/config.json';
|
||||
} else {
|
||||
// In non-resinOS hosts (or older than 1.0.0), if CONFIG_JSON_PATH wasn't passed
|
||||
// In non-balenaOS hosts (or older than 1.0.0), if CONFIG_JSON_PATH wasn't passed
|
||||
// then we can't do atomic changes (only access to config.json we have is in /boot,
|
||||
// which is assumed to be a file bind mount where rename is impossible)
|
||||
throw new Error(
|
||||
|
1
tools/dind/balenaos-in-container
Submodule
1
tools/dind/balenaos-in-container
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 16b91dc3ced586e8556ac5f2cc9405eff333b12c
|
@ -1 +0,0 @@
|
||||
Subproject commit 6549263ae304d12b3efe739897b98b10f67c7cc0
|
Loading…
x
Reference in New Issue
Block a user