Skip to content

Commit

Permalink
Add BASE_PATH to the k8s contrib (#96)
Browse files Browse the repository at this point in the history
* Update Dockerfile

* install pip packages with virtual env and permissions for the alerta user

* Update to use new config file.json rather than .js

* add port to uswigi

* Use mountpath instead of baseurl for the uswgi.ini

* Use mountpath as well

* Use BASE_PATH rather than BASE_URL - as BASE_URL can be fully qualified

* Updated follwing review comments to derive base_path from base_url
  • Loading branch information
doodle-tnw authored and satterly committed Feb 16, 2019
1 parent f5e4bb1 commit b1d81d2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion contrib/kubernetes/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ COPY uwsgi.ini /app/uwsgi.ini

ENV ALERTA_SVR_CONF_FILE /app/alertad.conf
ENV ALERTA_CONF_FILE /app/alerta.conf

ENV BASE_URL /
ENV INSTALL_PLUGINS ""

Expand Down
7 changes: 5 additions & 2 deletions contrib/kubernetes/backend/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ EOF
fi

if [ ! -f "${RUN_ONCE}" ]; then

BASE_PATH=$(echo "/"${BASE_URL#*//*/} | tr -s /)
sed -i 's@!BASE_PATH!@'"$BASE_PATH"'@' /app/uwsgi.ini

# Init admin users and API keys
if [ -n "${ADMIN_USERS}" ]; then
Expand Down Expand Up @@ -39,13 +42,13 @@ if [ ! -f "${ALERTA_CONF_FILE}" ]; then
if [ -n "${API_KEY}" ]; then
cat >${ALERTA_CONF_FILE} << EOF
[DEFAULT]
endpoint = http://localhost:8080${BASE_URL}
endpoint = http://localhost:8080${BASE_PATH}
key = ${API_KEY}
EOF
else
cat >${ALERTA_CONF_FILE} << EOF
[DEFAULT]
endpoint = http://localhost:8080${BASE_URL}
endpoint = http://localhost:8080${BASE_PATH}
EOF
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion contrib/kubernetes/backend/uwsgi.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[uwsgi]
chdir = /
mount = $(BASE_URL)=/app/wsgi.py
mount = !BASE_PATH!=/app/wsgi.py
callable = app
manage-script-name = true

Expand Down

0 comments on commit b1d81d2

Please sign in to comment.