mirror of
https://github.com/aykhans/my-self-host-services.git
synced 2026-10-17 12:33:53 +00:00
add matrix
This commit is contained in:
1 parent
14f48aae55
commit
c2622dc6ac
7 files changed
+113
No files matched your search
@@ -61,6 +61,7 @@ Edit the generated `.env` files to fill in the required fields:
|
|||||||
- `./caddy/.env`
|
- `./caddy/.env`
|
||||||
- `./crowdsec/.env`
|
- `./crowdsec/.env`
|
||||||
- `./prometheus/.env`
|
- `./prometheus/.env`
|
||||||
|
- `./matrix/.env` (set `POSTGRES_PASSWORD`; must match the DB password in `./matrix/data/synapse/homeserver.yaml`)
|
||||||
- `./caddy/Caddyfile.private`
|
- `./caddy/Caddyfile.private`
|
||||||
|
|
||||||
### 4. Bouncer Keys (CrowdSec)
|
### 4. Bouncer Keys (CrowdSec)
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ GOPKG_PROXY_DOMAIN=
|
|||||||
############# Ech0 #############
|
############# Ech0 #############
|
||||||
ECH0_DOMAIN=
|
ECH0_DOMAIN=
|
||||||
|
|
||||||
|
############# Matrix #############
|
||||||
|
MATRIX_DOMAIN=
|
||||||
|
|
||||||
############# CrowdSec #############
|
############# CrowdSec #############
|
||||||
# Same value as CROWDSEC_BOUNCER_KEY_CADDY in crowdsec/.env
|
# Same value as CROWDSEC_BOUNCER_KEY_CADDY in crowdsec/.env
|
||||||
CROWDSEC_API_KEY=
|
CROWDSEC_API_KEY=
|
||||||
@@ -155,12 +155,25 @@
|
|||||||
request_body {
|
request_body {
|
||||||
max_size 124MB
|
max_size 124MB
|
||||||
}
|
}
|
||||||
|
# Matrix federation/client delegation (server_name = apex domain)
|
||||||
|
handle /.well-known/matrix/server {
|
||||||
|
header Content-Type application/json
|
||||||
|
header Access-Control-Allow-Origin *
|
||||||
|
respond `{"m.server":"{$MATRIX_DOMAIN}:443"}`
|
||||||
|
}
|
||||||
|
handle /.well-known/matrix/client {
|
||||||
|
header Content-Type application/json
|
||||||
|
header Access-Control-Allow-Origin *
|
||||||
|
respond `{"m.homeserver":{"base_url":"https://{$MATRIX_DOMAIN}"}}`
|
||||||
|
}
|
||||||
|
handle {
|
||||||
route {
|
route {
|
||||||
import security
|
import security
|
||||||
reverse_proxy http://ghost:2368 {
|
reverse_proxy http://ghost:2368 {
|
||||||
header_up Host {http.request.host}
|
header_up Host {http.request.host}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
############## immich ##############
|
############## immich ##############
|
||||||
@@ -252,4 +265,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
############## matrix (synapse) ##############
|
||||||
|
{$MATRIX_DOMAIN} {
|
||||||
|
import access-log
|
||||||
|
request_body {
|
||||||
|
max_size 512MB
|
||||||
|
}
|
||||||
|
route {
|
||||||
|
import security
|
||||||
|
@matrix path /_matrix/* /_synapse/client/*
|
||||||
|
reverse_proxy @matrix http://synapse:8008 {
|
||||||
|
header_up Host {http.request.host}
|
||||||
|
}
|
||||||
|
respond 404
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
import Caddyfile.private
|
import Caddyfile.private
|
||||||
@@ -66,6 +66,7 @@ generate_env_files() {
|
|||||||
cp --update=none ./stalwart/.env.example ./stalwart/.env
|
cp --update=none ./stalwart/.env.example ./stalwart/.env
|
||||||
cp --update=none ./crowdsec/.env.example ./crowdsec/.env
|
cp --update=none ./crowdsec/.env.example ./crowdsec/.env
|
||||||
cp --update=none ./prometheus/.env.example ./prometheus/.env
|
cp --update=none ./prometheus/.env.example ./prometheus/.env
|
||||||
|
cp --update=none ./matrix/.env.example ./matrix/.env
|
||||||
cp --update=none ./caddy/Caddyfile.private.example ./caddy/Caddyfile.private
|
cp --update=none ./caddy/Caddyfile.private.example ./caddy/Caddyfile.private
|
||||||
print_success ".env files generated."
|
print_success ".env files generated."
|
||||||
}
|
}
|
||||||
@@ -216,6 +217,15 @@ start_services() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Starting matrix..."
|
||||||
|
$DOCKER_COMPOSE_COMMAND -f ./matrix/docker-compose.yaml up --pull always -d
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
print_success "Matrix started successfully."
|
||||||
|
else
|
||||||
|
print_error "failed to start Matrix!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Starting crowdsec..."
|
echo "Starting crowdsec..."
|
||||||
$DOCKER_COMPOSE_COMMAND -f ./crowdsec/docker-compose.yaml up --pull always -d
|
$DOCKER_COMPOSE_COMMAND -f ./crowdsec/docker-compose.yaml up --pull always -d
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@@ -412,6 +422,15 @@ stop_services() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Stopping matrix..."
|
||||||
|
$DOCKER_COMPOSE_COMMAND -f ./matrix/docker-compose.yaml down
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
print_success "Matrix stopped successfully."
|
||||||
|
else
|
||||||
|
print_error "failed to stop Matrix!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Stopping watchtower..."
|
echo "Stopping watchtower..."
|
||||||
$DOCKER_COMPOSE_COMMAND -f ./watchtower/docker-compose.yaml down
|
$DOCKER_COMPOSE_COMMAND -f ./watchtower/docker-compose.yaml down
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
POSTGRES_PASSWORD=
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/data
|
||||||
|
.env
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
networks:
|
||||||
|
caddy:
|
||||||
|
name: caddy
|
||||||
|
driver: bridge
|
||||||
|
external: true
|
||||||
|
matrix:
|
||||||
|
name: matrix
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
services:
|
||||||
|
synapse:
|
||||||
|
image: ghcr.io/element-hq/synapse:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
container_name: synapse
|
||||||
|
labels:
|
||||||
|
- "com.centurylinklabs.watchtower.enable=true"
|
||||||
|
environment:
|
||||||
|
UID: 1000
|
||||||
|
GID: 100
|
||||||
|
SYNAPSE_CONFIG_DIR: /data
|
||||||
|
SYNAPSE_CONFIG_PATH: /data/homeserver.yaml
|
||||||
|
volumes:
|
||||||
|
- ./data/synapse:/data
|
||||||
|
networks:
|
||||||
|
- caddy
|
||||||
|
- matrix
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "100m"
|
||||||
|
max-file: "3"
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
container_name: synapse-db
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: synapse
|
||||||
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||||
|
POSTGRES_DB: synapse
|
||||||
|
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C"
|
||||||
|
volumes:
|
||||||
|
- ./data/postgres:/var/lib/postgresql/data
|
||||||
|
networks:
|
||||||
|
- matrix
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U synapse"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "100m"
|
||||||
|
max-file: "3"
|
||||||
Reference in new issue
Block a user