gunicorn as prod env

This commit is contained in:
Daniel Tsvetkov 2020-04-15 21:33:31 +02:00
parent 9ecab37cc0
commit 2d4530ae24
2 changed files with 10 additions and 0 deletions

View File

@ -17,6 +17,7 @@ Usage $0 [ bootstrap | worker | web | venv | install | link | cert ]
install Install requirements install Install requirements
link Link dev oshipka link Link dev oshipka
prod Run in prod
cert [DOMAIN] Install certificate cert [DOMAIN] Install certificate
" "
@ -89,6 +90,12 @@ bootstrap() {
link_dev_oshipka link_dev_oshipka
} }
run_in_prod() {
shift
PORT=$1
gunicorn -w 4 -b 0.0.0.0:${PORT} run:app
}
command_main() { command_main() {
INITIAL_COMMAND=$1 INITIAL_COMMAND=$1
case "$INITIAL_COMMAND" in case "$INITIAL_COMMAND" in
@ -104,6 +111,8 @@ command_main() {
;; ;;
link) link_dev_oshipka "$@" link) link_dev_oshipka "$@"
;; ;;
prod) run_in_prod "$@"
;;
cert) install_cert "$@" cert) install_cert "$@"
;; ;;
*) >&2 echo -e "${HELP}" *) >&2 echo -e "${HELP}"

View File

@ -14,6 +14,7 @@ Flask-Security==3.0.0
Flask-SQLAlchemy==2.4.1 Flask-SQLAlchemy==2.4.1
Flask-Table==0.5.0 Flask-Table==0.5.0
Flask-WTF==0.14.3 Flask-WTF==0.14.3
gunicorn==20.0.4
importlib-metadata==1.5.2 importlib-metadata==1.5.2
inflect==4.1.0 inflect==4.1.0
itsdangerous==1.1.0 itsdangerous==1.1.0