Skip to content

Commit 2fbce74

Browse files
authored
Improve imposm config management and migrate tiler to new server (#736)
* Upload imposm config to s3 * Update branch name to create docker image * Read imposm config from s3 * Update config to fetch imposm3.json * Add env var to refresh views in parallel or sequencial * Increase work_men and maint_men for update mviews in seqeunce * Refresh all mviews in sequence * Set local for SECONDS * Update * mview refresh * Add max_parallel_workers_per_gather to refresh views * Update config * Update shared_buffers for tiler db * Keep imposm logs from each restart * Fix imposm liveness * Remove last.state.txt from imposm dir * Chekc object type to avoid flase positive * Print warnings when a object is not imported in the db * Reject naturla=coastline for landuse areas * Refresh views in parallel - and post the status in s3 * Update config for new tiler server * Migrate services to a new server * Update reseource for porduction * Update db connetion for tiler - new server * Add monitoring route - cloudflare
1 parent 98059d1 commit 2fbce74

25 files changed

Lines changed: 1021 additions & 155 deletions

.github/workflows/chartpress.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
branches:
55
- 'main'
66
- 'staging'
7-
- 'tiler_monitoring'
7+
- 'imposm_config'
88
jobs:
99
build:
1010
runs-on: ubuntu-22.04
@@ -71,7 +71,7 @@ jobs:
7171
OHM_SLACK_WEBHOOK_URL: ${{ secrets.OHM_SLACK_WEBHOOK_URL }}
7272
################ Staging secrets ################
7373
- name: Staging - substitute secrets
74-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/tiler_monitoring'
74+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/imposm_config'
7575
uses: bluwy/substitute-string-action@v1
7676
with:
7777
_input-file: 'values.staging.template.yaml'
@@ -189,14 +189,14 @@ jobs:
189189
PRODUCTION_OPENSTREETMAP_AUTH_SECRET: ${{ secrets.PRODUCTION_OPENSTREETMAP_AUTH_SECRET }}
190190

191191
- name: AWS Credentials
192-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/tiler_monitoring'
192+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/imposm_config'
193193
uses: aws-actions/configure-aws-credentials@v1
194194
with:
195195
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
196196
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
197197
aws-region: us-east-1
198198
- name: Setup Kubectl and Helm Dependencies
199-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/tiler_monitoring'
199+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/imposm_config'
200200
run: |
201201
sudo pip install awscli --ignore-installed six
202202
sudo curl -L -o /usr/bin/kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.17.7/2020-07-08/bin/linux/amd64/kubectl
@@ -210,22 +210,22 @@ jobs:
210210
helm version
211211
212212
- name: Update kube-config staging
213-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/tiler_monitoring'
213+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/imposm_config'
214214
run: aws eks --region us-east-1 update-kubeconfig --name osmseed-staging
215215
- name: Update kube-config prod
216216
if: github.ref == 'refs/heads/main'
217217
run: aws eks --region us-east-1 update-kubeconfig --name osmseed-production-v2
218218
- name: Add Helm repository
219-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/tiler_monitoring'
219+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/imposm_config'
220220
run: |
221221
helm repo add osm-seed https://osm-seed.github.io/osm-seed-chart/
222222
helm repo update
223223
- name: Install helm dependencies for
224-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/tiler_monitoring'
224+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/imposm_config'
225225
run: cd ohm && helm dep up
226226
# Staging
227227
- name: Staging - helm deploy
228-
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/tiler_monitoring'
228+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/imposm_config'
229229
run: helm upgrade --install staging --wait ohm/ -f values.staging.yaml -f ohm/values.yaml
230230
# Production
231231
- name: Production - helm deploy

hetzner/nominatim/nominatim.base.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
volumes:
66
- nominatim_data:/var/lib/postgresql/16/main
77
environment:
8-
PBF_URL: http://s3.amazonaws.com/planet.openhistoricalmap.org/planet/planet-250716_0101.osm.pbf
8+
PBF_URL: http://s3.amazonaws.com/planet.openhistoricalmap.org/planet/planet-260408_0307.osm.pbf
99
REPLICATION_URL: http://planet.openhistoricalmap.org.s3.amazonaws.com/replication/minute
1010
REPLICATION_UPDATE_INTERVAL: 60
1111
REPLICATION_RECHECK_INTERVAL: 30

hetzner/osmcha/osmcha.production.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ services:
44
container_name: osmcha_ohmx_adiff
55
environment:
66
- API_URL=https://api.${OHM_DOMAIN}
7-
- PLANET_PBF_URL=https://s3.amazonaws.com/planet.openhistoricalmap.org/planet/planet-260106_0350.osm.pbf
7+
- PLANET_PBF_URL=https://s3.amazonaws.com/planet.openhistoricalmap.org/planet/planet-260408_0307.osm.pbf
88
- MINUTE_REPLICATION_URL=https://planet.openhistoricalmap.org/?prefix=replication/minute/
99
# Add OSMX_INITIAL_SEQNUM to start from a specific sequence number
10-
# - OSMX_INITIAL_SEQNUM=1881020
10+
# - OSMX_INITIAL_SEQNUM=1900000
1111
- AWS_S3_BUCKET=planet.openhistoricalmap.org
1212
env_file:
1313
- ./.env.osmcha
@@ -22,5 +22,5 @@ services:
2222
- ${PWD}/images/ohmx-adiff-builder/update.sh:/app/update.sh
2323
networks:
2424
- ohm_network
25-
cpus: '8.0'
26-
mem_limit: 20G
25+
# cpus: '8.0'
26+
# mem_limit: 20G

hetzner/overpass/overpass.base.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ services:
99
environment:
1010
OVERPASS_META: attic
1111
OVERPASS_MODE: init
12-
OVERPASS_PLANET_URL: https://s3.amazonaws.com/planet.openhistoricalmap.org/planet/planet-260216_0301.osm.pbf
12+
OVERPASS_PLANET_URL: https://s3.amazonaws.com/planet.openhistoricalmap.org/planet/planet-260408_0307.osm.pbf
1313
OVERPASS_DIFF_URL: http://s3.amazonaws.com/planet.openhistoricalmap.org/replication/minute
1414
OVERPASS_RULES_LOAD: 10
15-
OVERPASS_REPLICATION_SEQUENCE_NUMBER: 1796000
15+
OVERPASS_REPLICATION_SEQUENCE_NUMBER: 1900000
1616
OVERPASS_ALLOW_DUPLICATE_QUERIES: yes
1717
restart: always
1818
## Disable healthcheck during initialization phase to prevent premature restarts
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
services:
22
overpass:
3-
mem_limit: 16g
4-
cpus: "8.0"
3+
# mem_limit: 16g
4+
# cpus: "8.0"

hetzner/tiler/config/postgresql.production.conf

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
# CONNECTIONS AND AUTHENTICATION
33
#------------------------------------------------------------------------------
44
listen_addresses = '*' # Allow connections from any network interface
5-
max_connections = 200 # Increase if you expect more concurrent connections
5+
max_connections = 300 # 4 Tegola replicas × 56 conn + refresh/imposm headroom
66
superuser_reserved_connections = 5 # Reserve connections for superusers
77

88
#------------------------------------------------------------------------------
99
# RESOURCE USAGE
1010
#------------------------------------------------------------------------------
1111

1212
# - Memory Configuration -
13-
shared_buffers = 10GB # ~25% of 40GB container limit
14-
work_mem = 256MB # Memory for each sort/hash operation; be cautious with many parallel queries
15-
maintenance_work_mem = 4GB # Larger memory for VACUUM / CREATE INDEX / ALTER
16-
effective_cache_size = 26GB # ~65% of 40GB container limit
13+
shared_buffers = 16GB # ~13% of 125GB RAM
14+
work_mem = 256MB # Memory for each sort/hash operation; balanced for 300 max connections
15+
maintenance_work_mem = 8GB # Larger memory for VACUUM / CREATE INDEX / ALTER / REFRESH
16+
effective_cache_size = 80GB # ~65% of 125GB RAM
1717

1818
# - Disk Optimization for SSD (if using SSD) -
1919
random_page_cost = 1.0 # Lower cost for random I/O on SSD
@@ -32,7 +32,7 @@ synchronous_commit = off # Improves write performance, risk of
3232
#------------------------------------------------------------------------------
3333
# AUTOVACUUM SETTINGS
3434
#------------------------------------------------------------------------------
35-
autovacuum_max_workers = 6 # More parallel vacuum workers for busy systems
35+
autovacuum_max_workers = 8 # More parallel vacuum workers for busy systems
3636
autovacuum_naptime = 30s # How often the autovacuum daemon checks for work
3737
autovacuum_vacuum_cost_limit = -1 # Let PostgreSQL adjust vacuum cost dynamically
3838

@@ -42,26 +42,27 @@ autovacuum_vacuum_cost_limit = -1 # Let PostgreSQL adjust vacuum cost d
4242
effective_io_concurrency = 300 # For SSD; helps the planner estimate IO concurrency
4343
parallel_tuple_cost = 0.001 # Lower cost to encourage parallelization
4444
parallel_setup_cost = 100 # Lower to encourage more parallel plans
45-
max_worker_processes = 25 # Match 25 CPUs container limit
46-
max_parallel_workers_per_gather = 6 # Max workers that can help a single query
47-
max_parallel_workers = 25 # Total number of parallel workers across all queries
45+
max_worker_processes = 36 # Match 36 CPUs
46+
max_parallel_workers_per_gather = 8 # Max workers that can help a single query
47+
max_parallel_workers = 36 # Total number of parallel workers across all queries
4848

4949
#------------------------------------------------------------------------------
5050
# LOGGING
5151
#------------------------------------------------------------------------------
5252
logging_collector = off # Disable log collection
53+
log_min_messages = fatal # Only log FATAL and PANIC (crashes, OOM kills)
54+
log_min_error_statement = panic # Do not log SQL statements even on errors
5355
log_statement = 'none' # Do not log any statements
5456
log_duration = off # Disable logging query duration
5557
log_min_duration_statement = -1 # Disable logging slow queries
56-
log_error_verbosity = terse # Minimal error messages
58+
log_error_verbosity = default # Show enough detail for debugging errors
5759
log_autovacuum_min_duration = -1 # Do not log autovacuum runs
58-
log_connections = on # Do not log new connections
59-
log_disconnections = on # Do not log disconnections
60+
log_connections = off # Do not log connections
61+
log_disconnections = off # Do not log disconnections
6062
log_lock_waits = off # Do not log lock waits
6163
log_temp_files = -1 # Do not log temporary file creation
6264
log_checkpoints = off # Do not log checkpoints
6365
log_replication_commands = off # Do not log replication-related commands
64-
log_directory = '/dev/null' # Redirect logs to /dev/null (no storage)
6566
#------------------------------------------------------------------------------
6667
# CLIENT CONNECTION DEFAULTS
6768
#------------------------------------------------------------------------------

hetzner/tiler/config/postgresql.staging.conf

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ superuser_reserved_connections = 2 # Reserve a few connections for superus
1111
#------------------------------------------------------------------------------
1212

1313
# - Memory Configuration -
14-
shared_buffers = 1GB # ~25% of total memory for PostgreSQL caching
15-
work_mem = 32MB # Lower memory per query to fit within 4GB RAM
16-
maintenance_work_mem = 256MB # Allocate memory for maintenance tasks like VACUUM
17-
effective_cache_size = 2GB # 50% of total memory for query planner caching
14+
shared_buffers = 4GB # Conservative, shares server with production
15+
work_mem = 256MB # Enough for import sorting
16+
maintenance_work_mem = 4GB # For CREATE INDEX during import
17+
effective_cache_size = 16GB # Conservative estimate sharing with production
1818

1919
# - Disk Optimization for SSD -
2020
random_page_cost = 1.0 # Optimize for SSD storage
@@ -35,20 +35,20 @@ synchronous_commit = off # Improve performance by reducing commi
3535
# AUTOVACUUM SETTINGS
3636
#------------------------------------------------------------------------------
3737

38-
autovacuum_max_workers = 2 # Limit autovacuum workers due to lower memory
38+
autovacuum_max_workers = 3 # Conservative, shares server with production
3939
autovacuum_naptime = 1min # Run autovacuum more frequently
4040
autovacuum_vacuum_cost_limit = -1 # Allow PostgreSQL to auto-adjust vacuum cost
4141

4242
#------------------------------------------------------------------------------
4343
# QUERY TUNING
4444
#------------------------------------------------------------------------------
4545

46-
effective_io_concurrency = 100 # Reduce IO concurrency to fit within staging constraints
46+
effective_io_concurrency = 300 # For SSD
4747
parallel_tuple_cost = 0.001 # Encourage parallel execution
4848
parallel_setup_cost = 100 # Lower parallel setup cost
49-
max_worker_processes = 4 # Limit worker processes to available CPU cores
50-
max_parallel_workers_per_gather = 4 # Allow more per-query parallel workers
51-
max_parallel_workers = 4 # Total parallel workers for staging
49+
max_worker_processes = 6 # Conservative, shares server with production
50+
max_parallel_workers_per_gather = 4 # Max workers per query
51+
max_parallel_workers = 6 # Total parallel workers
5252

5353
#------------------------------------------------------------------------------
5454
# LOGGING

hetzner/tiler/tiler.production.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ services:
1010
- "54329:5432"
1111
env_file:
1212
- .env.tiler
13-
mem_limit: 40G
14-
cpus: "25.0"
13+
mem_limit: 100G
14+
cpus: "30.0"
15+
shm_size: 16g
1516
networks:
1617
- ohm_network
1718

1819
tiler_imposm:
1920
container_name: tiler_imposm
20-
image: ghcr.io/openhistoricalmap/tiler-imposm:0.0.1-0.dev.git.3323.h6950acce
21+
image: ghcr.io/openhistoricalmap/tiler-imposm:0.0.1-0.dev.git.3347.h9440d7a7
2122
volumes:
2223
- tiler_imposm_data:/mnt/data
2324
env_file:
@@ -120,7 +121,7 @@ services:
120121

121122
tiler_monitor:
122123
container_name: tiler_monitor
123-
image: ghcr.io/openhistoricalmap/tiler-monitor:0.0.1-0.dev.git.3353.h63df1944
124+
image: ghcr.io/openhistoricalmap/tiler-monitor:0.0.1-0.dev.git.3340.h7261c0e9
124125
volumes:
125126
- /var/run/docker.sock:/var/run/docker.sock
126127
# - ../../images/tiler-monitor:/app
@@ -138,13 +139,13 @@ services:
138139
volumes:
139140
tiler_pgdata:
140141
driver: local
141-
name: tiler_db_17_03
142+
name: tiler_db
142143
tiler_imposm_data:
143144
driver: local
144-
name: tiler_imposm_17_03
145+
name: tiler_imposm
145146
tiler_monitor_data:
146147
driver: local
147-
name: tiler_monitor_data
148+
name: tiler_monitor_data_v3
148149

149150
networks:
150151
ohm_network:

hetzner/traefik/traefik.template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ http:
218218
tiler_monitor:
219219
loadBalancer:
220220
servers:
221-
- url: http://tiler-monitor:8001
221+
- url: http://tiler_monitor:8001
222222

223223
providers:
224224
file:

images/tiler-imposm/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ RUN git clone https://github.com/OpenHistoricalMap/DateFunctions-plpgsql.git /us
4040

4141
WORKDIR /go
4242
ENV GOPATH /go
43-
RUN echo "Version v0.14.2"
44-
RUN git clone https://github.com/omniscale/imposm3.git $GOPATH/src/github.com/omniscale/imposm3
43+
RUN echo "objs_warnings"
44+
RUN git clone https://github.com/OpenHistoricalMap/imposm3.git $GOPATH/src/github.com/omniscale/imposm3
4545

4646
WORKDIR $GOPATH/src/github.com/omniscale/imposm3
47-
RUN git checkout v0.14.2
47+
RUN git checkout objs_warnings
4848

4949
# Apply fixes or patches (if necessary)
5050
RUN sed -i '/setMaxFileSize/d' cache/ldb_pre_121.go

0 commit comments

Comments
 (0)