From 62d98cac7144ce88dea98473028c9ec56bfc68b2 Mon Sep 17 00:00:00 2001
From: rick <rick@gnous.eu>
Date: Fri, 7 Mar 2025 22:36:18 +0100
Subject: [PATCH] fix and add traeffik and environnement configurations

change version for v-0.5
change db name
---
 compute-1-mep/conduwuit/docker-compose.yaml | 27 +++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/compute-1-mep/conduwuit/docker-compose.yaml b/compute-1-mep/conduwuit/docker-compose.yaml
index 1f39eb1..8d8666f 100644
--- a/compute-1-mep/conduwuit/docker-compose.yaml
+++ b/compute-1-mep/conduwuit/docker-compose.yaml
@@ -4,7 +4,7 @@ services:
   homeserver:
     ### If you already built the conduduwit image with 'docker build' or want to use the Docker Hub image,
     ### then you are ready to go.
-    image: girlbossceo/conduwuit:main-e3b81f7b6488b5c483e8b13e3959fe591bf4cb92
+    image: girlbossceo/conduwuit:v0.5.0-rc3-b6e9dc3d98704c56027219d3775336910a0136c6
     restart: unless-stopped
     volumes:
       - db:/var/lib/conduwuit
@@ -13,6 +13,17 @@ services:
       - 6167:6167
     networks:
       - proxy
+    environment:
+      CONDUWUIT_SERVER_NAME=matrix.gnous.eu
+      CONDUWUIT_DATABASE_PATH=/var/lib/conduwuit
+      CONDUWUIT_PORT=6167 # pas touche, c'est le port de Docker
+      CONDUWUIT_MAX_REQUEST_SIZE=20000000 # in bytes, ~20 MB
+      CONDUWUIT_ALLOW_REGISTRATION='true'
+      CONDUWUIT_ALLOW_FEDERATION='true'
+      CONDUWUIT_ALLOW_CHECK_FOR_UPDATES='true'
+      CONDUWUIT_TRUSTED_SERVERS='["matrix.org"]'
+      CONDUWUIT_LOG=warn,state_res=warn
+      CONDUWUIT_ADDRESS=0.0.0.0 # because in a container
     env_file:
       - .env
     #cpuset: "0-4" # Uncomment to limit to specific CPU cores
@@ -20,6 +31,18 @@ services:
       nofile:
         soft: 1048567
         hard: 1048567
+    labels:
+      - "traefik.enable=true"
+      - "traefik.http.routers.mastodon-web.entrypoints=websecure"
+      - "traefik.http.routers.mastodon-web.rule=Host(`matrix.gnous.eu`)"
+      - "traefik.http.routers.mastodon-web.middlewares=proxyHeader@file,proxyError@file"
+
+      # volé depuis https://community.traefik.io/t/setting-up-conduit-matrix-server-with-traefik/19394
+      - "traefik.http.routers.to-conduit.middlewares=cors-headers@docker"
+      - "traefik.http.middlewares.cors-headers.headers.accessControlAllowOriginList=*"
+      - "traefik.http.middlewares.cors-headers.headers.accessControlAllowHeaders=Origin, X-Requested-With, Content-Type, Accept, Authorization"
+      - "traefik.http.middlewares.cors-headers.headers.accessControlAllowMethods=GET, POST, PUT, DELETE, OPTIONS"
+
 
   ### Uncomment if you want to use your own Element-Web App.
   ### Note: You need to provide a config.json for Element and you also need a second
@@ -38,7 +61,7 @@ services:
   #        - homeserver
 
 volumes:
-  conduwuit_db:
+  db:
     driver: local
 
 networks: