Skip to content

Commit

Permalink
Update hostname to *.docker.localhost
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
opdavies committed May 10, 2024
1 parent 4384952 commit abf76c5
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
6 changes: 4 additions & 2 deletions templates/fractal/docker-compose.yaml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
8 changes: 5 additions & 3 deletions templates/php/drupal/docker-compose.yaml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -74,7 +76,7 @@ services:
env_file:
- .env
labels:
- "traefik.enabled=false"
- "traefik.enable=false"
environment:
MYSQL_RANDOM_ROOT_PASSWORD: true
profiles: [database]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -63,7 +65,7 @@ services:
env_file:
- .env
labels:
- "traefik.enabled=false"
- "traefik.enable=false"
environment:
MYSQL_RANDOM_ROOT_PASSWORD: true
profiles: [database]
Expand Down
8 changes: 5 additions & 3 deletions tests/snapshots/output/drupal-localgov/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -63,7 +65,7 @@ services:
env_file:
- .env
labels:
- "traefik.enabled=false"
- "traefik.enable=false"
environment:
MYSQL_RANDOM_ROOT_PASSWORD: true
profiles: [database]
Expand Down
8 changes: 5 additions & 3 deletions tests/snapshots/output/drupal/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -63,7 +65,7 @@ services:
env_file:
- .env
labels:
- "traefik.enabled=false"
- "traefik.enable=false"
environment:
MYSQL_RANDOM_ROOT_PASSWORD: true
profiles: [database]
Expand Down
6 changes: 4 additions & 2 deletions tests/snapshots/output/fractal/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit abf76c5

Please sign in to comment.