diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..4e42e50 --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +DOMAIN= +COTURN_AUTH_SECRET= \ No newline at end of file diff --git a/README.md b/README.md index b758cc5..1be7466 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,21 @@ # matrix-server -self-hosted matrix server configuration \ No newline at end of file +self-hosted matrix server configuration + +## Requirements +### VPS +2GB RAM sollte passen, wenn wir ned ins föderierte Multiversum wollen +- https://www.ionos.de/server/vps +- https://www.hetzner.com/cloud + +### Domain +Domain = Server-Name = User-Identity +Namen später ändern heißt: Chatverläufe und User weg... +- https://www.namecheap.com/ + +## Setup +1. VPS Setup, imo Debian beschde weil light-weight +2. Docker install +3. Clone repo +4. `docker-compose up -d` +5. fertig? kp \ No newline at end of file diff --git a/config/Caddyfile b/config/Caddyfile new file mode 100644 index 0000000..7a15afe --- /dev/null +++ b/config/Caddyfile @@ -0,0 +1,7 @@ +matrix.{$DOMAIN} { + reverse_proxy conduit:6167 +} + +element.{$DOMAIN} { + reverse_proxy element:80 +} \ No newline at end of file diff --git a/config/conduit.toml b/config/conduit.toml new file mode 100644 index 0000000..97f886a --- /dev/null +++ b/config/conduit.toml @@ -0,0 +1,17 @@ +[global] +server_name = "matrix.${DOMAIN}" + +database_backend = "rocksdb" +database_path = "/var/lib/matrix-conduit/" + +address = "0.0.0.0" +port = 6167 + +# Turn on only long enough to create your first accounts +allow_registration = true + +allow_federation = false + +# TURN configuration +turn_uris = ["turn:${DOMAIN}:3478?transport=udp","turns:${DOMAIN}:5349?transport=tcp"] +turn_secret = ${COTURN_AUTH_SECRET} \ No newline at end of file diff --git a/config/element_config.template.json b/config/element_config.template.json new file mode 100644 index 0000000..206076d --- /dev/null +++ b/config/element_config.template.json @@ -0,0 +1,11 @@ +{ + "default_server_config": { + "m.homeserver": { + "base_url": "https://matrix.${DOMAIN}", + "server_name": "matrix.${DOMAIN}" + } + }, + "disable_custom_urls": true, + "disable_guests": true, + "brand": "My Matrix" +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d4b4ee0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,79 @@ +version: "3.8" + +services: + conduit: + image: matrixconduit/matrix-conduit:latest + container_name: conduit + restart: unless-stopped + volumes: + - conduit_data:/var/lib/matrix-conduit/ + - ./config/conduit.toml:/etc/conduit.toml:ro + environment: + DOMAIN: ${DOMAIN} + COTURN_AUTH_SECRET: ${COTURN_AUTH_SECRET} + CONDUIT_CONFIG: /etc/conduit.toml + networks: + - matrix + + element: + image: vectorim/element-web:latest + container_name: element + restart: unless-stopped + environment: + - DOMAIN=${DOMAIN} + volumes: + - ./config/element_config.template.json:/app/config.template.json:ro + command: sh -c "envsubst < /app/config.template.json > /app/config.json && /docker-entrypoint.sh" + networks: + - matrix + + caddy: + image: caddy:latest + container_name: caddy + restart: unless-stopped + environment: + - DOMAIN=${DOMAIN} + ports: + - "80:80" + - "443:443" + volumes: + - ./config/Caddyfile:/etc/caddy/Caddyfile + - caddy_data:/data + - caddy_config:/config + networks: + - matrix + + coturn: + image: coturn/coturn:latest + container_name: coturn + restart: unless-stopped + environment: + - DOMAIN=${DOMAIN} + - COTURN_AUTH_SECRET=${COTURN_AUTH_SECRET} + command: > + -n + --log-file=stdout + --external-ip=YOUR_SERVER_PUBLIC_IP + --realm=$$DOMAIN + --use-auth-secret + --static-auth-secret=$$COTURN_AUTH_SECRET + --no-cli + --listening-port=3478 + --tls-listening-port=5349 + --fingerprint + ports: + - "3478:3478" + - "3478:3478/udp" + - "5349:5349" + - "5349:5349/udp" + - "49152-49200:49152-49200/udp" + networks: + - matrix + +volumes: + conduit_data: + caddy_data: + caddy_config: + +networks: + matrix: diff --git a/docs/note.exe b/docs/note.exe new file mode 100755 index 0000000..a1111ae Binary files /dev/null and b/docs/note.exe differ