victorpopkov/universal-redux

View on GitHub
docker-stack.yml

Summary

Maintainability
Test Coverage
version: '3.7'

services:
  app:
    image: '${DOCKER_IMAGE}'
    networks:
      - cluster
    volumes:
      - '/etc/localtime:/etc/localtime:ro'
      - '/etc/timezone:/etc/timezone:ro'
    logging:
      driver: loki
      options:
        loki-url: '${LOKI_URL}'
        loki-external-labels: 'job=logs,logs_provider=morgan,traefik_service=${TRAEFIK_NAME}@docker'
        loki-pipeline-stage-file: '${LOKI_PIPELINE_STAGE_FILE}'
    deploy:
      mode: global
      placement:
        constraints:
          - 'node.hostname == ${DOCKER_STACK_NODE_HOSTNAME}'
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      labels:
        # Traefik (General)
        - 'traefik.enable=true'
        # Traefik (Services)
        - 'traefik.http.services.${TRAEFIK_NAME}.loadbalancer.server.port=8080'
        # Traefik (Routers - HTTP)
        - 'traefik.http.routers.${TRAEFIK_NAME}-http.entrypoints=web'
        - 'traefik.http.routers.${TRAEFIK_NAME}-http.middlewares=github-http'
        - 'traefik.http.routers.${TRAEFIK_NAME}-http.rule=Host(`${TRAEFIK_HOSTNAME}`) && PathPrefix(`${TRAEFIK_PATH_PREFIX}`)'
        - 'traefik.http.routers.${TRAEFIK_NAME}-http.service=${TRAEFIK_NAME}'
        # Traefik (Routers - HTTPS)
        - 'traefik.http.routers.${TRAEFIK_NAME}-https.entrypoints=websecure'
        - 'traefik.http.routers.${TRAEFIK_NAME}-https.middlewares=github-https'
        - 'traefik.http.routers.${TRAEFIK_NAME}-https.rule=Host(`${TRAEFIK_HOSTNAME}`) && PathPrefix(`${TRAEFIK_PATH_PREFIX}`)'
        - 'traefik.http.routers.${TRAEFIK_NAME}-https.service=${TRAEFIK_NAME}'

networks:
  cluster:
    external: true