services:
  gotify:
    image: ${GOTIFY_IMAGE}
    container_name: ${GOTIFY_COMPOSE_PROJECT_NAME}_app
    restart: unless-stopped
    volumes:
      - gotify_data:/app/data
    environment:
      TZ: ${TIMEZONE:-Europe/Amsterdam}
      GOTIFY_DEFAULTUSER_NAME: ${GOTIFY_DEFAULTUSER_NAME}
      GOTIFY_DEFAULTUSER_PASS: ${GOTIFY_DEFAULTUSER_PASS}
    ports:
      - "${GOTIFY_PORT:-8085}:80"
    networks:
      - compose_network
    labels:
      - 'traefik.enable=${GOTIFY_TRAEFIK_ENABLED}'
      - 'traefik.http.middlewares.${GOTIFY_COMPOSE_PROJECT_NAME}-gotify-redirect-web-secure.redirectscheme.scheme=https'
      - 'traefik.http.routers.${GOTIFY_COMPOSE_PROJECT_NAME}-gotify-web.middlewares=${GOTIFY_COMPOSE_PROJECT_NAME}-gotify-redirect-web-secure'
      - 'traefik.http.routers.${GOTIFY_COMPOSE_PROJECT_NAME}-gotify-web.rule=Host(`${GOTIFY_TRAEFIK_HOST}`)'
      - 'traefik.http.routers.${GOTIFY_COMPOSE_PROJECT_NAME}-gotify-web.entrypoints=web'
      - 'traefik.http.routers.${GOTIFY_COMPOSE_PROJECT_NAME}-gotify-web-secure.rule=Host(`${GOTIFY_TRAEFIK_HOST}`)'
      - 'traefik.http.routers.${GOTIFY_COMPOSE_PROJECT_NAME}-gotify-web-secure.tls.certresolver=resolver'
      - 'traefik.http.routers.${GOTIFY_COMPOSE_PROJECT_NAME}-gotify-web-secure.entrypoints=web-secure'
      - 'traefik.http.middlewares.${GOTIFY_COMPOSE_PROJECT_NAME}-gotify-web-secure-compress.compress=true'
      - 'traefik.http.routers.${GOTIFY_COMPOSE_PROJECT_NAME}-gotify-web-secure.middlewares=${GOTIFY_COMPOSE_PROJECT_NAME}-gotify-web-secure-compress'
      - 'traefik.http.services.${GOTIFY_COMPOSE_PROJECT_NAME}-gotify-web-secure.loadbalancer.server.port=80'
      - 'traefik.docker.network=${NETWORK_NAME}'

volumes:
  gotify_data:
    name: ${GOTIFY_COMPOSE_PROJECT_NAME}_gotify_data
