networks:
  1panel-network:
    external: true

services:
  synapse-init:
    image: matrixdotorg/synapse:v1.140.0
    container_name: init-${CONTAINER_NAME}
    entrypoint:
      - /start.py
      - generate
    env_file:
      - ${GLOBAL_ENV_FILE:-/etc/1panel/envs/global.env}
      - ${ENV_FILE:-/etc/1panel/envs/default.env}
    volumes:
      - ${SYNAPSE_ROOT_PATH}/data:/data
    networks:
      - 1panel-network
    restart: no
    environment:
      - SYNAPSE_REPORT_STATS=no
      - SYNAPSE_NO_TLS=true
      - SYNAPSE_HTTP_PORT=8008
  synapse:
    image: matrixdotorg/synapse:v1.140.0
    container_name: ${CONTAINER_NAME}
    labels:
      createdBy: "Apps"
    restart: always
    networks:
      - 1panel-network
    ports:
      - ${PANEL_APP_PORT_HTTP}:8008
    env_file:
      - ${GLOBAL_ENV_FILE:-/etc/1panel/envs/global.env}
      - ${ENV_FILE:-/etc/1panel/envs/default.env}
    volumes:
      - ${SYNAPSE_ROOT_PATH}/data:/data
    depends_on:
      - synapse-init
