From 5b0cdb703098f5fc235e0e00e2dcab642e3cfd03 Mon Sep 17 00:00:00 2001 From: "Ruben L. Mendoza" Date: Sun, 6 Sep 2026 07:39:48 -0500 Subject: [PATCH 1/2] Import mapping tables missing in the database before running imposm diffs (#844) --- images/tiler-imposm/start.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/images/tiler-imposm/start.sh b/images/tiler-imposm/start.sh index 33f17742..965b9789 100755 --- a/images/tiler-imposm/start.sh +++ b/images/tiler-imposm/start.sh @@ -233,9 +233,38 @@ function monitorImposmErrors() { done } +function importMissingLayers() { + # Layers added after the initial import have no table yet and "imposm run" fails on them. + local missing_layers + missing_layers=$(psql "$PG_CONNECTION" -At -c "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';" | python3 -c ' +import glob, json, sys +existing = set(sys.stdin.read().split()) +mapped = json.load(open("./config/imposm3.json"))["tables"] +layers = [p.split("/")[-1][:-5] for p in sorted(glob.glob("./config/layers/*.json")) + if any(t in mapped and "osm_" + t not in existing for t in json.load(open(p))["tables"])] +print(" ".join(layers))') + + if [ -n "$missing_layers" ]; then + log_message "Importing missing layers: $missing_layers" + getData + if ! ./scripts/reimport_layer.sh $missing_layers; then + log_message "ERROR: Failed to import missing layers: $missing_layers" + exit 1 + fi + touch "$WORKDIR/mviews_pending" + fi + + # The marker survives a restart in the middle of create_mviews.sh, so the views get retried. + if [ -f "$WORKDIR/mviews_pending" ] && [ "$RECREATE_MVIEWS_ON_UPDATE" != "true" ]; then + ./scripts/create_mviews.sh && rm -f "$WORKDIR/mviews_pending" + fi +} + function updateData() { log_message "Starting database update process..." + importMissingLayers + # Step 0: Recreate materialized views if RECREATE_MVIEWS_ON_UPDATE is enabled if [ "$RECREATE_MVIEWS_ON_UPDATE" = "true" ]; then log_message "Recreating materialized views before update..." From da0fd918f96f40c8f4c48ab65fc96f40e6fb4a76 Mon Sep 17 00:00:00 2001 From: Rub21 Date: Sun, 6 Sep 2026 12:52:53 -0500 Subject: [PATCH 2/2] Update path for tiler DB - producion --- values.k3s.production.template.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/values.k3s.production.template.yaml b/values.k3s.production.template.yaml index 7684dbbc..063fca39 100644 --- a/values.k3s.production.template.yaml +++ b/values.k3s.production.template.yaml @@ -48,7 +48,7 @@ osm-seed: mountPath: /var/lib/postgresql/data subPath: postgresql-data staticHostPath: true - localVolumeHostPath: /mnt/tiler-db-data-v6 + localVolumeHostPath: /mnt/tiler-db-data-v7 resources: enabled: false postgresqlConfig: @@ -160,7 +160,7 @@ osm-seed: accessMode: ReadWriteOnce mountPath: /mnt/data staticHostPath: true - localVolumeHostPath: /mnt/tiler-imposm-data-v6 + localVolumeHostPath: /mnt/tiler-imposm-data-v7 resources: enabled: true nodeSelector: