Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--notification-email-delay is ignored #1135

Closed
kirbylink opened this issue Nov 14, 2021 · 2 comments · Fixed by #1142
Closed

--notification-email-delay is ignored #1135

kirbylink opened this issue Nov 14, 2021 · 2 comments · Fixed by #1142

Comments

@kirbylink
Copy link
Contributor

Describe the bug

It seems, that the variable --notification-email-delay (or the environment variable WATCHTOWER_NOTIFICATION_EMAIL_DELAY) is ignored and the email is send immediately after finishing the update process of all containers.
This is a problem, when the mail service itself is a docker service and updated by watchtower and not yet ready to receive the email from watchtower.
To Reproduce

  1. Create a docker-compose file like:
version: "3"
services:
  watchtower:
    container_name: watchtower
    restart: unless-stopped
    image: containrrr/watchtower
    network_mode: bridge
    environment:
      - WATCHTOWER_MONITOR_ONLY=false
      - WATCHTOWER_SCHEDULE=@midnight
      - WATCHTOWER_NOTIFICATIONS=email
      - WATCHTOWER_NOTIFICATION_EMAIL_FROM=${WATCHTOWER_NOTIFICATION_EMAIL_FROM}
      - WATCHTOWER_NOTIFICATION_EMAIL_TO=${WATCHTOWER_NOTIFICATION_EMAIL_TO}
      - WATCHTOWER_NOTIFICATION_EMAIL_SERVER=${WATCHTOWER_NOTIFICATION_EMAIL_SERVER}
      - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=${WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT}
      - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=${WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER}
      - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=${WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD}
      - WATCHTOWER_NOTIFICATION_EMAIL_SUBJECTTAG=${WATCHTOWER_NOTIFICATION_EMAIL_SUBJECTTAG}
      - WATCHTOWER_NOTIFICATION_EMAIL_DELAY=300
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /etc/localtime:/etc/localtime:ro

and fill the variables with correct data
2. Wait until watchtower starts at midnight and new container are available for updates
3. Email will be send immediately

Expected behavior

After updating the container(s) the email notification should not be sent before 00:05 a.m. (300s = 5 minutes)

Screenshots
image

Environment

  • Platform: Debian Bullseye (Linux 5.10.17-v8+)
  • Architecture: aarch64 (Raspberry Pi)
  • Docker version: Docker version 20.10.9, build c2ea9bc
Logs from running watchtower with the --debug option
time="2021-07-09T00:02:34+02:00" level=info msg="Stopping /transmission (46be36e8777b) with SIGTERM",
time="2021-07-09T00:02:40+02:00" level=debug msg="Removing container 46be36e8777b",
time="2021-07-09T00:02:40+02:00" level=info msg="Stopping /mailu_front (58e4eba0d0d0) with SIGTERM",
time="2021-07-09T00:02:41+02:00" level=debug msg="Removing container 58e4eba0d0d0",
time="2021-07-09T00:02:41+02:00" level=info msg="Stopping /mailu_antispam (b3c140ff1c32) with SIGTERM",
time="2021-07-09T00:02:43+02:00" level=debug msg="Removing container b3c140ff1c32",
time="2021-07-09T00:02:43+02:00" level=info msg="Stopping /mailu_imap (0f51d8382e21) with SIGTERM",
time="2021-07-09T00:02:45+02:00" level=debug msg="Removing container 0f51d8382e21",
time="2021-07-09T00:02:45+02:00" level=info msg="Stopping /mailu_certdump (a10c7d16f5ee) with SIGTERM",
time="2021-07-09T00:02:55+02:00" level=debug msg="Removing container a10c7d16f5ee",
time="2021-07-09T00:02:55+02:00" level=info msg="Stopping /mailu_admin (26f10f8be6b9) with SIGTERM",
time="2021-07-09T00:03:05+02:00" level=debug msg="Removing container 26f10f8be6b9",
time="2021-07-09T00:03:06+02:00" level=info msg="Stopping /mailu_smtp (c81b2aef50dc) with SIGTERM",
time="2021-07-09T00:03:16+02:00" level=debug msg="Removing container c81b2aef50dc",
time="2021-07-09T00:03:17+02:00" level=info msg="Stopping /mailu_webmail (f8fa8547a5cb) with SIGTERM",
time="2021-07-09T00:03:27+02:00" level=debug msg="Removing container f8fa8547a5cb",
time="2021-07-09T00:03:27+02:00" level=debug msg="This is the watchtower container /watchtower",
time="2021-07-09T00:03:27+02:00" level=info msg="Creating /mailu_webmail",
time="2021-07-09T00:03:27+02:00" level=debug msg="Starting container /mailu_webmail (e5eb7b049e89)",
time="2021-07-09T00:03:29+02:00" level=info msg="Creating /mailu_smtp",
time="2021-07-09T00:03:29+02:00" level=debug msg="Starting container /mailu_smtp (a5648d79fdd1)",
time="2021-07-09T00:03:31+02:00" level=info msg="Creating /mailu_admin",
time="2021-07-09T00:03:31+02:00" level=debug msg="Starting container /mailu_admin (38dba7459fa3)",
time="2021-07-09T00:03:32+02:00" level=info msg="Creating /mailu_certdump",
time="2021-07-09T00:03:33+02:00" level=debug msg="Starting container /mailu_certdump (1f4f5879181f)",
time="2021-07-09T00:03:34+02:00" level=info msg="Creating /mailu_imap",
time="2021-07-09T00:03:35+02:00" level=debug msg="Starting container /mailu_imap (ce089a49b1a3)",
time="2021-07-09T00:03:37+02:00" level=info msg="Creating /mailu_antispam",
time="2021-07-09T00:03:37+02:00" level=debug msg="Starting container /mailu_antispam (17e890c90a3d)",
time="2021-07-09T00:03:39+02:00" level=info msg="Creating /mailu_front",
time="2021-07-09T00:03:39+02:00" level=debug msg="Starting container /mailu_front (fee1acb8f96b)",
time="2021-07-09T00:03:41+02:00" level=info msg="Creating /transmission",
time="2021-07-09T00:03:42+02:00" level=debug msg="Starting container /transmission (5bdca098870e)",
time="2021-07-09T00:03:45+02:00" level=debug msg="Session done: 44 scanned, 8 updated, 0 failed",
time="2021-07-09T00:03:45+02:00" level=debug msg="Scheduled next run: 2021-07-10 00:00:00 +0200 CEST",
Failed to send notification via shoutrrr (url=smtp://<smtp-server>:465/?auth=Plain&fromaddress=<fromaddress>&fromname=Watchtower&subject=%5BWatchtower%5D+Watchtower+updates+on+6a3a2a6b90e9&toaddresses=<toaddresses>):  failed to send using smtp: timed out,
Failed to send notification via shoutrrr (url=smtp://<smtp-server>:465/?auth=Plain&fromaddress=<fromaddress>&fromname=Watchtower&subject=%5BWatchtower%5D+Watchtower+updates+on+6a3a2a6b90e9&toaddresses=<toaddresses>):  failed to send using smtp: timed out,
Failed to send notification via shoutrrr (url=smtp://<smtp-server>:465/?auth=Plain&fromaddress=<fromaddress>&fromname=Watchtower&subject=%5BWatchtower%5D+Watchtower+updates+on+6a3a2a6b90e9&toaddresses=<toaddresses>):  failed to send using smtp: timed out

Additional context

The logs are a little bit old, but the bug exists from beginning and i logged the debug output in July.
Container beginning with "mailu" are updated and mailu is the mail service that should receive the message from watchtower.
After finishing watchtower tries to send the mail (i removed the real address from the log), but since the containers are not ready yet the notification is failing.

@github-actions
Copy link

Hi there! 👋🏼 As you're new to this repo, we'd like to suggest that you read our code of conduct as well as our contribution guidelines. Thanks a bunch for opening your first issue! 🙏

@piksel
Copy link
Member

piksel commented Nov 16, 2021

Yeah, I didn't even know there were such an option. This has probably not been ported to the new notification system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants