From e92cfd448e8d698619c955a1e932dccaf69abcb9 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Mon, 12 Jun 2023 20:43:45 +1000 Subject: [PATCH] fixed BUG-26 (saving with a series), and added a bookdb_webdev container that maps ~/src/pybook to /pybook_mapped_volume. Then start a single threaded, reloading, output capturing gunicorn via wraper.sh if in DEV, otherwise normal gunicorn if in PROD - gives me an idnentical dev in a container to prod. --- Dockerfile | 3 ++- TODO | 4 ---- wrapper.sh | 9 +++++++++ 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100755 wrapper.sh diff --git a/Dockerfile b/Dockerfile index 99dcb04..0476de1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,5 +19,6 @@ RUN apt-get update && apt-get -y install python3-pip python3-psycopg2 libpq-dev COPY requirements.txt requirements.txt RUN pip3 install -r requirements.txt EXPOSE 443 +EXPOSE 5000 COPY . . -CMD gunicorn --bind=0.0.0.0:443 --workers=2 --threads=2 --certfile /etc/letsencrypt/live/book.depaoli.id.au/fullchain.pem --keyfile /etc/letsencrypt/live/book.depaoli.id.au/privkey.pem main:app --env FLASK_ENV="production" --error-logfile gunicorn.error.log --access-logfile gunicorn.log --capture-output +CMD ["./wrapper.sh"] diff --git a/TODO b/TODO index 4c17371..4ed268e 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,2 @@ - create a bookdb_web_dev container - use ~/src/pybook/ as the /code area - somehow make it run either gunicorn - 1 thread? or mara -> expose port 5000 - look into pug series -> feels like there is an overarching series/sequence that would make books on shelf work better - use this: https://www.crydee.com/raymond-feist/reading-order/chronological diff --git a/wrapper.sh b/wrapper.sh new file mode 100755 index 0000000..de0875b --- /dev/null +++ b/wrapper.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ "$FLASK_ENV" == "production" ]; then + gunicorn --bind=0.0.0.0:443 --workers=2 --threads=2 --certfile /etc/letsencrypt/live/book.depaoli.id.au/fullchain.pem --keyfile /etc/letsencrypt/live/book.depaoli.id.au/privkey.pem main:app --env FLASK_ENV="production" --error-logfile gunicorn.error.log --access-logfile gunicorn.log --capture-output +else + cd /pybook_mapped_volume + gunicorn --bind=0.0.0.0:5000 --workers=1 --threads=1 main:app --env FLASK_ENV="development" --error-logfile gunicorn.error.log --access-logfile gunicorn.log --capture-output --enable-stdio-inheritance --reload +fi +