Skip to content

Commit

Permalink
Update tiler containers
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Feb 23, 2024
1 parent 49ac91b commit ba778b9
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 38 deletions.
32 changes: 28 additions & 4 deletions compose/tiler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -42,7 +42,7 @@ services:
retries: 3
restart: always
# ######################################################
# ### Tiler imposm for importing data
# ### Tiler server
# ######################################################
tiler-server:
image: osmseed-tiler-server:v1
Expand All @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions images/tiler-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion images/tiler-server/expire-watcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ while true ; do
if [ "$sum" != "$new_sum" ]; then
./seed-by-diffs.sh
else
sleep 1
sleep 30s
fi
done
45 changes: 14 additions & 31 deletions images/tiler-server/seed-by-diffs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ba778b9

Please sign in to comment.