Last active
March 20, 2022 01:49
-
-
Save m1yag1/5470871c454394124179e7f1ab1c14db to your computer and use it in GitHub Desktop.
A docker stack configuration to setup redirects using traefik 1.7 reverse proxy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Save this to a file called traefik-redirect.yml | |
# docker stack deploy --compose-file traefik_redirect.yml traefik_redirect | |
version: "3.7" | |
networks: | |
traefik-public: | |
external: true | |
name: traefik-public | |
services: | |
# This is spun up as a "dummy" service. We redirect to another location. | |
staging: | |
deploy: | |
placement: | |
constraints: | |
- node.labels.proxy == true | |
- node.role == manager | |
labels: | |
traefik.enable: "true" | |
traefik.frontend.rule: Host:corgi-staging.openstax.org | |
traefik.frontend.redirect.regex: '^https?://corgi-staging.openstax.org/(.*)' | |
traefik.frontend.redirect.replacement: "https://corgi-staging.ce.openstax.org/$$1" | |
traefik.servicehttp.frontend.entryPoints: https | |
traefik.port: '5000' | |
traefik.tags: traefik-public | |
traefik.frontend.priority: 1 | |
replicas: 1 | |
restart_policy: | |
condition: on-failure | |
update_config: | |
delay: 10s | |
parallelism: 1 | |
image: m1yag1/one-flask-service:latest | |
networks: | |
default: {} | |
traefik-public: {} | |
# This is spun up as a "dummy" service. We redirect to another location. | |
prod: | |
deploy: | |
placement: | |
constraints: | |
- node.labels.proxy == true | |
- node.role == manager | |
labels: | |
traefik.enable: "true" | |
traefik.frontend.rule: Host:corgi.openstax.org | |
traefik.frontend.redirect.regex: '^https?://corgi.openstax.org/(.*)' | |
traefik.frontend.redirect.replacement: "https://corgi.ce.openstax.org/$$1" | |
traefik.servicehttp.frontend.entryPoints: https | |
traefik.port: '5000' | |
traefik.tags: traefik-public | |
traefik.frontend.priority: 1 | |
replicas: 1 | |
restart_policy: | |
condition: on-failure | |
update_config: | |
delay: 10s | |
parallelism: 1 | |
# This is spun up as a "dummy" service. We redirect to another location. | |
image: m1yag1/one-flask-service:latest | |
networks: | |
default: {} | |
traefik-public: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment