Skip to content

Commit

Permalink
Merge pull request #1791 from danskernesdigitalebibliotek/DDFBRA-226-…
Browse files Browse the repository at this point in the history
…saet-dpl-cms-dapple-cms-docker-til-at-kore-med-https-og-opsaet-cors-configuration

No CORS + Https
  • Loading branch information
spaceo authored Nov 27, 2024
2 parents d4c15ff + 572aa27 commit db5f413
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
15 changes: 15 additions & 0 deletions assets/local.services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 22 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down
21 changes: 21 additions & 0 deletions docs/local-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit db5f413

Please sign in to comment.