networks: hs1-net: hs2-net: rc1-net: rc2-net: rc_host-net: element-net: services: traefik: image: traefik:v2.9 container_name: traefik command: - "--api.insecure=true" # - "--log.level=DEBUG" - "--providers.docker=true" - "--providers.docker.exposedbydefault=false" - "--entrypoints.web.address=:80" - "--entrypoints.websecure.address=:443" ports: - "80:80" - "443:443" - "8080:8080" volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - ./traefik/traefik.yml:/etc/traefik/traefik.yml:ro - ./traefik/dynamic_conf.yml:/etc/traefik/dynamic_conf.yml:ro - ./traefik/certs:/etc/traefik/certs:ro # - ./traefik-logs:/logs # Mount a volume for logs networks: # Defines and isolate one network per service to prevent inter service communication which # would not happen in real life. The name clashing between the host and service in the same # network (like rc1 service provided as rc1 host) is causing a bug on home server address # resolution which tries to communicate with the container directly some times and which does # not provide SSL neither the correct exposed ports. hs1-net: aliases: [hs1, hs2, rc1, rc2, rc.host, rocketchat.host] hs2-net: aliases: [hs1, hs2, rc1, rc2, rc.host, rocketchat.host] rc1-net: aliases: [hs1, hs2, rc1, rc2, rc.host, rocketchat.host] rc2-net: aliases: [hs1, hs2, rc1, rc2, rc.host, rocketchat.host] rc_host-net: aliases: [hs1, hs2, rc1, rc2, rc.host, rocketchat.host] element-net: aliases: [hs1, hs2, rc1, rc2, rc.host, rocketchat.host, element] # HomeServer 1 (synapse) hs1: image: matrixdotorg/synapse:latest # build: # context: ../synapse # dockerfile: ../synapse/docker/Dockerfile container_name: hs1 entrypoint: | sh -c "update-ca-certificates && /start.py & until curl -sf http://localhost:8008/_matrix/client/versions; do echo '=====> Waiting for Synapse...'; sleep 2; done; echo ''; echo '=====> Running register_new_matrix_user...'; register_new_matrix_user -u admin -p admin --admin http://localhost:8008 -c /data/homeserver.yaml | sed 's/^/=======> /'; register_new_matrix_user -u alice -p alice --admin http://localhost:8008 -c /data/homeserver.yaml | sed 's/^/=======> /'; register_new_matrix_user -u bob -p bob --admin http://localhost:8008 -c /data/homeserver.yaml | sed 's/^/=======> /'; register_new_matrix_user -u cleiton -p cleiton --admin http://localhost:8008 -c /data/homeserver.yaml | sed 's/^/=======> /'; echo '=====> Finished register_new_matrix_user.'; wait" volumes: - ./hs1:/data - ./traefik/certs/ca:/usr/local/share/ca-certificates networks: - hs1-net labels: - "traefik.enable=true" - "traefik.http.routers.hs1.rule=Host(`hs1`)" - "traefik.http.routers.hs1.entrypoints=websecure" - "traefik.http.routers.hs1.tls=true" - "traefik.http.services.hs1.loadbalancer.server.port=8008" # HomeServer 2 (synapse) hs2: image: matrixdotorg/synapse:latest container_name: hs2 hostname: hs2_container entrypoint: | sh -c "update-ca-certificates && /start.py & until curl -sf http://localhost:8008/_matrix/client/versions; do echo '=====> Waiting for Synapse...'; sleep 2; done; echo ''; echo '=====> Running register_new_matrix_user...'; register_new_matrix_user -u admin -p admin --admin http://localhost:8008 -c /data/homeserver.yaml | sed 's/^/=======> /'; register_new_matrix_user -u alice -p alice --admin http://localhost:8008 -c /data/homeserver.yaml | sed 's/^/=======> /'; register_new_matrix_user -u bob -p bob --admin http://localhost:8008 -c /data/homeserver.yaml | sed 's/^/=======> /'; register_new_matrix_user -u cleiton -p cleiton --admin http://localhost:8008 -c /data/homeserver.yaml | sed 's/^/=======> /'; echo '=====> Finished register_new_matrix_user.'; wait" volumes: - ./hs2:/data - ./traefik/certs/ca:/usr/local/share/ca-certificates networks: - hs2-net labels: - "traefik.enable=true" - "traefik.http.routers.hs2.rule=Host(`hs2`)" - "traefik.http.routers.hs2.entrypoints=websecure" - "traefik.http.routers.hs2.tls=true" - "traefik.http.services.hs2.loadbalancer.server.port=8008" profiles: - all - hs2 # Element element: image: vectorim/element-web container_name: element # ports: # - "8080:80" volumes: - ./element/config.json:/app/config.json networks: - element-net labels: - "traefik.enable=true" - "traefik.http.routers.element.rule=Host(`element`)" - "traefik.http.routers.element.entrypoints=websecure" - "traefik.http.routers.element.tls=true" - "traefik.http.services.element.loadbalancer.server.port=80" # HTTPS Redirect - "traefik.http.middlewares.element.redirectscheme.scheme=https" - "traefik.http.routers.element-http.rule=Host(`element`)" - "traefik.http.routers.element-http.middlewares=element" # Rocket.Chat rc1 (container) rc1: image: rocketchat/rocket.chat:7.11.0-rc.0 container_name: rc1 environment: ROOT_URL: https://rc1 PORT: 3000 MONGO_URL: mongodb://mongo:27017/rc1?replicaSet=rs0 NODE_EXTRA_CA_CERTS: /usr/local/share/ca-certificates/rootCA.pem LOG_LEVEL: debug ROCKETCHAT_LICENSE: ${ENTERPRISE_LICENSE_RC1} OVERWRITE_SETTING_Show_Setup_Wizard: completed OVERWRITE_SETTING_Federation_Service_Enabled: true OVERWRITE_SETTING_Federation_Service_Domain: rc1 OVERWRITE_SETTING_Federation_Service_Matrix_Signing_Key: ${MATRIX_SIGNING_KEY_RC1} OVERWRITE_SETTING_Cloud_Workspace_Client_Id: temp_id OVERWRITE_SETTING_Cloud_Workspace_Client_Secret: temp_secret ADMIN_USERNAME: admin ADMIN_PASS: admin ADMIN_EMAIL: admin@admin.com volumes: - ./traefik/certs/ca/rootCA.crt:/usr/local/share/ca-certificates/rootCA.pem networks: - rc1-net depends_on: - mongo labels: - "traefik.enable=true" - "traefik.http.routers.rc1.rule=Host(`rc1`)" - "traefik.http.routers.rc1.entrypoints=websecure" - "traefik.http.routers.rc1.tls=true" - "traefik.http.services.rc1.loadbalancer.server.port=3000" # HTTPS Redirect - "traefik.http.middlewares.rc1.redirectscheme.scheme=https" - "traefik.http.routers.rc1-http.rule=Host(`rc1`)" - "traefik.http.routers.rc1-http.middlewares=rc1" profiles: - all - rc1 # Rocket.Chat rc2 (container) rc2: image: rocketchat/rocket.chat:7.11.0-rc.0 container_name: rc2 environment: ROOT_URL: https://rc2 PORT: 3000 MONGO_URL: mongodb://mongo:27017/rc2?replicaSet=rs0 NODE_EXTRA_CA_CERTS: /usr/local/share/ca-certificates/rootCA.pem LOG_LEVEL: debug ROCKETCHAT_LICENSE: ${ENTERPRISE_LICENSE_RC2} OVERWRITE_SETTING_Show_Setup_Wizard: completed OVERWRITE_SETTING_Federation_Service_Enabled: true OVERWRITE_SETTING_Federation_Service_Domain: rc2 OVERWRITE_SETTING_Federation_Service_Matrix_Signing_Key: ${MATRIX_SIGNING_KEY_RC2} OVERWRITE_SETTING_Cloud_Workspace_Client_Id: temp_id OVERWRITE_SETTING_Cloud_Workspace_Client_Secret: temp_secret ADMIN_USERNAME: admin ADMIN_PASS: admin ADMIN_EMAIL: admin@admin.com volumes: - ./traefik/certs/ca/rootCA.crt:/usr/local/share/ca-certificates/rootCA.pem networks: - rc2-net depends_on: - mongo labels: - "traefik.enable=true" - "traefik.http.routers.rc2.rule=Host(`rc2`)" - "traefik.http.routers.rc2.entrypoints=websecure" - "traefik.http.routers.rc2.tls=true" - "traefik.http.services.rc2.loadbalancer.server.port=3000" # HTTPS Redirect - "traefik.http.middlewares.rc2.redirectscheme.scheme=https" - "traefik.http.routers.rc2-http.rule=Host(`rc2`)" - "traefik.http.routers.rc2-http.middlewares=rc2" profiles: - all - rc2 mongo: image: mongo:8.0 container_name: mongo restart: on-failure entrypoint: | bash -c "mongod --replSet rs0 --bind_ip_all & sleep 2; until mongosh --eval \"db.adminCommand('ping')\"; do echo '=====> Waiting for Mongo...'; sleep 1; done; echo '=====> Initiating ReplSet...'; mongosh --eval \"rs.initiate({_id: 'rs0', members: [{ _id: 0, host: 'mongo:27017' }]})\"; echo '=====> Initiating ReplSet done...'; wait" volumes: - ./mongodb/data:/data/db networks: - rc1-net - rc2-net profiles: - all - rc1 - rc2 well-known: image: nginx:latest container_name: well-known volumes: - ./nginx/matrix.conf:/etc/nginx/conf.d/matrix.conf labels: - "traefik.enable=true" - "traefik.http.routers.well-known.rule=Host(`rocketchat.host`)" - "traefik.http.services.well-known.loadbalancer.server.port=80" - "traefik.http.routers.well-known.entrypoints=websecure" - "traefik.http.routers.well-known.tls=true" # HTTPS Redirect - "traefik.http.middlewares.well-known.redirectscheme.scheme=https" - "traefik.http.routers.well-known-http.rule=Host(`well-known`)" - "traefik.http.routers.well-known-http.middlewares=well-known" networks: - rc_host-net