From 42a3edb4cc08bc0fae0b2744dbc1f59f6f8d3687 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Fri, 15 Nov 2024 23:08:58 +1100 Subject: [PATCH] use sudo of pybook user to run gunicorn, and add timeout of 300 as getting the ebook can be really slow --- wrapper.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wrapper.sh b/wrapper.sh index 4291ac5..ac5aebf 100755 --- a/wrapper.sh +++ b/wrapper.sh @@ -1,11 +1,11 @@ #!/bin/bash + if [ "$FLASK_ENV" == "production" ]; then - gunicorn --bind=0.0.0.0:80 --workers=2 --threads=2 main:app --env FLASK_ENV="production" --error-logfile /code/gunicorn.error.log --access-logfile /code/gunicorn.log --capture-output --enable-stdio-inheritance + sudo -u pybook ENV=${ENV} gunicorn --bind=0.0.0.0:80 --timeout 300 --workers=2 --threads=2 main:app --env FLASK_ENV="production" --error-logfile /code/gunicorn.error.log --access-logfile /code/gunicorn.log --capture-output --enable-stdio-inheritance else cd /pybook_mapped_volume - gunicorn --bind=0.0.0.0:80 --workers=1 --threads=1 main:app --env FLASK_ENV="$FLASK_ENV" --error-logfile /code/gunicorn.error.log --access-logfile /code/gunicorn.log --capture-output --enable-stdio-inheritance --reload - # just in case it fails - sleep 99999 + sudo -u pybook ENV=${ENV} gunicorn --bind=0.0.0.0:80 --timeout 300 --workers=1 --threads=1 main:app --env FLASK_ENV="$FLASK_ENV" --error-logfile ./gunicorn.error.log --access-logfile ./gunicorn.log --capture-output --enable-stdio-inheritance --reload fi - +# just in case it fails +sleep 99999