From abf76c50bba82221f8fc62086747b82c5628a732 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 10 May 2024 23:05:38 +0200 Subject: [PATCH] Update hostname to `*.docker.localhost` Following updates in https://github.com/opdavies/traefik-development to add HTTPS support to Docker Compose-based projects, this commit changes the host name from `*.localhost` to `*.docker.localhost`. This should allow each project to be available at https://{project_name}.docker.localhost instead of http://{project_name}.localhost. --- templates/fractal/docker-compose.yaml.twig | 6 ++++-- templates/php/drupal/docker-compose.yaml.twig | 8 +++++--- .../output/drupal-commerce-kickstart/docker-compose.yaml | 8 +++++--- .../snapshots/output/drupal-localgov/docker-compose.yaml | 8 +++++--- tests/snapshots/output/drupal/docker-compose.yaml | 8 +++++--- tests/snapshots/output/fractal/docker-compose.yaml | 6 ++++-- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/templates/fractal/docker-compose.yaml.twig b/templates/fractal/docker-compose.yaml.twig index 228cd29..af492ea 100644 --- a/templates/fractal/docker-compose.yaml.twig +++ b/templates/fractal/docker-compose.yaml.twig @@ -5,13 +5,15 @@ x-proxy: &default-proxy - default - web labels: + - "traefik.enable=true" - "traefik.docker.network=traefik_proxy" - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host( - `${COMPOSE_PROJECT_NAME}.localhost`, + `${COMPOSE_PROJECT_NAME}.docker.localhost`, {% for host in web.extra_hosts | default([]) -%} {{ '`' ~ host ~ '`,' }} {%- endfor %} )" + - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.tls=true" x-app: &default-app volumes: @@ -27,7 +29,7 @@ x-app: &default-app cpus: "${DOCKER_MYSQL_CPUS:-0}" memory: "${DOCKER_MYSQL_MEMORY:-0}" labels: - - "traefik.enabled=false" + - "traefik.enable=false" tty: true services: diff --git a/templates/php/drupal/docker-compose.yaml.twig b/templates/php/drupal/docker-compose.yaml.twig index 824cf5b..aceb96c 100644 --- a/templates/php/drupal/docker-compose.yaml.twig +++ b/templates/php/drupal/docker-compose.yaml.twig @@ -5,13 +5,15 @@ x-proxy: &default-proxy - default - web labels: + - "traefik.enable=true" - "traefik.docker.network=traefik_proxy" - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host( - `${COMPOSE_PROJECT_NAME}.localhost`, + `${COMPOSE_PROJECT_NAME}.docker.localhost`, {% for host in web.extra_hosts | default([]) -%} {{ '`' ~ host ~ '`,' }} {%- endfor %} )" + - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.tls=true" x-app: &default-app volumes: @@ -27,7 +29,7 @@ x-app: &default-app cpus: "${DOCKER_MYSQL_CPUS:-0}" memory: "${DOCKER_MYSQL_MEMORY:-0}" labels: - - "traefik.enabled=false" + - "traefik.enable=false" tty: true services: @@ -74,7 +76,7 @@ services: env_file: - .env labels: - - "traefik.enabled=false" + - "traefik.enable=false" environment: MYSQL_RANDOM_ROOT_PASSWORD: true profiles: [database] diff --git a/tests/snapshots/output/drupal-commerce-kickstart/docker-compose.yaml b/tests/snapshots/output/drupal-commerce-kickstart/docker-compose.yaml index fa1f56c..f6453f6 100644 --- a/tests/snapshots/output/drupal-commerce-kickstart/docker-compose.yaml +++ b/tests/snapshots/output/drupal-commerce-kickstart/docker-compose.yaml @@ -5,10 +5,12 @@ x-proxy: &default-proxy - default - web labels: + - "traefik.enable=true" - "traefik.docker.network=traefik_proxy" - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host( - `${COMPOSE_PROJECT_NAME}.localhost`, + `${COMPOSE_PROJECT_NAME}.docker.localhost`, )" + - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.tls=true" x-app: &default-app volumes: @@ -24,7 +26,7 @@ x-app: &default-app cpus: "${DOCKER_MYSQL_CPUS:-0}" memory: "${DOCKER_MYSQL_MEMORY:-0}" labels: - - "traefik.enabled=false" + - "traefik.enable=false" tty: true services: @@ -63,7 +65,7 @@ services: env_file: - .env labels: - - "traefik.enabled=false" + - "traefik.enable=false" environment: MYSQL_RANDOM_ROOT_PASSWORD: true profiles: [database] diff --git a/tests/snapshots/output/drupal-localgov/docker-compose.yaml b/tests/snapshots/output/drupal-localgov/docker-compose.yaml index fa1f56c..f6453f6 100644 --- a/tests/snapshots/output/drupal-localgov/docker-compose.yaml +++ b/tests/snapshots/output/drupal-localgov/docker-compose.yaml @@ -5,10 +5,12 @@ x-proxy: &default-proxy - default - web labels: + - "traefik.enable=true" - "traefik.docker.network=traefik_proxy" - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host( - `${COMPOSE_PROJECT_NAME}.localhost`, + `${COMPOSE_PROJECT_NAME}.docker.localhost`, )" + - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.tls=true" x-app: &default-app volumes: @@ -24,7 +26,7 @@ x-app: &default-app cpus: "${DOCKER_MYSQL_CPUS:-0}" memory: "${DOCKER_MYSQL_MEMORY:-0}" labels: - - "traefik.enabled=false" + - "traefik.enable=false" tty: true services: @@ -63,7 +65,7 @@ services: env_file: - .env labels: - - "traefik.enabled=false" + - "traefik.enable=false" environment: MYSQL_RANDOM_ROOT_PASSWORD: true profiles: [database] diff --git a/tests/snapshots/output/drupal/docker-compose.yaml b/tests/snapshots/output/drupal/docker-compose.yaml index fa1f56c..f6453f6 100644 --- a/tests/snapshots/output/drupal/docker-compose.yaml +++ b/tests/snapshots/output/drupal/docker-compose.yaml @@ -5,10 +5,12 @@ x-proxy: &default-proxy - default - web labels: + - "traefik.enable=true" - "traefik.docker.network=traefik_proxy" - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host( - `${COMPOSE_PROJECT_NAME}.localhost`, + `${COMPOSE_PROJECT_NAME}.docker.localhost`, )" + - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.tls=true" x-app: &default-app volumes: @@ -24,7 +26,7 @@ x-app: &default-app cpus: "${DOCKER_MYSQL_CPUS:-0}" memory: "${DOCKER_MYSQL_MEMORY:-0}" labels: - - "traefik.enabled=false" + - "traefik.enable=false" tty: true services: @@ -63,7 +65,7 @@ services: env_file: - .env labels: - - "traefik.enabled=false" + - "traefik.enable=false" environment: MYSQL_RANDOM_ROOT_PASSWORD: true profiles: [database] diff --git a/tests/snapshots/output/fractal/docker-compose.yaml b/tests/snapshots/output/fractal/docker-compose.yaml index 5aa3f79..c156f09 100644 --- a/tests/snapshots/output/fractal/docker-compose.yaml +++ b/tests/snapshots/output/fractal/docker-compose.yaml @@ -5,10 +5,12 @@ x-proxy: &default-proxy - default - web labels: + - "traefik.enable=true" - "traefik.docker.network=traefik_proxy" - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host( - `${COMPOSE_PROJECT_NAME}.localhost`, + `${COMPOSE_PROJECT_NAME}.docker.localhost`, )" + - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.tls=true" x-app: &default-app volumes: @@ -24,7 +26,7 @@ x-app: &default-app cpus: "${DOCKER_MYSQL_CPUS:-0}" memory: "${DOCKER_MYSQL_MEMORY:-0}" labels: - - "traefik.enabled=false" + - "traefik.enable=false" tty: true services: