Skip to content
Snippets Groups Projects
Verified Commit 26593b09 authored by David Hoese's avatar David Hoese
Browse files

Fix mapcache_timedb not replacing all JSON characters from time list

parent 55de7126
Branches
No related tags found
No related merge requests found
......@@ -37,6 +37,12 @@ Taken the lessons learned from task 1, generate a series of cloud-friendly
docker images to run various CSPP Geo projects in a remote cloud service
(ex Amazon Web Services, Google Cloud Computing, Microsoft Azure, etc).
## Technical Notes
Examples of how to use the various URL APIs for getting images and image
tiles can be found in
[this Google Doc](https://docs.google.com/document/d/1onC15gGjtoErAOVx0Rx0WZG5LtjCSVWiDo4UpJlKLps/edit?usp=sharing).
## Installation/Usage
TODO
......@@ -3,18 +3,28 @@
## Build
```bash
docker build -t gitlab.ssec.wisc.edu:5555/cspp)geo/cspp-geo-web-viewer/mapcache:latest mapcache/
docker build -t gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapcache:latest mapcache/
```
## Usage
```bash
docker run -p 8889:80 -d --rm --name cspp-geo-mapcache1 -v cspp-geo-tile-cache:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapcache:latest
docker run -p 8889:80 -d --rm --name cspp-geo-mapcache1 --network cspp-geo-rabbit -v cspp-geo-tile-cache:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapcache:latest ./run.sh cspp-geo-mapserver 80
```
Then the main mapcache CGI script can be accessed with:
Note the host name and port of the MapServer passed to the `run.sh` at the end.
The the main mapcache CGI script can be accessed with:
```bash
http://localhost:8889/mapcache/wmts
```
An example usage of this including some WMS/WMTS URL parameters:
```bash
http://localhost:8889/mapcache/wmts?TIME=2020-01-01T12:00:00Z&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=g16_abi_radf_l1b_true_color&STYLE=default&TILEMATRIXSET=grid_g16_abi_radf&TILEMATRIX=1&TILEROW=1&TILECOL=1&FORMAT=image/png
```
http://localhost:8889/mapcache
## Special Notes
......
......@@ -3,12 +3,17 @@
## Build
```bash
docker build -t gitlab.ssec.wisc.edu:5555/cspp)geo/cspp-geo-web-viewer/mapcache:latest mapcache_timedb/
docker build -t gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapcache:latest mapcache_timedb/
```
## Usage
```bash
docker run -d --rm --name cspp-geo-mapcache-timedb -v cspp-geo-tile-cache:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapcache_timedb:latest ./bin/run.sh
docker run -d --rm --name cspp-geo-mapcache-timedb --network cspp-geo-rabbit -v cspp-geo-tile-cache:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapcache_timedb:latest ./bin/run.sh cspp-geo-mapserver 80
```
Note the host name and port of the MapServer passed to the `run.sh` at the end.
The container will run, wait for RabbitMQ events for new tiles or removed
tiles, and update a local SQLite database with these times. See the `run.sh`
for more details.
......@@ -23,13 +23,12 @@ export G2G_PRODUCTS=${G2G_PRODUCTS:-"C01 C02 C03 C04 C05 C06 C07 C08 C09 C10 C11
export SATELLITES=${SATELLITES:"g16 g17"}
export INSTRUMENTS=${INSTRUMENTS:"abi"}
export SECTORS=${SECTORS:"radf radc radm1 radm2"}
export BASE_TIME_URL=${BASE_TIME_URL:"http://cspp-geo-mapserver/wms_times"}
json_list_to_bash() {
blist=$1
blist=${blist/,/}
blist=${blist/[/}
blist=${blist/]/}
blist=${blist//,/}
blist=${blist//[/}
blist=${blist//]/}
echo "$blist"
}
export -f json_list_to_bash
......@@ -88,7 +87,7 @@ init_time_updater() {
dbfile="${dst_dir}/mapcache_time.sqlite"
for product in ${G2G_PRODUCTS}; do
echo "Initializing database ${dbfile} for product ${product}"
current_times=$(curl "${BASE_TIME_URL}/${sat_id}/${inst}/${sector}/${product}")
current_times=$(curl "http://${WMS_HOST}:${WMS_PORT}/${sat_id}/${inst}/${sector}/${product}")
table_name="${sat_id}_${inst}_${sector}_l1b_${product}"
python3 /work/bin/time_updater.py --json "${dbfile}" "${table_name}" "${current_times}"
done
......@@ -97,6 +96,14 @@ init_time_updater() {
done
}
if [[ $# -eq 2 ]]; then
WMS_HOST=$1
WMS_PORT=$2
else
echo "Usage: ./run.sh <wms_hostname> <wms_port>"
exit 1
fi
# Initialize the database if it doesn't exist already
init_time_updater
if [[ $? -ne 0 ]]; then
......
# MapServer
## Build
```bash
docker build -t gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapserver:latest mapserver/
```
## Usage
```bash
docker run -p 8888:80 -d --rm --name cspp-geo-mapserver -v cspp-geo-abi-l1b-geotiffs:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapserver:latest
docker run -p 8888:80 -d --rm --name cspp-geo-mapserver --network cspp-geo-rabbit -v cspp-geo-abi-l1b-geotiffs:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapserver:latest
```
Then the main mapserv CGI script can be accessed with:
http://localhost:8888/cgi-bin/mapserv
where MapServer parameters can be appended to the end (after a `?`). However,
an easier to access API is available:
```bash
http://localhost:8888/wms/<satellite>/<instrument>/<sector>/<data_level>?...
```
An example URL of this including MapServer parameters is:
```bash
http://localhost:8888/wms/g16/abi/radf/l1b?request=GetMap&service=WMS&version=1.1.1&srs=EPSG:930916&layers=true_color_test&bbox=-5000000,-5000000,5000000,5000000&format=image/png&WIDTH=1000&HEIGHT=1000&TIME=2020-01-21T16:00:16
```
## Special Notes
This image has had its installation of the PROJ library modified to include
......
......@@ -50,7 +50,7 @@ docker exec ${RABBITMQ_NAME} rabbitmqadmin declare exchange name=satellite type=
docker run -d --rm --name ${TILE_GEN_NAME} --network ${NETWORK_NAME} -e G2G_PRODUCTS="true_color" -e AMQPFIND_ARGS="-vv -H ${RABBITMQ_NAME} -X satellite -u guest -p guest" -e AMQPSEND_ARGS="-vv -D 15 -H ${RABBITMQ_NAME} -X satellite -u guest -p guest" -e AMQPFIND_TOPIC="data.goes.g16.abi.radf.l1b.geotiff.complete" -v ${DST}:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/tile_gen:latest ./run.sh || oops "Couldn't create tile generation container"
docker run -d --rm --name ${MAPSERVER_NAME} --network ${NETWORK_NAME} -p ${MAPSERVER_PORT}:80 -v ${DST}:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapserver:latest || oops "Couldn't create mapserver container"
docker run -d --rm --name ${MAPCACHE_TIMEDB_NAME} --network ${NETWORK_NAME} -e G2G_PRODUCTS="true_color" -e AMQPFIND_ARGS="-vv -H ${RABBITMQ_NAME} -X satellite -u guest -p guest" -e AMQPSEND_ARGS="-vv -D 15 -H ${RABBITMQ_NAME} -X satellite -u guest -p guest" -v ${DST}:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapcache_timedb:latest ./bin/run.sh
docker run -d --rm --name ${MAPCACHE_TIMEDB_NAME} --network ${NETWORK_NAME} -e G2G_PRODUCTS="true_color" -e AMQPFIND_ARGS="-vv -H ${RABBITMQ_NAME} -X satellite -u guest -p guest" -e AMQPSEND_ARGS="-vv -D 15 -H ${RABBITMQ_NAME} -X satellite -u guest -p guest" -v ${DST}:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapcache_timedb:latest ./bin/run.sh ${MAPSERVER_NAME} 80
docker run -d --rm --name ${MAPCACHE_NAME} --network ${NETWORK_NAME} -p ${MAPCACHE_PORT}:80 -v ${DST}:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapcache:latest ./run.sh ${MAPSERVER_NAME} 80
# Let things run for a bit
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment