From 3c84e0b7a408d95064bdd780ed1a91366529adaa Mon Sep 17 00:00:00 2001 From: Clinton Graham Date: Fri, 24 Mar 2023 10:22:37 -0400 Subject: [PATCH 1/6] #328: Update demo_content to formulate the password for example_content.yml --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 681c9f49a..a6cdc3937 100644 --- a/Makefile +++ b/Makefile @@ -473,7 +473,7 @@ demo_content: # if prod do this by default [ -d "islandora_workbench" ] || (git clone https://github.com/mjordan/islandora_workbench) cd islandora_workbench ; cd islandora_workbench_demo_content || git clone https://github.com/DonRichards/islandora_workbench_demo_content - $(SED_DASH_I) 's/^nopassword.*/password\: $(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD) /g' islandora_workbench/islandora_workbench_demo_content/example_content.yml + $(SED_DASH_I) 's/^password.*/password: '$(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD | sed s#/#\\\\\\\\/#g)'/g' islandora_workbench/islandora_workbench_demo_content/example_content.yml cd islandora_workbench && docker build -t workbench-docker . cd islandora_workbench && docker run -it --rm --network="host" -v $(QUOTED_CURDIR)/islandora_workbench:/workbench --name my-running-workbench workbench-docker bash -lc "./workbench --config /workbench/islandora_workbench_demo_content/example_content.yml" $(MAKE) reindex-solr From ec00f0e0c1f25e5d3741ab74111b7c5ebd11bd6d Mon Sep 17 00:00:00 2001 From: Don Richards Date: Thu, 30 Mar 2023 13:25:06 -0400 Subject: [PATCH 2/6] Add improved password and domain process improvements --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a6cdc3937..47440d063 100644 --- a/Makefile +++ b/Makefile @@ -150,15 +150,15 @@ local: generate-secrets docker-compose up -d --remove-orphans docker-compose exec -T drupal with-contenv bash -lc 'composer install; chown -R nginx:nginx .' $(MAKE) remove_standard_profile_references_from_config drupal-database update-settings-php ENVIRONMENT=local - docker-compose exec -T drupal with-contenv bash -lc "drush si -y islandora_install_profile_demo --account-pass $(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD)" + docker-compose exec -T drupal with-contenv bash -lc "drush si -y islandora_install_profile_demo --account-pass '$(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD)'" $(MAKE) delete-shortcut-entities && docker-compose exec -T drupal with-contenv bash -lc "drush pm:un -y shortcut" docker-compose exec -T drupal with-contenv bash -lc "drush en -y migrate_tools" $(MAKE) hydrate ENVIRONMENT=local -docker-compose exec -T drupal with-contenv bash -lc 'mkdir -p /var/www/drupal/config/sync && chmod -R 775 /var/www/drupal/config/sync' #docker-compose exec -T drupal with-contenv bash -lc 'chown -R `id -u`:nginx /var/www/drupal' #docker-compose exec -T drupal with-contenv bash -lc 'drush migrate:rollback islandora_defaults_tags,islandora_tags' - curl -k -u admin:$(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD) -H "Content-Type: application/json" -d "@build/demo-data/homepage.json" https://${DOMAIN}/node?_format=json - curl -k -u admin:$(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD) -H "Content-Type: application/json" -d "@build/demo-data/browse-collections.json" https://${DOMAIN}/node?_format=json + curl -k -u admin:'$(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD)' -H "Content-Type: application/json" -d "@build/demo-data/homepage.json" https://${DOMAIN}/node?_format=json + curl -k -u admin:'$(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD)' -H "Content-Type: application/json" -d "@build/demo-data/browse-collections.json" https://${DOMAIN}/node?_format=json $(MAKE) login @@ -473,7 +473,8 @@ demo_content: # if prod do this by default [ -d "islandora_workbench" ] || (git clone https://github.com/mjordan/islandora_workbench) cd islandora_workbench ; cd islandora_workbench_demo_content || git clone https://github.com/DonRichards/islandora_workbench_demo_content - $(SED_DASH_I) 's/^password.*/password: '$(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD | sed s#/#\\\\\\\\/#g)'/g' islandora_workbench/islandora_workbench_demo_content/example_content.yml + $(SED_DASH_I) 's/^host.*/host: https:\/\/$(DOMAIN)\//g' islandora_workbench/islandora_workbench_demo_content/example_content.yml + $(SED_DASH_I) 's/^password.*/password: "$(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD | sed s#/#\\\\\\\\/#g)"/g' islandora_workbench/islandora_workbench_demo_content/example_content.yml cd islandora_workbench && docker build -t workbench-docker . cd islandora_workbench && docker run -it --rm --network="host" -v $(QUOTED_CURDIR)/islandora_workbench:/workbench --name my-running-workbench workbench-docker bash -lc "./workbench --config /workbench/islandora_workbench_demo_content/example_content.yml" $(MAKE) reindex-solr @@ -551,7 +552,7 @@ starter-init: generate-secrets starter-finalize: docker-compose exec -T drupal with-contenv bash -lc 'chown -R nginx:nginx .' $(MAKE) drupal-database update-settings-php - docker-compose exec -T drupal with-contenv bash -lc "drush si -y --existing-config minimal --account-pass $(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD)" + docker-compose exec -T drupal with-contenv bash -lc "drush si -y --existing-config minimal --account-pass '$(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD)'" docker-compose exec -T drupal with-contenv bash -lc "drush -l $(SITE) user:role:add fedoraadmin admin" MIGRATE_IMPORT_USER_OPTION=--userid=1 $(MAKE) hydrate docker-compose exec -T drupal with-contenv bash -lc 'drush -l $(SITE) migrate:import --userid=1 islandora_fits_tags' From e47a666f344b8e39507943f6b6ad14848d957d34 Mon Sep 17 00:00:00 2001 From: Josh D'entremont Date: Fri, 14 Apr 2023 13:10:14 -0300 Subject: [PATCH 3/6] changed logic for make up to not run make demo if docker-compose up fails --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a6cdc3937..a5c129c3c 100644 --- a/Makefile +++ b/Makefile @@ -257,9 +257,13 @@ docker-compose.yml: $(SERVICES:%=build/docker-compose/docker-compose.%.yml) .env .PHONY: up .SILENT: up -## Brings up the containers or builds demo if no containers were found. +## Brings up the containers or builds demo if no docker-compose.yml file is found. up: - test -f docker-compose.yml && docker-compose up -d --remove-orphans || $(MAKE) demo + if [ -f docker-compose.yml ]; then \ + docker-compose up -d --remove-orphans; \ + else \ + $(MAKE) demo; \ + fi @echo "\n Sleeping for 10 seconds to wait for Drupal to finish building.\n" sleep 10 docker-compose exec -T drupal with-contenv bash -lc "for_all_sites update_settings_php" From 4c41cf4bdb032abbbc5a7171e145ce286b3ad6f4 Mon Sep 17 00:00:00 2001 From: Josh D'entremont Date: Fri, 14 Apr 2023 15:42:20 -0300 Subject: [PATCH 4/6] added option to build a site using make starter from a codebase other than the starter site --- Makefile | 6 ++++-- sample.env | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a5c129c3c..3baaf0c5f 100644 --- a/Makefile +++ b/Makefile @@ -163,12 +163,14 @@ local: generate-secrets .PHONY: starter -## Make a local site with codebase directory bind mounted, using starter site. +## Make a local site with codebase directory bind mounted, using starter site unless other package specified in .env or present already. starter: QUOTED_CURDIR = "$(CURDIR)" starter: generate-secrets $(MAKE) starter-init ENVIRONMENT=starter if [ -z "$$(ls -A $(QUOTED_CURDIR)/codebase)" ]; then \ - docker container run --rm -v $(CURDIR)/codebase:/home/root $(REPOSITORY)/nginx:$(TAG) with-contenv bash -lc 'composer create-project islandora/islandora-starter-site:dev-main /tmp/codebase; mv /tmp/codebase/* /home/root;'; \ + docker container run --rm -v $(CURDIR)/codebase:/home/root $(REPOSITORY)/nginx:$(TAG) with-contenv bash -lc 'composer create-project $(CODEBASE_PACKAGE) /tmp/codebase; mv /tmp/codebase/* /home/root;'; \ + else \ + docker container run --rm -v $(CURDIR)/codebase:/home/root $(REPOSITORY)/nginx:$(TAG) with-contenv bash -lc 'cd /home/root; composer install'; \ fi $(MAKE) set-files-owner SRC=$(CURDIR)/codebase ENVIRONMENT=starter docker-compose up -d --remove-orphans diff --git a/sample.env b/sample.env index be0f23474..1ac49b431 100644 --- a/sample.env +++ b/sample.env @@ -32,6 +32,10 @@ DOCKER_BUILDKIT=1 # Dockerfile to use when building the custom project. PROJECT_DRUPAL_DOCKERFILE=Dockerfile +# Packagist repo to use when creating a site with make starter +# Change this if you want to build from a different codebase than the starter site +CODEBASE_PACKAGE=islandora/islandora-starter-site:dev-main + # Includes `traefik` as a service, if false assume we are sharing a traefik # from another project. INCLUDE_TRAEFIK_SERVICE=true From 4d3a1257d7fb19f54ce24331db7113551f5adc8d Mon Sep 17 00:00:00 2001 From: Josh D'entremont Date: Fri, 14 Apr 2023 16:05:02 -0300 Subject: [PATCH 5/6] Revert "changed logic for make up to not run make demo if docker-compose up fails" This reverts commit e47a666f344b8e39507943f6b6ad14848d957d34. --- Makefile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 3baaf0c5f..17d839617 100644 --- a/Makefile +++ b/Makefile @@ -259,13 +259,9 @@ docker-compose.yml: $(SERVICES:%=build/docker-compose/docker-compose.%.yml) .env .PHONY: up .SILENT: up -## Brings up the containers or builds demo if no docker-compose.yml file is found. +## Brings up the containers or builds demo if no containers were found. up: - if [ -f docker-compose.yml ]; then \ - docker-compose up -d --remove-orphans; \ - else \ - $(MAKE) demo; \ - fi + test -f docker-compose.yml && docker-compose up -d --remove-orphans || $(MAKE) demo @echo "\n Sleeping for 10 seconds to wait for Drupal to finish building.\n" sleep 10 docker-compose exec -T drupal with-contenv bash -lc "for_all_sites update_settings_php" From 01d40322d9776b3d22c1a2118c8969a3f6225ac0 Mon Sep 17 00:00:00 2001 From: Don Richards Date: Mon, 17 Apr 2023 15:49:37 -0400 Subject: [PATCH 6/6] Updated using suggestions for better delimiter --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 47440d063..4e9dbea00 100644 --- a/Makefile +++ b/Makefile @@ -473,7 +473,7 @@ demo_content: # if prod do this by default [ -d "islandora_workbench" ] || (git clone https://github.com/mjordan/islandora_workbench) cd islandora_workbench ; cd islandora_workbench_demo_content || git clone https://github.com/DonRichards/islandora_workbench_demo_content - $(SED_DASH_I) 's/^host.*/host: https:\/\/$(DOMAIN)\//g' islandora_workbench/islandora_workbench_demo_content/example_content.yml + $(SED_DASH_I) 's#^host.*#host: $(SITE)/#g' islandora_workbench/islandora_workbench_demo_content/example_content.yml $(SED_DASH_I) 's/^password.*/password: "$(shell cat secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD | sed s#/#\\\\\\\\/#g)"/g' islandora_workbench/islandora_workbench_demo_content/example_content.yml cd islandora_workbench && docker build -t workbench-docker . cd islandora_workbench && docker run -it --rm --network="host" -v $(QUOTED_CURDIR)/islandora_workbench:/workbench --name my-running-workbench workbench-docker bash -lc "./workbench --config /workbench/islandora_workbench_demo_content/example_content.yml"