diff --git a/watchtower/script-watchtower.sh b/watchtower/script-watchtower.sh new file mode 100644 index 0000000..55202a6 --- /dev/null +++ b/watchtower/script-watchtower.sh @@ -0,0 +1,14 @@ +#test updates in watchtower with ntfy notification +docker stop nginx +# list previous nginx images then pipe them into removal +docker image ls --filter='reference=nginx:*' -q | xargs docker rmi -f +# remove dangling layers, avoid "already exists messages" +docker image prune +# pull old version +docker pull nginx:1.26 +# tag that mofo +docker image tag nginx:1.26 nginx:1 +# important: run the container +docker run --rm --detach --name nginx nginx:1 +# watchtower run once and notify +docker run --rm --net proxy --name watchtower2 -v /var/run/docker.sock:/var/run/docker.sock -e WATCHTOWER_CLEANUP=false -e TZ=America/New_York -e WATCHTOWER_NOTIFICATION_SKIP_TITLE=True -e WATCHTOWER_NOTIFICATION_URL="ntfy://:token_goes_here@ntfy.meftimes.com/alerts?title=Watchtower&priority=high" containrrr/watchtower --debug --run-once nginx diff --git a/watchtower/watchtower.yml b/watchtower/watchtower.yml new file mode 100644 index 0000000..ac337c5 --- /dev/null +++ b/watchtower/watchtower.yml @@ -0,0 +1,23 @@ +services: + watchtower: + image: containrrr/watchtower + container_name: watchtower + volumes: + - /var/run/docker.sock:/var/run/docker.sock + command: --debug + environment: + WATCHTOWER_SCHEDULE: "0 0 9 * * 0" + WATCHTOWER_CLEANUP: false + WATCHTOWER_DISABLE_CONTAINERS: "gitea postgres" + TZ: "America/New_York" + WATCHTOWER_NO_STARTUP_MESSAGE: true + WATCHTOWER_TIMEOUT: 30s + WATCHTOWER_NOTIFICATION_SKIP_TITLE: true + WATCHTOWER_NOTIFICATION_URL: "ntfy://:token_goes_here@ntfy.meftimes.com/alerts?title=Watchtower&priority=high" + networks: + - proxy + restart: unless-stopped + +networks: + proxy: + external: true