diff --git a/CHANGELOG.md b/CHANGELOG.md index 5167d7e8..65780bf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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! 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 * Update docker-progress #502 [Akis Kesoglou] diff --git a/Makefile b/Makefile index 738b79fe..7cda3ac1 100644 --- a/Makefile +++ b/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 # * 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 +# * 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)) @@ -76,9 +78,11 @@ IMAGE ?= resin/$(ARCH)-supervisor:master # Default values for run-supervisor SUPERVISOR_IMAGE ?= resin/$(ARCH)-supervisor:master PASSWORDLESS_DROPBEAR ?= false +CONTAINER_NAME ?= resin_supervisor_1 +CONFIG_FILENAME ?= config.json # 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) SUPERVISOR_DIND_MOUNTS := ${SUPERVISOR_DIND_MOUNTS} -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /bin/kmod:/bin/kmod endif @@ -150,14 +154,14 @@ run-supervisor: stop-supervisor supervisor-dind if [ -n "$(rt_no_proxy)" ]; then \ echo "no_proxy=$(rt_no_proxy)" >> config/localenv; \ 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 docker and remove volumes to prevent us from running out of loopback devices, # as per https://github.com/jpetazzo/dind/issues/19 - -docker exec resin_supervisor_1 bash -c "systemctl stop docker" || true - -docker stop resin_supervisor_1 > /dev/null || true - -docker rm -f --volumes resin_supervisor_1 > /dev/null || true + -docker exec $(CONTAINER_NAME) bash -c "systemctl stop docker" || true + -docker stop $(CONTAINER_NAME) > /dev/null || true + -docker rm -f --volumes $(CONTAINER_NAME) > /dev/null || true supervisor-image: ifneq ($(DOCKER_GE_17_05),true) diff --git a/dindctl b/dindctl index 50fb1136..1761cc82 100755 --- a/dindctl +++ b/dindctl @@ -21,10 +21,12 @@ # --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 ) # --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-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 +# --config | -c [file] path to config.json, relative to tools/dind ( default: config.json ) # # See README.md for examples. # @@ -45,8 +47,10 @@ PASSWORDLESS_DROPBEAR="false" SUPERVISOR_EXTRA_MOUNTS="" DIST_MOUNTED="false" DIND_IMAGE="resin-supervisor-dind" +CONTAINER_NAME="resin_supervisor_1" PRELOADED_IMAGE="" OPTIMIZE="true" +CONFIG_FILENAME="config.json" function showHelp { 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" 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="$2" 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) ARCH="$2" shift || { echo "--arch provided not specified" && exit 1; } @@ -113,7 +125,7 @@ function buildSupervisorSrc { function refreshSupervisorSrc { buildSupervisorSrc 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 { @@ -136,16 +148,18 @@ function runDind { SUPERVISOR_EXTRA_MOUNTS="$SUPERVISOR_EXTRA_MOUNTS" \ PRELOADED_IMAGE="$PRELOADED_IMAGE" \ IMAGE="$DIND_IMAGE" \ + CONTAINER_NAME="$CONTAINER_NAME" \ + CONFIG_FILENAME="$CONFIG_FILENAME" \ run-supervisor } function stopDind { echo "Stopping dind supervisor" - make -C "$SUPERVISOR_BASE_DIR" stop-supervisor + make -C "$SUPERVISOR_BASE_DIR" CONTAINER_NAME="$CONTAINER_NAME" stop-supervisor } function logs { - docker exec -ti resin_supervisor_1 journalctl $@ + docker exec -ti $CONTAINER_NAME journalctl $@ } action="$1" diff --git a/package.json b/package.json index 2d3d2f23..9e418744 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "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.", - "version": "6.3.1", + "version": "6.3.2", "license": "Apache-2.0", "repository": { "type": "git",