diff --git a/Procfile b/Procfile index 62f1e02..69a9ac5 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ release: flask db upgrade -web: gunicorn project:app --log-file=- +web: gunicorn -c gunicorn.conf.py project:app diff --git a/README.md b/README.md index ed88ac9..9a60432 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,12 @@ psql -c 'create database gsevpt;' -U postgres ### Install and run ```sh -export DATABASE_URL="postgresql://postgres@localhost/gsevpt" -pip install -r requirements.txt -flask db upgrade -gunicorn --bind 0.0.0.0:5000 project:app +python3 -m venv venv +source venv/bin/activate +(venv) pip install -r requirements.txt +(venv) export DATABASE_URL='postgresql://postgres@localhost/gsevpt' +(venv) flask db upgrade +(venv) gunicorn -c gunicorn.conf.py --bind 0.0.0.0:5000 project:app ``` ## Scheduled/Cron jobs @@ -61,8 +63,8 @@ Create `.env` file in the root directory or pass as environment variables. | Variable | Function | | --- | --- | -| SECRET_KEY | A secret key for verifying the integrity of signed cookies. Generate a nice key using secrets.token_urlsafe(). | -| SECURITY_PASSWORD_HASH | Bcrypt is set as default SECURITY_PASSWORD_HASH, which requires a salt. Generate a good salt using: secrets.SystemRandom().getrandbits(128). | +| SECRET_KEY | A secret key for verifying the integrity of signed cookies. Generate a nice key using `python3 -c "import secrets; print(secrets.token_urlsafe())"`. | +| SECURITY_PASSWORD_HASH | Bcrypt is set as default SECURITY_PASSWORD_HASH, which requires a salt. Generate a good salt using: `python3 -c "import secrets; print(secrets.SystemRandom().getrandbits(128))"`. | ### Send notifications via Mail diff --git a/entrypoint.sh b/entrypoint.sh index d098f0f..f140dc5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,4 +7,4 @@ do done BIND_PORT=${PORT:-5000} -gunicorn --bind 0.0.0.0:$BIND_PORT project:app +gunicorn -c gunicorn.conf.py --bind 0.0.0.0:$BIND_PORT project:app diff --git a/gunicorn.conf.py b/gunicorn.conf.py new file mode 100644 index 0000000..30d3f97 --- /dev/null +++ b/gunicorn.conf.py @@ -0,0 +1,5 @@ +import multiprocessing + +workers = multiprocessing.cpu_count() * 2 + 1 +capture_output = True +errorlog = "-"