Skip to content

Issue 631 run services with supervisor#676

Merged
tomav merged 12 commits intodocker-mailserver:masterfrom
johansmitsnl:issue-631-run-services-with-supervisor
Aug 7, 2017
Merged

Issue 631 run services with supervisor#676
tomav merged 12 commits intodocker-mailserver:masterfrom
johansmitsnl:issue-631-run-services-with-supervisor

Conversation

@johansmitsnl
Copy link
Copy Markdown
Contributor

Use the supervisor as the main process. The start-mailserver is started
from the supervisord and then this process triggers others.

Defined some default variable in the Dockerfile. In order for
supervisored to build the command lines the ENV variable need to be set.
Therefore the defaults are defined.

Some processes are not single processes like postfix and fail2ban and
they have a wrapper. The wrapper takes care of proper shutdown and checking
if the process is running or not. Supervisored will restart the wrapping
script if the process is gone.

Increased some delays between tests because sometimes they where to short
for all containers to be running.

LukeAllen and others added 10 commits July 29, 2017 10:16
from the supervisord and then this process triggers others.

Defined some default variable in the Dockerfile. In order for
supervisored to build the command lines the ENV variable need to be set.
Therefore the defaults are defined.

Some processes are not single processes like postfix and fail2ban and
they have a wrapper. The wrapper takes care of proper shutdown and checking
if the process is running or not. Supervisored will restart the wrapping
script if the process is gone.

Increased some delays between tests because sometimes they where to short
for all containers to be running.
@tomav
Copy link
Copy Markdown
Contributor

tomav commented Jul 30, 2017

Restarted build.

Copy link
Copy Markdown
Contributor

@tomav tomav left a comment

Choose a reason for hiding this comment

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

Thanks, tests are green but could you fix these little things? Thanks @johansmitsnl

Comment thread target/fail2ban-wrapper.sh Outdated
# wait until fail2ban is dead (triggered by trap)
while kill -0 "`cat /var/run/fail2ban/fail2ban.pid`"; do
sleep 5
done No newline at end of file
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.

Missing newline.

Comment thread target/postfix-wrapper.sh Outdated
# wait until postfix is dead (triggered by trap)
while kill -0 "`cat /var/spool/postfix/pid/master.pid`"; do
sleep 5
done No newline at end of file
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.

Missing newline

Comment thread target/start-mailserver.sh Outdated
notify 'task' 'Starting pop3 services' 'n'
mv /etc/dovecot/protocols.d/pop3d.protocol.disab /etc/dovecot/protocols.d/pop3d.protocol
display_startup_daemon "/usr/sbin/dovecot reload"
# /usr/sbin/dovecot reload
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.

If useless, this should be removed.

Comment thread target/start-mailserver.sh Outdated
if [ -f /tmp/docker-mailserver/dovecot.cf ]; then
cp /tmp/docker-mailserver/dovecot.cf /etc/dovecot/local.conf
/usr/sbin/dovecot reload
# /usr/sbin/dovecot reload
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.

If useless, this should be removed.

Comment thread target/supervisor/saslauth.conf Outdated
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
command=/usr/sbin/saslauthd -d -a shadow -O %(ENV_SASLAUTHD_MECH_OPTIONS)s
pidfile=/var/run/saslauthd/saslauthd.pid No newline at end of file
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.

Missing newline

Comment thread target/supervisor/supervisor-app.conf Outdated
autorestart=true
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
command=/usr/local/bin/postfix-wrapper.sh No newline at end of file
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.

Missing newline

Comment thread test/tests.bats Outdated
@test "checking restart of process: saslauthd (saslauthd server enabled)" {
run docker exec mail_with_ldap /bin/bash -c "pkill saslauthd && sleep 10 && ps aux --forest | grep -v grep | grep '/usr/sbin/saslauthd'"
assert_success
} No newline at end of file
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.

Missing newline

Comment thread Makefile
-e POSTFIX_DAGENT=lmtp:127.0.0.1:24 \
-e DMS_DEBUG=0 \
-h mail.my-domain.com -t $(NAME)
sleep 30
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.

If sleep increased too 40 at the end, perhaps this one can be set to 15 like previous.

Comment thread Makefile Outdated
-e [email protected] \
-e DMS_DEBUG=0 \
-h mail.my-domain.com -t $(NAME)
# Wait for containers to fully start
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.

Could you remove this comment?

@johansmitsnl
Copy link
Copy Markdown
Contributor Author

@tomav pushed the changes you requested.

@johansmitsnl
Copy link
Copy Markdown
Contributor Author

My editor is eating up the new line at the end, making a new commit.

@johansmitsnl
Copy link
Copy Markdown
Contributor Author

@tomav I set the delay back to 20 seconds but some first check (and now to) fails when it is to low. I think it should be 40 (is was good for my testing, 30 didn't do it for me).

Sometimes it fails the tests and gives a wrong state about
the test. During testing 40 seconds was the safe value.
@johansmitsnl
Copy link
Copy Markdown
Contributor Author

@tomav @alinmear I have updated the PR with tests and they pass all now.
Can someone review and accept if ok?

@tomav tomav merged commit 9e7959f into docker-mailserver:master Aug 7, 2017
@tomav
Copy link
Copy Markdown
Contributor

tomav commented Aug 7, 2017

Thanks!
I'll release a new version soon with these changes.

@johansmitsnl johansmitsnl deleted the issue-631-run-services-with-supervisor branch August 7, 2017 15:49
@dolanor
Copy link
Copy Markdown

dolanor commented Jan 29, 2018

Hello,

Just to know, every service runs by/with supervisor on the latest image?
So using service fail2ban stop is useless, right?

@johansmitsnl
Copy link
Copy Markdown
Contributor Author

@dolanor correct. You should use the supervisorctl stop

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.

4 participants