added capability to run a dev container for pa, and if we re-build we create a new .sk and remove old PA_UserState on fresh login. BUG-120 is either fixed by this or at least the log catches it and does not crash now (if we rebuild between re-use)

This commit is contained in:
2024-03-10 23:52:34 +11:00
parent 2665ab086e
commit d86893875d
5 changed files with 29 additions and 16 deletions

View File

@@ -2,8 +2,19 @@
echo "ENV is set to: $ENV" &> /var/log/pa_job_manager.out &
su mythtv -g mythtv -c 'ENV="production" python3 -u /code/pa_job_manager.py' &> /var/log/pa_job_manager.out &
gunicorn --bind=0.0.0.0:80 --workers=4 --threads=16 main:app --env ENV="production" --error-logfile gunicorn.error.log --access-logfile gunicorn.log --capture-output
if [ "$ENV" == "production" ]; then
su mythtv -g mythtv -c 'ENV="production" python3 -u /code/pa_job_manager.py' &> /var/log/pa_job_manager.out &
gunicorn --bind=0.0.0.0:80 --workers=4 --threads=16 main:app --env ENV="production" --error-logfile gunicorn.error.log --access-logfile gunicorn.log --capture-output
elif [ "$ENV" == "container" ]; then
cd /home/ddp/src/photoassistant/
# add ddp quickly to container so we can run the job manager as ddp and write to the files
echo "ddp:x:1000:1000:Damien De Paoli,,,:/home/ddp:/bin/bash" >> /etc/passwd
ENV="container" sudo -u ddp python3 -u pa_job_manager.py &
gunicorn --bind=0.0.0.0:80 --workers=1 --threads=1 main:app --env ENV="container" --reload --capture-output
else
echo "Not sure which ENV ($ENV) we are running, set up for DEV and dont run job manager (jic)"
gunicorn --bind=0.0.0.0:80 --workers=1 --threads=1 main:app --env ENV="development" --error-logfile gunicorn.error.log --access-logfile gunicorn.log --capture-output --enable-stdio-inheritance --reload
fi
# this should never be invoked unless gunicorn fails -- in that case, at least
# we will keep the container can login by hand and check the issue/error