From 2d4530ae242b11880e75ad3f606ab8272b938464 Mon Sep 17 00:00:00 2001 From: Daniel Tsvetkov Date: Wed, 15 Apr 2020 21:33:31 +0200 Subject: [PATCH] gunicorn as prod env --- oshipka.sh | 9 +++++++++ requirements.txt | 1 + 2 files changed, 10 insertions(+) diff --git a/oshipka.sh b/oshipka.sh index 75b4329..87d0de6 100755 --- a/oshipka.sh +++ b/oshipka.sh @@ -17,6 +17,7 @@ Usage $0 [ bootstrap | worker | web | venv | install | link | cert ] install Install requirements link Link dev oshipka + prod Run in prod cert [DOMAIN] Install certificate " @@ -89,6 +90,12 @@ bootstrap() { link_dev_oshipka } +run_in_prod() { + shift + PORT=$1 + gunicorn -w 4 -b 0.0.0.0:${PORT} run:app +} + command_main() { INITIAL_COMMAND=$1 case "$INITIAL_COMMAND" in @@ -104,6 +111,8 @@ command_main() { ;; link) link_dev_oshipka "$@" ;; + prod) run_in_prod "$@" + ;; cert) install_cert "$@" ;; *) >&2 echo -e "${HELP}" diff --git a/requirements.txt b/requirements.txt index dc69db6..ee4c346 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,6 +14,7 @@ Flask-Security==3.0.0 Flask-SQLAlchemy==2.4.1 Flask-Table==0.5.0 Flask-WTF==0.14.3 +gunicorn==20.0.4 importlib-metadata==1.5.2 inflect==4.1.0 itsdangerous==1.1.0