Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions docker/init_scripts/init
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,18 @@ wait_for_gunicorn_socket() {
fi
}

# function that runs or main process and creates a corresponding PID file,
# Function that runs our main process and creates a corresponding PID file
start_bin_gunicorn() {
# cleanup potentially leftover socket
rm /tmp/gunicorn.sock -f

# Wire LOGLEVEL into Gunicorn's logging config so it respects the env var
# Wire LOGLEVEL into Gunicorn's logging config so it respects the env var.
local gunicorn_level="${LOGLEVEL^^}"
sed -i '/\[logger_gunicorn\]/,/^\[/ s/^level=.*/level='"${gunicorn_level}"'/' /etc/gunicorn/logging.conf
local gunicorn_log_config="/tmp/gunicorn/logging.conf"
# Copy the config to a writable runtime path so this works on read-only root filesystems.
mkdir -p /tmp/gunicorn
cp /etc/gunicorn/logging.conf "${gunicorn_log_config}"
sed -i '/\[logger_gunicorn\]/,/^\[/ s/^level=.*/level='"${gunicorn_level}"'/' "${gunicorn_log_config}"

# commands to start our main application and store its PID to check for crashes
info_log "Starting backend"
Expand All @@ -118,7 +122,7 @@ start_bin_gunicorn() {
--max-requests-jitter "${WEB_SERVER_MAX_REQUESTS_JITTER:-100}" \
--worker-connections "${WEB_SERVER_WORKER_CONNECTIONS:-1000}" \
--error-logfile - \
--log-config /etc/gunicorn/logging.conf \
--log-config "${gunicorn_log_config}" \
main:app &
}

Expand Down
Loading