Skip to content

Commit

Permalink
Resource for staging api db
Browse files Browse the repository at this point in the history
Update script to remove tiler cache
  • Loading branch information
Rub21 committed Jul 11, 2024
1 parent 1e4bd47 commit b90079f
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 21 deletions.
3 changes: 1 addition & 2 deletions images/tiler-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ RUN cd /opt/ && python build_config.py \
--output /opt/tegola_config/config.toml

# Copy config and exec files
# COPY ./config/config.toml /opt/tegola_config/config.toml
COPY ./tile2bounds.py .
COPY ./start.sh .
COPY ./expire-watcher.sh .
COPY ./seed-by-diffs.sh .
COPY ./tile_cache_downloader.sh .
COPY ./cache_cleaner.sh .
COPY ./rm_tegola_ps.sh .
COPY ./rm_ps.sh .
ENTRYPOINT ["/bin/bash", "-c"]
CMD ./start.sh & ./tile_cache_downloader.sh & ./expire-watcher.sh
2 changes: 1 addition & 1 deletion images/tiler-server/cache_cleaner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ flag=true
while "$flag" = true; do
pg_isready -h $POSTGRES_HOST -p 5432 >/dev/null 2>&2 || continue
flag=false
./tile_cache_downloader.sh & ./expire-watcher.sh & ./rm_tegola_ps.sh
./tile_cache_downloader.sh & ./expire-watcher.sh & ./rm_ps.sh
done
27 changes: 27 additions & 0 deletions images/tiler-server/rm_ps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -e

PROCESS_NAME="tegola"
MAX_RUNTIME_SECONDS=300
SLEEP_INTERVAL=60

calculate_elapsed_seconds() {
local start_time=$1
local current_time=$(date +%s)
echo $((current_time - start_time))
}

if [[ -n "${KILL_PROCESS}" && "${KILL_PROCESS}" == "manually" ]]; then
while true; do
for pid in $(pgrep -f ${PROCESS_NAME}); do
start_time=$(stat -c %Y /proc/$pid)
elapsed_seconds=$(calculate_elapsed_seconds $start_time)
if [[ $elapsed_seconds -gt $MAX_RUNTIME_SECONDS ]]; then
echo "The process ${PROCESS_NAME} with PID $pid has been running for $elapsed_seconds seconds"
kill -9 $pid
aws s3 rm s3://${TILER_CACHE_BUCKET}/mnt/data/osm/ --recursive
fi
done
sleep $SLEEP_INTERVAL
done
fi
16 changes: 0 additions & 16 deletions images/tiler-server/rm_tegola_ps.sh

This file was deleted.

2 changes: 1 addition & 1 deletion images/tiler-server/seed-by-diffs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fi

for f in $imp_list; do
# echo "Purge tiles from...$f"
( set -x ; tegola cache purge tile-list $f \
( set -x ; time tegola cache purge tile-list $f \
--config=/opt/tegola_config/config.toml \
--format="/zxy" \
--min-zoom=0 \
Expand Down
2 changes: 1 addition & 1 deletion values.staging.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ osm-seed:
AWS_ElasticBlockStore_volumeID : vol-09964172ef71bc8e8
AWS_ElasticBlockStore_size: 200Gi
resources:
enabled: false
enabled: true
requests:
memory: "6Gi"
cpu: "1500m"
Expand Down

0 comments on commit b90079f

Please sign in to comment.