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

Restart supervisord early #2494

Merged

Conversation

casperklein
Copy link
Member

@casperklein casperklein commented Mar 20, 2022

Description

With SUPERVISOR_LOGLEVEL=info, supervisord is restarted on startup to activate the new loglevel. Restarting supervisord, will also restart start-mailserver.sh.

This is how it looks like on container start:

[ TASKLOG ]  Welcome to docker-mailserver 10.5.0
[ TASKLOG ]  Initializing setup
[ TASKLOG ]  Checking configuration
[ TASKLOG ]  Configuring mail server
Restarted supervisord
2022-03-20 22:35:19,944 INFO Included extra file "/etc/supervisor/conf.d/saslauth.conf" during parsing
2022-03-20 22:35:19,944 INFO Included extra file "/etc/supervisor/conf.d/supervisor-app.conf" during parsing
2022-03-20 22:35:19,944 INFO Set uid to user 0 succeeded
2022-03-20 22:35:19,944 INFO RPC interface 'supervisor' initialized
2022-03-20 22:35:19,944 INFO supervisord started with pid 7
2022-03-20 22:35:20,947 INFO spawned: 'mailserver' with pid 20
[ TASKLOG ]  Welcome to docker-mailserver 10.5.0
[ TASKLOG ]  Initializing setup
[ TASKLOG ]  Checking configuration
[ TASKLOG ]  Configuring mail server

This is not optimal. Some tasks are processed twice. To fix this, supervisord must be restarted as early as possible.

I've moved the necessary lines to the top. source /usr/local/bin/setup-stack.sh is needed to call _setup_supervisor. Just moving this line to the top would be fine. But I decided to move the whole sourcing block to the top and integrated also the helpers sourcing in it.

After the changes it looks like this:

Restarted supervisord
2022-03-20 22:39:37,581 INFO Included extra file "/etc/supervisor/conf.d/saslauth.conf" during parsing
2022-03-20 22:39:37,581 INFO Included extra file "/etc/supervisor/conf.d/supervisor-app.conf" during parsing
2022-03-20 22:39:37,581 INFO Set uid to user 0 succeeded
2022-03-20 22:39:37,582 INFO RPC interface 'supervisor' initialized
2022-03-20 22:39:37,582 INFO supervisord started with pid 7
2022-03-20 22:39:38,585 INFO spawned: 'mailserver' with pid 14
[ TASKLOG ]  Welcome to docker-mailserver 10.5.0
[ TASKLOG ]  Initializing setup
[ TASKLOG ]  Checking configuration
[ TASKLOG ]  Configuring mail server

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

@casperklein casperklein self-assigned this Mar 20, 2022
@casperklein casperklein added this to the v11.0.0 milestone Mar 20, 2022
@casperklein casperklein added area/scripts kind/improvement Improve an existing feature, configuration file or the documentation labels Mar 20, 2022
@casperklein casperklein marked this pull request as ready for review March 20, 2022 22:22
@casperklein casperklein requested a review from a team March 20, 2022 22:22
Copy link
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source /usr/local/bin/setup-stack.sh is needed to call _setup_supervisor.
Just moving this line to the top would be fine. But I decided to move the whole sourcing block to the top and integrated also the helpers sourcing in it.

Could probably just extract that out of setup-stack.sh, but it's all just functions being sourced so no concerns either way 👍

@georglauterbach
Copy link
Member

I'm fine with merging this too. Maybe we can ditch check-stack.sh and create a preflight-check.sh which runs before anything else. I imagine there are some setup checks etc. that should be run in the very beginning to not waste time.

@casperklein casperklein merged commit 37c8e44 into docker-mailserver:master Mar 21, 2022
@casperklein casperklein deleted the supervisord-reload-early branch March 21, 2022 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/scripts kind/improvement Improve an existing feature, configuration file or the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants