mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 15:15:38 -05:00
Merge pull request #1922 from alphagov/tail-celery-multi-logs
Stream delivery worker logs to stdout when running on PaaS
This commit is contained in:
@@ -97,6 +97,12 @@ function start_aws_logs_agent {
|
|||||||
echo "AWS logs agent pid: ${AWSLOGS_AGENT_PID}"
|
echo "AWS logs agent pid: ${AWSLOGS_AGENT_PID}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function start_logs_tail {
|
||||||
|
exec tail -n0 -f ${LOGS_DIR}/app.log.json &
|
||||||
|
LOGS_TAIL_PID=$!
|
||||||
|
echo "tail pid: ${LOGS_TAIL_PID}"
|
||||||
|
}
|
||||||
|
|
||||||
function run {
|
function run {
|
||||||
while true; do
|
while true; do
|
||||||
get_celery_pids
|
get_celery_pids
|
||||||
@@ -104,6 +110,7 @@ function run {
|
|||||||
kill -0 ${APP_PID} 2&>/dev/null || return 1
|
kill -0 ${APP_PID} 2&>/dev/null || return 1
|
||||||
done
|
done
|
||||||
kill -0 ${AWSLOGS_AGENT_PID} 2&>/dev/null || start_aws_logs_agent
|
kill -0 ${AWSLOGS_AGENT_PID} 2&>/dev/null || start_aws_logs_agent
|
||||||
|
kill -0 ${LOGS_TAIL_PID} 2&>/dev/null || start_logs_tail
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -120,5 +127,6 @@ configure_aws_logs
|
|||||||
start_application "$@"
|
start_application "$@"
|
||||||
|
|
||||||
start_aws_logs_agent
|
start_aws_logs_agent
|
||||||
|
start_logs_tail
|
||||||
|
|
||||||
run
|
run
|
||||||
|
|||||||
Reference in New Issue
Block a user