diff --git a/.env.example b/.env.example index 2a87ecdaa..63f8fe1d9 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -COMPOSE_PROJECT_NAME=dpl-cms +COMPOSE_PROJECT_NAME=dapple-cms COMPOSER_MEMORY_LIMIT=-1 # GraphQL Consumer environment variables used for local development diff --git a/Taskfile.yml b/Taskfile.yml index 6f4a7f0c8..8f666e4b5 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -34,6 +34,8 @@ vars: DOCKER_COMPOSE_FILES_DEFAULT: "-f docker-compose.yml" DOCKER_COMPOSE_FILES: "{{.DOCKER_COMPOSE_FILES | default .DOCKER_COMPOSE_FILES_DEFAULT }}" DOCKER_COMPOSE_FILES_CI: "{{.DOCKER_COMPOSE_FILES}} -f docker-compose.ci.yml" + DOCKER_COMPOSE_FILES_DEV: "{{.DOCKER_COMPOSE_FILES}} -f docker-compose.dev.yml" + # Sql dump files directory DIR_RESTORE_DATABASE: "restore/database" # Directory with lagoon backup files. @@ -176,6 +178,8 @@ tasks: - task dev:create-users # Show a one-time login to the local site. - task dev:cli -- drush user-login + env: + DOCKER_COMPOSE_FILES: "{{ .DOCKER_COMPOSE_FILES_DEV }}" dev:openid:configure: desc: Set openid connect settings based on .env variables. And run cron. diff --git a/assets/local.services.yml b/assets/local.services.yml index 19d9b757b..2f740baa3 100644 --- a/assets/local.services.yml +++ b/assets/local.services.yml @@ -2,6 +2,21 @@ parameters: twig.config: debug: true http.response.debug_cacheability_headers: true + cors.config: + enabled: true + # Specify allowed headers, like 'x-allowed-header'. + allowedHeaders: ['*'] + # Specify allowed request methods, specify ['*'] to allow all possible ones. + allowedMethods: ['*'] + # Configure requests allowed from specific origins. + allowedOrigins: ['*'] + # Sets the Access-Control-Expose-Headers header. + exposedHeaders: false + # Sets the Access-Control-Max-Age header. + maxAge: false + # Sets the Access-Control-Allow-Credentials header. + supportsCredentials: false + services: cache.backend.null: class: Drupal\Core\Cache\NullBackendFactory diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 000000000..729d2cdd5 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,22 @@ +--- +services: + https: + image: ghcr.io/reload/https-proxy:proxy + ports: + - '80' + - '443' + depends_on: + - varnish + volumes: + - 'projectroot:/app' + - '${HOME}/.local/share/mkcert:/rootCA:ro' + - '${HOME}/.local/share/dev_certificates:/cert:rw' + environment: + NGINX_DOCUMENT_ROOT: /app/web + NGINX_PROXY_PASS: http://varnish:8080 + VIRTUAL_PROTO: https + VIRTUAL_HOST: >- + ${COMPOSE_PROJECT_NAME:-dapple-cms}.${DEV_TLD:-docker} + labels: + - dev.orbstack.domains=${COMPOSE_PROJECT_NAME:-dapple-cms}.local + working_dir: /app diff --git a/docker-compose.yml b/docker-compose.yml index decadeb59..912075aff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,7 +52,7 @@ services: << : *default-environment # VARNISH_BYPASS: "true" # Add this to disable caching in varnish. # Is used by [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) or [dory](https://github.com/FreedomBen/dory) - VIRTUAL_HOST: ${COMPOSE_PROJECT_NAME}.docker + VIRTUAL_HOST: ${COMPOSE_PROJECT_NAME}-varnish.docker VIRTUAL_PORT: 8080 cli: # cli container, will be used for executing composer and any local commands (drush, drupal, etc.) diff --git a/docs/local-development.md b/docs/local-development.md index a13120f3e..27fd2a3c3 100644 --- a/docs/local-development.md +++ b/docs/local-development.md @@ -29,6 +29,27 @@ volumes in docker-compose, to speed up the containers. ![OSX preference pane providing access to VirtioFS](docs/images/virtiofs.png) +### Configuration of https + +Install mkcert on your host machine and generate and install a root certificate +by running mkcert -install on your host machine (one time only). + +Mac users can run: `brew install mkcert` to install mkcert + +Then run: + +`mkcert -install` + +Mac users should then do (one time only): + +$ mkdir -p ~/.local/share && ln -s "$(mkcert -CAROOT)" ~/.local/share + +#### If you are using Dory + +Update the ssl_certs_dir as described here: + +[https://github.com/reload/drupal-apache-fpm?tab=readme-ov-file#using-autogenerated-certificates](https://github.com/reload/drupal-apache-fpm?tab=readme-ov-file#using-autogenerated-certificates) + ## Howtos ### Enable XDebug