parent
93ae4d6c8a
commit
b7cce0a516
|
@ -1,4 +1,6 @@
|
|||
DOMAIN=matrix.example.com
|
||||
TYPE=matrix
|
||||
|
||||
DOMAIN=matrix.example.com
|
||||
LETS_ENCRYPT_ENV=production
|
||||
|
||||
SECRET_DB_PASSWORD_VERSION=v1
|
||||
|
|
30
README.md
30
README.md
|
@ -3,14 +3,15 @@
|
|||
[![Build Status](https://drone.autonomic.zone/api/badges/coop-cloud/matrix-synapse/status.svg?ref=refs/heads/main)](https://drone.autonomic.zone/coop-cloud/matrix-synapse)
|
||||
|
||||
<!-- metadata -->
|
||||
* **Category**: Apps
|
||||
* **Status**: 0, work-in-progress
|
||||
* **Image**: [`matrixdotorg/synapse`](https://hub.docker.com/r/matrixdotorg/synapse), 4, upstream
|
||||
* **Healthcheck**: Yes
|
||||
* **Backups**: No
|
||||
* **Email**: No
|
||||
* **Tests**: No
|
||||
* **SSO**: No
|
||||
|
||||
- **Category**: Apps
|
||||
- **Status**: 0, work-in-progress
|
||||
- **Image**: [`matrixdotorg/synapse`](https://hub.docker.com/r/matrixdotorg/synapse), 4, upstream
|
||||
- **Healthcheck**: Yes
|
||||
- **Backups**: No
|
||||
- **Email**: No
|
||||
- **Tests**: No
|
||||
- **SSO**: No
|
||||
<!-- endmetadata -->
|
||||
|
||||
## Basic usage
|
||||
|
@ -27,3 +28,16 @@
|
|||
|
||||
[abra]: https://git.autonomic.zone/autonomic-cooperative/abra
|
||||
[cc-traefik]: https://git.autonomic.zone/coop-cloud/traefik
|
||||
|
||||
## Tips & Tricks
|
||||
|
||||
### Generating a new `homeserver.yaml`
|
||||
|
||||
```
|
||||
docker run -it \
|
||||
--entrypoint="" \
|
||||
-e SYNAPSE_SERVER_NAME=foo.com \
|
||||
-e SYNAPSE_REPORT_STATS=no \
|
||||
matrixdotorg/synapse:v1.48.0 \
|
||||
sh -c '/start.py generate; cat /data/homeserver.yaml' > homeserver.yaml.tmpl`
|
||||
```
|
||||
|
|
32
compose.yml
32
compose.yml
|
@ -6,16 +6,21 @@ services:
|
|||
image: "matrixdotorg/synapse:v1.48.0"
|
||||
volumes:
|
||||
- "data:/data"
|
||||
secrets:
|
||||
- db_password
|
||||
environment:
|
||||
- VIRTUAL_HOST=${DOMAIN}
|
||||
- VIRTUAL_PORT=8008
|
||||
- LETSENCRYPT_HOST=${DOMAIN}
|
||||
- SYNAPSE_SERVER_NAME=${DOMAIN}
|
||||
- SYNAPSE_REPORT_STATS=no
|
||||
- SYNAPSE_DB_PASSWORD_FILE=/run/secrets/db_password
|
||||
networks:
|
||||
- proxy
|
||||
entrypoint: /docker-entrypoint.sh
|
||||
configs:
|
||||
- source: homeserver_yaml
|
||||
target: /data/homeserver.yaml
|
||||
- source: entrypoint_conf
|
||||
target: /docker-entrypoint.sh
|
||||
mode: 0555
|
||||
|
@ -33,8 +38,26 @@ services:
|
|||
max_attempts: 3
|
||||
window: 120s
|
||||
|
||||
db:
|
||||
image: postgres:13-alpine
|
||||
secrets:
|
||||
- db_password
|
||||
environment:
|
||||
POSTGRES_DB: synapse
|
||||
POSTGRES_USER: synapse
|
||||
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
|
||||
# https://matrix-org.github.io/synapse/latest/postgres.html#set-up-database
|
||||
POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
|
||||
networks:
|
||||
- internal
|
||||
healthcheck:
|
||||
test: ["CMD", "pg_isready", "-U", "synapse"]
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
|
||||
volumes:
|
||||
data:
|
||||
postgres:
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
|
@ -46,3 +69,12 @@ configs:
|
|||
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_CONF_VERSION}
|
||||
file: entrypoint.sh.tmpl
|
||||
template_driver: golang
|
||||
homeserver_yaml:
|
||||
name: ${STACK_NAME}_homserver_yaml_${HOMESERVER_YAML_VERSION}
|
||||
file: homeserver.yaml.tmpl
|
||||
template_driver: golang
|
||||
|
||||
secrets:
|
||||
db_password:
|
||||
external: true
|
||||
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
|
||||
|
|
|
@ -1,7 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ ! -f /data/homeserver.yaml ]]; then
|
||||
/start.py generate
|
||||
fi
|
||||
set -e
|
||||
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
|
||||
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local val="$def"
|
||||
|
||||
if [ "${!var:-}" ]; then
|
||||
val="${!var}"
|
||||
elif [ "${!fileVar:-}" ]; then
|
||||
val="$(< "${!fileVar}")"
|
||||
fi
|
||||
|
||||
export "$var"="$val"
|
||||
unset "$fileVar"
|
||||
}
|
||||
|
||||
file_env "POSTGRES_DB_PASSWORD"
|
||||
|
||||
/start.py
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue