docker-alerta: config.json does not respect base_url
Issue Summary When setting BASE_URL to e.g. /alerta, config.json still gets loaded from /
Environment
-
OS: Linux
-
API version: 7.4.0
-
Deployment: Docker with Traefik as reverse proxy
-
Database: Postgres
-
Server config from the docker-compose file:
web:
image: alerta/alerta-web
depends_on:
- db
volumes:
- ./alerta/config.json:/web/config.json
environment:
- DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
- AUTH_REQUIRED=True
- ADMIN_USERS=admin@alerta.io,devops@alerta.io
- PLUGINS=reject,blackout,normalise,enhance,prometheus
- USE_PROXYFIX=True
- BASE_URL=/alerta
restart: always
networks:
traefik_proxy:
aliases:
- alerta
container_name: alerta
labels:
- "namespace=Monitoring"
- "traefik.backend=alerta"
#- "traefik.frontend.rule=Host:sub1.example.com;PathPrefix:/alerta, /config.json, /js"
- "traefik.frontend.rule=Host:sub1.example.com;PathPrefix:/alerta"
- "traefik.enable=true"
- "traefik.port=8080"
- "traefik.passHostHeader=true"
I’ve created two traefik.frontend.rules to test. If I use the one with multiple PathPrefix settings it’s ‘mostly’ working but there are still some issues I haven’t yet fully identified. There are also some javascript files from the /js folder loaded from / instead of the BASE_URL.
config.json:
{"endpoint": "https://sub1.example.com", "base_path": "/alerta/api" }
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (10 by maintainers)
@satterly yes, those sed replacements only work for assests, so i ended up building alerta-webui with
BASE_URL
set to “/alerta/”@Madic- you might need to do something like this
i have a similar problem and as far as i can see, when
getLocalConfig
is called the path for the configuration file gets concatenated to just/config.json
becauseprocess.env.BASE_URL
is hardcoded to/
. shouldn’t this be a relative path since no configuration have been loaded yet?original config.ts
unminified app.f24b8480.js
test Dockerfile
Can’t attach the files directly so I’ve packed them in the following zip archive: config.zip