diff --git a/cache/Dockerfile b/cache/Dockerfile index 5bbfe5b9f58b6cdbf072177ad848e965c7cb194e..f415ab13c23fe3603f1ef575f835c94bbeddece3 100644 --- a/cache/Dockerfile +++ b/cache/Dockerfile @@ -64,6 +64,7 @@ ADD configure.sh \ seeder.py \ mapcache-template.xml \ entrypoint.sh \ + mapcache_items_view.sql \ / RUN chmod -v +x \ diff --git a/cache/configure.sh b/cache/configure.sh index 34e8101058e6c41508c98d0e5c128aa1233e4f06..3e478fe9059ea52c03c3b0b0a5edd3224fd2917a 100755 --- a/cache/configure.sh +++ b/cache/configure.sh @@ -108,5 +108,6 @@ else echo "Using existing index.html" fi -echo "Store environment variables for cron." -env > /etc/environment +# create a database view for the mapcache items +echo "Creating database view for mapcache items" +psql "host=${DB_HOST} user=${DB_USER} password=${DB_PW} dbname=${DB_NAME} port=${DB_PORT}" -f /mapcache_items_view.sql diff --git a/cache/install.sh b/cache/install.sh index 1df036ae33ea2f3ae6b181a066132111fea226da..1fd4d5331e81f0b7c1911e01b3b0a228fc59f1b5 100755 --- a/cache/install.sh +++ b/cache/install.sh @@ -13,6 +13,6 @@ echo "Installing packages" VERSION=1.8.0-1~bionic1eox5 DEBIAN_FRONTEND=noninteractive apt install -y \ libmapcache1=${VERSION} libapache2-mod-mapcache=${VERSION} mapcache-tools=${VERSION} \ - sqlite3 curl apache2 python3-dateutil python3-redis wait-for-it + sqlite3 curl apache2 python3-dateutil python3-redis wait-for-it postgresql-client rm -rf /var/lib/apt/lists/* diff --git a/cache/mapcache_items_view.sql b/cache/mapcache_items_view.sql new file mode 100644 index 0000000000000000000000000000000000000000..4d429a79c84b138c3ca1f56c3eca2439339e0813 --- /dev/null +++ b/cache/mapcache_items_view.sql @@ -0,0 +1,14 @@ +CREATE OR REPLACE VIEW mapcache_items AS + SELECT + product_eoobject."begin_time" AS "begin_time", + product_eoobject."end_time" AS "end_time", + product_eoobject."footprint" AS "footprint", + CONCAT(to_char(product_eoobject."begin_time", 'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(product_eoobject."end_time", 'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval", + collection_eoobject.identifier AS "collection" + FROM "coverages_product" + INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") + INNER JOIN "coverages_collection" collection ON ("coverages_product_collections"."collection_id" = collection."eoobject_ptr_id") + INNER JOIN "coverages_eoobject" ON (collection."eoobject_ptr_id" = "coverages_eoobject"."id") + INNER JOIN "coverages_eoobject" product_eoobject ON ("coverages_product"."eoobject_ptr_id" = product_eoobject."id") + INNER JOIN "coverages_eoobject" collection_eoobject ON (collection."eoobject_ptr_id" = collection_eoobject."id") +;