@@ -29,24 +29,32 @@ supervisord_create() {
2929 SVCTL_ENABLE=" ${SVCTL_ENABLE:- 0} "
3030 SVCTL_LISTEN_ADDR=" 0.0.0.0"
3131 SVCTL_LISTEN_PORT=9001
32- SVCTL_USER=" $( get_random_alphanum " 10" ) "
33- SVCTL_PASS=" $( get_random_alphanum " 10" ) "
34-
32+ if [ -z " ${SVCTL_USER:- } " ]; then
33+ SVCTL_USER=" $( get_random_alphanum " 10" ) "
34+ fi
35+ if [ -z " ${SVCTL_PASS:- } " ]; then
36+ SVCTL_PASS=" $( get_random_alphanum " 10" ) "
37+ fi
3538 if [ " ${SVCTL_LISTEN_ADDR} " = " 0.0.0.0" ] || [ " ${SVCTL_LISTEN_ADDR} " = " *" ]; then
3639 SVCTL_CONNECT_ADDR=" 127.0.0.1"
3740 fi
3841
42+ # Allow tailing remote logs from supervisord via supervisorctl
43+ SVCTL_REMOTE_LOGS_ENABLE=" ${SVCTL_REMOTE_LOGS_ENABLE:- 0} "
44+
3945 # This allows for 'supvervisorctl restart watcherd
4046 {
4147 # Use 'echo_supervisord_conf' to generate an example config
4248 if [ " ${SVCTL_ENABLE} " = " 1" ]; then
4349 echo " [rpcinterface:supervisor]"
4450 echo " supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface"
51+ echo
4552
4653 echo " [inet_http_server] ; inet (TCP) server disabled by default"
4754 echo " port=${SVCTL_LISTEN_ADDR} :${SVCTL_LISTEN_PORT} ; ip_address:port specifier, *:port for all iface"
4855 echo " username=${SVCTL_USER} ; default is no username (open server)"
4956 echo " password=${SVCTL_PASS} ; default is no password (open server)"
57+ echo
5058
5159 echo " [supervisorctl]"
5260 echo " ;serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket"
@@ -55,34 +63,48 @@ supervisord_create() {
5563 echo " password=${SVCTL_PASS} ; should be same as in [*_http_server] if set"
5664 echo " ;prompt=mysupervisor ; cmd line prompt (default 'supervisor')"
5765 echo " ;history_file=~/.sc_history ; use readline history if available"
66+ echo
5867 fi
5968
6069 echo " [supervisord]"
6170 echo " user=root"
6271 echo " nodaemon=true"
6372 echo " loglevel=warn"
73+ echo " strip_ansi=true" # Required to fix tail logs for watcherd
6474 echo
75+
6576 echo " [program:httpd]"
6677 echo " command=${httpd_command} "
6778 echo " priority=1"
6879 echo " autostart=true"
6980 echo " startretries=100"
7081 echo " startsecs=1"
7182 echo " autorestart=true"
72- echo " stdout_logfile=/dev/stdout"
73- echo " stderr_logfile=/dev/stderr"
83+ if [ " ${SVCTL_REMOTE_LOGS_ENABLE} " = " 1" ]; then
84+ echo " stdout_logfile=/var/log/supervisord-httpd.log"
85+ echo " stderr_logfile=/var/log/supervisord-httpd.err"
86+ else
87+ echo " stdout_logfile=/dev/stdout"
88+ echo " stderr_logfile=/dev/stderr"
89+ fi
7490 echo " stdout_logfile_maxbytes=0"
7591 echo " stderr_logfile_maxbytes=0"
7692 echo " stdout_events_enabled=true"
7793 echo " stderr_events_enabled=true"
7894 echo
95+
7996 echo " [program:watcherd]"
8097 echo " command=${watcherd_command} "
8198 echo " priority=999"
8299 echo " autostart=true"
83100 echo " autorestart=true"
84- echo " stdout_logfile=/dev/stdout"
85- echo " stderr_logfile=/dev/stderr"
101+ if [ " ${SVCTL_REMOTE_LOGS_ENABLE} " = " 1" ]; then
102+ echo " stdout_logfile=/var/log/supervisord-watcherd.log"
103+ echo " stderr_logfile=/var/log/supervisord-watcherd.err"
104+ else
105+ echo " stdout_logfile=/dev/stdout"
106+ echo " stderr_logfile=/dev/stderr"
107+ fi
86108 echo " stdout_logfile_maxbytes=0"
87109 echo " stderr_logfile_maxbytes=0"
88110 echo " stdout_events_enabled=true"
0 commit comments