diff --git a/README.md b/README.md index 34f0fa70ed32d91856f26682e5f1b1c955719ac9..2a194cde5cca2ac12726abc0e9020fecc4ca7912 100644 --- a/README.md +++ b/README.md @@ -163,10 +163,10 @@ Initialize swarm & stack: ```bash docker swarm init # initialize swarm # build images - docker build core/ --cache-from registry.gitlab.eox.at/esa/prism/vs/pvs_core -t registry.gitlab.eox.at/esa/prism/vs/pvs_core - docker build cache/ --cache-from registry.gitlab.eox.at/esa/prism/vs/pvs_cache -t registry.gitlab.eox.at/esa/prism/vs/pvs_cache - docker build preprocessor/ --cache-from registry.gitlab.eox.at/esa/prism/vs/pvs_preprocessor -t registry.gitlab.eox.at/esa/prism/vs/pvs_preprocessor - docker build client/ --cache-from registry.gitlab.eox.at/esa/prism/vs/pvs_client -t registry.gitlab.eox.at/esa/prism/vs/pvs_client +docker build core/ --cache-from registry.gitlab.eox.at/esa/prism/vs/pvs_core -t registry.gitlab.eox.at/esa/prism/vs/pvs_core +docker build cache/ --cache-from registry.gitlab.eox.at/esa/prism/vs/pvs_cache -t registry.gitlab.eox.at/esa/prism/vs/pvs_cache +docker build preprocessor/ --cache-from registry.gitlab.eox.at/esa/prism/vs/pvs_preprocessor -t registry.gitlab.eox.at/esa/prism/vs/pvs_preprocessor +docker build client/ --cache-from registry.gitlab.eox.at/esa/prism/vs/pvs_client -t registry.gitlab.eox.at/esa/prism/vs/pvs_client #or docker login -u {DOCKER_USER} -p {DOCKER_PASSWORD} registry.gitlab.eox.at docker pull registry.gitlab.eox.at/esa/prism/vs/pvs_core @@ -189,6 +189,7 @@ docker volume rm vhr18-pvs_db-data # delete volumes docker volume rm vhr18-pvs_redis-data docker volume rm vhr18-pvs_traefik-data docker volume rm vhr18-pvs_cache-db +docker volume rm vhr18-pvs_instance-data ``` Generate mapcache.sqlite diff --git a/cache/Dockerfile b/cache/Dockerfile index 9a6ae7c705bd281cf0a9d9aa0284e16063e42724..f415ab13c23fe3603f1ef575f835c94bbeddece3 100644 --- a/cache/Dockerfile +++ b/cache/Dockerfile @@ -62,15 +62,17 @@ ADD configure.sh \ run-httpd.sh \ run-seeder.sh \ seeder.py \ - get-token-and-render.sh \ mapcache-template.xml \ + entrypoint.sh \ + mapcache_items_view.sql \ / + RUN chmod -v +x \ /configure.sh \ /run-httpd.sh \ - /run-seeder.sh - -ADD reload-http /etc/cron.d/ + /run-seeder.sh \ + /entrypoint.sh EXPOSE 80 +ENTRYPOINT ["/entrypoint.sh"] CMD ["/run-httpd.sh"] diff --git a/cache/configure.sh b/cache/configure.sh index 4e187bca4922442caf5760e727dcf1483ab79ef9..3e478fe9059ea52c03c3b0b0a5edd3224fd2917a 100755 --- a/cache/configure.sh +++ b/cache/configure.sh @@ -2,10 +2,31 @@ echo "Running configure.sh" echo "Generating directory for seeding logs" -mkdir -p "/cache-db/${COLLECTION}" +mkdir -p "${INSTALL_DIR}" +cd "${INSTALL_DIR}" + +cat /mapcache-template.xml \ + | sed -e "s/{{ST_AUTH_VERSION}}/$(echo ${ST_AUTH_VERSION} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ + | sed -e "s/{{OS_AUTH_URL_SHORT}}/$(echo ${OS_AUTH_URL_SHORT} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ + | sed -e "s/{{OS_TENANT_NAME}}/$(echo ${OS_TENANT_NAME} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ + | sed -e "s/{{OS_TENANT_ID}}/$(echo ${OS_TENANT_ID} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ + | sed -e "s/{{OS_USERNAME}}/$(echo ${OS_USERNAME} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ + | sed -e "s/{{OS_PASSWORD}}/$(echo ${OS_PASSWORD} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ + | sed -e "s/{{BUCKET_NAME}}/$(echo ${BUCKET_NAME} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ + | sed -e "s/{{DB_USER}}/$(echo ${DB_USER} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ + | sed -e "s/{{DB_PW}}/$(echo ${DB_PW} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ + | sed -e "s/{{DB_HOST}}/$(echo ${DB_HOST} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ + | sed -e "s/{{DB_PORT}}/$(echo ${DB_PORT} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ + | sed -e "s/{{DB_NAME}}/$(echo ${DB_NAME} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ + | sed -e "s;http://localhost/ows;http://${RENDERER_HOST}/ows;" > mapcache.xml + +cd - chown -R www-data:www-data "${INSTALL_DIR}" +mkdir -p "/cache-db/${COLLECTION}" + + if [ ! -f "${APACHE_CONF}" ] ; then echo "Adding Apache configuration" @@ -87,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/entrypoint.sh b/cache/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..81a77cdfc99c60a582199ac8918d02f9f5957c9b --- /dev/null +++ b/cache/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash -e + +SERVICES=${WAIT_SERVICES:=''} +TIMEOUT=${WAIT_TIMEOUT:='15'} + +if [[ ! -z $SERVICES ]] ; then + for service in $SERVICES ; do + wait-for-it -t $TIMEOUT $service + done +fi + +eval "$@" diff --git a/cache/get-token-and-render.sh b/cache/get-token-and-render.sh deleted file mode 100755 index cf898357ac5509bb0a1b96be3735bd10ca620fb2..0000000000000000000000000000000000000000 --- a/cache/get-token-and-render.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -e - -echo "Fetching auth token and storage URL" - -# fetch a new token -eval $(swift auth) - -echo "Fetched auth token ${OS_AUTH_TOKEN} and storage URL ${OS_STORAGE_URL}" - -# render the template with the provided values -echo "Copying and adjusting MapCache configuration file" -mkdir -p "${INSTALL_DIR}" -cd "${INSTALL_DIR}" -cat /mapcache-template.xml \ - | sed -e "s/{{OS_STORAGE_URL}}/$(echo ${OS_STORAGE_URL} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ - | sed -e "s/{{OS_AUTH_TOKEN}}/$(echo ${OS_AUTH_TOKEN} | sed -e 's/[]\/$*.^[]/\\&/g')/g" \ - | sed -e "s/{{BUCKET_NAME}}/$(echo ${BUCKET_NAME} | sed -e 's/[]\/$*.^[]/\\&/g')/g" > mapcache.xml -sed -e "s;http://localhost/ows;http://${RENDERER_HOST}/ows;" -i mapcache.xml -cd - diff --git a/cache/install.sh b/cache/install.sh index 6048eb7a54cdbeb584a0fcec2df03651fbe5e4c6..d7c73c713b74893b196c6f9acaeedbf504fd0de6 100755 --- a/cache/install.sh +++ b/cache/install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e echo "Running install.sh" apt update @@ -6,12 +6,13 @@ apt update echo "Adding UbuntuGIS repo" DEBIAN_FRONTEND=noninteractive apt install -y software-properties-common add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable +add-apt-repository -y ppa:schpidi2/eox apt update echo "Installing packages" -DEBIAN_FRONTEND=noninteractive apt install -y libapache2-mod-mapcache \ - mapcache-tools sqlite3 curl apache2 python3-dateutil python3-redis \ - python3-boto3 cron \ - python3-swiftclient python-swiftclient +VERSION=1.8.0-1~bionic1eox6 +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 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") +; diff --git a/cache/reload-http b/cache/reload-http deleted file mode 100755 index 9653417c990bbbee03ecc67a21ac82ce5f173461..0000000000000000000000000000000000000000 --- a/cache/reload-http +++ /dev/null @@ -1 +0,0 @@ -42 * * * * root /get-token-and-render.sh > /proc/1/fd/1 && /usr/sbin/apache2ctl -k graceful > /proc/1/fd/1 diff --git a/cache/run-httpd.sh b/cache/run-httpd.sh index d7e01bf7b92b92c9219dffe3cd142fc35e6112e3..0f0567a836253fbfda02e5ec5914bf8505ef7449 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 diff --git a/config/emg_mapcache-dev.xml b/config/emg_mapcache-dev.xml index 55b2646284180d4bcae8b47d4195bc99a9e91c72..8b95da85b15934681dd2a7c2d956eac71e62fb7a 100644 --- a/config/emg_mapcache-dev.xml +++ b/config/emg_mapcache-dev.xml @@ -50,6 +50,8 @@ <errors>empty_img</errors> <lock_dir>/tmp</lock_dir> <threaded_fetching>true</threaded_fetching> + + <!-- Cache --> <cache name="emg" type="sqlite3"> <dbfile>/tmp/cache.db</dbfile> </cache> @@ -112,10 +114,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/emg_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'Emergency';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'Emergency' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -134,10 +136,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/emg_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'Emergency';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'Emergency' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -156,10 +158,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/emg_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'Emergency';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'Emergency' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> diff --git a/config/emg_mapcache-ops.xml b/config/emg_mapcache-ops.xml index 0e2e5c35d8d24d25996fc3b7f1a9a6b565666612..8029c2fabf433ce4ae1cfbcb25ec9ec9d6ef8d91 100644 --- a/config/emg_mapcache-ops.xml +++ b/config/emg_mapcache-ops.xml @@ -51,11 +51,16 @@ <errors>empty_img</errors> <lock_dir>/tmp</lock_dir> <threaded_fetching>true</threaded_fetching> - <cache name="emg" type="rest"> - <url>{{OS_STORAGE_URL}}/{{BUCKET_NAME}}/{tileset}/{grid}/{dim}/{z}/{x}/{y}.{ext}</url> - <headers> - <X-Auth-Token>{{OS_AUTH_TOKEN}}</X-Auth-Token> - </headers> + + <!-- Cache --> + <cache name="emg" type="swift"> + <auth_url>{{OS_AUTH_URL_SHORT}}</auth_url> + <auth_version>{{ST_AUTH_VERSION}}</auth_version> + <tenant>{{OS_TENANT_ID}}</tenant> + <username>{{OS_USERNAME}}</username> + <password>{{OS_PASSWORD}}</password> + <container>{{BUCKET_NAME}}</container> + <key>/{tileset}/{grid}/{dim}/{z}/{x}/{y}.{ext}</key> </cache> <!-- SOURCES Emergency --> @@ -116,10 +121,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/emg_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'Emergency';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'Emergency' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -138,10 +143,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/emg_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'Emergency';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'Emergency' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -160,10 +165,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/emg_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'Emergency';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'Emergency' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> diff --git a/config/vhr18_mapcache-dev.xml b/config/vhr18_mapcache-dev.xml index e9ce1af1c6270c3c94a31f90143f43a132734aa2..ee5ae0cfcd30330f1b4f8c174b6740207986cb63 100644 --- a/config/vhr18_mapcache-dev.xml +++ b/config/vhr18_mapcache-dev.xml @@ -50,6 +50,8 @@ <errors>empty_img</errors> <lock_dir>/tmp</lock_dir> <threaded_fetching>true</threaded_fetching> + + <!-- Cache --> <cache name="vhr18" type="sqlite3"> <dbfile>/tmp/cache.db</dbfile> </cache> @@ -125,10 +127,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(mapcache_items."begin_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(mapcache_items."end_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM mapcache_items WHERE mapcache_items."collection" = 'VHR_IMAGE_2018';</list_query> + <validate_query>SELECT * FROM (SELECT interval FROM mapcache_items WHERE (mapcache_items."collection" = 'VHR_IMAGE_2018' AND ((mapcache_items."begin_time" < to_timestamp(:end_timestamp) AND mapcache_items."end_time" > to_timestamp(:start_timestamp)) or (mapcache_items."begin_time" = mapcache_items."end_time" AND mapcache_items."begin_time" <= to_timestamp(:end_timestamp) AND mapcache_items."end_time" >= to_timestamp(:start_timestamp)))) AND mapcache_items."footprint" && ST_MakeEnvelope(:minx, :miny, :maxx, :maxy, 4326) ORDER BY mapcache_items."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -147,10 +149,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(mapcache_items."begin_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(mapcache_items."end_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM mapcache_items WHERE mapcache_items."collection" = 'VHR_IMAGE_2018';</list_query> + <validate_query>SELECT * FROM (SELECT interval FROM mapcache_items WHERE (mapcache_items."collection" = 'VHR_IMAGE_2018' AND ((mapcache_items."begin_time" < to_timestamp(:end_timestamp) AND mapcache_items."end_time" > to_timestamp(:start_timestamp)) or (mapcache_items."begin_time" = mapcache_items."end_time" AND mapcache_items."begin_time" <= to_timestamp(:end_timestamp) AND mapcache_items."end_time" >= to_timestamp(:start_timestamp)))) AND mapcache_items."footprint" && ST_MakeEnvelope(:minx, :miny, :maxx, :maxy, 4326) ORDER BY mapcache_items."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -169,10 +171,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(mapcache_items."begin_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(mapcache_items."end_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM mapcache_items WHERE mapcache_items."collection" = 'VHR_IMAGE_2018';</list_query> + <validate_query>SELECT * FROM (SELECT interval FROM mapcache_items WHERE (mapcache_items."collection" = 'VHR_IMAGE_2018' AND ((mapcache_items."begin_time" < to_timestamp(:end_timestamp) AND mapcache_items."end_time" > to_timestamp(:start_timestamp)) or (mapcache_items."begin_time" = mapcache_items."end_time" AND mapcache_items."begin_time" <= to_timestamp(:end_timestamp) AND mapcache_items."end_time" >= to_timestamp(:start_timestamp)))) AND mapcache_items."footprint" && ST_MakeEnvelope(:minx, :miny, :maxx, :maxy, 4326) ORDER BY mapcache_items."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -191,10 +193,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(mapcache_items."begin_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(mapcache_items."end_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM mapcache_items WHERE mapcache_items."collection" = 'VHR_IMAGE_2018';</list_query> + <validate_query>SELECT * FROM (SELECT interval FROM mapcache_items WHERE (mapcache_items."collection" = 'VHR_IMAGE_2018' AND ((mapcache_items."begin_time" < to_timestamp(:end_timestamp) AND mapcache_items."end_time" > to_timestamp(:start_timestamp)) or (mapcache_items."begin_time" = mapcache_items."end_time" AND mapcache_items."begin_time" <= to_timestamp(:end_timestamp) AND mapcache_items."end_time" >= to_timestamp(:start_timestamp)))) AND mapcache_items."footprint" && ST_MakeEnvelope(:minx, :miny, :maxx, :maxy, 4326) ORDER BY mapcache_items."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -270,10 +272,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(mapcache_items."begin_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(mapcache_items."end_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM mapcache_items WHERE mapcache_items."collection" = 'VHR_IMAGE_2018_Level_1';</list_query> + <validate_query>SELECT * FROM (SELECT interval FROM mapcache_items WHERE (mapcache_items."collection" = 'VHR_IMAGE_2018_Level_1' AND ((mapcache_items."begin_time" < to_timestamp(:end_timestamp) AND mapcache_items."end_time" > to_timestamp(:start_timestamp)) or (mapcache_items."begin_time" = mapcache_items."end_time" AND mapcache_items."begin_time" <= to_timestamp(:end_timestamp) AND mapcache_items."end_time" >= to_timestamp(:start_timestamp)))) AND mapcache_items."footprint" && ST_MakeEnvelope(:minx, :miny, :maxx, :maxy, 4326) ORDER BY mapcache_items."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -292,10 +294,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(mapcache_items."begin_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(mapcache_items."end_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM mapcache_items WHERE mapcache_items."collection" = 'VHR_IMAGE_2018_Level_1';</list_query> + <validate_query>SELECT * FROM (SELECT interval FROM mapcache_items WHERE (mapcache_items."collection" = 'VHR_IMAGE_2018_Level_1' AND ((mapcache_items."begin_time" < to_timestamp(:end_timestamp) AND mapcache_items."end_time" > to_timestamp(:start_timestamp)) or (mapcache_items."begin_time" = mapcache_items."end_time" AND mapcache_items."begin_time" <= to_timestamp(:end_timestamp) AND mapcache_items."end_time" >= to_timestamp(:start_timestamp)))) AND mapcache_items."footprint" && ST_MakeEnvelope(:minx, :miny, :maxx, :maxy, 4326) ORDER BY mapcache_items."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -314,10 +316,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(mapcache_items."begin_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(mapcache_items."end_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM mapcache_items WHERE mapcache_items."collection" = 'VHR_IMAGE_2018_Level_1';</list_query> + <validate_query>SELECT * FROM (SELECT interval FROM mapcache_items WHERE (mapcache_items."collection" = 'VHR_IMAGE_2018_Level_1' AND ((mapcache_items."begin_time" < to_timestamp(:end_timestamp) AND mapcache_items."end_time" > to_timestamp(:start_timestamp)) or (mapcache_items."begin_time" = mapcache_items."end_time" AND mapcache_items."begin_time" <= to_timestamp(:end_timestamp) AND mapcache_items."end_time" >= to_timestamp(:start_timestamp)))) AND mapcache_items."footprint" && ST_MakeEnvelope(:minx, :miny, :maxx, :maxy, 4326) ORDER BY mapcache_items."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -336,10 +338,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(mapcache_items."begin_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(mapcache_items."end_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM mapcache_items WHERE mapcache_items."collection" = 'VHR_IMAGE_2018_Level_1';</list_query> + <validate_query>SELECT * FROM (SELECT interval FROM mapcache_items WHERE (mapcache_items."collection" = 'VHR_IMAGE_2018_Level_1' AND ((mapcache_items."begin_time" < to_timestamp(:end_timestamp) AND mapcache_items."end_time" > to_timestamp(:start_timestamp)) or (mapcache_items."begin_time" = mapcache_items."end_time" AND mapcache_items."begin_time" <= to_timestamp(:end_timestamp) AND mapcache_items."end_time" >= to_timestamp(:start_timestamp)))) AND mapcache_items."footprint" && ST_MakeEnvelope(:minx, :miny, :maxx, :maxy, 4326) ORDER BY mapcache_items."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -439,10 +441,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(mapcache_items."begin_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(mapcache_items."end_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM mapcache_items WHERE mapcache_items."collection" = 'VHR_IMAGE_2018_Level_3';</list_query> + <validate_query>SELECT * FROM (SELECT interval FROM mapcache_items WHERE (mapcache_items."collection" = 'VHR_IMAGE_2018_Level_3' AND ((mapcache_items."begin_time" < to_timestamp(:end_timestamp) AND mapcache_items."end_time" > to_timestamp(:start_timestamp)) or (mapcache_items."begin_time" = mapcache_items."end_time" AND mapcache_items."begin_time" <= to_timestamp(:end_timestamp) AND mapcache_items."end_time" >= to_timestamp(:start_timestamp)))) AND mapcache_items."footprint" && ST_MakeEnvelope(:minx, :miny, :maxx, :maxy, 4326) ORDER BY mapcache_items."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -461,10 +463,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(mapcache_items."begin_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(mapcache_items."end_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM mapcache_items WHERE mapcache_items."collection" = 'VHR_IMAGE_2018_Level_3';</list_query> + <validate_query>SELECT * FROM (SELECT interval FROM mapcache_items WHERE (mapcache_items."collection" = 'VHR_IMAGE_2018_Level_3' AND ((mapcache_items."begin_time" < to_timestamp(:end_timestamp) AND mapcache_items."end_time" > to_timestamp(:start_timestamp)) or (mapcache_items."begin_time" = mapcache_items."end_time" AND mapcache_items."begin_time" <= to_timestamp(:end_timestamp) AND mapcache_items."end_time" >= to_timestamp(:start_timestamp)))) AND mapcache_items."footprint" && ST_MakeEnvelope(:minx, :miny, :maxx, :maxy, 4326) ORDER BY mapcache_items."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -483,10 +485,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(mapcache_items."begin_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(mapcache_items."end_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM mapcache_items WHERE mapcache_items."collection" = 'VHR_IMAGE_2018_Level_3';</list_query> + <validate_query>SELECT * FROM (SELECT interval FROM mapcache_items WHERE (mapcache_items."collection" = 'VHR_IMAGE_2018_Level_3' AND ((mapcache_items."begin_time" < to_timestamp(:end_timestamp) AND mapcache_items."end_time" > to_timestamp(:start_timestamp)) or (mapcache_items."begin_time" = mapcache_items."end_time" AND mapcache_items."begin_time" <= to_timestamp(:end_timestamp) AND mapcache_items."end_time" >= to_timestamp(:start_timestamp)))) AND mapcache_items."footprint" && ST_MakeEnvelope(:minx, :miny, :maxx, :maxy, 4326) ORDER BY mapcache_items."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -505,10 +507,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(mapcache_items."begin_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(mapcache_items."end_time"), 'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM mapcache_items WHERE mapcache_items."collection" = 'VHR_IMAGE_2018_Level_3';</list_query> + <validate_query>SELECT * FROM (SELECT interval FROM mapcache_items WHERE (mapcache_items."collection" = 'VHR_IMAGE_2018_Level_3' AND ((mapcache_items."begin_time" < to_timestamp(:end_timestamp) AND mapcache_items."end_time" > to_timestamp(:start_timestamp)) or (mapcache_items."begin_time" = mapcache_items."end_time" AND mapcache_items."begin_time" <= to_timestamp(:end_timestamp) AND mapcache_items."end_time" >= to_timestamp(:start_timestamp)))) AND mapcache_items."footprint" && ST_MakeEnvelope(:minx, :miny, :maxx, :maxy, 4326) ORDER BY mapcache_items."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> diff --git a/config/vhr18_mapcache-ops.xml b/config/vhr18_mapcache-ops.xml index 11e42a171ad6213070364099ccb2cd8e020f38b0..1817b233a6d8681026c373cba0b8daa672c46d54 100644 --- a/config/vhr18_mapcache-ops.xml +++ b/config/vhr18_mapcache-ops.xml @@ -51,11 +51,16 @@ <errors>empty_img</errors> <lock_dir>/tmp</lock_dir> <threaded_fetching>true</threaded_fetching> - <cache name="vhr18" type="rest"> - <url>{{OS_STORAGE_URL}}/vhr18_cache/{tileset}/{grid}/{dim}/{z}/{x}/{y}.{ext}</url> - <headers> - <X-Auth-Token>{{OS_AUTH_TOKEN}}</X-Auth-Token> - </headers> + + <!-- Cache --> + <cache name="vhr18" type="swift"> + <auth_url>{{OS_AUTH_URL_SHORT}}</auth_url> + <auth_version>{{ST_AUTH_VERSION}}</auth_version> + <tenant>{{OS_TENANT_ID}}</tenant> + <username>{{OS_USERNAME}}</username> + <password>{{OS_PASSWORD}}</password> + <container>{{BUCKET_NAME}}</container> + <key>/{tileset}/{grid}/{dim}/{z}/{x}/{y}.{ext}</key> </cache> <!-- SOURCES VHR_IMAGE_2018 --> @@ -129,10 +134,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'VHR_IMAGE_2018';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'VHR_IMAGE_2018' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -151,10 +156,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'VHR_IMAGE_2018';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'VHR_IMAGE_2018' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -173,10 +178,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'VHR_IMAGE_2018';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'VHR_IMAGE_2018' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -195,10 +200,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'VHR_IMAGE_2018';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'VHR_IMAGE_2018' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -274,10 +279,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_1';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_1' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -296,10 +301,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_1';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_1' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -318,10 +323,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_1';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_1' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -340,10 +345,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_1';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_1' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -443,10 +448,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_3';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_3' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -465,10 +470,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_3';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_3' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -487,10 +492,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_3';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_3' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> @@ -509,10 +514,10 @@ <assembly_type>stack</assembly_type> <store_assemblies>false</store_assemblies> <subdimensions_read_only>false</subdimensions_read_only> - <dimension type="sqlite" name="time" default="2017/2019" time="true"> - <dbfile>/cache-db/vhr18_mapcache_cache.sqlite</dbfile> - <list_query>select strftime('%Y-%m-%dT%H:%M:%SZ', MIN(start_time))||'/'||strftime('%Y-%m-%dT%H:%M:%SZ', MAX(end_time)) from time</list_query> - <validate_query>select * from (select strftime('%Y-%m-%dT%H:%M:%SZ',start_time)||'/'||strftime('%Y-%m-%dT%H:%M:%SZ',end_time) as interval from time where (start_time<datetime(:end_timestamp,'unixepoch') and (end_time>datetime(:start_timestamp,'unixepoch')) or (start_time=end_time and start_time<=datetime(:end_timestamp,'unixepoch') and end_time>=datetime(:start_timestamp,'unixepoch'))) and ((maxx>=:minx and minx<=:maxx) or (maxx>180 and (maxx-360.0)>=:minx and (minx-360.0)<=:maxx)) and maxy>=:miny and miny<=:maxy order by end_time desc limit 20) order by interval asc</validate_query> + <dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601"> + <connection>host={{DB_HOST}} user={{DB_USER}} password={{DB_PW}} dbname={{DB_NAME}} port={{DB_PORT}}</connection> + <list_query>SELECT CONCAT(to_char(MIN(T5."begin_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(MAX(T5."end_time"),'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE "coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_3';</list_query> + <validate_query>SELECT * FROM (SELECT CONCAT(to_char(T5."begin_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'), CONCAT('/', to_char(T5."end_time",'YYYY-MM-DD"T"HH24:MI:SS"Z"'))) AS "interval" FROM "coverages_product" INNER JOIN "coverages_product_collections" ON ("coverages_product"."eoobject_ptr_id" = "coverages_product_collections"."product_id") INNER JOIN "coverages_collection" ON ("coverages_product_collections"."collection_id" = "coverages_collection"."eoobject_ptr_id") INNER JOIN "coverages_eoobject" ON ("coverages_collection"."eoobject_ptr_id" = "coverages_eoobject"."id") INNER JOIN "coverages_eoobject" T5 ON ("coverages_product"."eoobject_ptr_id" = T5."id") WHERE ("coverages_eoobject"."identifier" = 'VHR_IMAGE_2018_Level_3' AND ((T5."begin_time" < to_timestamp(:end_timestamp) AND T5."end_time" > to_timestamp(:start_timestamp)) or (T5."begin_time" = T5."end_time" AND T5."begin_time" <= to_timestamp(:end_timestamp) AND T5."end_time" >= to_timestamp(:start_timestamp)))) AND T5."footprint" && ST_MakeEnvelope(:minx,:miny,:maxx,:maxy,4326) ORDER BY T5."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query> </dimension> </dimensions> </tileset> diff --git a/core/Dockerfile b/core/Dockerfile index 75b2f0ed148c4b82eef0b40f49f3b995d72d0a17..a634ddfbe271d1202ebd61e7b866f8ebbf53a1cf 100644 --- a/core/Dockerfile +++ b/core/Dockerfile @@ -37,12 +37,11 @@ USER root RUN apt update && \ apt install -y \ - libpq-dev && \ + libpq-dev wait-for-it && \ apt autoremove -y && \ apt clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - RUN pip3 install . && \ pip3 install python-keystoneclient python-swiftclient redis @@ -69,22 +68,32 @@ ENV INSTANCE_ID="prism-view-server_core" \ REDIS_PORT= \ REDIS_REGISTER_QUEUE_KEY= \ REDIS_REGISTERED_SET_KEY= \ - INIT_SCRIPTS="/configure.sh" + INIT_SCRIPTS="/configure.sh" \ + COLLECT_STATIC="false" ADD rgbnir_definition.json \ configure.sh \ run-httpd.sh \ run-registrar.sh \ registrar.py \ + entrypoint.sh \ + wait-initialized.sh \ + initialized.sh \ / + # run-redis-manager.sh \ # redis-manager.py \ RUN chmod -v +x \ /configure.sh \ /run-registrar.sh \ - /run-httpd.sh + /run-httpd.sh \ + /entrypoint.sh \ + /wait-initialized.sh \ + /initialized.sh # /run-redis-manager.sh EXPOSE 80 + +ENTRYPOINT ["/entrypoint.sh"] CMD ["/run-httpd.sh"] diff --git a/core/entrypoint.sh b/core/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..e78b1330d926b5936575619ce36509e11d4d08b3 --- /dev/null +++ b/core/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash -e + +SERVICES=${WAIT_SERVICES:=''} +TIMEOUT=${WAIT_TIMEOUT:='15'} + +if [[ ! -z $SERVICES ]] ; then + for service in $SERVICES ; do + wait-for-it -t $TIMEOUT $service + done +fi + +eval "/opt/eoxserver/eoxserver-entrypoint.sh $@" diff --git a/core/initialized.sh b/core/initialized.sh new file mode 100644 index 0000000000000000000000000000000000000000..8fc6714bda7f168a3a5807588463805987da1d2e --- /dev/null +++ b/core/initialized.sh @@ -0,0 +1,4 @@ +#!/bin/bash -e + +touch "${INSTANCE_DIR}/.initialized" +echo "Instance ${INSTANCE_ID} is initialized" diff --git a/core/registrar.py b/core/registrar.py index 45b60237a64abfc2ccd0f356b36c79ed1090c6f0..dee575790794cd4be5298e2a9551f821b1ef31df 100644 --- a/core/registrar.py +++ b/core/registrar.py @@ -173,7 +173,7 @@ def registrar( % objects_prefix ) - product_type = data_package.split("/")[1] + product_type = data_package.split("/")[2] product, replaced = ProductRegistrator().register( metadata_locations=[[upload_container, diff --git a/core/run-registrar.sh b/core/run-registrar.sh index ba8d1e9ed748f47db2b7772f4edb3f60cdf81314..a1bb5c44f748777615108e349c5832d8c2590303 100644 --- a/core/run-registrar.sh +++ b/core/run-registrar.sh @@ -2,4 +2,4 @@ echo "Running registrar" - python3 /registrar.py --mode redis --redis-host ${REDIS_HOST} --redis-port ${REDIS_PORT} --redis-register-queue-key ${REDIS_REGISTER_QUEUE_KEY} --redis-registered-set-key ${REDIS_REGISTERED_SET_KEY} +python3 /registrar.py --mode redis --redis-host ${REDIS_HOST} --redis-port ${REDIS_PORT} --redis-register-queue-key ${REDIS_REGISTER_QUEUE_KEY} --redis-registered-set-key ${REDIS_REGISTERED_SET_KEY} diff --git a/core/wait-initialized.sh b/core/wait-initialized.sh new file mode 100644 index 0000000000000000000000000000000000000000..bfefbc12868fcc0b52a52748df694b38961447b5 --- /dev/null +++ b/core/wait-initialized.sh @@ -0,0 +1,7 @@ +#!/bin/bash -e + +until [ -f "${INSTANCE_DIR}/.initialized" ] ; do + echo "Waiting until instance ${INSTANCE_ID} is initialized" + sleep 3 + # TODO: timeout? +done diff --git a/docker-compose.vhr18.yml b/docker-compose.vhr18.yml index 128810d1fb4c7c4102bac3a7d221174d1c5575a9..d8d91f8a231610820b0d8515c6b8e8ad4b083801 100644 --- a/docker-compose.vhr18.yml +++ b/docker-compose.vhr18.yml @@ -42,7 +42,10 @@ services: environment: INSTANCE_ID: "prism-view-server_renderer" INSTALL_DIR: "/var/www/pvs/dev/" - INIT_SCRIPTS: "/configure.sh /init-db.sh" + COLLECT_STATIC: "false" + INIT_SCRIPTS: "/configure.sh /init-db.sh /initialized.sh" + STARTUP_SCRIPTS: "/wait-initialized.sh" + WAIT_SERVICES: "database:5432" configs: - source: init-db target: /init-db.sh @@ -62,10 +65,13 @@ services: target: /cache-db env_file: - env/vhr18.env + - env/vhr18_db.env - env/vhr18_obs.env environment: INSTANCE_ID: "prism-view-server_cache" RENDERER_HOST: renderer + WAIT_SERVICES: "database:5432 renderer:80" + WAIT_TIMEOUT: 300 # wait up to 5 minutes deploy: replicas: 1 networks: @@ -87,6 +93,7 @@ services: environment: INSTANCE_ID: "prism-view-server_seeder" RENDERER_HOST: renderer + WAIT_SERVICES: "redis:6379 database:5432" deploy: replicas: 0 networks: @@ -101,6 +108,7 @@ services: - env/vhr18_redis.env environment: INSTANCE_ID: "prism-view-server_preprocessor" + WAIT_SERVICES: "redis:6379" deploy: replicas: 1 networks: @@ -125,7 +133,10 @@ services: INSTALL_DIR: "/var/www/pvs/dev/" SCALEFACTOR: "1" IN_MEMORY: "false" - INIT_SCRIPTS: "/configure.sh /init-db.sh" + COLLECT_STATIC: "false" + INIT_SCRIPTS: "/configure.sh /init-db.sh /initialized.sh" + STARTUP_SCRIPTS: "/wait-initialized.sh" + WAIT_SERVICES: "redis:6379 database:5432" configs: - source: init-db target: /init-db.sh diff --git a/preprocessor/Dockerfile b/preprocessor/Dockerfile index 39b317ed07e797dd0dcce2811e53ea32155fa7b7..9294c83268a2d60ed15c497dbba838523dce7b8b 100644 --- a/preprocessor/Dockerfile +++ b/preprocessor/Dockerfile @@ -25,7 +25,7 @@ # IN THE SOFTWARE. #----------------------------------------------------------------------------- -FROM osgeo/gdal:alpine-normal-latest +FROM osgeo/gdal:ubuntu-small-latest MAINTAINER EOX LABEL name="prism view server preprocessor" \ vendor="EOX IT Services GmbH <https://eox.at>" \ @@ -35,9 +35,12 @@ LABEL name="prism view server preprocessor" \ USER root -RUN apk add --no-cache gcc py3-pip python3-dev py3-setuptools musl-dev \ - linux-headers py3-redis && \ - pip3 install python-keystoneclient python-swiftclient argparse +RUN apt update && \ + apt install -y \ + python3-redis python3-keystoneclient python3-swiftclient wait-for-it && \ + apt autoremove -y && \ + apt clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ENV INSTANCE_ID="prism-data-access-server_preprocessor" \ COLLECTION= \ @@ -64,12 +67,12 @@ ADD run-preprocessor.sh \ preprocessor.py \ get_min_max.py \ transform_chain.py \ + entrypoint.sh \ / RUN chmod -v +x \ /run-preprocessor.sh \ - /preprocessor.py\ - /get_min_max.py\ - /transform_chain.py + /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] CMD ["/run-preprocessor.sh"] diff --git a/preprocessor/entrypoint.sh b/preprocessor/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..81a77cdfc99c60a582199ac8918d02f9f5957c9b --- /dev/null +++ b/preprocessor/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash -e + +SERVICES=${WAIT_SERVICES:=''} +TIMEOUT=${WAIT_TIMEOUT:='15'} + +if [[ ! -z $SERVICES ]] ; then + for service in $SERVICES ; do + wait-for-it -t $TIMEOUT $service + done +fi + +eval "$@" diff --git a/preprocessor/preprocessor.py b/preprocessor/preprocessor.py index e24892eb0b93fe92632d9fc00ae3a38339b80a6d..a0d059797a0ab7e4b3663b4e423c3f34b4edef9c 100644 --- a/preprocessor/preprocessor.py +++ b/preprocessor/preprocessor.py @@ -146,14 +146,14 @@ def preprocessor( m for m in tf.getmembers() if m is not None and re.search(r"GSC.+\.xml", m.name, re.IGNORECASE) ) world_files_ti = [ - m for m in tf.getmembers() if m is not None and + m for m in tf.getmembers() if m is not None and re.search(r"RPC.+\.xml", m.name, re.IGNORECASE) ] # add J2W files only if more than one files are present # that signalizes that file was split into multiple or has panchromatic if len(data_files_ti) > 1: world_files_ti += [ - m for m in tf.getmembers() if m is not None and + m for m in tf.getmembers() if m is not None and re.search(r".+\.J2W", m.name, re.IGNORECASE) ] data_files = [