This repository has been archived on 2021-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
6 changed files with
69 additions and
4 deletions
|
|
|
@ -1,6 +1,11 @@
|
|
|
|
|
export DOMAIN=matrix.example.com
|
|
|
|
|
export STACK_NAME=matrix
|
|
|
|
|
export APP=matrix
|
|
|
|
|
|
|
|
|
|
export DOMAIN=matrix.example.com
|
|
|
|
|
export LETS_ENCRYPT_ENV=production
|
|
|
|
|
|
|
|
|
|
export ENTRYPOINT_CONF_VERSION=v1
|
|
|
|
|
|
|
|
|
|
## TURN server
|
|
|
|
|
#export TURNSERVER_CONF_VERSION=v1
|
|
|
|
|
#export COTURN_SHARED_SECRET_VERSION=v1
|
|
|
|
|
|
|
|
@ -9,9 +9,10 @@ image][synapse-docker].
|
|
|
|
|
3. Edit `.envrc` - be sure to change `$DOMAIN` to something that resolves to
|
|
|
|
|
your Docker swarm box
|
|
|
|
|
4. `direnv allow` (or `. .envrc`)
|
|
|
|
|
4. `abra secret_generate coturn_shared_secret`
|
|
|
|
|
5. `abra deploy`
|
|
|
|
|
6. `abra service_run synapse` to open a shell
|
|
|
|
|
7. `register_new_matrix_user -c /data/homeserver.yaml http://localhost:8008`
|
|
|
|
|
7. `abra register_new_matrix_user`
|
|
|
|
|
|
|
|
|
|
[synapse-docker]: https://hub.docker.com/r/matrixdotorg/synapse
|
|
|
|
|
[abra]: https://git.autonomic.zone/autonomic-cooperative/abra
|
|
|
|
|
|
|
|
@ -0,0 +1,3 @@
|
|
|
|
|
sub_register_new_matrix_user() {
|
|
|
|
|
abra run synapse register_new_matrix_user -c /data/homeserver.yaml http://localhost:8008
|
|
|
|
|
}
|
|
|
|
@ -5,13 +5,15 @@ services:
|
|
|
|
|
synapse:
|
|
|
|
|
image: "matrixdotorg/synapse:latest"
|
|
|
|
|
volumes:
|
|
|
|
|
- "data:/data"
|
|
|
|
|
- "synapse:/data"
|
|
|
|
|
environment:
|
|
|
|
|
- VIRTUAL_HOST=${DOMAIN}
|
|
|
|
|
- VIRTUAL_PORT=8008
|
|
|
|
|
- LETSENCRYPT_HOST=${DOMAIN}
|
|
|
|
|
- SYNAPSE_SERVER_NAME=${DOMAIN}
|
|
|
|
|
- SYNAPSE_REPORT_STATS=no
|
|
|
|
|
- TURN_SERVER=${DOMAIN}
|
|
|
|
|
- TURN_PORT=3478
|
|
|
|
|
networks:
|
|
|
|
|
- proxy
|
|
|
|
|
deploy:
|
|
|
|
@ -31,17 +33,45 @@ services:
|
|
|
|
|
- source: entrypoint_conf
|
|
|
|
|
target: /docker-entrypoint.sh
|
|
|
|
|
mode: 0555
|
|
|
|
|
secrets:
|
|
|
|
|
- coturn_shared_secret
|
|
|
|
|
|
|
|
|
|
coturn:
|
|
|
|
|
image: instrumentisto/coturn:latest
|
|
|
|
|
networks:
|
|
|
|
|
- swarm_host
|
|
|
|
|
secrets:
|
|
|
|
|
- coturn_shared_secret
|
|
|
|
|
configs:
|
|
|
|
|
- source: turnserver_conf
|
|
|
|
|
target: /etc/coturn/turnserver.conf
|
|
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
|
data:
|
|
|
|
|
synapse:
|
|
|
|
|
traefik_letsencrypt:
|
|
|
|
|
external: true
|
|
|
|
|
|
|
|
|
|
networks:
|
|
|
|
|
proxy:
|
|
|
|
|
external: true
|
|
|
|
|
internal:
|
|
|
|
|
# use host-mode networking until Docker can handle mass port-forwards:
|
|
|
|
|
# https://github.com/moby/moby/issues/11185
|
|
|
|
|
swarm_host:
|
|
|
|
|
external:
|
|
|
|
|
name: 'host'
|
|
|
|
|
|
|
|
|
|
configs:
|
|
|
|
|
entrypoint_conf:
|
|
|
|
|
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_CONF_VERSION}
|
|
|
|
|
file: entrypoint.sh.tmpl
|
|
|
|
|
template_driver: golang
|
|
|
|
|
turnserver_conf:
|
|
|
|
|
name: ${STACK_NAME}_turnserver_conf_${TURNSERVER_CONF_VERSION}
|
|
|
|
|
file: turnserver.conf.tmpl
|
|
|
|
|
template_driver: golang
|
|
|
|
|
|
|
|
|
|
secrets:
|
|
|
|
|
coturn_shared_secret:
|
|
|
|
|
external: true
|
|
|
|
|
name: ${STACK_NAME}_coturn_shared_secret_${COTURN_SHARED_SECRET_VERSION}
|
|
|
|
|
|
|
|
@ -2,6 +2,17 @@
|
|
|
|
|
|
|
|
|
|
if [[ ! -f /data/homeserver.yaml ]]; then
|
|
|
|
|
/start.py generate
|
|
|
|
|
|
|
|
|
|
apt update && apt install -y wget
|
|
|
|
|
wget https://github.com/mikefarah/yq/releases/download/3.3.2/yq_linux_amd64 && \
|
|
|
|
|
chmod +x yq_linux_amd64 && \
|
|
|
|
|
mv yq_linux_amd64 /bin/yq
|
|
|
|
|
|
|
|
|
|
# turn (https://github.com/matrix-org/synapse/blob/master/docs/turn-howto.md#synapse-setup)
|
|
|
|
|
yq w -i /data/homeserver.yaml turn_uris "[]"
|
|
|
|
|
yq w -i /data/homeserver.yaml turn_uris\[0\] "turn:${TURN_SERVER}:${TURN_PORT}?transport=udp"
|
|
|
|
|
yq w -i /data/homeserver.yaml turn_uris\[1\] "turn:${TURN_SERVER}:${TURN_PORT}?transport=tcp"
|
|
|
|
|
yq w -i /data/homeserver.yaml coturn_shared_secret "$(tr -d \"\n\" < /run/secrets/coturn_shared_secret)"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
/start.py
|
|
|
|
|
|
|
|
@ -0,0 +1,15 @@
|
|
|
|
|
use-auth-secret
|
|
|
|
|
static-auth-secret={{ secret "coturn_shared_secret" }}
|
|
|
|
|
realm=turn.{{ env "DOMAIN" }}
|
|
|
|
|
|
|
|
|
|
log-file=stdout
|
|
|
|
|
pidfile=/var/tmp/turnserver.pid
|
|
|
|
|
userdb=/var/tmp/turnserver.db
|
|
|
|
|
|
|
|
|
|
no-cli
|
|
|
|
|
|
|
|
|
|
no-tls
|
|
|
|
|
no-dtls
|
|
|
|
|
|
|
|
|
|
prod
|
|
|
|
|
no-tcp-relay
|