Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v3.2.2
### Feat
- add subpath/base url for frontend

## v3.2.1
### Fix
- change status from wildcard to exact match in alert and history filter
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ENV UWSGI_LISTEN=100
ENV UWSGI_BUFFER_SIZE=8192
ENV UWSGI_MAX_WORKER_LIFETIME=30
ENV UWSGI_WORKER_LIFETIME_DELTA=3
ENV FRONTEND_BASE_URL=/

ENV HEARTBEAT_SEVERITY=major

Expand Down
2 changes: 1 addition & 1 deletion config/templates/app/alerta.conf.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[DEFAULT]
sslverify = no
output = presto
endpoint = http://localhost:8080/api
endpoint = http://localhost:8080{{ env.FRONTEND_BASE_URL }}api
timezone = Europe/London
{%- if env.API_KEY %}
key = {{ env.API_KEY }}
Expand Down
7 changes: 4 additions & 3 deletions config/templates/app/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ http {

access_log /dev/stdout main;

location /api {
location {{ env.FRONTEND_BASE_URL }}api {
include /etc/nginx/uwsgi_params;
uwsgi_pass backend;

Expand All @@ -58,8 +58,9 @@ http {

root /web;
index index.html;
location / {
try_files $uri $uri/ /index.html;

location {{ env.FRONTEND_BASE_URL }} {
try_files $uri $uri/ {{ env.FRONTEND_BASE_URL }}index.html;
}
}
}
2 changes: 1 addition & 1 deletion config/templates/app/uwsgi.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ log-route = info ^\D
chdir = /app
module = wsgi
manage-script-name = true
mount = /api=wsgi:app
mount = {{ env.FRONTEND_BASE_URL }}api=wsgi:app
master = true
processes = {{ env.UWSGI_PROCESSES }}
listen = {{ env.UWSGI_LISTEN }}
Expand Down
5 changes: 4 additions & 1 deletion config/templates/web/config.json.j2
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{"endpoint": "/api"}
{
"endpoint": "{{ env.FRONTEND_BASE_URL }}api",
"base": "{{ env.FRONTEND_BASE_URL }}"
}
7 changes: 6 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ JINJA2="import os, sys, jinja2; sys.stdout.write(jinja2.Template(sys.stdin.read(

ALERTA_CONF_FILE=${ALERTA_CONF_FILE:-/app/alerta.conf}
ALERTA_SVR_CONF_FILE=${ALERTA_SVR_CONF_FILE:-/app/alertad.conf}
ALERTA_WEB_CONF_FILE=${ALERTA_WEB_CONF_FILE:-/web/config.json}
ALERTA_WEB_CONF_FILE=/web${FRONTEND_BASE_URL}config.json
NGINX_CONF_FILE=/app/nginx.conf
UWSGI_CONF_FILE=/app/uwsgi.ini
SUPERVISORD_CONF_FILE=/app/supervisord.conf
Expand Down Expand Up @@ -76,6 +76,11 @@ if [ ! -f "${UWSGI_CONF_FILE}" ]; then
python3 -c "${JINJA2}" < ${UWSGI_CONF_FILE}.j2 >${UWSGI_CONF_FILE}
fi

if [ ! -d "/web${FRONTEND_BASE_URL}" ]; then
mkdir /web${FRONTEND_BASE_URL}
mv /web/* /web${FRONTEND_BASE_URL} || :
fi

# Generate web config, if not supplied.
if [ ! -f "${ALERTA_WEB_CONF_FILE}" ]; then
if [ $INIT_LOG = true ]; then echo "# Create web configuration file."; fi
Expand Down
Loading