Skip to content

Commit

Permalink
wip: Provide some scripts to seed some layers #185
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Nouguier committed Oct 9, 2020
1 parent 5994d3d commit a91df1c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 9 deletions.
30 changes: 26 additions & 4 deletions scripts/clear-cache.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
#!/bin/bash

LAYER=$1

echo Clearing $LAYER
k-worker-foreach -c "sudo rm -fr $MAPCACHE_DATA_PATH/$LAYER/GLOBAL_WEBMERCATOR"
usage() {
echo "usage: clear-cache <layer>"
}

help() {
echo "Seeds the given layer up to the specified level using the specified number of threads"
usage
}

exec() {
local LAYER=$1
echo Clearing $LAYER
k-worker-foreach -c "sudo rm -fr $MAPCACHE_DATA_PATH/$LAYER/GLOBAL_WEBMERCATOR"
}

if [ "$#" -ne 1 ]; then
echo error: illegal number of arguments
usage
exit 1
fi

case $1 in
-h|--help) help;;
*) exec "$1"
esac

32 changes: 27 additions & 5 deletions scripts/seed-cache.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
#!/bin/bash

LAYER=$1
LEVEL=${2:-9}
THREADS=${3:-4}
usage() {
echo "usage: seed-cache <layer> <max-level> <nb-threads>"
}

echo Seeding $LAYER up to $LEVEL with $THREADS threads
k-worker-foreach -c "docker run -d --rm --network=$DOCKER_NETWORK --user=www-data:www-data --volume=$MAPCACHE_DATA_PATH:/mnt/data --volume=/mnt/share/kargo/.kargo/configs/mapcache:/etc/mapcache kalisio/mapcache:1.10 mapcache_seed -c /etc/mapcache/mapcache.xml -t $LAYER -z0,$LEVEL -n $THREADS"
help() {
echo "Seeds the given layer up to the specified level using the specified number of threads"
usage
}

exec() {
local LAYER=$1
local MAX_LEVEL=$2
local NB_THREADS=$3
echo Seeding $LAYER up to $MAX_LEVEL level with $NB_THREADS threads
local CONFIG_PATH=`pwd`/../configs/mapcache
k-worker-foreach -c "docker run -d --rm --network=$DOCKER_NETWORK --user=www-data:www-data --volume=$MAPCACHE_DATA_PATH:/mnt/data --volume=$CONFIG_PATH:/etc/mapcache kalisio/mapcache:1.10 mapcache_seed -c /etc/mapcache/mapcache.xml -t $LAYER -z0,$MAX_LEVEL -n $NB_THREADS"
}

if [ "$#" -ne 3 ]; then
echo error: illegal number of arguments
usage
exit 1
fi

case $1 in
-h|--help) help;;
*) exec "$1" "$2" "$3"
esac

0 comments on commit a91df1c

Please sign in to comment.