mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-28 04:12:41 +00:00
Auto-merge for PR #503 via VersionBot
Allow specifying a container name for the docker-in-docker development supervisor
This commit is contained in:
commit
ee2bfbe347
@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file
|
|||||||
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## v6.3.2 - 2017-10-11
|
||||||
|
|
||||||
|
* Allow specifying a config.json filename in dindctl #503 [Pablo Carranza Velez]
|
||||||
|
* Allow specifying a container name for the docker-in-docker development supervisor #503 [Pablo Carranza Velez]
|
||||||
|
|
||||||
## v6.3.1 - 2017-10-04
|
## v6.3.1 - 2017-10-04
|
||||||
|
|
||||||
* Update docker-progress #502 [Akis Kesoglou]
|
* Update docker-progress #502 [Akis Kesoglou]
|
||||||
|
14
Makefile
14
Makefile
@ -29,6 +29,8 @@
|
|||||||
# * 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
|
# * 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
|
||||||
# * SUPERVISOR_EXTRA_MOUNTS: Additional bind mount flags for the docker-in-docker supervisor
|
# * SUPERVISOR_EXTRA_MOUNTS: Additional bind mount flags for the docker-in-docker supervisor
|
||||||
# * PASSWORDLESS_DROPBEAR: For run-supervisor - start a passwordless ssh daemon in the docker-in-docker supervisor
|
# * PASSWORDLESS_DROPBEAR: For run-supervisor - start a passwordless ssh daemon in the docker-in-docker supervisor
|
||||||
|
# * CONTAINER_NAME: For run-supervisor, specify the container name for the docker-in-docker container (default: resin_supervisor_1)
|
||||||
|
# * CONFIG_FILENAME: For run-supervisor, specify the filename to mount as config.json, relative to tools/dind/ (default: config.json)
|
||||||
#
|
#
|
||||||
|
|
||||||
THIS_FILE := $(lastword $(MAKEFILE_LIST))
|
THIS_FILE := $(lastword $(MAKEFILE_LIST))
|
||||||
@ -76,9 +78,11 @@ IMAGE ?= resin/$(ARCH)-supervisor:master
|
|||||||
# Default values for run-supervisor
|
# Default values for run-supervisor
|
||||||
SUPERVISOR_IMAGE ?= resin/$(ARCH)-supervisor:master
|
SUPERVISOR_IMAGE ?= resin/$(ARCH)-supervisor:master
|
||||||
PASSWORDLESS_DROPBEAR ?= false
|
PASSWORDLESS_DROPBEAR ?= false
|
||||||
|
CONTAINER_NAME ?= resin_supervisor_1
|
||||||
|
CONFIG_FILENAME ?= config.json
|
||||||
|
|
||||||
# Bind mounts and variables for the run-supervisor target
|
# Bind mounts and variables for the run-supervisor target
|
||||||
SUPERVISOR_DIND_MOUNTS := -v $$(pwd)/../../:/resin-supervisor -v $$(pwd)/config.json:/mnt/conf/config.json -v $$(pwd)/config/env:/usr/src/app/config/env -v $$(pwd)/config/localenv:/usr/src/app/config/localenv
|
SUPERVISOR_DIND_MOUNTS := -v $$(pwd)/../../:/resin-supervisor -v $$(pwd)/$(CONFIG_FILENAME):/mnt/conf/config.json -v $$(pwd)/config/env:/usr/src/app/config/env -v $$(pwd)/config/localenv:/usr/src/app/config/localenv
|
||||||
ifeq ($(OS), Linux)
|
ifeq ($(OS), Linux)
|
||||||
SUPERVISOR_DIND_MOUNTS := ${SUPERVISOR_DIND_MOUNTS} -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /bin/kmod:/bin/kmod
|
SUPERVISOR_DIND_MOUNTS := ${SUPERVISOR_DIND_MOUNTS} -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /bin/kmod:/bin/kmod
|
||||||
endif
|
endif
|
||||||
@ -150,14 +154,14 @@ run-supervisor: stop-supervisor supervisor-dind
|
|||||||
if [ -n "$(rt_no_proxy)" ]; then \
|
if [ -n "$(rt_no_proxy)" ]; then \
|
||||||
echo "no_proxy=$(rt_no_proxy)" >> config/localenv; \
|
echo "no_proxy=$(rt_no_proxy)" >> config/localenv; \
|
||||||
fi \
|
fi \
|
||||||
&& docker run -d --name resin_supervisor_1 --privileged ${SUPERVISOR_DIND_MOUNTS} $(IMAGE)
|
&& docker run -d --name $(CONTAINER_NAME) --privileged ${SUPERVISOR_DIND_MOUNTS} $(IMAGE)
|
||||||
|
|
||||||
stop-supervisor:
|
stop-supervisor:
|
||||||
# Stop docker and remove volumes to prevent us from running out of loopback devices,
|
# Stop docker and remove volumes to prevent us from running out of loopback devices,
|
||||||
# as per https://github.com/jpetazzo/dind/issues/19
|
# as per https://github.com/jpetazzo/dind/issues/19
|
||||||
-docker exec resin_supervisor_1 bash -c "systemctl stop docker" || true
|
-docker exec $(CONTAINER_NAME) bash -c "systemctl stop docker" || true
|
||||||
-docker stop resin_supervisor_1 > /dev/null || true
|
-docker stop $(CONTAINER_NAME) > /dev/null || true
|
||||||
-docker rm -f --volumes resin_supervisor_1 > /dev/null || true
|
-docker rm -f --volumes $(CONTAINER_NAME) > /dev/null || true
|
||||||
|
|
||||||
supervisor-image:
|
supervisor-image:
|
||||||
ifneq ($(DOCKER_GE_17_05),true)
|
ifneq ($(DOCKER_GE_17_05),true)
|
||||||
|
20
dindctl
20
dindctl
@ -21,10 +21,12 @@
|
|||||||
# --arch | -a [arch] architecture of the supervisor to build (default: amd64 )
|
# --arch | -a [arch] architecture of the supervisor to build (default: amd64 )
|
||||||
# --image | -i [image] image name for supervisor image to build/use ( default: resin/$ARCH-supervisor:master )
|
# --image | -i [image] image name for supervisor image to build/use ( default: resin/$ARCH-supervisor:master )
|
||||||
# --dind-image [image] image name for the dind host container
|
# --dind-image [image] image name for the dind host container
|
||||||
|
# --dind-container [name] container name for the dind host container ( default: resin_supervisor_1 )
|
||||||
# --mount-dist bind-mount './dist/' (where webpack stores the built js) from local development environment into supervisor container.
|
# --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-nm bind-mount './node_modules/' from local development environment into supervisor container.
|
||||||
# --preload | -p use tools/dev/apps.json to preload an application image into the dind host.
|
# --preload | -p use tools/dev/apps.json to preload an application image into the dind host.
|
||||||
# --ssh enable a passwordless dropbear ssh server on the dind host
|
# --ssh enable a passwordless dropbear ssh server on the dind host
|
||||||
|
# --config | -c [file] path to config.json, relative to tools/dind ( default: config.json )
|
||||||
#
|
#
|
||||||
# See README.md for examples.
|
# See README.md for examples.
|
||||||
#
|
#
|
||||||
@ -45,8 +47,10 @@ PASSWORDLESS_DROPBEAR="false"
|
|||||||
SUPERVISOR_EXTRA_MOUNTS=""
|
SUPERVISOR_EXTRA_MOUNTS=""
|
||||||
DIST_MOUNTED="false"
|
DIST_MOUNTED="false"
|
||||||
DIND_IMAGE="resin-supervisor-dind"
|
DIND_IMAGE="resin-supervisor-dind"
|
||||||
|
CONTAINER_NAME="resin_supervisor_1"
|
||||||
PRELOADED_IMAGE=""
|
PRELOADED_IMAGE=""
|
||||||
OPTIMIZE="true"
|
OPTIMIZE="true"
|
||||||
|
CONFIG_FILENAME="config.json"
|
||||||
|
|
||||||
function showHelp {
|
function showHelp {
|
||||||
cat $THIS_FILE | awk '{if(/^#/)print;else exit}' | tail -n +2 | sed 's/\#//' | sed 's|dindctl|'$THIS_FILE'|'
|
cat $THIS_FILE | awk '{if(/^#/)print;else exit}' | tail -n +2 | sed 's/\#//' | sed 's|dindctl|'$THIS_FILE'|'
|
||||||
@ -73,10 +77,18 @@ function parseOptions {
|
|||||||
SUPERVISOR_IMAGE="$2"
|
SUPERVISOR_IMAGE="$2"
|
||||||
shift || { echo "--image provided not specified" && exit 1; }
|
shift || { echo "--image provided not specified" && exit 1; }
|
||||||
;;
|
;;
|
||||||
|
-c|--config)
|
||||||
|
CONFIG_FILENAME="$2"
|
||||||
|
shift || { echo "--config provided not specified" && exit 1; }
|
||||||
|
;;
|
||||||
--dind-image)
|
--dind-image)
|
||||||
DIND_IMAGE="$2"
|
DIND_IMAGE="$2"
|
||||||
shift || { echo "--dind-image provided not specified" && exit 1; }
|
shift || { echo "--dind-image provided not specified" && exit 1; }
|
||||||
;;
|
;;
|
||||||
|
--dind-container)
|
||||||
|
CONTAINER_NAME="$2"
|
||||||
|
shift || { echo "--dind-container provided not specified" && exit 1; }
|
||||||
|
;;
|
||||||
-a|--arch)
|
-a|--arch)
|
||||||
ARCH="$2"
|
ARCH="$2"
|
||||||
shift || { echo "--arch provided not specified" && exit 1; }
|
shift || { echo "--arch provided not specified" && exit 1; }
|
||||||
@ -113,7 +125,7 @@ function buildSupervisorSrc {
|
|||||||
function refreshSupervisorSrc {
|
function refreshSupervisorSrc {
|
||||||
buildSupervisorSrc
|
buildSupervisorSrc
|
||||||
echo "Restarting the supervisor container"
|
echo "Restarting the supervisor container"
|
||||||
docker exec -ti resin_supervisor_1 docker restart resin_supervisor
|
docker exec -ti $CONTAINER_NAME docker restart resin_supervisor
|
||||||
}
|
}
|
||||||
|
|
||||||
function runDind {
|
function runDind {
|
||||||
@ -136,16 +148,18 @@ function runDind {
|
|||||||
SUPERVISOR_EXTRA_MOUNTS="$SUPERVISOR_EXTRA_MOUNTS" \
|
SUPERVISOR_EXTRA_MOUNTS="$SUPERVISOR_EXTRA_MOUNTS" \
|
||||||
PRELOADED_IMAGE="$PRELOADED_IMAGE" \
|
PRELOADED_IMAGE="$PRELOADED_IMAGE" \
|
||||||
IMAGE="$DIND_IMAGE" \
|
IMAGE="$DIND_IMAGE" \
|
||||||
|
CONTAINER_NAME="$CONTAINER_NAME" \
|
||||||
|
CONFIG_FILENAME="$CONFIG_FILENAME" \
|
||||||
run-supervisor
|
run-supervisor
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopDind {
|
function stopDind {
|
||||||
echo "Stopping dind supervisor"
|
echo "Stopping dind supervisor"
|
||||||
make -C "$SUPERVISOR_BASE_DIR" stop-supervisor
|
make -C "$SUPERVISOR_BASE_DIR" CONTAINER_NAME="$CONTAINER_NAME" stop-supervisor
|
||||||
}
|
}
|
||||||
|
|
||||||
function logs {
|
function logs {
|
||||||
docker exec -ti resin_supervisor_1 journalctl $@
|
docker exec -ti $CONTAINER_NAME journalctl $@
|
||||||
}
|
}
|
||||||
|
|
||||||
action="$1"
|
action="$1"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "resin-supervisor",
|
"name": "resin-supervisor",
|
||||||
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
|
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
|
||||||
"version": "6.3.1",
|
"version": "6.3.2",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user