treeherder/bin/run_gunicorn

38 строки
876 B
Bash
Executable File

#!/bin/bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
set -e
SRC_DIR=$(dirname "$(dirname "${BASH_SOURCE[0]}")")
cd $SRC_DIR
PROJECT_ROOT=$(readlink -f ../)
PATH=$PROJECT_ROOT/venv/bin:$PATH
LOGDIR=/var/log/gunicorn
ACCESS_LOGFILE=$LOGDIR/treeherder_access.log
ERROR_LOGFILE=$LOGDIR/treeherder_error.log
if [ ! -f $ACCESS_LOGFILE ]; then
touch $ACCESS_LOGFILE
fi
if [ ! -f $ERROR_LOGFILE ]; then
touch $ERROR_LOGFILE
fi
NUM_WORKERS=5
source /etc/profile.d/treeherder.sh
exec gunicorn -w $NUM_WORKERS \
--max-requests=150 \
--access-logfile=$ACCESS_LOGFILE \
--error-logfile=$ERROR_LOGFILE treeherder.webapp.wsgi:application \
--keep-alive=3 \
--log-level error \
--timeout=120