Skip to content

Commit

Permalink
fix: Don't kill supervisord when processes exit, for #5906, fixes #5358
Browse files Browse the repository at this point in the history
… (#5936)
  • Loading branch information
stasadev committed Mar 7, 2024
1 parent 1ca5643 commit a4bf20b
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ stdout_logfile_maxbytes=0
redirect_stderr=true
exitcodes=0
startsecs=1 # Must stay up 1 sec
autorestart=true
startretries=10
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ logfile=/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)

[eventlistener:child_exit_monitor]
command=/usr/local/bin/kill_supervisor.py
process_name=child_exit_monitor
events=PROCESS_STATE_FATAL,PROCESS_STATE_EXITED

[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ priority=5
stdout_logfile=/var/tmp/logpipe
stdout_logfile_maxbytes=0
redirect_stderr=true
autorestart=true
startretries=10
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ priority=5
stdout_logfile=/var/tmp/logpipe
stdout_logfile_maxbytes=0
redirect_stderr=true
autorestart=true
startretries=10
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ priority=10
stdout_logfile=/var/tmp/logpipe
stdout_logfile_maxbytes=0
redirect_stderr=true
autorestart=true
startretries=10
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ priority=10
stdout_logfile=/var/tmp/logpipe
stdout_logfile_maxbytes=0
redirect_stderr=true
autorestart=true
startretries=10

This file was deleted.

4 changes: 3 additions & 1 deletion docs/content/users/extend/customization-extendibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ web_extra_daemons:
directory: /var/www/html
```

!!!tip "How to view the results of a daemon start attempt?"
See [`ddev logs`](../usage/commands.md#logs) or `docker logs ddev-<project>-web`.

* `directory` should be the absolute path inside the container to the directory where the daemon should run.
* `command` is best as a simple binary with its arguments, but Bash features like `cd` or `&&` work. If the program to be run is not in the `ddev-webserver` `$PATH` then it should have the absolute in-container path to the program to be run, like `/var/www/html/node_modules/.bin/http-server`.
* `web_extra_daemons` is a shortcut for adding a configuration to `supervisord`, which organizes daemons inside the web container. If the default settings are inadequate for your use, you can write a [complete config file for your daemon](#explicit-supervisord-configuration-for-additional-daemons).
* Your daemon is expected to run in the foreground, not to daemonize itself, `supervisord` will take care of that.
* To see the results of the attempt to start your daemon, see [`ddev logs`](../usage/commands.md#logs) or `docker logs ddev-<project>-web`.

## Exposing Extra Ports via `ddev-router`

Expand Down
3 changes: 2 additions & 1 deletion pkg/ddevapp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -948,10 +948,11 @@ func (app *DdevApp) RenderComposeYAML() (string, error) {
supervisorConf := fmt.Sprintf(`
[program:%s]
group=webextradaemons
command=bash -c "%s || sleep 2"
command=bash -c "%s; exit_code=$?; if [ $exit_code -ne 0 ]; then sleep 2; fi; exit $exit_code"
directory=%s
autostart=false
autorestart=true
startsecs=3 # Must stay up 3 sec, because "sleep 2" in case of fail
startretries=15
stdout_logfile=/var/tmp/logpipe
stdout_logfile_maxbytes=0
Expand Down
2 changes: 1 addition & 1 deletion pkg/versionconstants/versionconstants.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var AmplitudeAPIKey = ""
var WebImg = "ddev/ddev-webserver"

// WebTag defines the default web image tag
var WebTag = "20240306_mmikkel_javascript_type" // Note that this can be overridden by make
var WebTag = "20240305_stasadev_remove_kill_supervisor" // Note that this can be overridden by make

// DBImg defines the default db image used for applications.
var DBImg = "ddev/ddev-dbserver"
Expand Down

0 comments on commit a4bf20b

Please sign in to comment.