Files
tuwunel/compose.yml

73 lines
3.1 KiB
YAML

# Gratefully cribbed from https://matrix-construct.github.io/tuwunel/deploying/docker-compose.for-traefik.yml
---
services:
app:
image: jevolk/tuwunel:v1.5.1
volumes:
- db:/var/lib/tuwunel
networks:
- proxy
environment:
TUWUNEL_SERVER_NAME: '${SERVER_NAME}'
TUWUNEL_DATABASE_PATH: /var/lib/tuwunel
TUWUNEL_PORT: 6167
TUWUNEL_MAX_REQUEST_SIZE: 20000000 # in bytes, ~20 MB
TUWUNEL_ALLOW_REGISTRATION: $ALLOW_REGISTRATION
TUWUNEL_REGISTRATION_TOKEN_FILE: /run/secrets/reg_token
TUWUNEL_ALLOW_FEDERATION: '${ALLOW_FEDERATION}'
TUWUNEL_TRUSTED_SERVERS: '${TRUSTED_SERVERS}'
#TODO: expose TUWUNEL_LOG?
TUWUNEL_ADDRESS: 0.0.0.0
# We need some way to serve the client and server .well-known json. The simplest way is via the TUWUNEL_WELL_KNOWN
# variable / config option, there are multiple ways to do this, e.g. in the tuwunel.toml file, and in a separate
# see the override file for more information about delegation
TUWUNEL_WELL_KNOWN: |
{
client=https://$DOMAIN,
server=$DOMAIN:443
}
ulimits:
nofile:
soft: 1048567
hard: 1048567
deploy:
restart_policy:
condition: on-failure
labels:
- "coop-cloud.${STACK_NAME}.version=1.0.0+v1.5.1"
- "traefik.enable=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=6167"
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
# Serve ${DOMAIN}, but also /_matrix and /.well-known/matrix for ${SERVER_NAME} if it's different.
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS}) || (Host(`${SERVER_NAME}`) && (PathPrefix(`/_matrix`) || PathPrefix(`/.well-known/matrix`)))"
# Redirect HTTP to HTTPS
- "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.scheme=https"
- "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.permanent=true"
# Overly permissive to allow web-hosted clients from other domains
- "traefik.http.middlewares.${STACK_NAME}.headers.accesscontrolalloworiginlist=*"
- "traefik.http.middlewares.${STACK_NAME}.headers.accesscontrolallowmethods=GET,OPTIONS,PUT"
- "traefik.http.middlewares.${STACK_NAME}.headers.accesscontrolallowheaders=*"
- "traefik.http.middlewares.${STACK_NAME}.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.${STACK_NAME}.headers.addvaryheader=true"
## TODO: test and enable backups: https://docs.coopcloud.tech/maintainers/handbook/#how-do-i-configure-backuprestore
# - "backupbot.backup=true"
# - "backupbot.backup.path=/some/path"
## TODO: find a healthcheck endpoint
secrets:
- reg_token
secrets:
reg_token:
name: ${STACK_NAME}_reg_token_${SECRET_REG_TOKEN_VERSION}
external: true
networks:
proxy:
external: true
volumes:
db: