Skip to content

Commit

Permalink
Update config tiler purge for production
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Dec 18, 2024
1 parent 1d822a9 commit d6ad0bb
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
22 changes: 19 additions & 3 deletions images/tiler-imposm/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,25 @@ function updateData() {

# Check if the limit file exists
if [ -z "$TILER_IMPORT_LIMIT" ]; then
imposm run -config "$WORKDIR/config.json" -expiretiles-dir "$IMPOSM3_EXPIRE_DIR" -httpprofile ":6060" &
# imposm run -config "$WORKDIR/config.json" -expiretiles-dir "$IMPOSM3_EXPIRE_DIR" -httpprofile ":6060" &
imposm run \
-config "${WORKDIR}/config.json" \
-cachedir "${CACHE_DIR}" \
-diffdir "${DIFF_DIR}" \
-commit-latest \
-replication-interval 1m \
-expiretiles-dir "${EXPIRE_DIR}" \
-quiet &
else
imposm run -config "$WORKDIR/config.json" -limitto "$WORKDIR/$LIMITFILE" -expiretiles-dir "$IMPOSM3_EXPIRE_DIR" &
imposm run \
-config "${WORKDIR}/config.json" \
-cachedir "${CACHE_DIR}" \
-diffdir "${DIFF_DIR}" \
-commit-latest \
-replication-interval 1m \
-limitto "${WORKDIR}/${LIMITFILE}" \
-expiretiles-dir "${EXPIRE_DIR}" \
-quiet &
fi

while true; do
Expand Down Expand Up @@ -172,9 +188,9 @@ function importData() {
-deployproduction

# These index will help speed up tegola tile generation
# psql $PG_CONNECTION -f queries/postgis_index.sql
psql $PG_CONNECTION -f queries/postgis_post_import.sql

# To not import again
touch $INIT_FILE

# Update tables
Expand Down
17 changes: 17 additions & 0 deletions images/tiler-imposm/update_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,25 @@ def create_triggers(generalized_tables):
trigger_function = f"""
CREATE OR REPLACE FUNCTION {fixed_table_name}_transform_trigger()
RETURNS TRIGGER AS $$
DECLARE
start_time TIMESTAMP;
end_time TIMESTAMP;
elapsed_time INTERVAL;
BEGIN
-- Record the start time
start_time := clock_timestamp();
-- Perform the transformation
NEW.geometry = {geometry_transform.replace('geometry', 'NEW.geometry')};
-- Record the end time
end_time := clock_timestamp();
elapsed_time := end_time - start_time;
-- Log the time taken and the object being updated
RAISE NOTICE 'Table: %, ID: %, Time Taken: % ms',
TG_TABLE_NAME, NEW.id, EXTRACT(MILLISECOND FROM elapsed_time);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
Expand Down
2 changes: 1 addition & 1 deletion values.production.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ ohm:
NAMESPACE: default # Namespace to run the job
DOCKER_IMAGE: ghcr.io/openhistoricalmap/tiler-server:0.0.1-0.dev.git.1920.h4abe268 # TODO, this should be automatically updated from tiler server image
SQS_QUEUE_URL: {{PRODUCTION_SQS_QUEUE_URL}}
NODEGROUP_TYPE: job_large_tiler # Nodegroup type to run the purge and seed job
NODEGROUP_TYPE: web_large # Nodegroup type to run the purge and seed job
# Maximum number of active jobs in high concurrency queue
MAX_ACTIVE_JOBS: 10
DELETE_OLD_JOBS_AGE: 7200 # 2 hours
Expand Down

0 comments on commit d6ad0bb

Please sign in to comment.