Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@vincentDcmps
Copy link
Contributor

@vincentDcmps vincentDcmps commented Nov 26, 2023

Description

since release 13.0.0 commit my mailbox is flood by update mail. I think when script is exit supervisord launch it again

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (non-breaking change that does improve existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md or the documentation under docs/)
  • If necessary I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have added information about changes made in this PR to CHANGELOG.md

since release 13.0.0 commit I'am food by update mail. 
I think when swript is exit supervisord launch it again
@georglauterbach
Copy link
Member

georglauterbach commented Nov 26, 2023

Hmmm.. Looking at the Supervisor configuration

[program:update-check]
startsecs=0
stopwaitsecs=55
autostart=false
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
command=/bin/bash -l -c /usr/local/bin/update-check.sh

I do not think the check will run again.. The documentation for Supervisor says the default is autorestart: unexpected. The exit 0 should indicate a normal exit. @casperklein can you verify?

@vincentDcmps could you please elaborate a bit on the behavior that you are seeing exactly?:)

@georglauterbach georglauterbach added meta/needs triage This issue / PR needs checks and verification from maintainers area/scripts kind/bug/fix A fix (PR) for a confirmed bug labels Nov 26, 2023
@georglauterbach georglauterbach added this to the v13.1.0 milestone Nov 26, 2023
@georglauterbach georglauterbach changed the title remove exit 0 from update check bug fix: remove exit 0 from update-check.sh Nov 26, 2023
@georglauterbach
Copy link
Member

Something else is odd though: @casperklein @polarathene please have a look: https://github.com/docker-mailserver/docker-mailserver/pkgs/container/docker-mailserver Why was :edge not updated yet? :latest is equal to :13.0.0 but :edge is not..

@vincentDcmps
Copy link
Contributor Author

vincentDcmps commented Nov 26, 2023

edge is not update because cron is executed only on fifth day of week

.github/workflows/scheduled_builds.yml

name: 'Deploy :edge on Schedule'

on:
  workflow_dispatch:
  schedule:
    - cron: 0 0 * * 5

I'am agree with you if I read supervisord docs my issue doesn't have to happen
the issue was that I have received 5 mail by minute to inform me that update is availlable, until I switch to latest tag with 13.0 version pushed.

@georglauterbach
Copy link
Member

georglauterbach commented Nov 26, 2023

I think the actual issue is here:

- name: 'Prepare tags'
id: prep
uses: docker/[email protected]
with:
images: |
${{ secrets.DOCKER_REPOSITORY }}
${{ secrets.GHCR_REPOSITORY }}
tags: |
type=edge,branch=master
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}

My suggestions:

-             type=edge,branch=master
+             type=edge

I guess the issue is that in the past, I have immediately merged other PRs that were queued via meta/feature-freeze after the release of a new tag, which hid the effect we are now seeing. In my opinion, we should always push :edge, right? There is no scenario in which master is updated but :edge should not.

But to me, the question remains: why didn't the default push (by merging the PR) trigger the action to build :edge?

UPDATE: Ah, now I get it:

on:
workflow_dispatch:
push:
branches:
- master
paths:
- target/**
- .dockerignore
- .gitmodules
- Dockerfile
- setup.sh

The push on master does not change a file listed in paths:. I can provide a PR :)

@georglauterbach
Copy link
Member

Superseeded by #3662

@vincentDcmps Thank you for making us aware of this:) I have manually started a run on master, so :edge will be updated within the next half an hour and this problem should vanish.

@polarathene
Copy link
Member

polarathene commented Nov 27, 2023

@georglauterbach

Below is for reference, no need to read and respond 👍


Why was :edge not updated yet? :latest is equal to :13.0.0 but :edge is not..

Shouldn't matter, they would always differ in digest if this is respected:

ARG VCS_VERSION=edge

LABEL org.opencontainers.image.version=${VCS_VERSION}

But we've been bundling the VERSION:

- name: 'Acquire the image version'
id: get-version
shell: bash
run: echo "version=$(<VERSION)" >>"${GITHUB_OUTPUT}"
- name: 'Build and publish images'
uses: docker/[email protected]
with:
context: .
build-args: |
VCS_REVISION=${{ github.sha }}
VCS_VERSION=${{ steps.get-version.outputs.version }}

They only differ after your recent change to trigger builds for :edge with VERSION since the VCS_REVISION now differs.

Regarding :edge checking for updates, I'll open a PR that doesn't run the service in :edge 👍


My suggestions:

-             type=edge,branch=master
+             type=edge

For reference, no that would be bad.

The logic here is that either the workflow was triggered by:

  • A git tag for a release (create multiple image tags based on semver)
  • No tag, just a push event to master branch (tags aren't associated to branches, but commits). This qualifies for :edge.

Your suggestion would publish :edge regardless of event.

  • If the workflow was ever triggered to run on a different branch for example (sometimes created for PRs by maintainers, or CI scripts like CONTRIBUTORS.md updates), that'd accidentally attempt publishing a release.
  • It shouldn't happen however, since we call this workflow in a controlled manner via workflow_call with explicit reference to the latest iteration of the workflow on master branch. But pushes to the master branch isn't the only trigger event, we have workflow_dispatch (manually invoked) and scheduled workflow. Best to keep safeguards in place 😅

Multiple semver tags are useful for services like watchtower to leverage, when DMS updates an existing tag these services notify, but otherwise unaware of newer tags as they don't actually understand semver (some update services do).


But to me, the question remains: why didn't the default push (by merging the PR) trigger the action to build :edge?

UPDATE: Ah, now I get it:

To be fair, it's not a change relevant to :edge to warrant building the image again and publishing it.

  • It's a bug with the current behaviour for :edge, it should not check VERSION for update notifications.
  • :edge users should use watchtower or configure compose (or similar) to always pull the latest :edge tag if they want to always run the current :edge.

@polarathene
Copy link
Member

@vincentDcmps

Below is probably not important to you anymore, but if you're interested in better identifying / understanding the actual cause of the problem, give it a read.


the issue was that I have received 5 mail by minute to inform me that update is availlable

May be something related to your configuration, you've not provided much context. :edge shouldn't behave any differently than a published release presently.

They all just check their internal copy of VERSION and do a request to compare it to the one on Github, which if found to be newer will send you one mail about the update once per UPDATE_CHECK_INTERVAL:

_log_with_date 'info' "Update available [ ${VERSION} --> ${LATEST} ]"
# only notify once
echo "${MAIL}" | mail -s "Mailserver update available! [ ${VERSION} --> ${LATEST} ]" "${POSTMASTER_ADDRESS}" && exit 0
else
_log_with_date 'info' 'No update available'

For example I had a very simple container running, and it received the following log when the update was checked:

$ docker run --rm -it --hostname mail.example.test --name dms mailserver/docker-mailserver

# Update check log:
$ docker exec dms cat /var/log/supervisor/update-check.log
[   INF   ]  2023-11-25 04:51:31  No update available
[   INF   ]  2023-11-26 13:51:04  Update available [ 12.1.0 --> 13.0.0 ]

# Default internal alias for local user accounts that belong to DMS hostname (`@mail.example.test`)
# Mail sent to root locally will be redirected to `[email protected]`
$ docker exec dms cat /etc/aliases
root: [email protected]
Full log for update-check script at 1.51PM Nov 26th ``` Nov 26 13:51:04 mail postfix/pickup[123308]: F16DF483E: uid=0 from= Nov 26 13:51:04 mail postfix/cleanup[130419]: F16DF483E: message-id=<[email protected]> Nov 26 13:51:04 mail opendkim[439]: F16DF483E: localhost [127.0.0.1] not internal Nov 26 13:51:04 mail opendkim[439]: F16DF483E: not authenticated Nov 26 13:51:04 mail opendkim[439]: F16DF483E: no signature data Nov 26 13:51:04 mail postfix/qmgr[570]: F16DF483E: from=, size=731, nrcpt=1 (queue active) Nov 26 13:51:05 mail dovecot: master: Warning: Time moved forwards by 843.682211 seconds - adjusting timeouts. Nov 26 13:51:05 mail dovecot: lmtp(130422): Connect from local Nov 26 13:51:05 mail dovecot: auth: passwd-file([email protected]): unknown user Nov 26 13:51:05 mail postfix/lmtp[130421]: F16DF483E: to=, relay=mail.example.test[/var/run/dovecot/lmtp], delay=0.06, delays=0.02/0.01/0.02/0.01, dsn=5.1.1, status=bounced (host mail.example.test[/var/run/dovecot/lmtp] said: 550 5.1.1 User doesn't exist: [email protected] (in reply to RCPT TO command)) Nov 26 13:51:05 mail dovecot: lmtp(130422): Disconnect from local: Logged out (state=READY) Nov 26 13:51:05 mail postfix/cleanup[130419]: 0B214484C: message-id=<[email protected]> Nov 26 13:51:05 mail postfix/bounce[130424]: F16DF483E: sender non-delivery notification: 0B214484C Nov 26 13:51:05 mail postfix/qmgr[570]: 0B214484C: from=<>, size=2864, nrcpt=1 (queue active) Nov 26 13:51:05 mail postfix/qmgr[570]: F16DF483E: removed Nov 26 13:51:05 mail postfix/cleanup[130419]: 0C62B483E: message-id=<[email protected]> Nov 26 13:51:05 mail postfix/local[130425]: 0B214484C: to=, relay=local, delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (forwarded as 0C62B483E) Nov 26 13:51:05 mail postfix/qmgr[570]: 0C62B483E: from=<>, size=2998, nrcpt=1 (queue active) Nov 26 13:51:05 mail postfix/qmgr[570]: 0B214484C: removed Nov 26 13:51:05 mail dovecot: lmtp(130422): Connect from local Nov 26 13:51:05 mail dovecot: auth: passwd-file([email protected]): unknown user Nov 26 13:51:05 mail postfix/lmtp[130421]: 0C62B483E: to=, orig_to=, relay=mail.example.test[/var/run/dovecot/lmtp], delay=0, delays=0/0/0/0, dsn=5.1.1, status=bounced (host mail.example.test[/var/run/dovecot/lmtp] said: 550 5.1.1 User doesn't exist: [email protected] (in reply to RCPT TO command)) Nov 26 13:51:05 mail dovecot: lmtp(130422): Disconnect from local: Logged out (state=READY) Nov 26 13:51:05 mail postfix/qmgr[570]: 0C62B483E: removed ```

In the above logs, the notification mail (ID F16DF483E) is sent from [email protected] (DMS hostname) to the same address which by default DMS aliases to the assumed default postmaster account ([email protected]).

However that is not a valid user to deliver mail to in this case so it bounces. In this case, the bounce is sent back to the sender ( [email protected]), but since that loops back to [email protected] again it bounces and Postfix knows to stop at double bounce, thus it doesn't bother trying to deliver the original notification to the intended recipient again, nor the bounce to the original sender.


If your UPDATE_CHECK_INTERVAL ENV is the default value of 1d, you could provide more context, such as what the update-check.log shows (if it was actually running more frequently than expected, thus a fault of the script or supervisord), or if it was on the Postfix side (sounds more likely) with mail delivery.

It might just be that the update notification was sent to [email protected] like above demonstrates, but that bounced, yet actually delivered the bounce to a [email protected] account, so attempted to send the mail back to [email protected] and repeated this failure?

TL;DR

  • Check your UPDATE_CHECK_INTERVAL ENV is the default value of 1d
  • Confirm if the script or supervisord are actually at fault: docker exec dms cat /var/log/supervisor/update-check.log
  • Check docker exec dms cat /etc/aliases or related alias/ENV for the configured Postmaster account, that it actually exists. It's possible that Postfix repeatedly tried to deliver a mail due to some failure there.

@casperklein
Copy link
Member

The first update check is done on container start and then repeated infinite with the configured interval. If an update is found, the update-check exits (and won't be started by supervisor again). Your PR would effectively introduce notification on each interval when an update is found.
Did your container for some reason restarted frequently? That would explain your issue.

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

Labels

area/scripts kind/bug/fix A fix (PR) for a confirmed bug meta/needs triage This issue / PR needs checks and verification from maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants