version: '3.8' services: loki: image: grafana/loki:3.7.2 command: -config.file=/etc/loki/local-config.yaml networks: - proxy configs: - source: loki_yml target: /etc/loki/local-config.yaml volumes: - loki-data:/loki # secrets: # - loki_aws_key environment: - LOKI_ACCESS_KEY_ID - LOKI_AWS_ENDPOINT - LOKI_AWS_REGION - LOKI_BUCKET_NAMES - LOKI_RETENTION_PERIOD - LOKI_LOG_LEVEL - STACK_NAME - LOKI_STORAGE_FILESYSTEM - LOKI_STORAGE_S3 healthcheck: test: ["CMD", "/usr/bin/loki", "-health"] interval: 10s timeout: 10s retries: 10 start_period: 30s deploy: restart_policy: condition: on-failure labels: - "traefik.enable=true" - "traefik.swarm.network=proxy" - "traefik.http.services.${STACK_NAME}-loki.loadbalancer.server.port=3100" - "traefik.http.routers.${STACK_NAME}-loki.rule=Host(`loki.${DOMAIN}`)" - "traefik.http.routers.${STACK_NAME}-loki.entrypoints=web-secure" - "traefik.http.routers.${STACK_NAME}-loki.tls=true" - "traefik.http.routers.${STACK_NAME}-loki.tls.certresolver=${LETS_ENCRYPT_ENV}" - "traefik.http.routers.${STACK_NAME}-loki.middlewares=basicauth@file" - "prometheus.io/scrape=true" - "prometheus.io/port=3100" configs: loki_yml: template_driver: golang name: ${STACK_NAME}_loki_yml_${LOKI_YML_VERSION} file: loki.yml.tmpl volumes: loki-data: # secrets: # loki_aws_key: # external: true # name: ${STACK_NAME}_loki_aws_key_${SECRET_LOKI_AWS_KEY_VERSION}