#35 use gunicorn for running the backend in production
parent
7d5d821bae
commit
66f818e54f
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
echo "------------------------------------------------"
|
||||
echo "GeoNature-citizen backend server is starting ..."
|
||||
echo "------------------------------------------------"
|
||||
|
||||
|
||||
FLASKDIR=$(readlink -e "${0%/*}")
|
||||
APP_DIR="$(dirname "$FLASKDIR")"
|
||||
|
||||
. $APP_DIR/config/settings.ini
|
||||
|
||||
echo "info: Starting $app_name"
|
||||
echo "info: FLASKDIR: $FLASKDIR"
|
||||
echo "info: APP_DIR: $APP_DIR"
|
||||
|
||||
# Start your gunicorn
|
||||
LOG_DIR="$APP_DIR/var/log"
|
||||
echo "LOG_DIR: $LOG_DIR"
|
||||
if [[ ! -e $LOG_DIR ]]; then
|
||||
mkdir -p $LOG_DIR
|
||||
elif [[ ! -d $LOG_DIR ]]; then
|
||||
echo "LOG_DIR already exists but is not a directory" 1>&2
|
||||
fi
|
||||
export PYTHONPATH=`pwd`/${venv_dir}
|
||||
#echo $PYTHONPATH
|
||||
echo "info: Starting gunicorn"
|
||||
echo "--"
|
||||
exec gunicorn -w ${gun_num_workers:-2} --error-log $APP_DIR/var/log/gunicorn_gncitizen_errors.log --pid="${app_name:-"gncitizen"}.pid" -b ${gun_host:-"0.0.0.0"}:${gun_port:-5002} --timeout=${gun_timeout:-30} --reload -n "geonature-citizen" wsgi:app
|
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
FLASKDIR=$(readlink -e "${0%/*}")
|
||||
APP_DIR="$(dirname "$FLASKDIR")"
|
||||
|
||||
echo "Starting $app_name"
|
||||
echo "$FLASKDIR"
|
||||
echo "$APP_DIR"
|
||||
|
||||
. "$APP_DIR"/settings.ini
|
||||
|
||||
# # activate the virtualenv
|
||||
# cd $FLASKDIR/$venv_dir
|
||||
# source bin/activate
|
||||
|
||||
# export PYTHONPATH=$FLASKDIR:$PYTHONPATH
|
||||
|
||||
|
||||
# Start your unicorn
|
||||
exec gunicorn server:app --access-logfile $APP_DIR/var/log/taxhub-access.log --pid="${app_name}.pid" --error-log $APP_DIR/var/log/taxhub-errors.log -w "${gun_num_workers}" -b "${gun_host}:${gun_port}" -n "${app_name}"
|
Loading…
Reference in new issue