balena-supervisor/tools/dind/config/services/resin-supervisor-dind.service
Pablo Carranza Velez 392d963348 Use a local supervisor image for the dind supervisor
We change the Makefile and dinctl so that instead of having to deploy and then pull a supervisor image, we save it from the local
docker images and load it inside the dind container.

We also fix dind so that it uses the dind hack script from the docker repo as official dind images do (this avoids breaking the
permissions of /dev/pts/ptmx in the host as in https://github.com/kubernetes/kubernetes/issues/18230).

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
2017-07-20 21:22:25 -03:00

46 lines
1.7 KiB
Desktop File

[Unit]
Description=resin-supervisor-dind
Requires=confd.service docker.service openvpn-resin.service
After=confd.service
Before=openvpn-resin.service
[Service]
WorkingDirectory=/usr/src/app
EnvironmentFile=/usr/src/app/config/env
EnvironmentFile=/usr/src/app/config/localenv
ExecStartPre=/bin/bash -c 'if [ "${PRELOADED_IMAGE}" == "true" ]; then /usr/bin/docker pull $(jq ".[0].imageId" ${APPS_PATH}); fi'
ExecStartPre=/usr/bin/docker load --input /usr/src/supervisor-image.tar
ExecStartPre=-/usr/bin/docker kill resin_supervisor
ExecStartPre=-/usr/bin/docker rm resin_supervisor
ExecStartPre=-/bin/touch /etc/resolv.conf
ExecStart=/bin/bash -c 'source /usr/src/app/resin-vars && \
/usr/bin/docker run --rm --privileged --name resin_supervisor \
--net=host \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "${CONFIG_PATH}:/boot/config.json" \
-v "${APPS_PATH}:/boot/apps.json" \
-v /resin-data/resin-supervisor:/data \
-v /proc/net/fib_trie:/mnt/fib_trie \
-v /var/log/supervisor-log:/var/log \
-v /:/mnt/root \
-v /etc/resolv.conf:/etc/resolv.conf:rw \
${SUPERVISOR_EXTRA_MOUNTS} \
-e "API_ENDPOINT=$API_ENDPOINT" \
-e "DELTA_ENDPOINT=$DELTA_ENDPOINT" \
-e "REGISTRY_ENDPOINT=$REGISTRY_ENDPOINT" \
-e "PUBNUB_SUBSCRIBE_KEY=$PUBNUB_SUBSCRIBE_KEY" \
-e "PUBNUB_PUBLISH_KEY=$PUBNUB_PUBLISH_KEY" \
-e "MIXPANEL_TOKEN=$MIXPANEL_TOKEN" \
-e "LED_FILE=${LED_FILE}" \
-e "LISTEN_PORT=$LISTEN_PORT" \
-e "SUPERVISOR_IMAGE=${SUPERVISOR_IMAGE}" \
-e "RESIN_SUPERVISOR_SECRET=${RESIN_SUPERVISOR_SECRET}" \
-e "DOCKER_ROOT=/mnt/root/var/lib/docker" \
-e "DOCKER_SOCKET=/var/run/docker.sock" \
${SUPERVISOR_IMAGE}'
TimeoutStartSec=0
Restart=always
[Install]
WantedBy=basic.target