Skip to content

Commit

Permalink
Merge branch 'develop' into reader-player-feature
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperbirch1 committed Jan 22, 2025
2 parents 7778567 + 6a5623b commit 60804cf
Show file tree
Hide file tree
Showing 26 changed files with 1,282 additions and 1,944 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ docker-compose.override.yml

# Danish translations folder
/config/sync/language/da

# We use this in the BNF setup, it should never be committed.
/web/sites/sites.php
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ You can find the full documentation, along with setup instructions in either the
or directly in [the docs folder](docs/)

**tl;dr:** Run `task dev:reset` to get the site up and running locally.

For a environment that consists of both a CMS site and a BNF site, run
`task dev:bnf:enable` before running reset.
67 changes: 43 additions & 24 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ vars:
# Where is the docker file(s) we use for our builds residing?
LAGOON_DIR: "lagoon"

DOCKER_COMPOSE_FILES_DEFAULT: "-f docker-compose.yml"
DOCKER_COMPOSE_FILES_BNF:
sh: if [[ -f web/sites/sites.php ]]; then echo "-f docker-compose.bnf.yml"; fi
DOCKER_COMPOSE_FILES_DEFAULT: "-f docker-compose.yml {{ .DOCKER_COMPOSE_FILES_BNF}}"
DOCKER_COMPOSE_FILES: "{{.DOCKER_COMPOSE_FILES | default .DOCKER_COMPOSE_FILES_DEFAULT }}"
DOCKER_COMPOSE_FILES_CI: "{{.DOCKER_COMPOSE_FILES}} -f docker-compose.ci.yml"

Expand Down Expand Up @@ -70,6 +72,20 @@ tasks:
- sh: "[ ! -z {{.CR_PAT}} ]"
msg: "Env variable CR_PAT is not set or empty."

dev:bnf:enable:
summary: Set env up for BNF development.
silent: true
cmds:
- cp assets/sites.php web/sites
- echo 'Enabled, remember to run "task dev:reset"'

dev:bnf:disable:
summary: Reset env to non-BNF development.
silent: true
cmds:
- rm web/sites/sites.php
- echo 'Disabled, remember to run "task dev:reset"'

dev:format:
summary: Lint custom code, and fix when possible
cmds:
Expand Down Expand Up @@ -101,6 +117,13 @@ tasks:
cmds:
- docker compose {{ .DOCKER_COMPOSE_FILES }} run --rm cli sh -c "{{.CLI_ARGS}}"

dev:bnfcli:
summary: dev:cli for BNF site, a noop if BNF not enabled
status:
- "[[ -z \"{{ .DOCKER_COMPOSE_FILES_BNF}}\" ]]"
cmds:
- docker compose {{ .DOCKER_COMPOSE_FILES }} run --rm bnfcli sh -c "{{.CLI_ARGS}}"

dev:start:
summary: Run docker compose
deps:
Expand Down Expand Up @@ -153,30 +176,24 @@ tasks:
# Start local environment.
- task dev:start
# Install site.
- task dev:cli -- drush site-install --existing-config -y
# Practice shows that the cache needs to be cleared to avoid configuration
# errors even after a site install.
- task dev:cache:clear:drupal
# Import translations.
- |
if [ -n "${SKIP_LANGUAGE_IMPORT}" ]; then
echo "Skipping language import due to SKIP_LANGUAGE_IMPORT environment variable"
else
task dev:cli -- drush locale-check
task dev:cli -- drush locale-update
task dev:cli -- drush dpl_po:import-remote-config-po da https://danskernesdigitalebibliotek.github.io/dpl-cms/translations/da.config.po
fi
# Clear all caches to ensure we have a pristine setup.
- task dev:cache:clear:all
# Run deploy hooks.
- task dev:cli -- drush deploy -y
# Ensure site is reachable and warm any caches
- task dev:cli -- curl --silent --show-error --fail --output /dev/null http://varnish:8080/
# Enable dev modules.
- task dev:enable-dev-tools
- task dev:create-users
# Show a one-time login to the local site.
- task dev:cli -- ./dev-scripts/install-site.sh {{ if .SKIP_LANGUAGE_IMPORT }}--skip-language-import{{ end }}
# Possibly install the BNF site.
- task dev:bnfcli -- ./dev-scripts/install-site.sh --no-content {{ if .SKIP_LANGUAGE_IMPORT }}--skip-language-import{{ end }}
- task dev:bnfcli -- drush --yes pm:enable bnf_server
- task dev:bnfcli -- drush --yes config:set system.site name BNF
- task: dev:bnf:set-client
# Show a one-time login to the local site(s).
- task dev:cli -- drush user-login
- task dev:bnfcli -- drush user-login

# Set CMS site to point to BNF site. This needs to be a task so we
# can quietly skip it if BNF isn't enabled.
dev:bnf:set-client:
internal: true
status:
- "[[ -z \"{{ .DOCKER_COMPOSE_FILES_BNF}}\" ]]"
cmds:
- task dev:cli -- drush config:set --yes bnf_client.settings base_url https://https/

dev:openid:configure:
desc: Set openid connect settings based on .env variables. And run cron.
Expand All @@ -192,6 +209,7 @@ tasks:
dev:enable-dev-tools:
desc: Enable dev modules and settings, which are not to be used in Prod. They are config-ignored
cmds:
# If changing this, keep the corresponding line in ./dev-scripts/install-site.sh in sync.
- task dev:cli -- drush install -y devel dpl_example_content field_ui purge_ui restui uuid_url views_ui dblog

dev:enable-xdebug:
Expand All @@ -208,6 +226,7 @@ tasks:

dev:create-users:
desc: Create test users, with test roles
# If changing this, keep the corresponding lines in ./dev-scripts/install-site.sh in sync.
cmds:
- task dev:cli -- drush user:create editor --password="test"
- task dev:cli -- drush user:role:add 'editor' editor
Expand Down
17 changes: 17 additions & 0 deletions assets/sites.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

// phpcs:ignoreFile

$sites = [];

// HTTP_HOST is not set when running PHPUnit tests, so check for existence
// first.
if (isset($_SERVER['HTTP_HOST'])) {
// Add in the host name to sites if it starts with `bnf-`. This way we don't
// have to worry about what TLD people use (docker or local), nor the composer
// project name (dpl-cms per default, but could be anything).
$host = $_SERVER['HTTP_HOST'];
if (preg_match('/^bnf-/', $host)) {
$sites[$host] = 'bnf';
}
}
16 changes: 10 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
"type": "package",
"package": {
"name": "danskernesdigitalebibliotek/dpl-react",
"version": "0.0.0-dev",
"version": "2025.4.0",
"type": "drupal-library",
"dist": {
"url": "https://github.com/danskernesdigitalebibliotek/dpl-react/releases/download/branch-reader-player-feature/dist-reader-player-feature.zip",
"url": "https://github.com/danskernesdigitalebibliotek/dpl-react/releases/download/2025.4.0/dist-2025-4-0-851fc5159c4be5f290bdac88e85ad118ebf66698.zip",
"type": "zip"
},
"require": {
Expand All @@ -56,9 +56,9 @@
"package": {
"name": "danskernesdigitalebibliotek/dpl-design-system",
"type": "drupal-library",
"version": "0.0.0-dev",
"version": "2025.4.0",
"dist": {
"url": "https://github.com/danskernesdigitalebibliotek/dpl-design-system/releases/download/branch-reader-player-feature/dist-reader-player-feature.zip",
"url": "https://github.com/danskernesdigitalebibliotek/dpl-design-system/releases/download/2025.4.0/dist-2025-4-0-d4f21c986e88e25924a6c2fe87db1a39199ef649.zip",
"type": "zip"
}
}
Expand Down Expand Up @@ -90,8 +90,8 @@
"composer/installers": "1.12.0",
"cweagans/composer-patches": "1.7.3",
"danskernesdigitalebibliotek/cms-api": "*",
"danskernesdigitalebibliotek/dpl-design-system": "0.0.0-dev",
"danskernesdigitalebibliotek/dpl-react": "0.0.0-dev",
"danskernesdigitalebibliotek/dpl-design-system": "2025.4.0",
"danskernesdigitalebibliotek/dpl-react": "2025.4.0",
"danskernesdigitalebibliotek/fbs-client": "*",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"deoliveiralucas/array-keys-case-transform": "^1.1",
Expand Down Expand Up @@ -273,9 +273,13 @@
],
"file-mapping": {
"[web-root]/sites/default/all.settings.php": "assets/all.settings.php",
"[web-root]/sites/bnf/all.settings.php": "assets/all.settings.php",
"[web-root]/sites/default/development.settings.php": "assets/development.settings.php",
"[web-root]/sites/bnf/development.settings.php": "assets/development.settings.php",
"[web-root]/sites/default/local.services.yml": "assets/local.services.yml",
"[web-root]/sites/bnf/local.services.yml": "assets/local.services.yml",
"[web-root]/sites/default/local.settings.php": "assets/local.settings.php",
"[web-root]/sites/bnf/local.settings.php": "assets/local.settings.php",
"[project-root]/drush/sites/lagoon.site.yml": "assets/lagoon.site.yml",
"[web-root]/.eslintrc.json": false,
"[project-root]/.gitattributes": {
Expand Down
Loading

0 comments on commit 60804cf

Please sign in to comment.