update worker metrics exposure

This commit is contained in:
Nico Schottelius 2023-12-04 10:45:15 +01:00
parent a138276c54
commit 9bec5f0104
7 changed files with 71 additions and 13 deletions

View file

@ -29,7 +29,7 @@
include_role:
name: elementweb
tags:
- docker
- elementweb
when: matrix_service == "elementweb"
- name: Add synapse
include_role:

View file

@ -18,16 +18,6 @@
- dir
- test
- name: Create nginx log dir
ansible.builtin.file:
path: /home/{{ ansible_user }}/docker_compose/{{ matrix_service }}/nginx
state: directory
owner: "{{ ansible_user }}"
mode: '0755'
tags:
- dir
- test
- name: Create nginx config
ansible.builtin.template:
src: "nginx/elementweb.conf"

View file

@ -9,3 +9,10 @@ worker_listeners:
- names:
- client
- federation
- port: 9000
type: metrics
tls: false
x_forwarded: true
resources:
- names: [metrics]
compress: false

View file

@ -9,3 +9,10 @@ worker_listeners:
- names:
- client
- federation
- port: 9000
type: metrics
tls: false
x_forwarded: true
resources:
- names: [metrics]
compress: false

View file

@ -9,6 +9,7 @@ services:
- run
- --config-path=/config/homeserver.yaml
restart: always
container_name: synapse-main
synapse-worker-generic:
image: matrixdotorg/synapse:${SYNAPSE_VERSION}
@ -24,6 +25,7 @@ services:
depends_on:
- synapse-main
restart: unless-stopped
container_name: synapse-worker-generic
synapse-worker-sync:
image: matrixdotorg/synapse:${SYNAPSE_VERSION}
@ -39,6 +41,7 @@ services:
depends_on:
- synapse-main
restart: unless-stopped
container_name: synapse-worker-sync
synapse-worker-federation:
image: matrixdotorg/synapse:${SYNAPSE_VERSION}
@ -54,6 +57,7 @@ services:
depends_on:
- synapse-main
restart: unless-stopped
container_name: synapse-worker-federation
nginx:
@ -66,9 +70,11 @@ services:
- /ssl:/ssl
- /mnt/logs/nginx:/var/log/nginx/
restart: unless-stopped
container_name: nginx
redis:
image: "redis:latest"
ports:
- "6379:6379/tcp"
restart: "unless-stopped"
container_name: redis

View file

@ -6,4 +6,22 @@
mode: '0644'
tags:
- files
- test
- name: Create nginx dir
ansible.builtin.file:
path: /home/{{ ansible_user }}/docker_compose/{{ matrix_service }}/nginx
state: directory
owner: "{{ ansible_user }}"
mode: '0755'
tags:
- nginx
- dir
- name: Create nginx config
ansible.builtin.template:
src: "nginx/synapse.conf"
dest: /home/{{ ansible_user }}/docker_compose/{{ matrix_service }}/nginx/synapse.conf
owner: "{{ ansible_user }}"
mode: '0644'
tags:
- nginx
- synapse

View file

@ -65,7 +65,7 @@ server {
deny all;
}
# Metrics to master
# Metrics to worker-generic
location ~ /synapse-worker-generic/metrics {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
@ -80,6 +80,36 @@ server {
deny all;
}
# Metrics to worker-sync
location ~ /synapse-worker-sync/metrics {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_pass http://synapse-worker-generic:9000;
allow 10.161.228.115;
allow 10.161.228.116;
allow 10.161.228.117;
allow 10.161.228.118;
allow 10.161.228.119;
deny all;
}
# Metrics to worker-federation
location ~ /synapse-worker-federation/metrics {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_pass http://synapse-worker-generic:9000;
allow 10.161.228.115;
allow 10.161.228.116;
allow 10.161.228.117;
allow 10.161.228.118;
allow 10.161.228.119;
deny all;
}
# All other matrix/synapse requests go to main
location ~ /_matrix|/_synapse {