Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install profile #170

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2bd3669
Updating sandbox commit
dannylamb Apr 13, 2021
1f86ff8
Trying to pull in the install profile
dannylamb Apr 15, 2021
6b7f0ff
Using install profile variable when installing Drupal with Drush
dannylamb Apr 16, 2021
2fc70cf
Bumping sandbox commit
dannylamb Apr 23, 2021
9313caa
Setting content sync directory
dannylamb Apr 27, 2021
bda0981
Fixing content_sync directories
dannylamb May 17, 2021
69c9f9d
Bumping islandora-sandbox
dannylamb May 17, 2021
91f2b37
Bumping sandbox again
dannylamb May 17, 2021
c2d65ae
Merging in upstream
dannylamb Jul 16, 2021
21a732e
Updating sandbox hash
dannylamb Nov 22, 2021
5205186
Merge branch 'main' into install-profile
dannylamb Nov 23, 2021
4f16354
Merge branch 'install-profile' of github.com:Islandora-Devops/isle-bu…
dannylamb Nov 23, 2021
aed5adc
Update commit for islandora-sandbox and use official repo.
rosiel Dec 14, 2021
871142d
Install profile review (#177)
nigelgbanks Jan 5, 2022
b07d96f
Merge branch 'main' into install-profile
nigelgbanks Jan 13, 2022
78e2348
Refactor how we set/restore ownership of drupal settings file to allo…
jasonhildebrand Jan 13, 2022
25edadb
Added LDAP extension to nginx/php image. (#181)
nigelgbanks Jan 25, 2022
a65eb49
If SOLR config.zip cannot be produced, show useful error message. (#182)
jasonhildebrand Feb 1, 2022
b8de904
Updating sandbox commit
dannylamb Apr 13, 2021
8afd7be
Trying to pull in the install profile
dannylamb Apr 15, 2021
fac6648
Using install profile variable when installing Drupal with Drush
dannylamb Apr 16, 2021
27fea4b
Bumping sandbox commit
dannylamb Apr 23, 2021
598e9aa
Setting content sync directory
dannylamb Apr 27, 2021
c55ad3f
Fixing content_sync directories
dannylamb May 17, 2021
7cf1172
Bumping islandora-sandbox
dannylamb May 17, 2021
4b52d5b
Bumping sandbox again
dannylamb May 17, 2021
2b69382
Updating sandbox hash
dannylamb Nov 22, 2021
168d030
Update commit for islandora-sandbox and use official repo.
rosiel Dec 14, 2021
fa96351
Install profile review (#177)
nigelgbanks Jan 5, 2022
211bfff
Rebase onto main.
rosiel Feb 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 3 additions & 44 deletions demo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,19 @@ ARG repository=local
ARG tag=latest
FROM --platform=$BUILDPLATFORM ${repository}/composer:${tag} AS composer

ARG COMMIT=c4a7574e39ba07e1baa51a0d145da1328e7d9ed1
ARG COMMIT=4012e56a5c88b0a9a3686f1e51cd4f4da5ff13e4

# Islandora based Drupal install.
RUN --mount=type=cache,id=demo-composer,sharing=locked,target=/root/.composer/cache \
--mount=type=cache,id=demo-downloads,sharing=locked,target=/opt/downloads \
# Get the Drupal codebase
git-clone-cached.sh \
--url https://github.com/dannylamb/islandora-sandbox.git \
--url https://github.com/Islandora-Devops/islandora-sandbox.git \
--cache-dir "${DOWNLOAD_CACHE_DIRECTORY}" \
--commit "${COMMIT}" \
--worktree /var/www/drupal && \
cd /var/www/drupal && \
composer install && \
# Set up libraries
mkdir -p /var/www/drupal/web/libraries && \
# PDF.js
PDFJS_VERSION="2.0.943" && \
PDFJS_FILE="pdfjs-${PDFJS_VERSION}-dist.zip" && \
PDFJS_URL="https://github.com/mozilla/pdf.js/releases/download/v${PDFJS_VERSION}/${PDFJS_FILE}" && \
PDFJS_SHA256="381683b05f494fe28e11185f98a238b34a663b1b41b5432aa769ca493e5cd087" && \
download.sh --url "${PDFJS_URL}" --sha256 "${PDFJS_SHA256}" "${DOWNLOAD_CACHE_DIRECTORY}" && \
mkdir -p /var/www/drupal/web/libraries/pdf.js && \
unzip "${DOWNLOAD_CACHE_DIRECTORY}/${PDFJS_FILE}" -d /var/www/drupal/web/libraries/pdf.js && \
# Views Slideshow Dependencies
## jquery.cycle
JQUERY_CYCLE_FILE="jquery.cycle.all.js" && \
JQUERY_CYCLE_URL="https://raw.githubusercontent.com/malsup/cycle/db79722719a8a5a8b93fb5d5970d7296ff6bd8bc/${JQUERY_CYCLE_FILE}" && \
JQUERY_CYCLE_SHA256="58b44d975e1e1f0664d0fb8ab5b2918d08e9497324a021aa93de5894cdb586d4" && \
mkdir -p /var/www/drupal/web/libraries/jquery.cycle && \
download.sh --url "${JQUERY_CYCLE_URL}" --sha256 "${JQUERY_CYCLE_SHA256}" /var/www/drupal/web/libraries/jquery.cycle && \
## jquery.hoverIntent
JQUERY_HOVER_INTENT_FILE="jquery.hoverIntent.js" && \
JQUERY_HOVER_INTENT_URL="https://raw.githubusercontent.com/briancherne/jquery-hoverIntent/60f430c1391ceba429e6a856955a9dbab1d6036d/${JQUERY_HOVER_INTENT_FILE}" && \
JQUERY_HOVER_INTENT_SHA256="65f5f7e1298fe71f10290f4068df30b38a5df0106d6feb63210ddabcc67c3e59" && \
download.sh --url "${JQUERY_HOVER_INTENT_URL}" --sha256 "${JQUERY_HOVER_INTENT_SHA256}" "${DOWNLOAD_CACHE_DIRECTORY}" && \
mkdir -p /var/www/drupal/web/libraries/jquery.hoverIntent && \
cp "${DOWNLOAD_CACHE_DIRECTORY}/${JQUERY_HOVER_INTENT_FILE}" /var/www/drupal/web/libraries/jquery.hoverIntent && \
## jquery.pause
JQUERY_PAUSE_FILE="jquery.pause.js" && \
JQUERY_PAUSE_URL="https://raw.githubusercontent.com/tobia/Pause/bd9c80f16695cbbd5eb9feec87adce19183aaa74/${JQUERY_PAUSE_FILE}" && \
JQUERY_PAUSE_SHA256="39505a2a9fe36fce5b987f6804723d323ac86d0ed7220a5c12094f1d698fce33" && \
download.sh --url "${JQUERY_PAUSE_URL}" --sha256 "${JQUERY_PAUSE_SHA256}" "${DOWNLOAD_CACHE_DIRECTORY}" && \
mkdir -p /var/www/drupal/web/libraries/jquery.pause && \
cp "${DOWNLOAD_CACHE_DIRECTORY}/${JQUERY_PAUSE_FILE}" /var/www/drupal/web/libraries/jquery.pause && \
## json2
JSON2_FILE="jquery.pause.js" && \
JSON2_URL="https://raw.githubusercontent.com/tobia/Pause/bd9c80f16695cbbd5eb9feec87adce19183aaa74/${JSON2_FILE}" && \
JSON2_SHA256="39505a2a9fe36fce5b987f6804723d323ac86d0ed7220a5c12094f1d698fce33" && \
download.sh --url "${JSON2_URL}" --sha256 "${JSON2_SHA256}" "${DOWNLOAD_CACHE_DIRECTORY}" && \
mkdir -p /var/www/drupal/web/libraries/json2 && \
cp "${DOWNLOAD_CACHE_DIRECTORY}/${JSON2_FILE}" /var/www/drupal/web/libraries/json2 && \
# Openseadragon
mkdir -p /var/www/drupal/web/sites/default/files/library-definitions && \
cp /var/www/drupal/web/modules/contrib/openseadragon/openseadragon.json /var/www/drupal/web/sites/default/files/library-definitions
composer install

FROM ${repository}/drupal:${tag}

Expand Down
82 changes: 70 additions & 12 deletions drupal/rootfs/etc/islandora/utilities.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,21 @@ function install_site {
chmod a=rwx "${site_directory}/settings.php"
fi

echo "--driver ${driver}"
echo "--host ${host}"
echo "--port ${port}"
echo "--dbuser ${user}"
echo "--dbname ${db_name}"
echo "PROFILE: ${profile}"
echo "--account-mail=${account_email}"
echo "--account-name=${account_name}"
echo "--site-mail=${site_email}"
echo "--locale=${site_locale}"
echo "--site-name=${site_name}"
echo "--sites-subdir=${subdir}"
echo "USE_EXISTIG_CONFIG: ${use_existing_config_arg}"
echo "EVERYTHING ELSE: ${@}"

/usr/local/bin/install-drupal-site.sh \
--driver "${driver}" \
--host "${host}" \
Expand Down Expand Up @@ -284,6 +299,45 @@ function fedora_url {
fi
}


# Allow modifications to settings.php by changing ownership and perms
function allow_settings_modifications {
local site="${1}"; shift
local drupal_root=$(drush drupal:directory)
local subdir=$(drupal_site_env "${site}" "SUBDIR")
local site_directory=$(realpath "${drupal_root}/sites/${subdir}")

# send debug output to stderr because the caller typically captures output from this function.
#>&2 echo "adjusting ownership of ${site_directory}/settings.php"
if [ -f "${site_directory}/settings.php" ]; then
previous_owner_group=$(stat -c "%u:%g" "${site_directory}/settings.php")
chown 100:101 "${site_directory}/settings.php"
chmod a=rwx "${site_directory}/settings.php"
fi
if [ ! -z "${previous_owner_group}" ]; then
echo ${previous_owner_group}
fi
}

# Restore ownership of settings.php so that it is readable/writable outside of docker
function restore_settings_ownership {
local site="${1}"; shift
local previous_owner_group="${1}"; shift
local drupal_root=$(drush drupal:directory)
local subdir=$(drupal_site_env "${site}" "SUBDIR")
local site_directory=$(realpath "${drupal_root}/sites/${subdir}")

# Restore owner/group to previous value.
# When the codebase is bind-mounted, this ensures the file remains readable/writable by the host user.
if [ ! -z "${previous_owner_group}" ]; then
chown "${previous_owner_group}" "${site_directory}/settings.php"
fi

# Restrict access to settings.php
chmod 444 "${site_directory}/settings.php"
}


# Regenerate / Update settings.php
function update_settings_php {
local site="${1}"; shift
Expand Down Expand Up @@ -311,10 +365,16 @@ function update_settings_php {
fi

# Allow modifications to settings.php
if [ -f "${site_directory}/settings.php" ]; then
previous_owner_group=$(stat -c "%u:%g" "${site_directory}/settings.php")
chown 100:101 "${site_directory}/settings.php"
chmod a=rwx "${site_directory}/settings.php"
local previous_owner_group=$(allow_settings_modifications ${site})

if ! grep -q 'global \$content_directories;' ${site_directory}/settings.php; then
echo 'global $content_directories;' >> ${site_directory}/settings.php
echo '$content_directories["sync"] = "/var/www/drupal/content/sync";' >> ${site_directory}/settings.php
fi

if ! grep -q 'global \$content_directories;' ${site_directory}/settings.php; then
echo 'global $content_directories;' >> ${site_directory}/settings.php
echo '$content_directories["sync"] = "/var/www/drupal/content/sync";' >> ${site_directory}/settings.php
fi

drush -l "${site_url}" islandora:settings:create-settings-if-missing
Expand All @@ -336,12 +396,7 @@ function update_settings_php {
fi

# Restore owner/group to previous value
if [ ! -z "${previous_owner_group}" ]; then
chown "${previous_owner_group}" "${site_directory}/settings.php"
fi

# Restrict access to settings.php
chmod 444 "${site_directory}/settings.php"
restore_settings_ownership ${site} ${previous_owner_group}
}

# Enable module and apply configuration.
Expand Down Expand Up @@ -426,7 +481,10 @@ function generate_solr_config {

mkdir -p "/tmp/${core}" || true
chmod a+rwx "/tmp/${core}"
drush -l "${site_url}" -y search-api-solr:get-server-config default_solr_server "/tmp/${core}/solr_config.zip" 7.1
if ! drush -l "${site_url}" -y search-api-solr:get-server-config default_solr_server "/tmp/${core}/solr_config.zip" 7.1; then
echo -e "\n\nERROR: Could not generate SOLR config.zip!\nIn Drupal, check Configuration -> Search API -> SOLR Server, and use the\n"+ Get config.zip" option which should give you information into the actual error.\n\n"
return 1
fi
mkdir -p "${dest}/conf" || true
mkdir -p "${dest}/data" || true
unzip -o "/tmp/${core}/solr_config.zip" -d "${dest}/conf"
Expand Down Expand Up @@ -456,7 +514,7 @@ function create_solr_core_with_default_config {
fi

local site="${1}"; shift
generate_solr_config "${site}"
generate_solr_config "${site}" || return 1
create_solr_core "${site}"
}

Expand Down
3 changes: 2 additions & 1 deletion nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN --mount=type=cache,id=nginx-apk,sharing=locked,from=cache,target=/var/cache/
php7-iconv \
php7-intl \
php7-json \
php7-ldap \
php7-mbstring \
php7-mysqli \
php7-opcache \
Expand All @@ -30,8 +31,8 @@ RUN --mount=type=cache,id=nginx-apk,sharing=locked,from=cache,target=/var/cache/
php7-simplexml \
php7-tokenizer \
php7-xml \
php7-xmlwriter \
php7-xmlreader \
php7-xmlwriter \
php7-xsl \
php7-zip \
&& \
Expand Down