File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,14 +88,18 @@ wait_for_gunicorn_socket() {
8888 fi
8989}
9090
91- # function that runs or main process and creates a corresponding PID file,
91+ # Function that runs our main process and creates a corresponding PID file
9292start_bin_gunicorn () {
9393 # cleanup potentially leftover socket
9494 rm /tmp/gunicorn.sock -f
9595
96- # Wire LOGLEVEL into Gunicorn's logging config so it respects the env var
96+ # Wire LOGLEVEL into Gunicorn's logging config so it respects the env var.
9797 local gunicorn_level=" ${LOGLEVEL^^} "
98- sed -i ' /\[logger_gunicorn\]/,/^\[/ s/^level=.*/level=' " ${gunicorn_level} " ' /' /etc/gunicorn/logging.conf
98+ local gunicorn_log_config=" /tmp/gunicorn/logging.conf"
99+ # Copy the config to a writable runtime path so this works on read-only root filesystems.
100+ mkdir -p /tmp/gunicorn
101+ cp /etc/gunicorn/logging.conf " ${gunicorn_log_config} "
102+ sed -i ' /\[logger_gunicorn\]/,/^\[/ s/^level=.*/level=' " ${gunicorn_level} " ' /' " ${gunicorn_log_config} "
99103
100104 # commands to start our main application and store its PID to check for crashes
101105 info_log " Starting backend"
@@ -118,7 +122,7 @@ start_bin_gunicorn() {
118122 --max-requests-jitter " ${WEB_SERVER_MAX_REQUESTS_JITTER:- 100} " \
119123 --worker-connections " ${WEB_SERVER_WORKER_CONNECTIONS:- 1000} " \
120124 --error-logfile - \
121- --log-config /etc/gunicorn/logging.conf \
125+ --log-config " ${gunicorn_log_config} " \
122126 main:app &
123127}
124128
You can’t perform that action at this time.
0 commit comments