blob: d4f78725fc26e81a06ef919973b5ac7cf656fc0f (
plain)
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
|
#!/usr/bin/env bash
set -euo pipefail
APP_ROOT=/opt/pentest-ghostwriter/app
ENV_FILE=/etc/pentest-ghostwriter/pentest-ghostwriter.env
VENV_DIR=/var/lib/pentest-ghostwriter/venv
[[ -f ${ENV_FILE} ]] || { echo "Missing: ${ENV_FILE}" >&2; exit 1; }
[[ -x ${VENV_DIR}/bin/python ]] || { echo "Runtime venv is missing. Run pentest-ghostwriter-bootstrap first." >&2; exit 1; }
set -a
# shellcheck disable=SC1090
source "${ENV_FILE}"
set +a
export DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE:-config.settings.production}
export DATABASE_URL=${DATABASE_URL:-postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}}
export REDIS_URL=${REDIS_URL:-redis://${REDIS_HOST}:${REDIS_PORT}/0}
export PYTHONPATH="${APP_ROOT}:${PYTHONPATH:-}"
cd "${APP_ROOT}"
exec "${VENV_DIR}/bin/gunicorn" config.wsgi:application \
--bind "${DJANGO_BIND_HOST:-127.0.0.1}:${DJANGO_PORT:-8000}" \
--workers "${DJANGO_WORKERS:-2}" \
--access-logfile - \
--error-logfile -
|