From 5a95010f35a76b17d73bf8d53e30f293b0cf2f3e Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Sun, 1 Mar 2026 01:07:47 +0800 Subject: [PATCH] fix: route watchtower SMTP through SSH tunnel to bypass GFW - Switch to shoutrrr notification URL format - Use extra_hosts to resolve smtp.gmail.com to local tunnel (192.168.31.222:1587) - Add URL-encoded SMTP credentials for shoutrrr URL compatibility - SSH tunnel: NAS:1587 -> server2 -> smtp.gmail.com:587 --- watchtower/.env.example | 8 +++++--- watchtower/docker-compose.yml | 11 ++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/watchtower/.env.example b/watchtower/.env.example index e893737..4d7f6ae 100644 --- a/watchtower/.env.example +++ b/watchtower/.env.example @@ -1,4 +1,6 @@ -SMTP_FROM=zjgump@gmail.com -SMTP_TO=zjgump@gmail.com -SMTP_USER=zjgump@gmail.com +SMTP_FROM=your-email@gmail.com +SMTP_TO=your-email@gmail.com +SMTP_USER=your-email@gmail.com SMTP_PASSWORD=your-gmail-app-password +SMTP_USER_ENCODED=your-email%40gmail.com +SMTP_PASSWORD_ENCODED=your-gmail-app-password diff --git a/watchtower/docker-compose.yml b/watchtower/docker-compose.yml index 9cb2a56..dd49094 100644 --- a/watchtower/docker-compose.yml +++ b/watchtower/docker-compose.yml @@ -7,13 +7,10 @@ services: WATCHTOWER_LABEL_ENABLE: "true" WATCHTOWER_SCHEDULE: "0 0 4 * * *" WATCHTOWER_CLEANUP: "true" - WATCHTOWER_NOTIFICATIONS: email - WATCHTOWER_NOTIFICATION_EMAIL_FROM: ${SMTP_FROM} - WATCHTOWER_NOTIFICATION_EMAIL_TO: ${SMTP_TO} - WATCHTOWER_NOTIFICATION_EMAIL_SERVER: smtp.gmail.com - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT: "587" - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER: ${SMTP_USER} - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD: ${SMTP_PASSWORD} + WATCHTOWER_NOTIFICATIONS: shoutrrr + WATCHTOWER_NOTIFICATION_URL: "smtp://${SMTP_USER_ENCODED}:${SMTP_PASSWORD_ENCODED}@smtp.gmail.com:1587/?from=${SMTP_FROM}&to=${SMTP_TO}" + extra_hosts: + - "smtp.gmail.com:192.168.31.222" volumes: - /var/run/docker.sock:/var/run/docker.sock logging: