staging deploy: load env before manage.py checks
This commit is contained in:
@@ -22,6 +22,29 @@ chown -R wpp:wpp /opt/wpp-staging/app
|
|||||||
# Staging must not run on SQLite (issue #133). Remove bundled sqlite artifact.
|
# Staging must not run on SQLite (issue #133). Remove bundled sqlite artifact.
|
||||||
rm -f /opt/wpp-staging/app/db.sqlite3
|
rm -f /opt/wpp-staging/app/db.sqlite3
|
||||||
cd /opt/wpp-staging/app
|
cd /opt/wpp-staging/app
|
||||||
|
|
||||||
|
# Load staging env before any manage.py call (issue #133 follow-up).
|
||||||
|
ENV_LOADED=0
|
||||||
|
for ENV_FILE in \
|
||||||
|
/opt/wpp-staging/.env.staging \
|
||||||
|
/opt/wpp-staging/.env \
|
||||||
|
/opt/wpp-staging/env/wpp_staging.env \
|
||||||
|
/opt/wpp-staging/secrets/wpp_staging.env
|
||||||
|
do
|
||||||
|
if [ -f "${ENV_FILE}" ]; then
|
||||||
|
set -a
|
||||||
|
. "${ENV_FILE}"
|
||||||
|
set +a
|
||||||
|
echo "[deploy] loaded staging env: ${ENV_FILE}"
|
||||||
|
ENV_LOADED=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ "${ENV_LOADED}" -ne 1 ]; then
|
||||||
|
echo "[deploy] ERROR: no staging env file found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
runuser -u wpp -- python3 -m venv .venv
|
runuser -u wpp -- python3 -m venv .venv
|
||||||
runuser -u wpp -- .venv/bin/pip install -U pip >/dev/null
|
runuser -u wpp -- .venv/bin/pip install -U pip >/dev/null
|
||||||
runuser -u wpp -- .venv/bin/pip install -r requirements.txt >/dev/null
|
runuser -u wpp -- .venv/bin/pip install -r requirements.txt >/dev/null
|
||||||
|
|||||||
Reference in New Issue
Block a user