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.

This commit is contained in:
2023-06-12 20:43:45 +10:00
parent 98ef9b5edc
commit e92cfd448e
3 changed files with 11 additions and 5 deletions

View File

@@ -19,5 +19,6 @@ RUN apt-get update && apt-get -y install python3-pip python3-psycopg2 libpq-dev
COPY requirements.txt requirements.txt COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt RUN pip3 install -r requirements.txt
EXPOSE 443 EXPOSE 443
EXPOSE 5000
COPY . . 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"]

4
TODO
View File

@@ -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 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 - use this: https://www.crydee.com/raymond-feist/reading-order/chronological

9
wrapper.sh Executable file
View File

@@ -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