From 3703a1203106d999a5e41fab4cae2d440d37a158 Mon Sep 17 00:00:00 2001 From: Don Richards Date: Tue, 8 Nov 2022 15:21:08 -0500 Subject: [PATCH 01/11] Initial move to startup script --- .github/workflows/ci.yml | 46 ++------------------------ codebase/scripts/bash/start_up.sh | 40 ++++++++++++++++++++++ idc.Makefile | 13 +------- scripts/incremental_version_updater.sh | 3 +- 4 files changed, 46 insertions(+), 56 deletions(-) create mode 100644 codebase/scripts/bash/start_up.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d1919341..152a2c051 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,14 +28,6 @@ jobs: run: | echo '{"experimental": "enabled"}' > ~/.docker/config.json - # Temp fix for 9.4 switch to working tag - - name: Temp fix for 9.4 switch to working tag - run: git fetch --all --tags && git checkout cf17931c2bc5f8562ff8d26a7e642b3ca49cb92c codebase/ - - # Temp fix for 9.4 copy incremental_version_updater.sh to codebase - - name: Temp fix for 9.4 copy incremental_version_updater.sh to codebase - run: cp scripts/incremental_version_updater.sh codebase/incremental_version_updater.sh - # Build and run the static environment - name: Build Static run: make static-docker-compose.yml up @@ -44,41 +36,9 @@ jobs: - name: Temp fix for 9.4 Add github token to composer run: docker-compose exec -T drupal with-contenv bash -lc "composer config -g github-oauth.github.com ${{ secrets.GH_TOKEN }}" - # Temp fix for 9.4 run incremental_version_updater.sh - - name: Temp fix for 9.4 run incremental_version_updater.sh - run: docker-compose exec -T drupal bash -lc "cd /var/www/drupal && bash /var/www/drupal/incremental_version_updater.sh ${{ secrets.GH_TOKEN }}" - - # Temp fix for 9.4 remove incremental_version_updater.sh in codebase - - name: Temp fix for 9.4 remove incremental_version_updater.sh in codebase - run: rm -f codebase/incremental_version_updater.sh - - # Temp fix for 9.4 reset file permissions of codebase - - name: Temp fix for 9.4 reset file permissions of codebase - run: make set-codebase-owner - - # Temp fix for 9.4 reset codebase - - name: Temp fix for 9.4 reset codebase - run: git checkout codebase/ - - # Temp fix for 9.4 run composer install - - name: Temp fix for 9.4 run composer install - run: make composer-install - - # Run fix_permissions Script - - name: Run fix_permissions Script - run: docker-compose exec -T drupal bash /var/www/drupal/fix_permissions.sh /var/www/drupal/web nginx - - # Run the updatedb command. - - name: Run Update Hooks - run: docker-compose exec -T drupal drush updatedb -y - - # Rebuild the theme cache - - name: Rebuild Theme Cache - run: docker-compose exec -T drupal drush cc theme-registry - - # Drush tests - - name: Drush test - run: docker-compose exec -T drupal drush -d status + # Run initial start up script + - name: Run initial start up script + run: docker-compose exec -T drupal with-contenv bash -lc "bash /var/www/drupal/scripts/bash/start_up.sh" - name: Export image run: make static-drupal-image-export diff --git a/codebase/scripts/bash/start_up.sh b/codebase/scripts/bash/start_up.sh new file mode 100644 index 000000000..118d4091a --- /dev/null +++ b/codebase/scripts/bash/start_up.sh @@ -0,0 +1,40 @@ +#!/usr/bin/with-contenv bash + +set -e +echo "" +echo "" +echo " -------------------------------------------------------------------------- " +echo " - Running a Start up script - " +echo " -------------------------------------------------------------------------- " +echo "" + +COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction --no-progress + +bash /var/www/drupal/fix_permissions.sh /var/www/drupal/web nginx + +# This is a workaround for a bug. +drush cdel core.extension module.search_api_solr_defaults || true +drush sql-query "DELETE FROM key_value WHERE collection='system.schema' AND name='search_api_solr_defaults';" || true +drush php-eval "\Drupal::keyValue('system.schema')->delete('remote_stream_wrapper')" || true +drush php-eval "\Drupal::keyValue('system.schema')->delete('matomo')" || true + +drush config:import -y + +# Fix for Github runner "the input device is not a TTY" error +bash /var/www/drupal/fix_permissions.sh /var/www/drupal/web nginx +drush search-api-solr:install-missing-fieldtypes || true +drush search-api:rebuild-tracker || true +drush search-api-solr:finalize-index || true +drush search-api:index || true + +# Cleanup +drush updatedb -y +drush cc theme-registry +drush -d status + +echo "" +echo "" +echo " -------------------------------------------------------------------------- " +echo " - Done - " +echo " -------------------------------------------------------------------------- " +echo "" diff --git a/idc.Makefile b/idc.Makefile index 8519451d7..e92d709ef 100644 --- a/idc.Makefile +++ b/idc.Makefile @@ -176,18 +176,7 @@ start: echo "Pre-existing Drupal state found, not loading db from snapshot"; \ ${MAKE} _docker-up-and-wait; \ fi; - # 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 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 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" + -docker-compose exec -T drupal bash -lc "bash /var/www/drupal/scripts/bash/start_up.sh" $(MAKE) solr-cores .PHONY: _docker-up-and-wait diff --git a/scripts/incremental_version_updater.sh b/scripts/incremental_version_updater.sh index 1535a2288..df028212b 100644 --- a/scripts/incremental_version_updater.sh +++ b/scripts/incremental_version_updater.sh @@ -20,7 +20,8 @@ DRUPAL_VERSIONS=(9.4.7 9.4.6 9.4.5 9.4.4 9.4.3 9.4.2 9.4.1 9.4.0 9.3.22 9.3.21 9 STARTING_POINT_VERSION='9.2.13' HIGHEST_VERSION_IN_ARRAY="${DRUPAL_VERSIONS[0]}" -CURRENT_VERSION=$(cat web/core/lib/Drupal.php | grep 'const VERSION ' | cut -d\' -f2) +# CURRENT_VERSION=$(cat web/core/lib/Drupal.php | grep 'const VERSION ' | cut -d\' -f2) +CURRENT_VERSION=$(drush cr && drush core-status --fields=drupal-version | cut -d\: -f2 | sed 's/ //g') echo "Current version: $CURRENT_VERSION" apk add jq --quiet From 15ac207e8e4e596c10cfc606a224e2c231e6025d Mon Sep 17 00:00:00 2001 From: Don Richards Date: Tue, 8 Nov 2022 16:26:56 -0500 Subject: [PATCH 02/11] Add GITHUB token check & at tool with config export. --- Makefile | 2 +- codebase/composer.json | 1 + codebase/composer.lock | 97 +++++++++++++++++- .../config/sync/block.block.contactblock.yml | 24 ++--- .../sync/block.block.contactblock_2.yml | 24 ++--- ...w_display.node.article.content_browser.yml | 20 ++-- ...tity_view_display.node.article.default.yml | 20 ++-- ...ntity_view_display.node.article.teaser.yml | 20 ++-- codebase/config/sync/core.extension.yml | 1 + codebase/config/sync/devel.settings.yml | 4 +- codebase/config/sync/idcui.settings.yml | 99 +++++++++++++++++++ ...pi_solr.solr_field_type.text_und_6_0_0.yml | 6 +- ...pi_solr.solr_field_type.text_und_7_0_0.yml | 6 +- codebase/scripts/bash/start_up.sh | 3 + idc.Makefile | 5 +- 15 files changed, 258 insertions(+), 74 deletions(-) create mode 100644 codebase/config/sync/idcui.settings.yml diff --git a/Makefile b/Makefile index 987a96ed5..bf5f77b8e 100644 --- a/Makefile +++ b/Makefile @@ -245,7 +245,7 @@ remove_standard_profile_references_from_config: .PHONY: config-export .SILENT: config-export config-export: - docker-compose exec drupal bash -lc "bash /var/www/drupal/fix_permissions.sh /var/www/drupal/web nginx" + $(MAKE) set-codebase-owner -rm -rf ./codebase/config/sync/* git checkout $(CURDIR)/codebase/config/sync/ docker-compose exec drupal drush -l $(SITE) config:export -y diff --git a/codebase/composer.json b/codebase/composer.json index 3051c433d..dd9a19a83 100644 --- a/codebase/composer.json +++ b/codebase/composer.json @@ -114,6 +114,7 @@ "composer/installers": "^1.2", "cweagans/composer-patches": "^1.6.5", "drupal/admin_toolbar": "^2.0", + "drupal/at_tool": "^2.0", "drupal/auto_entitylabel": "^3.0@beta", "drupal/captcha": "^1.1", "drupal/console": "~1.0", diff --git a/codebase/composer.lock b/codebase/composer.lock index 5996ce7f3..b3cacb5ff 100644 --- a/codebase/composer.lock +++ b/codebase/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "300df65b30941cd7a462453cf022627c", + "content-hash": "4ac47f3e20018dc179d59308b368b85c", "packages": [ { "name": "alchemy/zippy", @@ -2320,6 +2320,53 @@ "abandoned": "roave/better-reflection", "time": "2022-05-31T18:46:25+00:00" }, + { + "name": "drupal/adaptivetheme", + "version": "5.1.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/adaptivetheme.git", + "reference": "8.x-5.1" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/adaptivetheme-8.x-5.1.zip", + "reference": "8.x-5.1", + "shasum": "22de075c38bc594ffb94b42ec7ff966a3056297e" + }, + "require": { + "drupal/core": "^9.3 || ^10" + }, + "type": "drupal-theme", + "extra": { + "drupal": { + "version": "8.x-5.1", + "datestamp": "1643902636", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Jeff Burnz", + "homepage": "https://www.drupal.org/user/61393" + }, + { + "name": "mattbloomfield", + "homepage": "https://www.drupal.org/user/3620586" + } + ], + "homepage": "https://www.drupal.org/project/adaptivetheme", + "support": { + "source": "https://git.drupalcode.org/project/adaptivetheme" + } + }, { "name": "drupal/admin_toolbar", "version": "2.5.0", @@ -2441,6 +2488,54 @@ "source": "https://git.drupalcode.org/project/at_theme" } }, + { + "name": "drupal/at_tool", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/at_tool.git", + "reference": "2.0.3" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/at_tool-2.0.3.zip", + "reference": "2.0.3", + "shasum": "a7e15fe72e8a165a60865a15cca362e3b4e2fdc5" + }, + "require": { + "drupal/adaptivetheme": "^5.0", + "drupal/core": "^9.3 || ^10" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "2.0.3", + "datestamp": "1643915557", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "Matt", + "homepage": "http://adaptivethemes.com", + "role": "Maintainer" + } + ], + "description": "Tools to support Adaptivetheme 8.x and sub-themes, includes the AT Theme Generator.", + "homepage": "https://www.drupal.org/project/at_tool", + "support": { + "source": "http://git.drupal.org/project/at_tool.git", + "issues": "https://www.drupal.org/project/issues/at_tool", + "irc": "irc://irc.freenode.org/drupal-contribute" + } + }, { "name": "drupal/auto_entitylabel", "version": "3.0.0-beta4", diff --git a/codebase/config/sync/block.block.contactblock.yml b/codebase/config/sync/block.block.contactblock.yml index 9e1220d06..991c4cf49 100644 --- a/codebase/config/sync/block.block.contactblock.yml +++ b/codebase/config/sync/block.block.contactblock.yml @@ -24,21 +24,18 @@ settings: provider: contact_block contact_form: collection_contact visibility: - view_inclusion: - id: view_inclusion - negate: false - context_mapping: { } - view_inclusion: { } - request_path_exclusion: - id: request_path_exclusion - negate: true - context_mapping: { } - pages: '' media_source_mimetype: id: media_source_mimetype mimetype: '' negate: false context_mapping: { } + 'entity_bundle:node': + id: 'entity_bundle:node' + negate: false + context_mapping: + node: '@node.node_route_context:node' + bundles: + collection_object: collection_object context_all: id: context_all negate: null @@ -58,10 +55,3 @@ visibility: own_page_true: '0' field_value: '0' user_fields: uid - 'entity_bundle:node': - id: 'entity_bundle:node' - negate: false - context_mapping: - node: '@node.node_route_context:node' - bundles: - collection_object: collection_object diff --git a/codebase/config/sync/block.block.contactblock_2.yml b/codebase/config/sync/block.block.contactblock_2.yml index fa944a28f..2eecd2422 100644 --- a/codebase/config/sync/block.block.contactblock_2.yml +++ b/codebase/config/sync/block.block.contactblock_2.yml @@ -24,21 +24,18 @@ settings: provider: contact_block contact_form: repository_item_contact visibility: - view_inclusion: - id: view_inclusion - negate: false - context_mapping: { } - view_inclusion: { } - request_path_exclusion: - id: request_path_exclusion - negate: true - context_mapping: { } - pages: '' media_source_mimetype: id: media_source_mimetype mimetype: '' negate: false context_mapping: { } + 'entity_bundle:node': + id: 'entity_bundle:node' + negate: false + context_mapping: + node: '@node.node_route_context:node' + bundles: + islandora_object: islandora_object context_all: id: context_all negate: null @@ -58,10 +55,3 @@ visibility: own_page_true: '0' field_value: '0' user_fields: uid - 'entity_bundle:node': - id: 'entity_bundle:node' - negate: false - context_mapping: - node: '@node.node_route_context:node' - bundles: - islandora_object: islandora_object diff --git a/codebase/config/sync/core.entity_view_display.node.article.content_browser.yml b/codebase/config/sync/core.entity_view_display.node.article.content_browser.yml index 3b271aec3..4673ec1d0 100644 --- a/codebase/config/sync/core.entity_view_display.node.article.content_browser.yml +++ b/codebase/config/sync/core.entity_view_display.node.article.content_browser.yml @@ -30,24 +30,24 @@ content: weight: 0 region: content display_media_entity_view_1: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content display_media_entity_view_2: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content display_media_service_file: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content display_media_thumbnail: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content field_image: type: image @@ -72,34 +72,34 @@ content: weight: 100 region: content openseadragon_media_evas_entity_view_1: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content openseadragon_media_evas_entity_view_2: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content openseadragon_media_evas_service_file: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content pdfjs_media_evas_entity_view_1: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content pdfjs_media_evas_entity_view_2: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content pdfjs_media_evas_service_file: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content hidden: comment: true diff --git a/codebase/config/sync/core.entity_view_display.node.article.default.yml b/codebase/config/sync/core.entity_view_display.node.article.default.yml index 296a82f52..85fef0349 100644 --- a/codebase/config/sync/core.entity_view_display.node.article.default.yml +++ b/codebase/config/sync/core.entity_view_display.node.article.default.yml @@ -39,24 +39,24 @@ content: weight: 110 region: content display_media_entity_view_1: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content display_media_entity_view_2: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content display_media_service_file: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content display_media_thumbnail: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content field_image: type: image @@ -83,34 +83,34 @@ content: weight: 100 region: content openseadragon_media_evas_entity_view_1: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content openseadragon_media_evas_entity_view_2: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content openseadragon_media_evas_service_file: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content pdfjs_media_evas_entity_view_1: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content pdfjs_media_evas_entity_view_2: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content pdfjs_media_evas_service_file: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content hidden: langcode: true diff --git a/codebase/config/sync/core.entity_view_display.node.article.teaser.yml b/codebase/config/sync/core.entity_view_display.node.article.teaser.yml index c4dc0ae8d..72a8453e9 100644 --- a/codebase/config/sync/core.entity_view_display.node.article.teaser.yml +++ b/codebase/config/sync/core.entity_view_display.node.article.teaser.yml @@ -30,24 +30,24 @@ content: weight: 0 region: content display_media_entity_view_1: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content display_media_entity_view_2: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content display_media_service_file: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content display_media_thumbnail: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content field_image: type: image @@ -72,34 +72,34 @@ content: weight: 100 region: content openseadragon_media_evas_entity_view_1: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content openseadragon_media_evas_entity_view_2: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content openseadragon_media_evas_service_file: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content pdfjs_media_evas_entity_view_1: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content pdfjs_media_evas_entity_view_2: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content pdfjs_media_evas_service_file: - weight: 10 settings: { } third_party_settings: { } + weight: 10 region: content hidden: comment: true diff --git a/codebase/config/sync/core.extension.yml b/codebase/config/sync/core.extension.yml index d600f18d0..1d0f1febe 100644 --- a/codebase/config/sync/core.extension.yml +++ b/codebase/config/sync/core.extension.yml @@ -4,6 +4,7 @@ module: action: 0 admin_toolbar: 0 admin_toolbar_links_access_filter: 0 + at_tool: 0 automated_cron: 0 basic_auth: 0 big_pipe: 0 diff --git a/codebase/config/sync/devel.settings.yml b/codebase/config/sync/devel.settings.yml index 5ef4f4410..24431dbff 100644 --- a/codebase/config/sync/devel.settings.yml +++ b/codebase/config/sync/devel.settings.yml @@ -4,7 +4,9 @@ page_alter: false raw_names: false error_handlers: 1: 1 -rebuild_theme: false +rebuild_theme: true debug_mail_file_format: '%to-%subject-%datetime.mail.txt' debug_mail_directory: 'temporary://devel-mails' devel_dumper: default +debug_logfile: 'temporary://drupal_debug.txt' +debug_pre: false diff --git a/codebase/config/sync/idcui.settings.yml b/codebase/config/sync/idcui.settings.yml new file mode 100644 index 000000000..077d4c4e1 --- /dev/null +++ b/codebase/config/sync/idcui.settings.yml @@ -0,0 +1,99 @@ +features: + node_user_picture: 1 + comment_user_picture: 1 + comment_user_verification: 1 + favicon: 1 +logo: + use_default: 1 +favicon: + use_default: 1 +settings_generated_files_path: themes/contrib/idc-ui-theme/styles/css/generated +list_info: | + name: 'JHU IDC UI Theme' + type: theme + description: 'JHU''s Islandora based data repository UI theme' + core: 8.x + core_version_requirement: '^8 || ^9' + 'base theme': carapace + 'subtheme type': adaptive_subtheme + layout: page-layout + screenshot: themes/contrib/idc-ui-theme/screenshot.png + libraries: + - idcui/idc-styles + - idcui/idc-js + - idcui/idc-mirador + regions: + top_menu: 'Top menu' + top_nav: 'Top Nav' + header_1: 'Sub Header 1' + header_2: 'Sub Header 2' + highlighted: Highlighted + content: Content + footer: Footer + modal: Modal + page_top: 'Page top' + page_bottom: 'Page bottom' + core_incompatible: false + lifecycle: stable + mtime: 1667941486 + engine: twig + features: + - favicon + - logo + - node_user_picture + - comment_user_picture + - comment_user_verification + version: null + php: 7.3.0 + libraries_extend: { } + libraries_override: { } + dependencies: + - carapace + regions_hidden: + - page_top + - page_bottom +settings_extensions_form_open: 0 +settings_enable_extensions: 0 +settings_enable_responsive_menus: 0 +settings_enable_images: 0 +settings_enable_touch_icons: 0 +settings_enable_fonts: 0 +settings_enable_titles: 0 +settings_enable_shortcodes: 0 +settings_enable_slideshows: 0 +settings_enable_mobile_blocks: 0 +settings_enable_custom_css: 0 +settings_enable_devel: 0 +settings_enable_legacy_browsers: 0 +settings_enable_markup_overrides: 0 +settings_layouts_form_open: 0 +settings_layouts_enable: 0 +settings_suggestions: + page: page +ts_name: '' +settings_breakpoint_group_layout: bartik +settings_max_width_enable: 0 +settings_max_width_value: '' +settings_max_width_unit: em +settings_max_width_enable_rows: 0 +settings_max_width_value_leaderboard: '' +settings_max_width_unit_leaderboard: em +settings_max_width_value_header: '' +settings_max_width_unit_header: em +settings_max_width_value_navbar: '' +settings_max_width_unit_navbar: em +settings_max_width_value_highlighted: '' +settings_max_width_unit_highlighted: em +settings_max_width_value_features: '' +settings_max_width_unit_features: em +settings_max_width_value_content_prefix: '' +settings_max_width_unit_content_prefix: em +settings_max_width_value_main: '' +settings_max_width_unit_main: em +settings_max_width_value_content_suffix: '' +settings_max_width_unit_content_suffix: em +settings_max_width_value_subfeatures: '' +settings_max_width_unit_subfeatures: em +settings_max_width_value_footer: '' +settings_max_width_unit_footer: em +settings_enable_backups: 0 diff --git a/codebase/config/sync/search_api_solr.solr_field_type.text_und_6_0_0.yml b/codebase/config/sync/search_api_solr.solr_field_type.text_und_6_0_0.yml index d2411e97b..66c74d7f0 100644 --- a/codebase/config/sync/search_api_solr.solr_field_type.text_und_6_0_0.yml +++ b/codebase/config/sync/search_api_solr.solr_field_type.text_und_6_0_0.yml @@ -57,9 +57,9 @@ field_type: filters: - class: solr.SynonymFilterFactory - ignoreCase: true synonyms: synonyms_und.txt expand: true + ignoreCase: true - class: solr.StopFilterFactory ignoreCase: true @@ -187,6 +187,8 @@ solr_configs: VALUE: 'false' text_files: stopwords: '' + synonyms: | + drupal, durpal protwords: '' accents: | # À => A @@ -337,5 +339,3 @@ text_files: "\uFB05" => "st" # st => st "\uFB06" => "st" - synonyms: | - drupal, durpal diff --git a/codebase/config/sync/search_api_solr.solr_field_type.text_und_7_0_0.yml b/codebase/config/sync/search_api_solr.solr_field_type.text_und_7_0_0.yml index 62760c2ca..f7ec479aa 100644 --- a/codebase/config/sync/search_api_solr.solr_field_type.text_und_7_0_0.yml +++ b/codebase/config/sync/search_api_solr.solr_field_type.text_und_7_0_0.yml @@ -57,9 +57,9 @@ field_type: filters: - class: solr.SynonymGraphFilterFactory - ignoreCase: true synonyms: synonyms_und.txt expand: true + ignoreCase: true - class: solr.StopFilterFactory ignoreCase: true @@ -187,6 +187,8 @@ solr_configs: VALUE: 'false' text_files: stopwords: '' + synonyms: | + drupal, durpal protwords: '' accents: | # À => A @@ -337,5 +339,3 @@ text_files: "\uFB05" => "st" # st => st "\uFB06" => "st" - synonyms: | - drupal, durpal diff --git a/codebase/scripts/bash/start_up.sh b/codebase/scripts/bash/start_up.sh index 118d4091a..784c63e69 100644 --- a/codebase/scripts/bash/start_up.sh +++ b/codebase/scripts/bash/start_up.sh @@ -32,6 +32,9 @@ drush updatedb -y drush cc theme-registry drush -d status +CURRENT_VERSION=$(drush cr && drush core-status --fields=drupal-version | cut -d\: -f2 | sed 's/ //g') +echo "Current Drupal version: $CURRENT_VERSION" + echo "" echo "" echo " -------------------------------------------------------------------------- " diff --git a/idc.Makefile b/idc.Makefile index e92d709ef..40d2ac912 100644 --- a/idc.Makefile +++ b/idc.Makefile @@ -184,10 +184,13 @@ start: _docker-up-and-wait: docker-compose up -d sleep 5 + if [ "${GITHUB_TOKEN}" ]; then \ + echo "Installing github token"; \ + docker-compose exec -T drupal with-contenv bash -lc "composer config -g github-oauth.github.com ${GITHUB_TOKEN}" & echo '' ; \ + fi; 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" $(MAKE) cache-rebuild - # Static drupal image, with codebase baked in. This image # is tagged based on the current git hash/tag. If the image is not present # locally, nor pullable, then this is built locally. Ultimately, this image is From e6ea47a6f3aa062e537b64ce6a25f026e71577bf Mon Sep 17 00:00:00 2001 From: Tim Martin Date: Fri, 11 Nov 2022 11:20:00 -0700 Subject: [PATCH 03/11] add .dockerignore to prevent .git* context being added to image --- .dockerignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..3cc689e11 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +**/.git* From bc1764cfa1bf190b6a5aae7145550af5a6c23732 Mon Sep 17 00:00:00 2001 From: Tim Martin Date: Fri, 11 Nov 2022 11:20:10 -0700 Subject: [PATCH 04/11] rework drupal-static image build --- Dockerfile | 15 ++++++++-- codebase/fix_permissions.sh | 58 ++++++++++++++++++++++++++----------- idc.Makefile | 1 + 3 files changed, 54 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index f6b963d4a..265f0030a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,15 @@ ARG REPOSITORY ARG TAG FROM ${REPOSITORY}/drupal:${TAG} -RUN --mount=type=bind,source=codebase,target=/build \ - cp -r /build/* /var/www/drupal && \ - bash /var/www/drupal/fix_permissions.sh /var/www/drupal/web nginx +COPY --chown=0:0 rootfs / +COPY --chown=nginx:www-data codebase /var/www/drupal/ + +RUN bash /var/www/drupal/fix_permissions.sh /var/www/drupal/web nginx + +# Run composer install as application user: +USER nginx +RUN COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction --no-progress + +# Normal startup (via /init) must happen as root: +USER root + diff --git a/codebase/fix_permissions.sh b/codebase/fix_permissions.sh index 3a28e32a8..ffd2b135e 100644 --- a/codebase/fix_permissions.sh +++ b/codebase/fix_permissions.sh @@ -17,20 +17,44 @@ echo -e $help exit fi -cd $path; - -echo -e "Changing ownership of all contents of \"${path}\" :\n user => \"${user}\" \t group => \"${group}\"\n" -chown -R ${user}:${group} . -echo "Changing permissions of all directories inside \"${path}\" to \"750\"..." -find . -type d -exec chmod u=rwx,g=rx,o= {} \; -echo -e "Changing permissions of all files inside \"${path}\" to \"640\"...\n" -find . -type f -exec chmod u=rw,g=r,o= {} \; - -cd $path/sites; - -echo "Changing permissions of \"files\" directories in \"${path}/sites\" to \"770\"..." -find . -type d -name files -exec chmod ug=rwx,o= '{}' \; -echo "Changing permissions of all files inside all \"files\" directories in \"${path}/sites\" to \"660\"..." -find . -name files -type d -exec find '{}' -type f \; | while read FILE; do chmod ug=rw,o= "$FILE"; done -echo "Changing permissions of all directories inside all \"files\" directories in \"${path}/sites\" to \"770\"..." -find . -name files -type d -exec find '{}' -type d \; | while read DIR; do chmod ug=rwx,o= "$DIR"; done +cd $path + +set -e +#CHMOD="echo /bin/chmod" +CHMOD="/bin/chmod -v" + +echo -e "Fixing directory permissions beneath '$path'" +find . -type d \( \ + \( -path './sites/*' -a -name files -a \! -perm 0770 -exec $CHMOD 0770 {} \; \) \ + -o \( -path './sites/*' -a -path '*/files/*' -a \! -perm 0770 -exec $CHMOD 0770 {} \; \) \ + -o \( \! -perm 0750 -exec $CHMOD 0750 {} \; \) \ + \) \ + #> /tmp/fix_permissions-dirs.log + +echo -e "Fixing file permissions beneath '$path'" +find . -type f \( \ + \( -path './sites/' -a -path '*/files/*' -a \! -perm 0660 -exec $CHMOD 0660 {} \; \) \ + -o \( \! -perm 0640 -exec $CHMOD 0640 {} \; \) \ + \) \ + #> /tmp/fix_permissions-files.log + +exit 0 + +# This is now performed in the Docker COPY layer: +#echo -e "Changing ownership of all contents of \"${path}\" :\n user => \"${user}\" \t group => \"${group}\"\n" +#chown -R ${user}:${group} . + +# Replaced by above finds: +#echo "Changing permissions of all directories inside \"${path}\" to \"750\"..." +#1 find . -type d -exec chmod u=rwx,g=rx,o= {} \; +#echo -e "Changing permissions of all files inside \"${path}\" to \"640\"...\n" +#2 find . -type f -exec chmod u=rw,g=r,o= {} \; +# +#cd $path/sites; +# +#echo "Changing permissions of \"files\" directories in \"${path}/sites\" to \"770\"..." +#3 find . -type d -name files -exec chmod ug=rwx,o= '{}' \; +#echo "Changing permissions of all files inside all \"files\" directories in \"${path}/sites\" to \"660\"..." +#4 find . -name files -type d -exec find '{}' -type f \; | while read FILE; do chmod ug=rw,o= "$FILE"; done +#echo "Changing permissions of all directories inside all \"files\" directories in \"${path}/sites\" to \"770\"..." +#5 find . -name files -type d -exec find '{}' -type d \; | while read DIR; do chmod ug=rwx,o= "$DIR"; done diff --git a/idc.Makefile b/idc.Makefile index 40d2ac912..204248264 100644 --- a/idc.Makefile +++ b/idc.Makefile @@ -201,6 +201,7 @@ static-drupal-image: IMAGE=${REPOSITORY}/drupal-static:${GIT_TAG} ; \ EXISTING=`docker images -q $$IMAGE` ; \ if test -z "$$EXISTING" ; then \ + echo "Building Drupal image with base: $${REPOSITORY}/drupal:$${TAG} " ; \ docker pull $${IMAGE} 2>/dev/null || \ docker build --build-arg REPOSITORY=$${REPOSITORY} --build-arg TAG=$${TAG} -t $${IMAGE} .; \ else \ From 2c864c64aca9e9f61a864fcf9d4827c2ed72494c Mon Sep 17 00:00:00 2001 From: Tim Martin Date: Thu, 17 Nov 2022 15:52:22 -0700 Subject: [PATCH 05/11] refactor startup to have common logic based off of drupal-static image --- .github/workflows/ci.yml | 15 +++------- Dockerfile | 11 ++++++++ idc.Makefile | 28 ------------------- .../etc/cont-init.d/99-startup.sh | 4 --- 4 files changed, 15 insertions(+), 43 deletions(-) rename codebase/scripts/bash/start_up.sh => rootfs/etc/cont-init.d/99-startup.sh (89%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 152a2c051..a5b86a546 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,21 +28,14 @@ jobs: run: | echo '{"experimental": "enabled"}' > ~/.docker/config.json + # Build and Export image for push to github container registry + - name: Build and export drupal image + run: make static-drupal-image-export + # Build and run the static environment - name: Build Static run: make static-docker-compose.yml up - # Temp fix for 9.4 Add github token to composer - - name: Temp fix for 9.4 Add github token to composer - run: docker-compose exec -T drupal with-contenv bash -lc "composer config -g github-oauth.github.com ${{ secrets.GH_TOKEN }}" - - # Run initial start up script - - name: Run initial start up script - run: docker-compose exec -T drupal with-contenv bash -lc "bash /var/www/drupal/scripts/bash/start_up.sh" - - - name: Export image - run: make static-drupal-image-export - - uses: actions/upload-artifact@v2 with: name: drupal-image diff --git a/Dockerfile b/Dockerfile index 265f0030a..b9b883b1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,17 @@ FROM ${REPOSITORY}/drupal:${TAG} COPY --chown=0:0 rootfs / COPY --chown=nginx:www-data codebase /var/www/drupal/ +USER nginx +RUN echo "Creating tmp directory " && \ + mkdir -m 0775 -p /var/www/drupal/web/sites/default/files/tmp && \ + mkdir -m 0755 -p /tmp/private && \ + echo "Copy Generic File" && \ + if [ ! -f web/sites/default/files/generic.png ] ; then \ + cp "web/core/modules/media/images/icons/generic.png" "web/sites/default/files/generic.png" ; \ + fi + +USER root +# Final permissions sets: RUN bash /var/www/drupal/fix_permissions.sh /var/www/drupal/web nginx # Run composer install as application user: diff --git a/idc.Makefile b/idc.Makefile index 204248264..6f75a03cd 100644 --- a/idc.Makefile +++ b/idc.Makefile @@ -10,29 +10,9 @@ GIT_TAG := $(shell git describe --tags --always) .SILENT: bootstrap bootstrap: snapshot-empty default destroy-state up install \ update-settings-php update-config-from-environment solr-cores run-islandora-migrations \ - cache-rebuild git checkout -- .env @echo " └─ Bootstrap complete." -.PHONY: set-tmp -set-tmp: - @echo "Creating and setting $(shell id -u):101 permissions on tmp & private directories" - -docker-compose exec -T drupal /bin/sh -c "mkdir -p /var/www/drupal/web/sites/default/files/tmp" - -docker-compose exec -T drupal /bin/sh -c "if [[ ! \$$(stat -c \"%u:%G\" /var/www/drupal/web/sites/default/files/tmp) == \"$(shell id -u):101\" ]] ; then chown -R $(shell id -u):101 /var/www/drupal/web/sites/default/files ; fi ; " - -docker-compose exec -T drupal /bin/sh -c "if [[ ! \$$(stat -c \"%a\" /var/www/drupal/web/sites/default/files/tmp) == \"755\" ]] ; then chmod -R 775 /var/www/drupal/web/sites/default/files/tmp ; fi ; " - -docker-compose exec -T drupal /bin/sh -c "mkdir -p /tmp/private" - -docker-compose exec -T drupal /bin/sh -c "if [[ ! \$$(stat -c \"%u:%G\" /tmp/private) == \"$(shell id -u):101\" ]] ; then chown -R $(shell id -u):101 /tmp/private ; fi ; " - -docker-compose exec -T drupal /bin/sh -c "if [[ ! \$$(stat -c \"%a\" /tmp/private) == \"755\" ]] ; then chmod -R 775 /tmp/private ; fi ; " - @echo " └─ Done" - @echo "" - -# Rebuilds the Drupal cache -.PHONY: cache-rebuild -.SILENT: cache-rebuild -cache-rebuild: set-tmp - echo "rebuilding Drupal cache..." - docker-compose exec -T drupal drush cr -y - .PHONY: destroy-state .SILENT: destroy-state destroy-state: @@ -43,13 +23,6 @@ destroy-state: -rm -rf docker-compose.yml -rm -rf .docker-compose.yml -.PHONY: composer-install -.SILENT: composer-install -composer-install: - echo "Installing via composer" - docker-compose exec -T drupal bash -lc "COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction --no-progress" - - .PHONY: snapshot-image .SILENT: snapshot-image snapshot-image: @@ -189,7 +162,6 @@ _docker-up-and-wait: docker-compose exec -T drupal with-contenv bash -lc "composer config -g github-oauth.github.com ${GITHUB_TOKEN}" & echo '' ; \ fi; 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" - $(MAKE) cache-rebuild # Static drupal image, with codebase baked in. This image # is tagged based on the current git hash/tag. If the image is not present diff --git a/codebase/scripts/bash/start_up.sh b/rootfs/etc/cont-init.d/99-startup.sh similarity index 89% rename from codebase/scripts/bash/start_up.sh rename to rootfs/etc/cont-init.d/99-startup.sh index 784c63e69..e67a99c81 100644 --- a/codebase/scripts/bash/start_up.sh +++ b/rootfs/etc/cont-init.d/99-startup.sh @@ -8,10 +8,6 @@ echo " - Running a Start up script echo " -------------------------------------------------------------------------- " echo "" -COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction --no-progress - -bash /var/www/drupal/fix_permissions.sh /var/www/drupal/web nginx - # This is a workaround for a bug. drush cdel core.extension module.search_api_solr_defaults || true drush sql-query "DELETE FROM key_value WHERE collection='system.schema' AND name='search_api_solr_defaults';" || true From e847f13f2132ca4ad09ca9c480ea9d7b44c71ce6 Mon Sep 17 00:00:00 2001 From: Tim Martin Date: Thu, 17 Nov 2022 15:53:10 -0700 Subject: [PATCH 06/11] remove OBE steps from forked 04-custom-setup.sh script --- rootfs/etc/cont-init.d/04-custom-setup.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/rootfs/etc/cont-init.d/04-custom-setup.sh b/rootfs/etc/cont-init.d/04-custom-setup.sh index 11be60949..582eb2d3a 100644 --- a/rootfs/etc/cont-init.d/04-custom-setup.sh +++ b/rootfs/etc/cont-init.d/04-custom-setup.sh @@ -15,16 +15,24 @@ function main { update_settings_php "${site}" # Ensure that settings which depend on environment variables like service urls are set dynamically on startup. configure_islandora_module "${site}" - configure_matomo_module "${site}" configure_openseadragon "${site}" configure_islandora_default_module "${site}" - # The following commands require several services - # to be up and running before they can complete. - wait_for_required_services "${site}" + + + # JHU: Fedora has been removed, so use alternate call syntax with SERVICES specified: + #wait_for_required_services "${site}" + wait_for_required_services "${site}" SOLR + # Create missing solr cores. create_solr_core_with_default_config "${site}" + + # JHU: no triplestore # Create namespace assumed one per site. - create_blazegraph_namespace_with_default_properties "${site}" + #create_blazegraph_namespace_with_default_properties "${site}" + + # JHU: SKIP BELOW +exit 0 + # Need to run migration to get expected default content, now that our required services are running. import_islandora_migrations "${site}" # Workaround for this issue (only seems to apply to islandora_fits): From 9238df889f7bce1c67c31050bd67484fc37aff30 Mon Sep 17 00:00:00 2001 From: Tim Martin Date: Tue, 22 Nov 2022 14:27:59 -0700 Subject: [PATCH 07/11] re-add idc.Makefile targets for dev assist --- idc.Makefile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/idc.Makefile b/idc.Makefile index 6f75a03cd..e9490148e 100644 --- a/idc.Makefile +++ b/idc.Makefile @@ -13,6 +13,13 @@ bootstrap: snapshot-empty default destroy-state up install \ git checkout -- .env @echo " └─ Bootstrap complete." +# Rebuilds the Drupal cache +.PHONY: cache-rebuild +.SILENT: cache-rebuild +cache-rebuild: set-tmp + echo "rebuilding Drupal cache..." + docker-compose exec -T drupal drush cr -y + .PHONY: destroy-state .SILENT: destroy-state destroy-state: @@ -23,6 +30,12 @@ destroy-state: -rm -rf docker-compose.yml -rm -rf .docker-compose.yml +.PHONY: composer-install +.SILENT: composer-install +composer-install: + echo "Installing via composer" + docker-compose exec -T drupal bash -lc "COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction --no-progress" + .PHONY: snapshot-image .SILENT: snapshot-image snapshot-image: From ab565b49425e2d71b8d186caa7a41dbb2b227e47 Mon Sep 17 00:00:00 2001 From: Tim Martin Date: Tue, 22 Nov 2022 14:32:01 -0700 Subject: [PATCH 08/11] re-add idc.Makefile targets for dev assist --- idc.Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/idc.Makefile b/idc.Makefile index e9490148e..3b6844245 100644 --- a/idc.Makefile +++ b/idc.Makefile @@ -36,6 +36,7 @@ composer-install: echo "Installing via composer" docker-compose exec -T drupal bash -lc "COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction --no-progress" + .PHONY: snapshot-image .SILENT: snapshot-image snapshot-image: From e409348e751ac0db2aa8e49d22c172bcc764482e Mon Sep 17 00:00:00 2001 From: Tim Martin Date: Wed, 23 Nov 2022 11:36:42 -0700 Subject: [PATCH 09/11] unify use of static drupal image for local and static builds --- Dockerfile | 27 +++++++------------ codebase/fix_permissions.sh | 29 +++++--------------- codebase/web/sites/default/settings.php | 11 ++++++++ docker-compose.drupal-dev.yml | 3 ++- docker-compose.local.yml | 3 ++- docker-compose.static.yml | 3 ++- idc.Makefile | 32 ++++++++++++++++------- rootfs/etc/cont-init.d/04-custom-setup.sh | 24 +---------------- rootfs/etc/cont-init.d/99-startup.sh | 18 ++++++++++++- 9 files changed, 73 insertions(+), 77 deletions(-) mode change 100644 => 100755 codebase/fix_permissions.sh diff --git a/Dockerfile b/Dockerfile index b9b883b1a..2409f36ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,19 @@ # syntax=docker/dockerfile:experimental +# Dockerfile for drupal-static build + ARG REPOSITORY ARG TAG FROM ${REPOSITORY}/drupal:${TAG} -COPY --chown=0:0 rootfs / -COPY --chown=nginx:www-data codebase /var/www/drupal/ - USER nginx -RUN echo "Creating tmp directory " && \ - mkdir -m 0775 -p /var/www/drupal/web/sites/default/files/tmp && \ - mkdir -m 0755 -p /tmp/private && \ - echo "Copy Generic File" && \ - if [ ! -f web/sites/default/files/generic.png ] ; then \ - cp "web/core/modules/media/images/icons/generic.png" "web/sites/default/files/generic.png" ; \ - fi - -USER root -# Final permissions sets: -RUN bash /var/www/drupal/fix_permissions.sh /var/www/drupal/web nginx # Run composer install as application user: -USER nginx -RUN COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction --no-progress - -# Normal startup (via /init) must happen as root: +# Normal startup (via /init) must also happen as root USER root +COPY --chown=nginx:www-data codebase /var/www/drupal/ +COPY --chown=0:0 rootfs / + +RUN COMPOSER_MEMORY_LIMIT=-1 COMPOSER_DISCARD_CHANGES=true composer install --no-interaction --no-progress && \ + chmod 0750 /var/www/drupal/fix_permissions.sh && \ + /var/www/drupal/fix_permissions.sh /var/www/drupal/web nginx diff --git a/codebase/fix_permissions.sh b/codebase/fix_permissions.sh old mode 100644 new mode 100755 index ffd2b135e..16f2d13cb --- a/codebase/fix_permissions.sh +++ b/codebase/fix_permissions.sh @@ -17,11 +17,13 @@ echo -e $help exit fi -cd $path - set -e -#CHMOD="echo /bin/chmod" -CHMOD="/bin/chmod -v" + +### IDC Customizations below here to remove multiple recursive find commands: + +CHMOD="/bin/chmod" + +cd $path echo -e "Fixing directory permissions beneath '$path'" find . -type d \( \ @@ -39,22 +41,3 @@ find . -type f \( \ #> /tmp/fix_permissions-files.log exit 0 - -# This is now performed in the Docker COPY layer: -#echo -e "Changing ownership of all contents of \"${path}\" :\n user => \"${user}\" \t group => \"${group}\"\n" -#chown -R ${user}:${group} . - -# Replaced by above finds: -#echo "Changing permissions of all directories inside \"${path}\" to \"750\"..." -#1 find . -type d -exec chmod u=rwx,g=rx,o= {} \; -#echo -e "Changing permissions of all files inside \"${path}\" to \"640\"...\n" -#2 find . -type f -exec chmod u=rw,g=r,o= {} \; -# -#cd $path/sites; -# -#echo "Changing permissions of \"files\" directories in \"${path}/sites\" to \"770\"..." -#3 find . -type d -name files -exec chmod ug=rwx,o= '{}' \; -#echo "Changing permissions of all files inside all \"files\" directories in \"${path}/sites\" to \"660\"..." -#4 find . -name files -type d -exec find '{}' -type f \; | while read FILE; do chmod ug=rw,o= "$FILE"; done -#echo "Changing permissions of all directories inside all \"files\" directories in \"${path}/sites\" to \"770\"..." -#5 find . -name files -type d -exec find '{}' -type d \; | while read DIR; do chmod ug=rwx,o= "$DIR"; done diff --git a/codebase/web/sites/default/settings.php b/codebase/web/sites/default/settings.php index 2401f9497..a4175a560 100644 --- a/codebase/web/sites/default/settings.php +++ b/codebase/web/sites/default/settings.php @@ -792,3 +792,14 @@ if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) { include $app_root . '/' . $site_path . '/settings.local.php'; } +$settings['config_sync_directory'] = '/var/www/drupal/config/sync'; +$settings['flysystem']['fedora']['driver'] = 'fedora'; +$settings['flysystem']['fedora']['config']['root'] = 'http://fcrepo.isle-dc.localhost/fcrepo/rest/'; +$databases['default']['default']['database'] = 'drupal_default'; +$databases['default']['default']['username'] = 'drupal_default'; +$databases['default']['default']['password'] = 'password'; +$databases['default']['default']['host'] = 'mariadb-idc.traefik.me'; +$databases['default']['default']['port'] = '3306'; +$databases['default']['default']['prefix'] = ''; +$databases['default']['default']['driver'] = 'mysql'; +$databases['default']['default']['namespace'] = 'Drupal\\Core\\Database\\Driver\\mysql'; diff --git a/docker-compose.drupal-dev.yml b/docker-compose.drupal-dev.yml index 5a215014d..2a81fb06c 100644 --- a/docker-compose.drupal-dev.yml +++ b/docker-compose.drupal-dev.yml @@ -15,7 +15,8 @@ volumes: solr-data: services: drupal: - image: ${REPOSITORY:-islandora}/drupal-dev:${TAG:-latest} + image: ${REPOSITORY:-islandora}/drupal-dev:static + #image: ${REPOSITORY:-islandora}/drupal-dev:${TAG:-latest} # Uncomment below to PHP commands executed on container start, or PHP commands (e.g. drush) run from the CLI # (significantly slows down the container startup) # If debugging container startup is not necessary, consider setting the environment variables within a shell via diff --git a/docker-compose.local.yml b/docker-compose.local.yml index ce2b8ee6f..e3b29cb6d 100644 --- a/docker-compose.local.yml +++ b/docker-compose.local.yml @@ -15,7 +15,8 @@ volumes: solr-data: services: drupal: - image: ${REPOSITORY:-islandora}/drupal:${TAG:-latest} + #image: ${REPOSITORY:-islandora}/drupal:${DRUPAL_STATIC_TAG:-${TAG:-latest}} + image: ${REPOSITORY:-islandora}/drupal-static:static volumes: - ./codebase:/var/www/drupal:delegated - drupal-sites-data:/var/www/drupal/web/sites/default/files diff --git a/docker-compose.static.yml b/docker-compose.static.yml index b71282ef9..8cb79a3f1 100644 --- a/docker-compose.static.yml +++ b/docker-compose.static.yml @@ -20,7 +20,8 @@ services: args: TAG: ${TAG} REPOSITORY: ${REPOSITORY} - image: ${REPOSITORY}/drupal-static:${DRUPAL_STATIC_TAG} + #image: ${REPOSITORY}/drupal-static:${DRUPAL_STATIC_TAG} + image: ${REPOSITORY}/drupal-static:static environment: DRUPAL_INSTANCE: static volumes: diff --git a/idc.Makefile b/idc.Makefile index 3b6844245..6a5730359 100644 --- a/idc.Makefile +++ b/idc.Makefile @@ -102,7 +102,7 @@ snapshot-push: .PHONY: up .SILENT: up -up: download-default-certs docker-compose.yml start +up: download-default-certs static-drupal-image docker-compose.yml start .PHONY: down .SILENT: down @@ -163,7 +163,6 @@ start: echo "Pre-existing Drupal state found, not loading db from snapshot"; \ ${MAKE} _docker-up-and-wait; \ fi; - -docker-compose exec -T drupal bash -lc "bash /var/www/drupal/scripts/bash/start_up.sh" $(MAKE) solr-cores .PHONY: _docker-up-and-wait @@ -193,12 +192,14 @@ static-drupal-image: else \ echo "Using existing Drupal image $${EXISTING}" ; \ fi + docker tag ${REPOSITORY}/drupal-static:${GIT_TAG} ${REPOSITORY}/drupal-static:static # Export a tar of the static drupal image .PHONY: static-drupal-image-export .SILENT: static-drupal-image-export static-drupal-image-export: static-drupal-image IMAGE=${REPOSITORY}/drupal-static:${GIT_TAG} ; \ + echo saving docker image $${IMAGE} ; \ mkdir -p images ; \ docker save $${IMAGE} > images/static-drupal.tar @@ -208,8 +209,8 @@ static-drupal-image-export: static-drupal-image .PHONY: static-docker-compose.yml .SILENT: static-docker-compose.yml static-docker-compose.yml: static-drupal-image - ENV_FILE=.env ; \ - if [ "$(env)" != "" ] ; then ENV_FILE=$(env); fi; \ + ENV_FILE=.env + if [ "$(env)" != "" ] ; then echo inherited environment ; ENV_FILE=$(env); fi; \ echo '' > .env_static && \ while read line; do \ if echo $$line | grep -q "ENVIRONMENT" ; then \ @@ -218,11 +219,24 @@ static-docker-compose.yml: static-drupal-image echo $$line >> .env_static ; \ fi \ 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} - if [ -f .env.bak ] ; then mv .env.bak $${ENV_FILE} ; fi + echo setting xxDRUPAL_STATIC_TAG && \ + echo xxDRUPAL_STATIC_TAG=static >> .env_static + mv ${ENV_FILE} .env.bak + mv .env_static ${ENV_FILE} + echo Building static drupal configuration + #grep DRUPAL_STATIC_TAG= ${ENV_FILE} + grep ENVIRONMENT= ${ENV_FILE} + $(MAKE) -B docker-compose.yml args="--env-file ${ENV_FILE}" || ( echo reverting ${ENV_FILE} ; mv -v .env.bak ${ENV_FILE} ) + +.SILENT: revert-env +.PHONY: revert-env + +revert-env: + ENV_FILE=.env + if [ -f .env.bak ] ; then \ + echo reverting ${ENV_FILE} ; \ + mv -v .env.bak ${ENV_FILE} ; \ + fi .SILENT: test .PHONY: test diff --git a/rootfs/etc/cont-init.d/04-custom-setup.sh b/rootfs/etc/cont-init.d/04-custom-setup.sh index 582eb2d3a..ebd3ac4a6 100644 --- a/rootfs/etc/cont-init.d/04-custom-setup.sh +++ b/rootfs/etc/cont-init.d/04-custom-setup.sh @@ -25,28 +25,6 @@ function main { # Create missing solr cores. create_solr_core_with_default_config "${site}" - - # JHU: no triplestore - # Create namespace assumed one per site. - #create_blazegraph_namespace_with_default_properties "${site}" - - # JHU: SKIP BELOW -exit 0 - - # Need to run migration to get expected default content, now that our required services are running. - import_islandora_migrations "${site}" - # Workaround for this issue (only seems to apply to islandora_fits): - # https://www.drupal.org/project/drupal/issues/2914213 - cat << EOF > /tmp/fix.php - 'https://projects.iq.harvard.edu/fits']; -\$term->set('field_external_uri', \$default); -\$term->save(); -EOF - drush php:script /tmp/fix.php - # Rebuild the cache. - drush cr } main +exit 0 diff --git a/rootfs/etc/cont-init.d/99-startup.sh b/rootfs/etc/cont-init.d/99-startup.sh index e67a99c81..cc565ae68 100644 --- a/rootfs/etc/cont-init.d/99-startup.sh +++ b/rootfs/etc/cont-init.d/99-startup.sh @@ -8,6 +8,18 @@ echo " - Running a Start up script echo " -------------------------------------------------------------------------- " echo "" +DRUPAL_DIR=/var/www/drupal + +echo "Creating tmp and private directories" +for d in $DRUPAL_DIR/web/sites/default/files/tmp /tmp/private ; do + echo " directory: '$d'" + mkdir -m 0775 -p "$d" + chown -R nginx:nginx "$d" +done + +chmod 0750 $DRUPAL_DIR/fix_permissions.sh +$DRUPAL_DIR/fix_permissions.sh $DRUPAL_DIR/web nginx + # This is a workaround for a bug. drush cdel core.extension module.search_api_solr_defaults || true drush sql-query "DELETE FROM key_value WHERE collection='system.schema' AND name='search_api_solr_defaults';" || true @@ -17,7 +29,6 @@ drush php-eval "\Drupal::keyValue('system.schema')->delete('matomo')" || true drush config:import -y # Fix for Github runner "the input device is not a TTY" error -bash /var/www/drupal/fix_permissions.sh /var/www/drupal/web nginx drush search-api-solr:install-missing-fieldtypes || true drush search-api:rebuild-tracker || true drush search-api-solr:finalize-index || true @@ -31,6 +42,11 @@ drush -d status CURRENT_VERSION=$(drush cr && drush core-status --fields=drupal-version | cut -d\: -f2 | sed 's/ //g') echo "Current Drupal version: $CURRENT_VERSION" +echo "Copy Generic File" +if [ ! -f web/sites/default/files/generic.png ] ; then + cp "web/core/modules/media/images/icons/generic.png" "web/sites/default/files/generic.png" +fi + echo "" echo "" echo " -------------------------------------------------------------------------- " From 33f5706773fc06a250e049081cbeed9fe08b770d Mon Sep 17 00:00:00 2001 From: Tim Martin Date: Wed, 23 Nov 2022 12:26:35 -0700 Subject: [PATCH 10/11] rename static startup file to be post buildkit startup files, remove redundancy from startup --- rootfs/etc/cont-init.d/04-custom-setup.sh | 30 ------------------- .../{99-startup.sh => 999-startup.sh} | 1 - 2 files changed, 31 deletions(-) delete mode 100644 rootfs/etc/cont-init.d/04-custom-setup.sh rename rootfs/etc/cont-init.d/{99-startup.sh => 999-startup.sh} (99%) diff --git a/rootfs/etc/cont-init.d/04-custom-setup.sh b/rootfs/etc/cont-init.d/04-custom-setup.sh deleted file mode 100644 index ebd3ac4a6..000000000 --- a/rootfs/etc/cont-init.d/04-custom-setup.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/with-contenv bash -set -e - -source /etc/islandora/utilities.sh - -function main { - local site="default" - # Creates database if does not already exist. - create_database "${site}" - # Needs to be set to do an install from existing configuration. - drush islandora:settings:create-settings-if-missing - drush islandora:settings:set-config-sync-directory "${DRUPAL_DEFAULT_CONFIGDIR}" - install_site "${site}" - # Settings like the hash / flystem can be affected by environment variables at runtime. - update_settings_php "${site}" - # Ensure that settings which depend on environment variables like service urls are set dynamically on startup. - configure_islandora_module "${site}" - configure_openseadragon "${site}" - configure_islandora_default_module "${site}" - - - # JHU: Fedora has been removed, so use alternate call syntax with SERVICES specified: - #wait_for_required_services "${site}" - wait_for_required_services "${site}" SOLR - - # Create missing solr cores. - create_solr_core_with_default_config "${site}" -} -main -exit 0 diff --git a/rootfs/etc/cont-init.d/99-startup.sh b/rootfs/etc/cont-init.d/999-startup.sh similarity index 99% rename from rootfs/etc/cont-init.d/99-startup.sh rename to rootfs/etc/cont-init.d/999-startup.sh index cc565ae68..b06ebd0f4 100644 --- a/rootfs/etc/cont-init.d/99-startup.sh +++ b/rootfs/etc/cont-init.d/999-startup.sh @@ -35,7 +35,6 @@ drush search-api-solr:finalize-index || true drush search-api:index || true # Cleanup -drush updatedb -y drush cc theme-registry drush -d status From 310c5dac77a03dc4a1cc28fb06582d20801556f0 Mon Sep 17 00:00:00 2001 From: Tim Martin Date: Wed, 23 Nov 2022 13:05:34 -0700 Subject: [PATCH 11/11] add chown to fix_permissions --- codebase/fix_permissions.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/codebase/fix_permissions.sh b/codebase/fix_permissions.sh index 16f2d13cb..de191e0ee 100755 --- a/codebase/fix_permissions.sh +++ b/codebase/fix_permissions.sh @@ -25,6 +25,9 @@ CHMOD="/bin/chmod" cd $path +echo -e "Changing ownership of all contents of \"${path}\" :\n user => \"${user}\" \t group => \"${group}\"\n" +chown -R ${user}:${group} . + echo -e "Fixing directory permissions beneath '$path'" find . -type d \( \ \( -path './sites/*' -a -name files -a \! -perm 0770 -exec $CHMOD 0770 {} \; \) \