Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions docker/Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ RUN tar -xvjf /tmp/*.tar.bz2 -C /var/www/html/ && \
COPY config/openconext/parameters.yaml.dist config/openconext/parameters.yaml
COPY config/openconext/institutions.yaml.dist config/openconext/institutions.yaml

COPY --chmod=755 ./docker/entrypoint.sh /usr/local/bin/entrypoint.sh

# Add the config files for Apache2
RUN rm -rf /etc/apache2/sites-enabled/*
COPY ./docker/conf/azuremfa-apache2.conf /etc/apache2/sites-enabled/azuremfa.conf
Expand All @@ -23,4 +25,5 @@ EXPOSE 80
# Set the default workdir
WORKDIR /var/www/html

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["apache2-foreground"]
3 changes: 3 additions & 0 deletions docker/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ COPY config/openconext/parameters.yaml.dist config/openconext/parameters.yaml
COPY config/openconext/institutions.yaml.dist config/openconext/institutions.yaml
COPY config/packages/prod/monolog.yaml.docker config/packages/prod/monolog.yaml

COPY --chmod=755 ./docker/entrypoint.sh /usr/local/bin/entrypoint.sh

# Add the config files for Apache2
RUN rm -rf /etc/apache2/sites-enabled/* && rm -rf /var/www/html/output.zip
COPY ./docker/conf/azuremfa-apache2.conf /etc/apache2/sites-enabled/azuremfa.conf
RUN rm -rf /var/www/html/var/cache/prod && chown -R www-data /var/www/html/var
EXPOSE 80

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["apache2-foreground"]
18 changes: 18 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

PARAM_FILE="/var/www/html/config/openconext/parameters.yaml"
CACHE_DIR=$(grep -E '^ *federation_metadata_cache_location:' "$PARAM_FILE" \
| cut -d ':' -f2- | tr -d '[:space:]')
Comment on lines +4 to +5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont know bash, but Claude suggested the following, confirmed by GPT5.5:

Suggested change
CACHE_DIR=$(grep -E '^ *federation_metadata_cache_location:' "$PARAM_FILE" \
| cut -d ':' -f2- | tr -d '[:space:]')
CACHE_DIR=$(grep -E '^ *federation_metadata_cache_location:' "$PARAM_FILE" \
| cut -d ':' -f2- | tr -d '[:space:]' | tr -d "'\"")

Finding 1 — docker/entrypoint.sh:4-5:yaml-quote-handling

YAML-quoted values break cache path extraction

parameters.yaml.dist (the file copied as parameters.yaml in both Dockerfiles) stores the value as federation_metadata_cache_location: '/var/www/html/federation-metadata' — with YAML single quotes. The cut | tr pipeline doesn't strip those quotes, so $CACHE_DIR becomes the literal string '/var/www/html/federation-metadata' (with quote characters). The [ -d "$CACHE_DIR" ] test then fails silently because no such directory exists, meaning the cache is never cleared — which is the entire purpose of this PR.

Relevant lines: docker/entrypoint.sh lines 4–5

Suggested approach: Strip YAML quotes after the tr step:

CACHE_DIR=$(grep -E '^ *federation_metadata_cache_location:' "$PARAM_FILE"
| cut -d ':' -f2- | tr -d '[:space:]' | tr -d "'"")


if [ -z "$CACHE_DIR" ]; then
CACHE_DIR="/var/www/html/federation-metadata"
fi

echo "Metadata cache‑map: $CACHE_DIR"

if [ -d "$CACHE_DIR" ]; then
echo "Leegmaken van Metadata cache‑map $CACHE_DIR"
rm -rf "$CACHE_DIR"/* 2>/dev/null
fi

exec "$@"