version: "3.8"

services:
  next:
    image: ocram85/blog:next
    restart: unless-stopped
    networks:
      - blog
      - traefik-public
    deploy:
      replicas: 1
      update_config:
        parallelism: 1
        delay: 15s
        order: start-first
      labels:
        - "traefik.enable=true"
        #- "traefik.docker.lbswarm=true"
        - "traefik.docker.network=traefik-public"
        - "traefik.http.routers.next.rule=Host(`next.ocram85.com`)"
        - "traefik.http.routers.next.tls=true"
        - "traefik.http.services.next-srv.loadbalancer.server.port=80"
        # optional health checks
        - "traefik.http.services.next-srv.loadbalancer.healthCheck.path=/"
        - "traefik.http.services.next-srv.loadbalancer.healthCheck.interval=10s"
        - "traefik.http.services.next-srv.loadbalancer.healthCheck.timeout=3s"
        - "traefik.http.services.next-srv.loadbalancer.healthCheck.port=80"
        - "traefik.http.services.next-srv.loadbalancer.healthCheck.scheme=http"
  
  blog:
    image: ocram85/blog:latest
    restart: unless-stopped
    networks:
      - blog
      - traefik-public
    deploy:
      replicas: 2
      update_config:
        parallelism: 1
        delay: 15s
        order: start-first
      labels:
        - "traefik.enable=true"
        - "traefik.docker.network=traefik-public"
        #- "traefik.docker.lbswarm=true"
        - "traefik.http.routers.blog.rule=Host(`ocram85.com`)"
        - "traefik.http.routers.blog.tls=true"
        - "traefik.http.services.blog-srv.loadbalancer.server.port=80"
        # optional health checks
        - "traefik.http.services.blog-srv.loadbalancer.healthCheck.path=/"
        - "traefik.http.services.blog-srv.loadbalancer.healthCheck.interval=10s"
        - "traefik.http.services.blog-srv.loadbalancer.healthCheck.timeout=3s"
        - "traefik.http.services.blog-srv.loadbalancer.healthCheck.port=80"
        - "traefik.http.services.blog-srv.loadbalancer.healthCheck.scheme=http"

networks:
  traefik-public:
    external: true

  blog:
    name: blog
    driver: overlay
