-
Notifications
You must be signed in to change notification settings - Fork 223
/
run_webapp.sh
executable file
·48 lines (41 loc) · 1.62 KB
/
run_webapp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/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/.
# Runs the webapp.
#
# Use the "--dev" argument to run the webapp in a docker container for
# the purposes of local development.
set -e
BUFFER_SIZE=${BUFFER_SIZE:-"16384"}
PORT=${PORT:-"8000"}
NUM_WORKERS=${NUM_WORKERS:-"6"}
# If this was kicked off via docker-compose, then it has a behavior
# configuration already. If it wasn't, then we need to add behavior
# configuration to the environment.
if [[ -z "${WEBAPP_BEHAVIOR}" ]];
then
echo "Pulling in webapp behavior configuration..."
CMDPREFIX="/app/bin/build_env.py /app/docker/config/webapp.env"
else
echo "Already have webapp behavior configuration..."
CMDPREFIX=
fi
if [ "$1" == "--dev" ]; then
# Run with manage.py
echo "******************************************************************"
echo "Running webapp in local dev environment."
echo "Connect with your browser using: http://localhost:8000/ "
echo "******************************************************************"
cd /app/webapp-django/ && ${CMDPREFIX} python manage.py runserver 0.0.0.0:8000
else
# Run uwsgi
${CMDPREFIX} uwsgi --pythonpath /app/webapp-django/ \
--master \
--need-app \
--wsgi webapp-django.wsgi.socorro-crashstats \
--buffer-size "${BUFFER_SIZE}" \
--enable-threads \
--processes "${NUM_WORKERS}" \
--http-socket 0.0.0.0:"${PORT}"
fi