working on matrix setup

This commit is contained in:
venus
2026-06-06 23:08:36 -05:00
parent 810a063461
commit 1dd9756e6f
4 changed files with 43 additions and 15 deletions

View File

@@ -5,6 +5,9 @@ services:
image: traefik:v3.6 image: traefik:v3.6
container_name: traefik container_name: traefik
restart: unless-stopped restart: unless-stopped
dns:
- 1.1.1.1
- 8.8.8.8
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
@@ -12,6 +15,9 @@ services:
- "/var/run/docker.sock:/var/run/docker.sock" # running as root TODO need to make new user - "/var/run/docker.sock:/var/run/docker.sock" # running as root TODO need to make new user
- "./letsencrypt:/letsencrypt" - "./letsencrypt:/letsencrypt"
- "./traefik.yml:/etc/traefik/traefik.yml:ro" # sets the traefik.yml file as the options file for configuring proxy settings - "./traefik.yml:/etc/traefik/traefik.yml:ro" # sets the traefik.yml file as the options file for configuring proxy settings
environment:
- DESEC_TOKEN=RnKb69i8npX4HyvLr25NnQ1p25Kr
- LEGO_DISABLE_CNAME_SUPPORT=true
networks: networks:
traefik: traefik:
ipv4_address: 172.21.0.10 ipv4_address: 172.21.0.10
@@ -52,7 +58,7 @@ services:
ports: ports:
- "51820:51820/udp" - "51820:51820/udp"
networks: networks:
backend: {} traefik: {}
frontend: {} frontend: {}
labels: labels:
@@ -75,7 +81,7 @@ services:
networks: networks:
# Backend network for docker containers to talk to eachother # Backend network for docker containers to talk to eachother
backend: traefik:
name: traefik name: traefik
external: true external: true
# VPN network for external devices to connect to the server # VPN network for external devices to connect to the server

View File

@@ -26,7 +26,7 @@ services:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.gitea.rule=Host(`git.riverrooks.dev`)" - "traefik.http.routers.gitea.rule=Host(`git.riverrooks.dev`)"
- "traefik.http.routers.gitea.entrypoints=websecure" - "traefik.http.routers.gitea.entrypoints=websecure"
- "traefik.http.routers.gitea.tls.certresolver=myresolver" - "traefik.http.routers.gitea.tls.certresolver=desecresolver"
# Explicitly tell Traefik to send the web traffic to internal port 3000 # Explicitly tell Traefik to send the web traffic to internal port 3000
- "traefik.http.services.gitea.loadbalancer.server.port=3000" - "traefik.http.services.gitea.loadbalancer.server.port=3000"
# Tell Traefik to exclusively use the 'proxy' network to route traffic # Tell Traefik to exclusively use the 'proxy' network to route traffic

View File

@@ -1,5 +1,3 @@
version: '3.8'
services: services:
synapse-db: synapse-db:
image: postgres:16-alpine image: postgres:16-alpine
@@ -9,6 +7,7 @@ services:
POSTGRES_USER: synapse_user POSTGRES_USER: synapse_user
POSTGRES_PASSWORD: ${SYNAPSE_DB_PASSWORD} POSTGRES_PASSWORD: ${SYNAPSE_DB_PASSWORD}
POSTGRES_DB: synapse-db POSTGRES_DB: synapse-db
POSTGRES_INITDB_ARGS: "--locale=C --encoding=UTF8"
volumes: volumes:
- ./postgres_data:/var/lib/postgresql/data - ./postgres_data:/var/lib/postgresql/data
networks: networks:
@@ -39,9 +38,6 @@ services:
- "traefik.http.routers.matrix.tls=true" - "traefik.http.routers.matrix.tls=true"
- "traefik.http.routers.matrix.tls.certresolver=basic" - "traefik.http.routers.matrix.tls.certresolver=basic"
- "traefik.http.routers.matrix.middlewares=matrix-raw-path"
- "traefik.http.routers.matrix.middlewares.matrix-raw-path.plugin.allowEncodedSlash=true"
networks: networks:
- matrix-net - matrix-net
- traefik - traefik
@@ -49,17 +45,29 @@ services:
image: nginx:alpine image: nginx:alpine
container_name: matrix-delegation container_name: matrix-delegation
restart: unless-stopped restart: unless-stopped
# Generates the file dynamically and starts nginx # 1. Using "|" keeps literal newlines so the script executes perfectly
command: > command: >
/bin/sh -c "mkdir -p /usr/share/nginx/html/.well-known/matrix /bin/sh -c "mkdir -p /usr/share/nginx/html/.well-known/matrix && echo '{\"m.server\": \"matrix.riverrooks.dev:443\"}' > /usr/share/nginx/html/.well-known/matrix/server && nginx -g 'daemon off;'"
&& echo '{\"m.server\": \"matrix.riverrooks.dev:443\"}' > /usr/share/nginx/html/.well-known/matrix/server
&& nginx -g 'daemon off;'"
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
# Crucial: This intercepts only the specific Matrix path on the root domain
- "traefik.http.routers.matrix-delegation.rule=Host(`riverrooks.dev`) && PathPrefix(`/.well-known/matrix/server`)" - "traefik.http.routers.matrix-delegation.rule=Host(`riverrooks.dev`) && PathPrefix(`/.well-known/matrix/server`)"
- "traefik.http.routers.matrix-delegation.entrypoints=websecure" - "traefik.http.routers.matrix-delegation.entrypoints=websecure"
- "traefik.http.routers.matrix-delegation.tls.certresolver=basic" - "traefik.http.routers.matrix-delegation.tls.certresolver=desecresolver"
# 2. Added the traefik network so Traefik can actually reach this container
networks:
- matrix-net
- traefik
mautrix-gmessages:
image: dock.mau.fi/mautrix/gmessages:latest
container_name: mautrix-gmessages
restart: unless-stopped
volumes:
- ./data:/data
networks:
- matrix-net
depends_on:
- synapse-db
- synapse
networks: networks:

View File

@@ -23,6 +23,10 @@ entryPoints:
scheme: https scheme: https
websecure: websecure:
address: ":443" address: ":443"
http:
encodedCharacters:
allowEncodedSlash: true
allowEncodedHash: true # This is crucial for Matrix room aliases!
certificatesResolvers: certificatesResolvers:
basic: basic:
@@ -31,3 +35,13 @@ certificatesResolvers:
storage: /letsencrypt/acme.json storage: /letsencrypt/acme.json
# Use the TLS challenge for domain verification # Use the TLS challenge for domain verification
tlsChallenge: {} tlsChallenge: {}
desecresolver:
acme:
email: web-admin@riverrooks.art
storage: /letsencrypt/acme.json
dnsChallenge:
provider: desec
delayBeforeCheck: 15
resolvers:
- "1.1.1.1:53"
- "8.8.8.8:53"