Skip to content

Commit 77d8c17

Browse files
committed
Add entrypoint to clear the federation metadata cache on startup
1 parent 129daa7 commit 77d8c17

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

docker/Dockerfile.prod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ RUN tar -xvjf /tmp/*.tar.bz2 -C /var/www/html/ && \
1414
COPY config/openconext/parameters.yaml.dist config/openconext/parameters.yaml
1515
COPY config/openconext/institutions.yaml.dist config/openconext/institutions.yaml
1616

17+
COPY ./docker/entrypoint.sh /usr/local/bin/entrypoint.sh
18+
1719
# Add the config files for Apache2
1820
RUN rm -rf /etc/apache2/sites-enabled/*
1921
COPY ./docker/conf/azuremfa-apache2.conf /etc/apache2/sites-enabled/azuremfa.conf
@@ -23,4 +25,5 @@ EXPOSE 80
2325
# Set the default workdir
2426
WORKDIR /var/www/html
2527

28+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
2629
CMD ["apache2-foreground"]

docker/Dockerfile.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ COPY config/openconext/parameters.yaml.dist config/openconext/parameters.yaml
1313
COPY config/openconext/institutions.yaml.dist config/openconext/institutions.yaml
1414
COPY config/packages/prod/monolog.yaml.docker config/packages/prod/monolog.yaml
1515

16+
COPY ./docker/entrypoint.sh /usr/local/bin/entrypoint.sh
17+
1618
# Add the config files for Apache2
1719
RUN rm -rf /etc/apache2/sites-enabled/* && rm -rf /var/www/html/output.zip
1820
COPY ./docker/conf/azuremfa-apache2.conf /etc/apache2/sites-enabled/azuremfa.conf
1921
RUN rm -rf /var/www/html/var/cache/prod && chown -R www-data /var/www/html/var
2022
EXPOSE 80
2123

24+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
2225
CMD ["apache2-foreground"]

docker/entrypoint.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
PARAM_FILE="/var/www/html/config/openconext/parameters.yaml"
4+
CACHE_DIR=$(grep -E '^ *federation_metadata_cache_location:' "$PARAM_FILE" \
5+
| cut -d ':' -f2- | tr -d '[:space:]')
6+
7+
if [ -z "$CACHE_DIR" ]; then
8+
CACHE_DIR="/var/www/html/federation-metadata"
9+
fi
10+
11+
echo "Metadata cache‑map: $CACHE_DIR"
12+
13+
if [ -d "$CACHE_DIR" ]; then
14+
echo "Leegmaken van Metadata cache‑map $CACHE_DIR"
15+
rm -rf "$CACHE_DIR"/* 2>/dev/null
16+
fi
17+
18+
exec "$@"

0 commit comments

Comments
 (0)