Skip to content

Commit

Permalink
Update starter site & matomo extra tools & fix permission Bugs (#350)
Browse files Browse the repository at this point in the history
* Update Matomo Extra Tools from 5.0.1 -> 5.0.4

Required to fix build issue, that was being
covered up by a previously successful cache.

* Fix for potential permission issues.

A number of permission issues have gone unnoticed,
I became aware of them when I did a fresh build
without cache on a newly installed computer.

When building Docker images, Docker copies
files/folders with the same permissions as they
have on the host machine. Git does not track the
permissions of files except for the executable bit
on files. So depending on who builds the images
files/folders can get different permissions.

This changes it such that the Makefile will ensure
the appropriate permissions are set when building.

This is required as we run services as different
users other than root in the container. Those
users must be able to access and execute certain
files.

* Update to latest starter site, and hard-code paths to support it.
  • Loading branch information
nigelgbanks authored Sep 12, 2024
1 parent 04be359 commit 24f0418
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 11 deletions.
28 changes: 27 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,32 @@ build:
%:
$(call executable-exists,$@)

# Prior to building, all folders which might be copied into Docker images must
# have the executable bit set for all users. So that they can be read by the
# users we create like 'tomcat'. We can not insure this via Git as it does
# not track permissions for folders, so we rely on this hack.
.PHONY: folder-permissions
folder-permissions:
find . -type d -exec chmod +x {} \;

# Prior to building, all scripts which might be copied into Docker images must
# have the executable bit set for all users. So that they can be executed by
# the users we create like 'nginx'. We can not insure this via Git as it does
# not track executable permissions for "groups" or "others".
.PHONY: executable-permissons
executable-permissons:
find . -type f \
\( \
-name "*.sh" \
-o -name "run" \
-o -name "check" \
-o -name "finish" \
-o -name "bash.bashrc" \
-o -name "drush" \
-o -name "composer" \
\) \
-exec chmod +rx {} \;

# Checks for docker compose plugin.
.PHONY: docker-compose
docker-compose: MISSING_DOCKER_PLUGIN_MESSAGE = ${RED}docker compose plugin is not installed${RESET}\n${README_MESSAGE}
Expand Down Expand Up @@ -165,7 +191,7 @@ docker-compose.override.yml:
# Despite being a real target we make it PHONY so it is run everytime as $(TARGET) can change.
.PHONY: build/bake.json
.SILENT: build/bake.json
build/bake.json: | docker-buildx jq build
build/bake.json: | docker-buildx jq build folder-permissions executable-permissons
# Generate build plan for the given target and update the contexts if provided by the CI.
BRANCH=$(BRANCH) \
CACHE_FROM_REPOSITORY=$(CACHE_FROM_REPOSITORY) \
Expand Down
2 changes: 1 addition & 1 deletion code-server/rootfs/etc/confd/templates/tasks.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
"type": "command",
"command": "shellCommand.execute",
"args": {
"command": "drush pm-list --field=path | sort -u | xargs -I{} echo $(drush drupal:directory)/{}",
"command": "drush pm-list --field=path | sort -u | xargs -I{} echo /var/www/drupal/web/{}",
"cwd": "/var/www/drupal",
"description": "Select Module/Theme"
}
Expand Down
2 changes: 1 addition & 1 deletion drupal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ ENV \

COPY --link rootfs /

RUN chown -R nginx:nginx /var/www
RUN chown -R nginx:nginx /var/www /usr/share/drush
8 changes: 4 additions & 4 deletions drupal/rootfs/etc/islandora/utilities.sh
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ function install_site {
use_existing_config_arg
site="${1}"
shift
drupal_root=$(drush drupal:directory)
drupal_root=/var/www/drupal/web
driver=$(drupal_site_env "${site}" "DB_DRIVER")
host=$(drupal_site_env "${site}" "DB_HOST")
port=$(drupal_site_env "${site}" "DB_PORT")
Expand Down Expand Up @@ -343,7 +343,7 @@ function allow_settings_modifications {
local site drupal_root subdir site_directory
site="${1}"
shift
drupal_root=$(drush drupal:directory)
drupal_root=/var/www/drupal/web
subdir=$(drupal_site_env "${site}" "SUBDIR")
site_directory=$(realpath "${drupal_root}/sites/${subdir}")

Expand All @@ -366,7 +366,7 @@ function restore_settings_ownership {
shift
previous_owner_group="${1}"
shift
drupal_root=$(drush drupal:directory)
drupal_root=/var/www/drupal/web
subdir=$(drupal_site_env "${site}" "SUBDIR")
site_directory=$(realpath "${drupal_root}/sites/${subdir}")

Expand Down Expand Up @@ -665,7 +665,7 @@ function set_site_uuid {
site="${1}"
shift
site_url=$(drupal_site_env "${site}" "SITE_URL")
drupal_root=$(drush drupal:directory)
drupal_root=/var/www/drupal/web
# Handle the case if config_dir is a relative path.
config_dir=$(realpath "$(drush --root="${drupal_root}" php:eval "echo \Drupal\Core\Site\Settings::get('config_sync_directory');")")
uuid=$(awk '/uuid/ { print $2 }' "${config_dir:?}/system.site.yml")
Expand Down
4 changes: 2 additions & 2 deletions matomo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ ARG MATOMO_FILE="${MATOMO_VERSION}.tar.gz"
ARG MATOMO_URL="https://builds.matomo.org/matomo-${MATOMO_FILE}"
ARG MATOMO_SHA256="cd656ee7df4b29ac453456c6b9708d8264093ac2c99d6669d2830f31624cd626"

ARG EXTRA_TOOLS_VERSION="5.0.1"
ARG EXTRA_TOOLS_VERSION="5.0.4"
ARG EXTRA_TOOLS_FILE="${EXTRA_TOOLS_VERSION}.tar.gz"
ARG EXTRA_TOOLS_URL="https://github.com/digitalist-se/extratools/archive/refs/tags/${EXTRA_TOOLS_FILE}"
ARG EXTRA_TOOLS_SHA256="e76592e839a6aa0c73189790bed7e0032281e58a6b5b648278844b664367267c"
ARG EXTRA_TOOLS_SHA256="dacb54e3dd8d234ece8ed2454121cbe23870da1d3ea3357c436a43fd651a2e1e"

EXPOSE 8000

Expand Down
4 changes: 2 additions & 2 deletions test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
FROM drupal

ARG TARGETARCH
ARG COMMIT=1.5.0
ARG COMMIT=a129ed9e57b0de749f7c32f61684d639031e74ae
ARG FILE=${COMMIT}.tar.gz
ARG URL=https://github.com/Islandora/islandora-starter-site/archive/${FILE}
ARG SHA256=600f6af9d8b09815d2f36ea24ed0ddd6be5735ad58dbe262bf2acb6bbace0978
ARG SHA256=a91638746f9acb61a83e2f03d5e62c844feede574f3b71795982d0aebe6967b7

# Platform agnostic does not require arch specific identifier.
RUN --mount=type=cache,id=test-downloads-${TARGETARCH},sharing=locked,target=/opt/downloads \
Expand Down

0 comments on commit 24f0418

Please sign in to comment.