From 4624692279c474cc0990e3a17be5ea8cdc72348b Mon Sep 17 00:00:00 2001 From: Claudiu Cristea Date: Wed, 6 Dec 2023 11:04:28 +0200 Subject: [PATCH] Use Traefik to allow HTTPS by proxying requests. --- behat.yml.dist | 2 +- composer.json | 6 +++--- docker-compose.yml | 46 ++++++++++++++++++++++++++++++++++++---------- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/behat.yml.dist b/behat.yml.dist index 564ff05f..5ea3c2e6 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -45,7 +45,7 @@ drupal: tags: "~@blackbox&&~@wip" extensions: Drupal\MinkExtension: - base_url: http://drupal + base_url: http://proxy files_path: /var/www/html/fixtures/files Drupal\DrupalExtension: api_driver: "drupal" diff --git a/composer.json b/composer.json index 798e846d..132a9702 100644 --- a/composer.json +++ b/composer.json @@ -33,9 +33,9 @@ "require-dev": { "composer/installers": "^2", "drupal/coder": "^8.3", - "drupal/core": "^9.4 || ^10.0", - "drupal/core-composer-scaffold": "^9.4 || ^10.0", - "drush/drush": "^11.0", + "drupal/core": "^10", + "drupal/core-composer-scaffold": "^10", + "drush/drush": "^12.4", "php-parallel-lint/php-parallel-lint": "^1.3", "phpspec/phpspec": "^4.0 || ^6.0 || ^7.0" }, diff --git a/docker-compose.yml b/docker-compose.yml index bb24e06c..506cba53 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,9 +20,30 @@ services: PHP_IDE_CONFIG: "serverName=drupalextension" volumes: - ./:/var/www/html + labels: + - "traefik.enable=false" + depends_on: + - proxy + + proxy: + image: traefik:v2.10 + command: + - "--api.insecure=true" + - "--providers.docker" + - "--entrypoints.http-80.address=:80" + - "--entrypoints.http-443.address=:443" + ports: + - "80:80" + - "443:443" + # The Web UI (enabled by --api.insecure=true) + - "8080:8080" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + labels: + - "traefik.enable=false" drupal: - image: wodby/nginx:1.16-5.11.3 + image: wodby/nginx depends_on: - php environment: @@ -30,14 +51,18 @@ services: NGINX_ERROR_LOG_LEVEL: debug NGINX_BACKEND_HOST: php NGINX_SERVER_ROOT: /var/www/html/drupal - NGINX_VHOST_PRESET: drupal9 + NGINX_VHOST_PRESET: drupal10 volumes: - ./:/var/www/html - ports: - - "8080:80" + labels: + - "traefik.http.routers.drupal.rule=Host(`proxy`)" + - "traefik.http.routers.drupal.entrypoints=http-80" + - "traefik.http.routers.drupal-secure.rule=Host(`proxy`)" + - "traefik.http.routers.drupal-secure.tls=true" + - "traefik.http.routers.drupal-secure.entrypoints=http-443" blackbox: - image: wodby/nginx:1.16-5.11.3 + image: wodby/nginx environment: NGINX_STATIC_OPEN_FILE_CACHE: "off" NGINX_ERROR_LOG_LEVEL: debug @@ -45,8 +70,8 @@ services: NGINX_VHOST_PRESET: html volumes: - ./:/var/www/html - ports: - - "8081:80" + labels: + - "traefik.enable=false" db: image: wodby/mariadb:10.3-3.8.4 @@ -56,6 +81,8 @@ services: MYSQL_DATABASE: drupal MYSQL_USER: drupal MYSQL_PASSWORD: drupal + labels: + - "traefik.enable=false" node: image: node:latest @@ -67,6 +94,5 @@ services: volumes: - ./:/home/node/app command: "sleep infinity" - -volumes: - codebase: + labels: + - "traefik.enable=false"