Skip to content

Commit 76e21b3

Browse files
Rub21erictheise
andauthored
Update vtiles cache utilities cleanup and MV refresh improvements (#716)
* Update config and paths to deploy services with docker compose (#696) * Fix docker tiler volume for staging and production * Fix taginfo data processor image * Update readme * update * Update configs * Update deploy scripts * Update scripts * Display template * Remove tilerdb adn imposm from base * Add network tiler-db * Restart taginfo web after data has been proceed * Update overpass docker image * Update cgimap, teginfo and overpass config (#698) * Fix cgimap attribution setup * Deploy in staging * Update taginfo cronjob to process db files * Update taginfo script * Fix endpoint * Update osm-seed version * Update overpass version * Update overpass docker image * Adding non-administrative boundaries in vector tiles (#684) * Store all the objects that have boundary=* * Remove unused imposm config * Add role and add index for osm_admin_relation_members * Script optimization for admin * Add query to create non admin boundaries views * Add config to display non_admin in tegola * Add extra columns for no-bounduary areas * Add religion, timezone, postal_code, etc attribute in no_admin layers * Rename source layer to non_admin * Rename provider from osm -> ohm (#700) * Rename provider from osm to ohm * Update traefik to redirect osm provider to ohm tiler provider * Better to call ohm_non_admin * Rename osm to ohm vtiles source name (#701) * Rename provider from osm to ohm * Update traefik to redirect osm provider to ohm tiler provider * Better to call ohm_non_admin * Rename ohm_non_admin to ohm_other_boundaries * Release overpass-turbo v2.1.11 (#704) * Release overpass-turbo v2.1.11 * No need to change the bucket name --------- Co-authored-by: Rub21 <rub2106@gmail.com> * Vtiles improvements - communication_lines, transport_lines and route_lines (#703) * Include street and communication layers in vtiles * Update imposm config to import data to routes and communication multilines * update sql scripts * Update imposm configs * Update tiler compose * update comunication * script to reimport * update to reimport tables * Update * Create a Mview for transport lines * Update communication mview * Add highway in routes_line layer * Update columns for communication * Update communication props * Display communication from zoom 10 on * Do not returm empty values for communitacion_lines layer * Add relation attribute * Display the way itseff too. * Merge results in only one feature in case the attributes are the same * Update branch naem to generate docker images * Change yarn -> pnpm overpass-turbo and Docker images for Tiler (#705) * Fixed pnpm * Fixed communication - layer name * Update docker images and volume for prod deployment * testing vite upgrade * Release overpass-turbo v2.1.12 * Clean cache in different times (#710) * Clean cache in different times * Fix comments * Generate docker images * Update images for tiler cahe * Fix tiler cache paths to clean (#712) * Fix path to clean * Update path to remove from s3 * Ongoing translations: ohm-website * Fix script that refresh Material views - Imposm (#714) * Update script to refresh mviews * Update docker image for imposm * Update docker image * Update script to refresh views * Update tiler imposm docker image (#715) * Update * Update imposm docker image * Update script to refresh material views in tiler (#717) * Update * Update imposm docker image * Update branches name to deploy the docker image --------- Co-authored-by: Eric Theise <erictheise@gmail.com>
1 parent 63549fc commit 76e21b3

5 files changed

Lines changed: 26 additions & 14 deletions

File tree

hetzner/tiler/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production
3333
# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tiler_sqs_cleaner -d --force-recreate
3434
# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tile_global_seeding -d --force-recreate
3535
# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tile_coverage_seeding -d --force-recreate
36-
# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml run tiler_s3_cleaner tiler-cache-cleaner clean_by_prefix
36+
# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml run tiler_s3_cleaner
3737
# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tiler_monitor -d --force-recreate
3838
```
3939

hetzner/tiler/tiler.production.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ services:
55
volumes: !overwrite
66
- tiler_pgdata:/var/lib/postgresql/data
77
- ./config/postgresql.production.conf:/etc/postgresql/postgresql.conf
8-
# ports:
9-
# - "54329:5432"
8+
ports:
9+
- "54329:5432"
1010
env_file:
1111
- .env.tiler
1212
mem_limit: 55G
@@ -16,7 +16,7 @@ services:
1616

1717
tiler_imposm:
1818
container_name: tiler_imposm
19-
image: ghcr.io/openhistoricalmap/tiler-imposm:0.0.1-0.dev.git.3294.h12c71f95
19+
image: ghcr.io/openhistoricalmap/tiler-imposm:0.0.1-0.dev.git.3309.h529b5183
2020
volumes:
2121
- tiler_imposm_data:/mnt/data
2222
env_file:
@@ -47,7 +47,7 @@ services:
4747

4848
tiler_sqs_cleaner:
4949
container_name: tiler_sqs_cleaner
50-
image: ghcr.io/openhistoricalmap/tiler-cache:0.0.1-0.dev.git.3305.hda810a70
50+
image: ghcr.io/openhistoricalmap/tiler-cache:0.0.1-0.dev.git.3290.h63549fc1
5151
environment:
5252
- PORT=8000
5353
env_file:
@@ -70,7 +70,7 @@ services:
7070

7171
tiler_s3_cleaner:
7272
container_name: tiler_s3_cleaner
73-
image: ghcr.io/openhistoricalmap/tiler-cache:0.0.1-0.dev.git.3305.hda810a70
73+
image: ghcr.io/openhistoricalmap/tiler-cache:0.0.1-0.dev.git.3290.h63549fc1
7474
# image: tiler-cache:latest
7575
# build:
7676
# context: ../../images/tiler-cache

images/tiler-imposm/queries/ohm_mviews/communication.sql

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
-- Unified view: merge lines + multilines into a single source
99
-- TODO, Do we need to add name_lcale columns?
1010
-- ============================================================================
11-
DROP VIEW IF EXISTS mv_communication_z16_20 CASCADE;
12-
CREATE VIEW mv_communication_z16_20 AS
11+
DROP MATERIALIZED VIEW IF EXISTS mv_communication_z16_20 CASCADE;
12+
CREATE MATERIALIZED VIEW mv_communication_z16_20 AS
1313
-- Ways (simple linestrings)
1414
SELECT
1515
id,
@@ -81,6 +81,10 @@ CREATE VIEW mv_communication_z16_20 AS
8181
WHERE geometry IS NOT NULL
8282
AND ST_GeometryType(geometry) IN ('ST_LineString', 'ST_MultiLineString');
8383

84+
-- Unique index required for REFRESH MATERIALIZED VIEW CONCURRENTLY
85+
CREATE UNIQUE INDEX idx_mv_communication_z16_20_unique ON mv_communication_z16_20 (id, osm_id, source_type);
86+
-- Spatial index for geometry queries
87+
CREATE INDEX idx_mv_communication_z16_20_geometry ON mv_communication_z16_20 USING GIST (geometry);
8488

8589
-- ============================================================================
8690
-- Zoom 14-15: Slight simplification (5m tolerance)

images/tiler-imposm/scripts/refresh_mviews.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,20 @@ function refresh_mviews_group() {
3939
log_message "[$group_name] Refreshing $mview..."
4040
local error_output
4141
# Disable statement_timeout for long-running refresh operations (0 = no limit)
42-
error_output=$(psql "$PG_CONNECTION" -c "SET statement_timeout = 0; REFRESH MATERIALIZED VIEW CONCURRENTLY $mview;" 2>&1)
43-
local exit_code=$?
42+
local exit_code=0
43+
local start_time=$SECONDS
44+
error_output=$(psql "$PG_CONNECTION" -v ON_ERROR_STOP=1 -c "SET statement_timeout = 0" -c "REFRESH MATERIALIZED VIEW CONCURRENTLY $mview;" 2>&1) || exit_code=$?
45+
local elapsed=$((SECONDS - start_time))
4446
if [ $exit_code -eq 0 ]; then
45-
log_message "[$group_name] ✅ Successfully refreshed $mview."
47+
log_message "[$group_name] ✅ Successfully refreshed $mview. Time: ${elapsed}s"
4648
else
4749
log_message "[$group_name] ❌ ERROR refreshing $mview! Exit code: $exit_code"
4850
log_message "[$group_name] ❌ Error details: $error_output"
51+
# If connection failed, skip remaining views and wait before retrying
52+
if echo "$error_output" | grep -qi "connection\|could not connect\|server closed\|SSL"; then
53+
log_message "[$group_name] ⚠️ Connection error detected. Waiting ${sleep_interval}s before retrying all views..."
54+
break
55+
fi
4956
fi
5057
done
5158
sleep "$sleep_interval"
@@ -142,7 +149,8 @@ others_views=(
142149
communication_views=(
143150
# lines
144151
mv_communication_z16_20
145-
mv_communication_z14_15
152+
mv_communication_z13_15
153+
mv_communication_z10_12
146154
)
147155

148156
places_views=(
@@ -255,4 +263,4 @@ refresh_mviews_group "BUILDINGS" 180 "${buildings_views[@]}" &
255263
refresh_mviews_group "ROUTES" 180 "${routes_views[@]}" &
256264

257265
## This group high demand, so we refresh every 1 hour
258-
refresh_mviews_group "NO_ADMIN_BOUNDARIES" 36000 "${no_admin_boundaries_views[@]}" &
266+
refresh_mviews_group "NO_ADMIN_BOUNDARIES" 36000 "${no_admin_boundaries_views[@]}" &

images/web/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ RUN apt-get update && \
2424
&& apt-get clean && rm -rf /var/lib/apt/lists/*
2525

2626
# Download OHM Website using gitsha, faster than cloning
27-
ENV OPENHISTORICALMAP_WEBSITE_GITSHA=658bab0b9357cae3ac0d30f4f6a4693a16d36d4e
27+
ENV OPENHISTORICALMAP_WEBSITE_GITSHA=a53c1384ce78e7ce3c41e410e9ec61315f0afa93
2828
ENV OHM_WEBSITE_URL=https://github.com/OpenHistoricalMap/ohm-website/archive/${OPENHISTORICALMAP_WEBSITE_GITSHA}.zip
2929
RUN rm -rf $workdir/* && curl -fsSL $OHM_WEBSITE_URL -o /tmp/ohm-website.zip && \
3030
unzip /tmp/ohm-website.zip -d /tmp && \

0 commit comments

Comments
 (0)