TheHipbot / docker-web2py

web2py Docker files
13 stars 11 forks source link

supervisord keeps trying to start nginx, which is trying to run in daemon mode #1

Closed rowdy-fms closed 8 years ago

rowdy-fms commented 8 years ago

nginx should be run with daemon mode off under Docker, otherwise supervisord keeps thinking the process has terminated, and tries to restart it.

This results in repeated entries in the supervisor log like;

2016-07-08 15:22:29,985 INFO success: nginx-app entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-07-08 15:22:31,489 INFO exited: nginx-app (exit status 1; not expected)
2016-07-08 15:22:32,491 INFO spawned: 'nginx-app' with pid 57

And in the nginx log like:

2016/07/08 15:22:50 [emerg] 63#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2016/07/08 15:22:50 [emerg] 63#0: bind() to 0.0.0.0:443 failed (98: Address already in use)
2016/07/08 15:22:50 [emerg] 63#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2016/07/08 15:22:50 [emerg] 63#0: bind() to 0.0.0.0:443 failed (98: Address already in use)
2016/07/08 15:22:50 [emerg] 63#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2016/07/08 15:22:50 [emerg] 63#0: bind() to 0.0.0.0:443 failed (98: Address already in use)
2016/07/08 15:22:50 [emerg] 63#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2016/07/08 15:22:50 [emerg] 63#0: bind() to 0.0.0.0:443 failed (98: Address already in use)
2016/07/08 15:22:50 [emerg] 63#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2016/07/08 15:22:50 [emerg] 63#0: bind() to 0.0.0.0:443 failed (98: Address already in use)
2016/07/08 15:22:50 [emerg] 63#0: still could not bind()

Although a nginx process is running, supervisor keeps trying to start another one.

A work-around is to modify supervisor-app.conf as follows:

[program:nginx-app] command = /usr/sbin/nginx -g "daemon off;"

This work-around was suggested here: http://stackoverflow.com/questions/33650820/nginx-emerg-bind-to-0-0-0-080-failed-98-address-already-in-use-on-docke/33876214#33876214

TheHipbot commented 8 years ago

Thanks for the heads up, if I had known this image was in use I'd have refactored it long ago. I am working on a fix for this now and will be working to shrink the image and clean up a few things over the next couple weeks.

TheHipbot commented 8 years ago

This issue should be fixed