services:
  filestash:
    image: ${STASH_IMAGE:-machines/filestash:latest}
    container_name: ${STASH_COMPOSE_PROJECT_NAME}_app
    restart: unless-stopped
    volumes:
      - filestash_data:/app/data/state/
    environment:
      TZ: ${TIMEZONE:-Europe/Berlin}
      APPLICATION_URL: ${STASH_TRAEFIK_HOST}
      CANARY: ${STASH_CANARY:-true}
    networks:
      - compose_network
    labels:
      - 'traefik.enable=${STASH_TRAEFIK_ENABLED}'
      - 'traefik.http.middlewares.${STASH_COMPOSE_PROJECT_NAME}-filestash-redirect-web-secure.redirectscheme.scheme=https'
      - 'traefik.http.routers.${STASH_COMPOSE_PROJECT_NAME}-filestash-web.middlewares=${STASH_COMPOSE_PROJECT_NAME}-filestash-redirect-web-secure'
      - 'traefik.http.routers.${STASH_COMPOSE_PROJECT_NAME}-filestash-web.rule=Host(`${STASH_TRAEFIK_HOST}`)'
      - 'traefik.http.routers.${STASH_COMPOSE_PROJECT_NAME}-filestash-web.entrypoints=web'
      - 'traefik.http.routers.${STASH_COMPOSE_PROJECT_NAME}-filestash-web-secure.rule=Host(`${STASH_TRAEFIK_HOST}`)'
      - 'traefik.http.routers.${STASH_COMPOSE_PROJECT_NAME}-filestash-web-secure.tls.certresolver=resolver'
      - 'traefik.http.routers.${STASH_COMPOSE_PROJECT_NAME}-filestash-web-secure.entrypoints=web-secure'
      - 'traefik.http.middlewares.${STASH_COMPOSE_PROJECT_NAME}-filestash-web-secure-compress.compress=true'
      - 'traefik.http.routers.${STASH_COMPOSE_PROJECT_NAME}-filestash-web-secure.middlewares=${STASH_COMPOSE_PROJECT_NAME}-filestash-web-secure-compress'
      - 'traefik.http.services.${STASH_COMPOSE_PROJECT_NAME}-filestash-web-secure.loadbalancer.server.port=8334'
      - 'traefik.docker.network=${NETWORK_NAME}'
      - 'com.centurylinklabs.watchtower.enable=${WATCHTOWER_LABEL_ENABLE}'

volumes:
  filestash_data:
    name: ${STASH_COMPOSE_PROJECT_NAME}_filestash_data

networks:
  compose_network:
    name: ${NETWORK_NAME}
    external: true
