attempt using staticresponse

This commit is contained in:
Mayel de Borniol 2023-04-10 12:45:19 +12:00
parent 0a050e5977
commit b209bbb2d1

View File

@ -1,36 +1,31 @@
version: '3.8'
services:
error-pages:
image: tarampampam/error-pages:latest # Using the latest tag is highly discouraged. Please, use tags in X.Y.Z format
environment:
TEMPLATE_NAME: app-down
networks:
- proxy
deploy:
placement:
constraints:
- node.role == worker
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- # use as "fallback" for any non-registered services (with priority below normal)
- "traefik.http.routers.error-pages-router.rule=HostRegexp(`{host:.+}`)"
- "traefik.http.routers.error-pages-router.priority=10"
- # should say that all of your services work on https
- "traefik.http.routers.error-pages-router.tls=true"
- "traefik.http.routers.error-pages-router.entrypoints=https"
- "traefik.http.routers.error-pages-router.middlewares=error-pages-middleware"
- "traefik.http.services.error-pages-service.loadbalancer.server.port=8080"
- # "errors" middleware settings
- "traefik.http.middlewares.error-pages-middleware.errors.status=400-599"
- "traefik.http.middlewares.error-pages-middleware.errors.service=error-pages-service"
- "traefik.http.middlewares.error-pages-middleware.errors.query=/{status}.html"
app:
command:
- --providers.docker
- --experimental.plugins.staticresponse.modulename=github.com/jdel/staticresponse
- --experimental.plugins.staticresponse.version=v0.0.1
deploy:
labels:
# next line is important
- "traefik.http.routers.${STACK_NAME}.middlewares=error-pages-middleware"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
# custom traefik errors
- "traefik.http.middlewares.web-secure.errors.status=400-599"
- "traefik.http.middlewares.web-secure.errors.service=down-rule"
- "traefik.http.middlewares.web-secure.errors.query=/traefik-http-error/{status}"
# catchall rule
- "traefik.http.routers.http-catchall.entrypoints=web-secure"
- "traefik.http.routers.http-catchall.rule=PathPrefix(`/`)"
# lowest possible priority, evaluated when no other router is matched
- "traefik.http.routers.http-catchall.priority=1"
- "traefik.http.routers.http-catchall.middlewares=503down"
# static error message
- "traefik.http.middlewares.503down.plugin.staticresponse"
- "traefik.http.middlewares.503down.plugin.staticresponse.StatusCode=503"
- "traefik.http.middlewares.503down.plugin.staticresponse.Body=Sorry, currently under maintenance. Please try again later."
# error page
- "traefik.http.routers.down-rule.rule=PathPrefix(`/traefik-http-error`)"
- "traefik.http.routers.down-rule.service=noop@internal"
- "traefik.http.routers.down-rule.entrypoints=web-secure"
- "traefik.http.routers.down-rule.middlewares=503down"