Maintenance

Fallback to the maintenance page during downtime.

Manifests

services:
  homepage:
    image: hashicorp/http-echo
    deploy:
      labels:
        - "millau.enabled=true"
        - "millau.hosts=company.com"
        - "millau.port=9000"
    command: ["-listen=:9000", "-text=homepage"]
    ports:
      - "9000"
    networks:
      - millau
  fallback:
    image: hashicorp/http-echo
    deploy:
      labels:
        - "millau.enabled=true"
        - "millau.port=9000"
    command: ["-listen=:9000", "-text=maintenance page"]
    ports:
      - "9000"
    networks:
      - millau
networks:
  millau:
    external: true

Features

Website Available

docker stack deploy -c docker-compose.yml service
curl -H 'Host: company.com' localhost:8080

returns homepage due to longest-suffix host matching.

Website is Unavailable

docker service scale service_homepage=0
curl -H 'Host: company.com' localhost:8080

Once the homepage service is stopped, Millau routes traffic to the fallback service,
returning the maintenance page due to the default * host matching.

Website Restored

docker service scale service_homepage=1
curl -H 'Host: company.com' localhost:8080

returns homepage again due to longest-suffix host matching.