From f7e4fb41c9518856bee4b62eed426f07a7430f53 Mon Sep 17 00:00:00 2001 From: Don Richards Date: Fri, 7 Oct 2022 11:53:16 -0400 Subject: [PATCH 1/7] Correct spacing --- idc.Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/idc.Makefile b/idc.Makefile index 0ed54efdb..4eb59ae9d 100644 --- a/idc.Makefile +++ b/idc.Makefile @@ -242,8 +242,8 @@ static-docker-compose.yml: static-drupal-image else \ echo $$line >> .env_static ; \ fi \ - done < $${ENV_FILE} && \ - echo DRUPAL_STATIC_TAG=${GIT_TAG} >> .env_static + done < $${ENV_FILE} && \ + echo DRUPAL_STATIC_TAG=${GIT_TAG} >> .env_static mv $${ENV_FILE} .env.bak mv .env_static $${ENV_FILE} $(MAKE) -B docker-compose.yml args="--env-file $${ENV_FILE}" || mv .env.bak $${ENV_FILE} From 2dcbe1e315ed6f2ae665cf360b78edffcaa34c6d Mon Sep 17 00:00:00 2001 From: Don Richards Date: Fri, 7 Oct 2022 11:53:52 -0400 Subject: [PATCH 2/7] Change build order --- codebase/composer.json | 6 ++---- idc.Makefile | 25 +++++++++++-------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/codebase/composer.json b/codebase/composer.json index 04bdbc002..18953e8b5 100644 --- a/codebase/composer.json +++ b/codebase/composer.json @@ -265,13 +265,11 @@ ], "post-install-cmd": [ "@composer drupal:scaffold", - "DrupalProject\\composer\\ScriptHandler::createRequiredFiles", - "drush updatedb -y" + "DrupalProject\\composer\\ScriptHandler::createRequiredFiles" ], "post-update-cmd": [ "@composer drupal:scaffold", - "DrupalProject\\composer\\ScriptHandler::createRequiredFiles", - "drush updatedb -y" + "DrupalProject\\composer\\ScriptHandler::createRequiredFiles" ] }, "extra": { diff --git a/idc.Makefile b/idc.Makefile index 4eb59ae9d..b55c8a638 100644 --- a/idc.Makefile +++ b/idc.Makefile @@ -47,7 +47,7 @@ destroy-state: .SILENT: composer-install composer-install: echo "Installing via composer" - docker-compose exec drupal with-contenv bash -lc "COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction && drush updatedb -y && drush cr -y" + docker-compose exec drupal with-contenv bash -lc "COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction" # Fix the masonry is a submodule error message. [ -d codebase/web/libraries/masonry/.git/ ] && sudo rm -rf codebase/web/libraries/masonry/.git || true @@ -162,7 +162,7 @@ start: for i in $$(seq 5) ; do \ echo "waiting for mysql to start..."; \ sleep 5; \ - BASIC_DBS_PRESENT=$$(docker-compose exec -T mariadb mysql mysql -N -e "SELECT count(*) from information_schema.SCHEMATA;"); \ + BASIC_DBS_PRESENT=$$(docker-compose exec -T mariadb [ ! -S "/var/lib/mysql/mysql.sock" ] || mysql mysql -N -e "SELECT count(*) from information_schema.SCHEMATA;"); \ if [ "$$?" -gt "0" ]; then continue; fi; \ if [ ! -n "$$BASIC_DBS_PRESENT" ]; then continue; fi; \ if [ ! "$$BASIC_DBS_PRESENT" -gt "0" ]; then continue; fi; \ @@ -173,21 +173,23 @@ start: echo "No Drupal state found. Loading from snapshot, and importing config from config/sync"; \ ${MAKE} db_restore; \ ${MAKE} _docker-up-and-wait; \ - ${MAKE} composer-install; \ - if [ ! -f codebase/web/sites/default/files/generic.png ] ; then cp "codebase/web/core/modules/media/images/icons/generic.png" "codebase/web/sites/default/files/generic.png" || true ; fi ; \ - ${MAKE} config-import; \ else \ echo "Pre-existing Drupal state found, not loading db from snapshot"; \ ${MAKE} _docker-up-and-wait; \ - ${MAKE} composer-install; \ - ${MAKE} config-import; \ fi; - $(MAKE) solr-cores + # This is a bit of a hack to make the solr update work. This can be removed once the solr update is applied to production. + -docker-compose exec -T drupal /bin/sh -c "drush cdel core.extension module.search_api_solr_defaults || true" + -docker-compose exec -T drupal /bin/sh -c "drush sql-query \"DELETE FROM key_value WHERE collection='system.schema' AND name='search_api_solr_defaults';\" || true" + -docker-compose exec -T drupal /bin/sh -c "drush php-eval \"\Drupal::keyValue('system.schema')->delete('remote_stream_wrapper')\" || true" + -docker-compose exec -T drupal /bin/sh -c "drush php-eval \"\Drupal::keyValue('system.schema')->delete('matomo')\" || true" + $(MAKE) composer-install + docker-compose exec -T drupal with-contenv bash -lc "drush updatedb -y" + $(MAKE) config-import # Fix for Github runner "the input device is not a TTY" error docker-compose exec -T drupal bash -lc "bash /var/www/drupal/fix_permissions.sh /var/www/drupal/web nginx" docker-compose exec -T drupal with-contenv bash -lc "drush search-api-solr:install-missing-fieldtypes" docker-compose exec -T drupal with-contenv bash -lc "drush search-api:rebuild-tracker ; drush search-api-solr:finalize-index ; drush search-api:index" - $(MAKE) set-tmp + $(MAKE) solr-cores .PHONY: _docker-up-and-wait .SILENT: _docker-up-and-wait @@ -195,11 +197,6 @@ _docker-up-and-wait: docker-compose up -d sleep 5 docker-compose exec -T drupal /bin/sh -c "while true ; do echo \"Waiting for Drupal to start ...\" ; if [ -d \"/var/run/s6/services/nginx\" ] ; then s6-svwait -u /var/run/s6/services/nginx && exit 0 ; else sleep 5 ; fi done" - # This is a bit of a hack to make the solr update work. This can be removed once the solr update is applied to production. - -docker-compose exec -T drupal /bin/sh -c "drush cdel core.extension module.search_api_solr_defaults" - -docker-compose exec -T drupal /bin/sh -c "drush sql-query \"DELETE FROM key_value WHERE collection='system.schema' AND name='search_api_solr_defaults';\"" - -docker-compose exec -T drupal /bin/sh -c "drush php-eval \"\Drupal::keyValue('system.schema')->delete('remote_stream_wrapper')\"" - -docker-compose exec -T drupal /bin/sh -c "drush php-eval \"\Drupal::keyValue('system.schema')->delete('matomo')\"" $(MAKE) cache-rebuild From 215d366d1e9cfcc64f0192d599abb657e964dda8 Mon Sep 17 00:00:00 2001 From: Don Richards Date: Fri, 7 Oct 2022 12:03:19 -0400 Subject: [PATCH 3/7] Revert mysql if statement --- idc.Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idc.Makefile b/idc.Makefile index b55c8a638..a7a93b0fe 100644 --- a/idc.Makefile +++ b/idc.Makefile @@ -162,7 +162,7 @@ start: for i in $$(seq 5) ; do \ echo "waiting for mysql to start..."; \ sleep 5; \ - BASIC_DBS_PRESENT=$$(docker-compose exec -T mariadb [ ! -S "/var/lib/mysql/mysql.sock" ] || mysql mysql -N -e "SELECT count(*) from information_schema.SCHEMATA;"); \ + BASIC_DBS_PRESENT=$$(docker-compose exec -T mariadb mysql mysql -N -e "SELECT count(*) from information_schema.SCHEMATA;"); \ if [ "$$?" -gt "0" ]; then continue; fi; \ if [ ! -n "$$BASIC_DBS_PRESENT" ]; then continue; fi; \ if [ ! "$$BASIC_DBS_PRESENT" -gt "0" ]; then continue; fi; \ From 6debe2a90115e06a292ba9e5aa9fe3bdf1d5c439 Mon Sep 17 00:00:00 2001 From: Don Richards Date: Fri, 7 Oct 2022 12:17:05 -0400 Subject: [PATCH 4/7] Drop with-contenv --- idc.Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/idc.Makefile b/idc.Makefile index a7a93b0fe..6bdb07040 100644 --- a/idc.Makefile +++ b/idc.Makefile @@ -183,12 +183,12 @@ start: -docker-compose exec -T drupal /bin/sh -c "drush php-eval \"\Drupal::keyValue('system.schema')->delete('remote_stream_wrapper')\" || true" -docker-compose exec -T drupal /bin/sh -c "drush php-eval \"\Drupal::keyValue('system.schema')->delete('matomo')\" || true" $(MAKE) composer-install - docker-compose exec -T drupal with-contenv bash -lc "drush updatedb -y" + docker-compose exec -T drupal bash -lc "drush updatedb -y" $(MAKE) config-import # Fix for Github runner "the input device is not a TTY" error docker-compose exec -T drupal bash -lc "bash /var/www/drupal/fix_permissions.sh /var/www/drupal/web nginx" - docker-compose exec -T drupal with-contenv bash -lc "drush search-api-solr:install-missing-fieldtypes" - docker-compose exec -T drupal with-contenv bash -lc "drush search-api:rebuild-tracker ; drush search-api-solr:finalize-index ; drush search-api:index" + -docker-compose exec -T drupal bash -lc "drush search-api-solr:install-missing-fieldtypes" + -docker-compose exec -T drupal bash -lc "drush search-api:rebuild-tracker ; drush search-api-solr:finalize-index ; drush search-api:index" $(MAKE) solr-cores .PHONY: _docker-up-and-wait From 81af96cbb04016d17f44c537f287fbd5a9291566 Mon Sep 17 00:00:00 2001 From: Don Richards Date: Fri, 7 Oct 2022 12:32:45 -0400 Subject: [PATCH 5/7] Add mysql health-check and restart policy --- docker-compose.mariadb.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker-compose.mariadb.yml b/docker-compose.mariadb.yml index d3cd7677d..d0d85d3fd 100644 --- a/docker-compose.mariadb.yml +++ b/docker-compose.mariadb.yml @@ -10,6 +10,7 @@ services: # https://github.com/matomo-org/matomo/issues/500 mariadb: image: ${REPOSITORY:-islandora}/mariadb:${TAG:-latest} + restart: unless-stopped volumes: - mariadb-data:/var/lib/mysql - mariadb-files:/var/lib/mysql-files @@ -34,3 +35,7 @@ services: - mariadb-${COMPOSE_PROJECT_NAME-isle-dc}.${DRUPAL_SITE_HOST-traefik.me} - mariadb-${COMPOSE_PROJECT_NAME-isle-dc}-${DRUPAL_SITE_HOST-traefik.me} gateway: + healthcheck: + test: "mysql mysql -N -e \"SELECT count(*) from information_schema.SCHEMATA;\"" + timeout: 20s + retries: 10 \ No newline at end of file From 3f862d2204cd3744e639ad184ffee2a763cf16cd Mon Sep 17 00:00:00 2001 From: Don Richards Date: Fri, 7 Oct 2022 12:39:15 -0400 Subject: [PATCH 6/7] Tmp Remove masonry fix --- idc.Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/idc.Makefile b/idc.Makefile index 6bdb07040..a61447191 100644 --- a/idc.Makefile +++ b/idc.Makefile @@ -48,8 +48,7 @@ destroy-state: composer-install: echo "Installing via composer" docker-compose exec drupal with-contenv bash -lc "COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction" - # Fix the masonry is a submodule error message. - [ -d codebase/web/libraries/masonry/.git/ ] && sudo rm -rf codebase/web/libraries/masonry/.git || true + .PHONY: snapshot-image .SILENT: snapshot-image From 3d84088beeb3ff5584b32823322683f354b36b4c Mon Sep 17 00:00:00 2001 From: Don Richards Date: Fri, 7 Oct 2022 14:09:30 -0400 Subject: [PATCH 7/7] Drop root and add -T To disable pseudo-tty allocation --- idc.Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idc.Makefile b/idc.Makefile index a61447191..8519451d7 100644 --- a/idc.Makefile +++ b/idc.Makefile @@ -47,7 +47,7 @@ destroy-state: .SILENT: composer-install composer-install: echo "Installing via composer" - docker-compose exec drupal with-contenv bash -lc "COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction" + docker-compose exec -T drupal bash -lc "COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction --no-progress" .PHONY: snapshot-image