From ba778b9800b589fbee466000612314197d36d56e Mon Sep 17 00:00:00 2001 From: Rub21 Date: Fri, 23 Feb 2024 19:23:42 +0000 Subject: [PATCH] Update tiler containers --- compose/tiler.yml | 32 ++++++++++++++++--- images/tiler-server/Dockerfile | 4 +-- images/tiler-server/expire-watcher.sh | 2 +- images/tiler-server/seed-by-diffs.sh | 45 +++++++++------------------ 4 files changed, 45 insertions(+), 38 deletions(-) diff --git a/compose/tiler.yml b/compose/tiler.yml index b94acd66..94a12904 100644 --- a/compose/tiler.yml +++ b/compose/tiler.yml @@ -8,8 +8,8 @@ services: build: context: ../images/tiler-db dockerfile: Dockerfile - ports: - - "5433:5432" + # ports: + # - "5433:5432" volumes: - ../data/tiler-db-data:/var/lib/postgresql/data env_file: @@ -42,7 +42,7 @@ services: retries: 3 restart: always # ###################################################### - # ### Tiler imposm for importing data + # ### Tiler server # ###################################################### tiler-server: image: osmseed-tiler-server:v1 @@ -51,6 +51,7 @@ services: dockerfile: Dockerfile volumes: - ../data/tiler-server-data:/mnt/data + - ../data/tiler-imposm-data:/mnt/data/imposm depends_on: - tiler-db - tiler-imposm @@ -59,8 +60,31 @@ services: command: - sh - -c - - "sleep 60 && ./start.sh" + - "./start.sh & ./expire-watcher.sh" env_file: - ../envs/.env.tiler-db - ../envs/.env.tiler-server restart: always + # ###################################################### + # ### Tiler cache cleaner + # ###################################################### + # tiler-cache-cleaner: + # image: osmseed-tiler-server:v1 + # build: + # context: ../images/tiler-server + # dockerfile: Dockerfile + # volumes: + # - ../images/tiler-server:/go + # - ../data/tiler-imposm-data:/mnt/data/imposm + # depends_on: + # - tiler-db + # - tiler-imposm + # command: + # - sh + # - -c + # - "./expire-watcher.sh" + # # - "sleep 60 && ./expire-watcher.sh" + # env_file: + # - ../envs/.env.tiler-db + # - ../envs/.env.tiler-server + # restart: always \ No newline at end of file diff --git a/images/tiler-server/Dockerfile b/images/tiler-server/Dockerfile index 10df7d19..64255bff 100644 --- a/images/tiler-server/Dockerfile +++ b/images/tiler-server/Dockerfile @@ -10,7 +10,7 @@ RUN apk add musl-dev=1.1.24-r3 \ RUN mkdir -p /go/src/github.com/go-spatial/tegola RUN git clone https://github.com/go-spatial/tegola.git /go/src/github.com/go-spatial/tegola -RUN cd /go/src/github.com/go-spatial/tegola && git checkout v0.8.1 +RUN cd /go/src/github.com/go-spatial/tegola && git checkout v0.13.0 RUN cd /go/src/github.com/go-spatial/tegola/cmd/tegola \ && go build -gcflags "-N -l" -o /opt/tegola \ && chmod a+x /opt/tegola @@ -36,7 +36,7 @@ RUN pip3 install awscli RUN curl -sSL https://sdk.cloud.google.com | bash RUN ln -f -s /root/google-cloud-sdk/bin/gsutil /usr/bin/gsutil -RUN pip install mercantile \ +RUN pip3 install mercantile \ && apk del build-deps \ && rm -rf /var/cache/apk/* \ && apk --purge -v del py-pip diff --git a/images/tiler-server/expire-watcher.sh b/images/tiler-server/expire-watcher.sh index ef866b13..e0613fb1 100755 --- a/images/tiler-server/expire-watcher.sh +++ b/images/tiler-server/expire-watcher.sh @@ -10,6 +10,6 @@ while true ; do if [ "$sum" != "$new_sum" ]; then ./seed-by-diffs.sh else - sleep 1 + sleep 30s fi done \ No newline at end of file diff --git a/images/tiler-server/seed-by-diffs.sh b/images/tiler-server/seed-by-diffs.sh index 7963b6f1..0116429e 100755 --- a/images/tiler-server/seed-by-diffs.sh +++ b/images/tiler-server/seed-by-diffs.sh @@ -16,49 +16,32 @@ completed_jobs=$workDir/imposm/completed.list completed_dir=$workDir/imposm/imposm3_expire_purged mkdir -p $completed_dir - # List files in expire_dir -imp_list=`find $expire_dir -name '*.tiles' -type f` +imp_list=$(find $expire_dir -name '*.tiles' -type f) for f in $imp_list; do - echo "$f" >> $queued_jobs + echo "$f" >>$queued_jobs done # Sort the files and set unique rows -if [ -f $queued_jobs ] ; then - sort -u $queued_jobs > $workDir/imposm/tmp.list && mv $workDir/imposm/tmp.list $queued_jobs +if [ -f $queued_jobs ]; then + sort -u $queued_jobs >$workDir/imposm/tmp.list && mv $workDir/imposm/tmp.list $queued_jobs fi for f in $imp_list; do - echo "seeding from $f" - # Read each line on the tiles file - while IFS= read -r tile - do - bounds="$(python tile2bounds.py $tile)" - echo tegola cache purge \ - --config=/opt/tegola_config/config.toml \ - --min-zoom=0 --max-zoom=20 \ - --bounds=$bounds \ - tile-name=$tile - - tegola cache purge \ + # echo "Purge tiles from...$f" + tegola cache purge tile-list $f \ --config=/opt/tegola_config/config.toml \ - --min-zoom=0 --max-zoom=20 \ - --bounds=$bounds \ - tile-name=$tile - err=$? - if [[ $err != "0" ]]; then - #error - echo "tegola exited with error code $err" - # rm $queued_jobs - exit - fi - done < "$f" - echo "$f" >> $completed_jobs + --format="/zxy" \ + --min-zoom=0 \ + --max-zoom=20 \ + --overwrite=true & + sleep 10s + echo "$f" >>$completed_jobs mv $f $completed_dir done -if [ -f $queued_jobs ] ; then - echo "finished seeding" +if [ -f $queued_jobs ]; then + # Completed queued jobs rm $queued_jobs fi