This commit is contained in:
creme 2021-08-01 14:34:00 +02:00
commit 490b2ecba7
No known key found for this signature in database
GPG key ID: C147C3B7FBDF08D0
39 changed files with 5451 additions and 0 deletions

View file

@ -0,0 +1,272 @@
# Generic Worker
## Sync requests
location ~* ^/_matrix/client/(v2_alpha|r0)/sync$ {
proxy_pass http://localhost:8083;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|v2_alpha|r0)/events$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0)/initialSync$ {
proxy_pass http://localhost:8083;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0)/rooms/[^/]+/initialSync$ {
proxy_pass http://localhost:8083;
include include.d/synapse-proxy.conf;
}
## Federation requests
location ~* ^/_matrix/federation/v1/event/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/state/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/state_ids/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/backfill/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/get_missing_events/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/publicRooms {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/query/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/make_join/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/make_leave/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/send_join/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v2/send_join/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/send_leave/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v2/send_leave/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/invite/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v2/invite/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/query_auth/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/event_auth/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/exchange_third_party_invite/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/user/devices/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/federation/v1/get_groups_publicised$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/key/v2/query {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
## Inbound federation transaction request
location ~* ^/_matrix/federation/v1/send/ {
proxy_pass http://generic_worker_ih;
include include.d/synapse-proxy.conf;
}
## Client API requests
location ~* ^/_matrix/client/(api/v1|r0|unstable)/publicRooms$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/joined_members$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/context/.*$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/members$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/state$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/account/3pid$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/devices$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/keys/query$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/keys/changes$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/versions$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/voip/turnServer$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/joined_groups$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/publicised_groups$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/publicised_groups/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/event/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/joined_rooms$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/search$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
## Registration/login requests
location ~* ^/_matrix/client/(api/v1|r0|unstable)/login$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(r0|unstable)/register$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(r0|unstable)/auth/.*/fallback/web$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
## Event sending requests
location ~* ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/redact {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/send {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/state/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/join/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}
location ~* ^/_matrix/client/(api/v1|r0|unstable)/profile/ {
proxy_pass http://generic_worker_lc;
include include.d/synapse-proxy.conf;
}

View file

@ -0,0 +1,14 @@
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
port_in_redirect off;
proxy_redirect off;
proxy_connect_timeout 360;
proxy_read_timeout 600;
proxy_send_timeout 600;
#proxy_buffering off;
proxy_buffers 8 16k;
proxy_buffer_size 32k;

View file

@ -0,0 +1,19 @@
location ^~ /_synapse/admin/v1/users/@creme:envs.net/admin {
proxy_pass http://localhost:8008;
include include.d/synapse-proxy.conf;
}
location ^~ /_synapse/admin/v1/whois/@creme:envs.net {
proxy_pass http://localhost:8008;
include include.d/synapse-proxy.conf;
}
location ^~ /_synapse/admin/v1/deactivate {
proxy_pass http://localhost:8008;
include include.d/synapse-proxy.conf;
}
location ^~ /_synapse/admin {
allow 127.0.0.1;
deny all;
proxy_pass http://localhost:8008;
include include.d/synapse-proxy.conf;
}

View file

@ -0,0 +1,141 @@
server {
listen 80 default_server;
#listen [::]:80;
server_name matrix.envs.net;
location / {
return 307 https://$host$request_uri;
}
location /.well-known/acme-challenge/ {
alias /var/lib/letsencrypt/.well-known/acme-challenge/;
}
}
server {
listen 80;
#listen [::]:80;
server_name turn.envs.net;
location / {
return 307 https://matrix.envs.net$request_uri;
}
location /.well-known/acme-challenge/ {
alias /var/lib/letsencrypt/.well-known/acme-challenge/;
}
}
map $http_origin $DO_CORS {
# indicates all map values are hostnames and should be parsed as such
hostnames;
# default value
default 'true';
# blocked domains
renaissance.eu.org 'false';
element.renaissance.eu.org 'false';
}
upstream generic_worker_rr {
server localhost:8510;
server localhost:8511;
server localhost:8512;
}
upstream generic_worker_ih {
ip_hash;
server localhost:8510;
server localhost:8511;
server localhost:8512;
}
upstream generic_worker_lc {
least_conn;
server localhost:8510;
server localhost:8511;
server localhost:8512;
}
server {
listen 443 ssl http2 default_server;
#listen [::]:443 ssl;
server_name matrix.envs.net;
include snippets/ssl.conf;
## well-known
location /.well-known/matrix/support {
add_header Access-Control-Allow-Origin "$DO_CORS";
add_header Content-Type application/json;
return 200 '{"admins": [{"matrix_id": "@creme:envs.net", "email_address": "hostmaster@envs.net", "role": "admin"}]}';
}
location /.well-known/matrix/ {
add_header Access-Control-Allow-Origin "$DO_CORS";
add_header Content-Type application/json;
return 200 '{"m.server": "matrix.envs.net:443", "m.homeserver": {"base_url": "https://matrix.envs.net"}, "m.integrations": {"managers": [{"ui_url": "https://dimension.envs.net/riot", "api_url": "https://dimension.envs.net/api/v1/scalar"}, {"ui_url": "https://scalar.vector.im/", "api_url": "https://scalar.vector.im/api"}]}, "m.integrations_widget": {"url": "https://dimension.envs.net/riot", "data": {"api_url": "https://dimension.envs.net/api/v1/scalar"}}}';
}
## workers
include include.d/generic_worker.conf;
##
location ~* ^(\/_matrix|\/_synapse\/client) {
proxy_pass http://localhost:8008;
include include.d/synapse-proxy.conf;
}
# /synapse/admin
include include.d/synapse_admin.conf;
## media-repo
location ^~ /_matrix/media {
proxy_pass http://localhost:8000;
client_max_body_size 100M;
proxy_set_header Host envs.net;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_read_timeout 3600;
}
## appservice-irc
location ^~ /_matrix/provision {
allow 127.0.0.1;
deny all;
proxy_pass http://localhost:9999/_matrix/provision;
include include.d/synapse-proxy.conf;
}
## MAUBOT
location ^~ /_matrix/maubot {
proxy_pass http://localhost:29316/_matrix/maubot;
include include.d/synapse-proxy.conf;
}
# log
location ^~ /_matrix/maubot/v1/logs {
proxy_pass http://localhost:29316/_matrix/maubot/v1/logs;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
include include.d/synapse-proxy.conf;
}
##
location / {
proxy_pass http://localhost:8008;
include include.d/synapse-proxy.conf;
}
}
server {
listen 8448 ssl http2;
server_name matrix.envs.net;
include snippets/ssl.conf;
location / {
proxy_pass http://localhost:8008;
include include.d/synapse-proxy.conf;
}
}