Skip to content

Commit

Permalink
Change cache from file to s3 tegola
Browse files Browse the repository at this point in the history
Remove tegola process when there are more than x number

Update osm-seed version

Update osm-seed version

Update env var

update osm-seed version

Update autoscaling for cache cleaner

Update osm-seed version
  • Loading branch information
Rub21 committed Aug 17, 2023
1 parent 2f1a2aa commit 786d6ae
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 10 deletions.
1 change: 1 addition & 0 deletions images/tiler-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ COPY ./expire-watcher.sh .
COPY ./seed-by-diffs.sh .
COPY ./tile_cache_downloader.sh .
COPY ./cache_cleaner.sh .
COPY ./rm_tegola_ps.sh .
# CMD ./start.sh & ./tile_cache_downloader.sh & ./expire-watcher.sh
4 changes: 2 additions & 2 deletions 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
done
./tile_cache_downloader.sh & ./expire-watcher.sh & ./rm_tegola_ps.sh
done
16 changes: 16 additions & 0 deletions images/tiler-server/rm_tegola_ps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e
if [[ -n "${KILL_PROCESS}" && "${KILL_PROCESS}" == "manually" ]]; then
while true; do
NUM_PS=$(ps | grep ${PROCESS_NAME} | grep -v grep | wc -l)
if [[ $NUM_PS -gt $MAX_NUM_PS ]]; then
echo "${PROCESS_NAME} processes"
ps aux | grep ${PROCESS_NAME} | grep -v grep
# After clearing the S3 cache, terminate all 'tegola' processes.
killall ${PROCESS_NAME}
# Clean cache manually from s3
aws s3 rm s3://${TILER_CACHE_BUCKET}/mnt/data/osm/ --recursive
fi
sleep 600
done
fi
2 changes: 1 addition & 1 deletion ohm/requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dependencies:
- name: osm-seed
version: '0.1.0-n771.h5ab71b9'
version: '0.1.0-n768.h455eb76'
repository: https://devseed.com/osm-seed-chart/
10 changes: 7 additions & 3 deletions values.production.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,15 @@ osm-seed:
limits:
memory: "10Gi"
cpu: "2"
env:
KILL_PROCESS: manually
MAX_NUM_PS: 5
PROCESS_NAME: tegola
autoscaling:
enabled: false
enabled: true
minReplicas: 1
maxReplicas: 2
cpuUtilization: 60
maxReplicas: 1
cpuUtilization: 90
# ====================================================================================================
# Variables for tiler-visor
# ====================================================================================================
Expand Down
12 changes: 8 additions & 4 deletions values.staging.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ osm-seed:
service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: "300"
env:
TILER_SERVER_PORT: 9090
TILER_CACHE_TYPE: file
TILER_CACHE_TYPE: s3
TILER_CACHE_BASEPATH: /mnt/data
TILER_CACHE_MAX_ZOOM: 22
# in case s3
Expand Down Expand Up @@ -442,11 +442,15 @@ osm-seed:
limits:
memory: "10Gi"
cpu: "2"
env:
KILL_PROCESS: manually
MAX_NUM_PS: 3
PROCESS_NAME: bash
autoscaling:
enabled: false
enabled: true
minReplicas: 1
maxReplicas: 2
cpuUtilization: 60
maxReplicas: 1
cpuUtilization: 90
# ====================================================================================================
# Variables for tiler-visor
# ====================================================================================================
Expand Down

0 comments on commit 786d6ae

Please sign in to comment.