commit 94c6545986f5db764af1dd29afeed652c386ab91 Author: 3wc <3wc.git@doesthisthing.work> Date: Tue Sep 8 18:38:35 2020 +0200 Initial import diff --git a/.envrc.sample b/.envrc.sample new file mode 100644 index 0000000..05162de --- /dev/null +++ b/.envrc.sample @@ -0,0 +1,6 @@ +export DOMAIN=matrix.example.com +export STACK_NAME=matrix + +export LETS_ENCRYPT_ENV=production + +export ENTRYPOINT_CONF_VERSION=v1 diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..126e230 --- /dev/null +++ b/compose.yml @@ -0,0 +1,47 @@ +--- +version: "3.8" + +services: + synapse: + image: "matrixdotorg/synapse:latest" + volumes: + - "data:/data" + environment: + - VIRTUAL_HOST=${DOMAIN} + - VIRTUAL_PORT=8008 + - LETSENCRYPT_HOST=${DOMAIN} + - SYNAPSE_SERVER_NAME=${DOMAIN} + - SYNAPSE_REPORT_STATS=no + networks: + - proxy + deploy: + labels: + - "traefik.enable=true" + - "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=8008" + - "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)" + - "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure" + - "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}" + restart_policy: + condition: on-failure + delay: "60s" + max_attempts: 3 + window: 120s + entrypoint: /docker-entrypoint.sh + configs: + - source: entrypoint_conf + target: /docker-entrypoint.sh + mode: 0555 + +volumes: + data: + +networks: + proxy: + external: true + internal: + +configs: + entrypoint_conf: + name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_CONF_VERSION} + file: entrypoint.sh.tmpl + template_driver: golang diff --git a/entrypoint.sh.tmpl b/entrypoint.sh.tmpl new file mode 100644 index 0000000..757c122 --- /dev/null +++ b/entrypoint.sh.tmpl @@ -0,0 +1,7 @@ +#!/bin/bash + +if [[ ! -f /data/homeserver.yaml ]]; then + /start.py generate +fi + +/start.py