version: '2.3'
services:
  postgres:
    container_name: synapse_db
    image: postgres:14
    restart: unless-stopped
    volumes:
      - /mnt/hdd/docker/synapse_db:/var/lib/postgresql/data
    # These will be used in homeserver.yaml later on
    environment:
      - POSTGRES_DB=synapse
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=EjZ5AWAZAme2YvSr8uoWMm7csmXGY3rq
    networks:
      db_net:
  synapse:
    container_name: synapse
    image: matrixdotorg/synapse:latest
    restart: unless-stopped
    volumes:
      - /mnt/hdd/docker/matrix/synapse_data/:/data
    environment:
      UID: "1000"
      GID: "1000"
      TZ: "Europe/Berlin"
    labels:
      - traefik.enable=true
      - traefik.http.routers.synapse.entrypoints=websecure
      - traefik.http.routers.synapse.rule=Host(`synapse.ghoscht.com`, `localsynapse.ghoscht.com`,`synapse.local.ghoscht.com`)
      - traefik.docker.network=traefik-net
      - traefik.http.routers.synapse.tls=true
      - traefik.http.routers.synapse.tls.certresolver=lencrypt
    networks:
      net:
      db_net:
  #    profiles:
  #      - donotstart

  element:
    container_name: element
    image: vectorim/element-web:latest
    restart: unless-stopped
    volumes:
      - /mnt/hdd/docker/element_data/element-config.json:/app/config.json
    labels:
      - traefik.enable=true
      - traefik.http.routers.element.entrypoints=websecure
      - traefik.http.routers.element.rule=Host(`chat.ghoscht.com`)
      - traefik.docker.network=traefik-net
      - traefik.http.routers.element.tls=true
      - traefik.http.routers.element.tls.certresolver=lencrypt
    networks:
      net:
  redis:
    container_name: synapse_cache
    image: "redis:latest"
    restart: "unless-stopped"
    networks:
      db_net:
  nginx:
    container_name: matrix_nginx
    image: "nginx:latest"
    restart: "unless-stopped"
    volumes:
      - /mnt/hdd/docker/matrix/nginx_data/matrix.conf:/etc/nginx/conf.d/matrix.conf
      - /mnt/hdd/docker/matrix/nginx_data/www:/var/www/
    labels:
      - traefik.enable=true
      - traefik.http.routers.matrix-nginx.entrypoints=websecure
      - traefik.http.routers.matrix-nginx.rule=Host(`matrix.ghoscht.com`, `localmatrix.ghoscht.com`,`matrix.local.ghoscht.com`)
      - traefik.docker.network=traefik-net
      - traefik.http.routers.matrix-nginx.tls=true
      - traefik.http.routers.matrix-nginx.tls.certresolver=lencrypt
    networks:
      net:
      db_net:
#  cloudflared:
#    container_name: cloudflared
#    image: cloudflare/cloudflared:latest
#    restart: always
#    command: tunnel --no-autoupdate run
#    env_file:
#      - cloudflared.env
#    networks:
#      net:
#      db_net:

#  matterbridge:
#    container_name: matterbridge
#    image: 42wim/matterbridge:stable
#    restart: unless-stopped
networks:
  net:
    name: traefik-net
    external: true
  db_net: