Skip to content

Commit

Permalink
Add env var to execute purge and seed tiler
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Nov 26, 2024
1 parent 049eca2 commit 27fbedb
Showing 1 changed file with 39 additions and 19 deletions.
58 changes: 39 additions & 19 deletions images/tiler-server/purge_and_seed.sh
Original file line number Diff line number Diff line change
@@ -1,37 +1,57 @@
#!/bin/bash
set -e

# Default zoom levels
PURGE_MIN_ZOOM=${PURGE_MIN_ZOOM:-8}
PURGE_MAX_ZOOM=${PURGE_MAX_ZOOM:-20}
PURGE_CONCURRENCY=${PURGE_CONCURRENCY:-16}

SEED_MIN_ZOOM=${SEED_MIN_ZOOM:-8}
SEED_MAX_ZOOM=${SEED_MAX_ZOOM:-14}
SEED_CONCURRENCY=${SEED_CONCURRENCY:-16}

EXECUTE_PURGE=${EXECUTE_PURGE:-true}
EXECUTE_SEED=${EXECUTE_SEED:-true}

# Download file from S3
file_name=$(basename "$IMPOSM_EXPIRED_FILE")
aws s3 cp "$IMPOSM_EXPIRED_FILE" "$file_name"
if [ $? -ne 0 ]; then
echo "Error: Failed to download the file from S3."
exit 1
fi

set -x
# Run Tegola cache purge
tegola cache purge tile-list "$file_name" \
--config=/opt/tegola_config/config.toml \
--format="/zxy" \
--min-zoom=$PURGE_MIN_ZOOM \
--max-zoom=$PURGE_MAX_ZOOM \
--map=osm \
--overwrite=false \
--concurrency=16
# Run Tegola cache purge if enabled
if [ "$EXECUTE_PURGE" = "true" ]; then
echo "Starting Tegola cache purge..."
set -x
tegola cache purge tile-list "$file_name" \
--config=/opt/tegola_config/config.toml \
--format="/zxy" \
--min-zoom=$PURGE_MIN_ZOOM \
--max-zoom=$PURGE_MAX_ZOOM \
--map=osm \
--overwrite=false \
--concurrency=$PURGE_CONCURRENCY
set +x
else
echo "Skipping Tegola cache purge (EXECUTE_PURGE=false)."
fi

# Run Tegola cache seed
tegola cache seed tile-list "$file_name" \
--config=/opt/tegola_config/config.toml \
--map=osm \
--min-zoom=$SEED_MIN_ZOOM \
--max-zoom=$SEED_MAX_ZOOM \
--overwrite=true \
--concurrency=16
set +x
# Run Tegola cache seed if enabled
if [ "$EXECUTE_SEED" = "true" ]; then
echo "Starting Tegola cache seed..."
set -x
tegola cache seed tile-list "$file_name" \
--config=/opt/tegola_config/config.toml \
--map=osm \
--min-zoom=$SEED_MIN_ZOOM \
--max-zoom=$SEED_MAX_ZOOM \
--overwrite=false \
--concurrency=$SEED_CONCURRENCY
set +x
else
echo "Skipping Tegola cache seed (EXECUTE_SEED=false)."
fi

echo "Script completed successfully."

0 comments on commit 27fbedb

Please sign in to comment.