From dfddf54fe16847753f4d0ed30b728878d1d6232d Mon Sep 17 00:00:00 2001 From: Fabian Schindler <fabian.schindler.strauss@gmail.com> Date: Wed, 25 Mar 2020 18:17:21 +0100 Subject: [PATCH] cache: adding entrypoint cleanup of unused stuff --- cache/Dockerfile | 8 +++++++- cache/configure.sh | 1 + cache/entrypoint.sh | 11 +++++++++++ cache/install.sh | 2 +- cache/run-httpd.sh | 4 ---- 5 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 cache/entrypoint.sh diff --git a/cache/Dockerfile b/cache/Dockerfile index 8befa063..5f97dddc 100644 --- a/cache/Dockerfile +++ b/cache/Dockerfile @@ -63,11 +63,17 @@ ADD configure.sh \ run-seeder.sh \ seeder.py \ mapcache-template.xml \ + entrypoint.sh \ / + RUN chmod -v +x \ /configure.sh \ /run-httpd.sh \ - /run-seeder.sh + /run-seeder.sh \ + /entrypoint.sh + +ADD mapcache.xml ${INSTALL_DIR}/ EXPOSE 80 +ENTRYPOINT ["/entrypoint.sh"] CMD ["/run-httpd.sh"] diff --git a/cache/configure.sh b/cache/configure.sh index 4e187bca..f15dba8a 100755 --- a/cache/configure.sh +++ b/cache/configure.sh @@ -2,6 +2,7 @@ echo "Running configure.sh" echo "Generating directory for seeding logs" +mkdir -p "${INSTALL_DIR}" mkdir -p "/cache-db/${COLLECTION}" chown -R www-data:www-data "${INSTALL_DIR}" diff --git a/cache/entrypoint.sh b/cache/entrypoint.sh new file mode 100644 index 00000000..24f6491f --- /dev/null +++ b/cache/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash -e + +SERVICES=${WAIT_SERVICES:=''} + +if [[ ! -z $SERVICES ]] ; then + for service in $SERVICES ; do + wait-for-it $service + done +fi + +eval "$@" diff --git a/cache/install.sh b/cache/install.sh index 3bc64ae9..9200b166 100755 --- a/cache/install.sh +++ b/cache/install.sh @@ -12,6 +12,6 @@ apt update echo "Installing packages" DEBIAN_FRONTEND=noninteractive apt install -y \ libmapcache1=1.8.0-1~bionic1eox2 libapache2-mod-mapcache=1.8.0-1~bionic1eox2 mapcache-tools=1.8.0-1~bionic1eox2 \ - sqlite3 curl apache2 python3-dateutil python3-redis + sqlite3 curl apache2 python3-dateutil python3-redis wait-for-it rm -rf /var/lib/apt/lists/* diff --git a/cache/run-httpd.sh b/cache/run-httpd.sh index d7e01bf7..0f0567a8 100755 --- a/cache/run-httpd.sh +++ b/cache/run-httpd.sh @@ -1,11 +1,7 @@ #!/bin/bash -e -/get-token-and-render.sh /configure.sh -echo "Running cron in background" -service cron start - echo "Running Apache server" rm -rf /run/apache2/* /var/run/apache2/* /tmp/apache2* exec /usr/sbin/apache2ctl -D FOREGROUND -- GitLab