Skip to content

Calling supervisord directly instead of via shell#1074

Merged
johansmitsnl merged 1 commit intodocker-mailserver:masterfrom
danielpanteleit:supervisord_as_init
Nov 4, 2018
Merged

Calling supervisord directly instead of via shell#1074
johansmitsnl merged 1 commit intodocker-mailserver:masterfrom
danielpanteleit:supervisord_as_init

Conversation

@danielpanteleit
Copy link
Copy Markdown
Contributor

This fixes #1047 by calling supervisor directly. The container won't fail now anymore, because there is no way to tell supervisor to exit with an error, so I had to change the test that expects the container to fail.

I recommend increasing the stopping time, though. Since the container can take longer than 10 seconds to stop gracefully. This can be done using "stop_grace_period" in docker-compose.yml or "--stop-timeout" using "docker run" (also docker stop -t)

Comment thread test/tests.bats
@test "checking configuration: hostname/domainname" {
run docker run `docker inspect --format '{{ .Config.Image }}' mail`
assert_failure
assert_success
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why did you change this test? It does not seems to be related to your change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Supervisor is now the main process (PID 1) and we can't stop it in the start-mailserver.sh script in a way that would result in a failure. Supervisor is not designed to stop with an error if one of its processes is failing.

So there are basically two options:

  1. stopping supervisor gracefully or
  2. using a different init process.

I think 1) should be ok, since the container only failed if the setup was failing (due to configuration errors). For correctly configured containers this would not matter.

For option 2) we could either (a) use docker's built-in init process (docker run --init; or docker-compose option "init: true") or (b) add an external init program (like tini) and kill supervisor non-gracefully.

Option 2a) could be problematic for already deployed instances, since the docker-compose files (or docker run commands) need to be changed. I did not check out options for 2b)

Copy link
Copy Markdown
Contributor

@johansmitsnl johansmitsnl left a comment

Choose a reason for hiding this comment

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

Please check the test comment.

@johansmitsnl johansmitsnl merged commit cc56b4f into docker-mailserver:master Nov 4, 2018
@danielpanteleit danielpanteleit deleted the supervisord_as_init branch November 4, 2018 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Graceful stop of container

2 participants