From 9a41e3bc29d395dfc1941b759012e7610b511e2f Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Wed, 9 Oct 2024 16:29:36 -0700 Subject: [PATCH] lxc-docker: force container recreate and move watchtower auto update into modifiable env. --- install/docker/docker-compose.yml | 4 +--- install/docker/install-scrypted-docker-compose.sh | 3 +++ install/proxmox/docker-compose.sh | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/install/docker/docker-compose.yml b/install/docker/docker-compose.yml index ad04333d5..fadc44a7b 100644 --- a/install/docker/docker-compose.yml +++ b/install/docker/docker-compose.yml @@ -81,6 +81,7 @@ services: # lxc - /var/run/docker.sock:/var/run/docker.sock # lxc - /root/.scrypted/docker-compose.yml:/root/.scrypted/docker-compose.yml # lxc - /root/.scrypted/docker-compose.sh:/root/.scrypted/docker-compose.sh + # lxc - /root/.scrypted/.env:/root/.scrypted/.env # lxc - /mnt:/mnt # Uncomment the following lines to use Avahi daemon from the host @@ -129,9 +130,6 @@ services: - WATCHTOWER_HTTP_API_TOKEN=${WATCHTOWER_HTTP_API_TOKEN} - WATCHTOWER_HTTP_API_UPDATE=true - WATCHTOWER_SCOPE=scrypted - # remove the following line to never allow docker to auto update. - # this is not recommended. - - WATCHTOWER_HTTP_API_PERIODIC_POLLS=true image: containrrr/watchtower container_name: scrypted-watchtower restart: unless-stopped diff --git a/install/docker/install-scrypted-docker-compose.sh b/install/docker/install-scrypted-docker-compose.sh index 33638e08e..e2f5f4677 100755 --- a/install/docker/install-scrypted-docker-compose.sh +++ b/install/docker/install-scrypted-docker-compose.sh @@ -64,6 +64,9 @@ fi WATCHTOWER_HTTP_API_TOKEN=$(echo $RANDOM | md5sum | head -c 32) echo "WATCHTOWER_HTTP_API_TOKEN=$WATCHTOWER_HTTP_API_TOKEN" > $SCRYPTED_HOME/.env +# remove the following line from .env to disable autoupdates. +# this is not recommended. +echo "WATCHTOWER_HTTP_API_PERIODIC_POLLS=true" >> $SCRYPTED_HOME/.env DOCKER_COMPOSE_YML=$SCRYPTED_HOME/docker-compose.yml curl -s https://raw.githubusercontent.com/koush/scrypted/main/install/docker/docker-compose.yml > $DOCKER_COMPOSE_YML diff --git a/install/proxmox/docker-compose.sh b/install/proxmox/docker-compose.sh index 84e6af25f..cfe3ae36d 100644 --- a/install/proxmox/docker-compose.sh +++ b/install/proxmox/docker-compose.sh @@ -17,4 +17,7 @@ else fi # do not daemonize, when it exits, systemd will restart it. -docker compose up +# force a recreate as .env may have changed. +# furthermore force recreate gets the container back into a known state +# which is preferable in case the user has made manual changes and then restarts. +docker compose up --force-recreate