Skip to content

Commit c803bb9

Browse files
committed
Fix so prometheus does not require host header
1 parent ad5c271 commit c803bb9

File tree

1 file changed

+5
-4
lines changed
  • infrastructure/ansible/playbooks/api/roles/api/tasks

1 file changed

+5
-4
lines changed

infrastructure/ansible/playbooks/api/roles/api/tasks/main.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
set_fact:
1616
prometheus_ip: "{{ lookup('env', 'prometheus_ip') }}"
1717

18-
- name: print Prometheus IP
19-
debug:
20-
msg: 'Prometheus IP is {{ prometheus_ip }}'
21-
2218
- name: Create new api docker container
2319
docker_container:
2420
name: '{{ container_name }}'
@@ -44,6 +40,11 @@
4440
traefik.http.routers.api-metrics.rule: 'Host(`{{ api_domain }}`) && PathPrefix(`/api/metrics`)'
4541
traefik.http.routers.api-metrics.middlewares: metrics-whitelist
4642

43+
# Direct router for /api/metrics so prometheus can access it without Host header
44+
traefik.http.routers.api-metrics-direct.rule: 'PathPrefix(`/api/metrics`)'
45+
traefik.http.routers.api-metrics-direct.middlewares: 'metrics-whitelist'
46+
traefik.http.routers.api-metrics-direct.priority: '100'
47+
4748
- name: Swap docker containers if new one is healthy
4849
block:
4950
- name: Check if api docker container is healthy

0 commit comments

Comments
 (0)