Issue 631 run services with supervisor#676
Issue 631 run services with supervisor#676tomav merged 12 commits intodocker-mailserver:masterfrom johansmitsnl:issue-631-run-services-with-supervisor
Conversation
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.
|
Restarted build. |
tomav
left a comment
There was a problem hiding this comment.
Thanks, tests are green but could you fix these little things? Thanks @johansmitsnl
| # 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 |
| # 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 |
| 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 |
There was a problem hiding this comment.
If useless, this should be removed.
| 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 |
There was a problem hiding this comment.
If useless, this should be removed.
| 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 |
| 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 |
| @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 |
| -e POSTFIX_DAGENT=lmtp:127.0.0.1:24 \ | ||
| -e DMS_DEBUG=0 \ | ||
| -h mail.my-domain.com -t $(NAME) | ||
| sleep 30 |
There was a problem hiding this comment.
If sleep increased too 40 at the end, perhaps this one can be set to 15 like previous.
| -e [email protected] \ | ||
| -e DMS_DEBUG=0 \ | ||
| -h mail.my-domain.com -t $(NAME) | ||
| # Wait for containers to fully start |
There was a problem hiding this comment.
Could you remove this comment?
|
@tomav pushed the changes you requested. |
|
My editor is eating up the new line at the end, making a new commit. |
|
@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.
|
Thanks! |
|
Hello, Just to know, every service runs by/with supervisor on the latest image? |
|
@dolanor correct. You should use the supervisorctl stop |
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.