From 109d8b3a020502dec3f682e0f54c1ade8e273a80 Mon Sep 17 00:00:00 2001 From: David Alger Date: Tue, 3 Dec 2019 21:02:57 -0600 Subject: [PATCH] Added BYPASS_VARNISH flag to route requests around varnish directly to Nginx --- CHANGELOG.md | 1 + environments/magento2.base.yml | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc82a7c1..5afd5829 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ UNRELEASED * Added labels to the `php-fpm` container in `magento2` environment to support use of Live Reload via JS injection in the site header (see README for details!) * Updated Mutagen usage to rely on new commands and configuration in Mutagen 0.10.0 (Warden will now throw an error if you attempt to start a sync and have a version of Mutagen older than 0.10.0 installed) * Added WARDEN_ENV_NAME as prefix to each container hostname in compose configs (issue #29) +* Added simple `BYPASS_VARNISH` flag which when set in project `.env` file will cause Traefik to route requests directly to `nginx` container rather than `varnish` 0.1.11 =============== diff --git a/environments/magento2.base.yml b/environments/magento2.base.yml index b9260e99..1c6e92f1 100644 --- a/environments/magento2.base.yml +++ b/environments/magento2.base.yml @@ -7,6 +7,15 @@ services: - NGINX_TEMPLATE=magento2.conf depends_on: - php-fpm + labels: + - traefik.enable=${BYPASS_VARNISH:-false} + - traefik.http.routers.${WARDEN_ENV_NAME}-nginx.tls=true + - traefik.http.routers.${WARDEN_ENV_NAME}-nginx.priority=2 + - traefik.http.routers.${WARDEN_ENV_NAME}-nginx.rule=HostRegexp(`{subdomain:.+}.${TRAEFIK_DOMAIN}`) + - traefik.http.services.${WARDEN_ENV_NAME}-nginx.loadbalancer.server.port=80 + networks: + - warden + - default varnish: hostname: "${WARDEN_ENV_NAME}-varnish" @@ -35,7 +44,7 @@ services: labels: - traefik.enable=true - traefik.http.routers.${WARDEN_ENV_NAME}-livereload.tls=true - - traefik.http.routers.${WARDEN_ENV_NAME}-livereload.priority=1 + - traefik.http.routers.${WARDEN_ENV_NAME}-livereload.priority=2 - traefik.http.routers.${WARDEN_ENV_NAME}-livereload.rule= HostRegexp(`{subdomain:.+}.${TRAEFIK_DOMAIN}`) && Path(`/livereload.js,/livereload`) - traefik.http.routers.${WARDEN_ENV_NAME}-livereload.service=${WARDEN_ENV_NAME}-livereload