Skip to content

Commit 09bfac2

Browse files
committed
Rename purge to fresh_tiles for bypass in martin
1 parent 7b445b0 commit 09bfac2

4 files changed

Lines changed: 34 additions & 34 deletions

File tree

.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-
- 'martin_vtiles'
7+
- 'req_fresh_tiles'
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/martin_vtiles'
74+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/req_fresh_tiles'
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/martin_vtiles'
192+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/req_fresh_tiles'
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/martin_vtiles'
199+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/req_fresh_tiles'
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/martin_vtiles'
213+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/req_fresh_tiles'
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/martin_vtiles'
219+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/req_fresh_tiles'
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/martin_vtiles'
224+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/req_fresh_tiles'
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/martin_vtiles'
228+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/req_fresh_tiles'
229229
run: helm upgrade --install staging --wait ohm/ -f values.staging.yaml -f ohm/values.yaml
230230
# Production
231231
- name: Production - helm deploy

images/tiler-server-martin/config/nginx.conf.template

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ http {
1515

1616
# === Tile cache (dynamic: ohm, ohm_admin, etc.) ===
1717
# Tiles expire automatically via proxy_cache_valid TTLs (per zoom range).
18-
# Manual purge: append ?purge=1 to any tile URL to bypass cache and fetch fresh.
18+
# Manual bypass: append ?fresh_tiles=1 to any tile URL to bypass cache and fetch fresh.
1919
proxy_cache_path /var/cache/nginx/tiles
2020
levels=1:2
2121
keys_zone=tiles:200m
@@ -46,17 +46,17 @@ http {
4646
# nginx proxy_cache TTL varies by zoom range (generated per location block).
4747
# Ranges match materialized view zoom ranges. Lower zooms cache longer
4848
# (less change), higher zooms expire faster (more edits).
49-
# Manual purge via ?purge=1; TTLs are the automatic safety net.
49+
# Manual bypass via ?fresh_tiles=1; TTLs are the automatic safety net.
5050
# z0-2: 24h z3-5: 24h z6-7: 16h z8-9: 12h
5151
# z10-12: 8h z13-15: 4h z16-20: 1h
5252
# Browser Cache-Control is set to "no-store" for dynamic tiles so
5353
# browsers always revalidate with nginx.
5454

55-
# === Cache bypass for force-purge ===
56-
# Append ?purge=1 to any tile URL to skip the cache and fetch fresh from Martin.
55+
# === Cache bypass for fresh tiles ===
56+
# Append ?fresh_tiles=1 to any tile URL to skip the cache and fetch fresh from Martin.
5757
# The fresh response replaces the old cache entry (cache_key = $uri, without query params).
58-
# Usage: /maps/ohm/10/512/340.pbf?purge=1
59-
map $arg_purge $cache_bypass {
58+
# Usage: /maps/ohm/10/512/340.pbf?fresh_tiles=1
59+
map $arg_fresh_tiles $cache_bypass {
6060
default 0;
6161
"1" 1;
6262
}

images/tiler-server-martin/start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ cat > /app/config/config.yaml <<EOF
2525
listen_addresses: '0.0.0.0:${MARTIN_INTERNAL_PORT}'
2626
worker_processes: ${MARTIN_WORKER_PROCESSES:-8}
2727
# Disable Martin's internal tile cache so tiles are always generated fresh.
28-
# Nginx handles caching with TTLs + ?purge=1 bypass.
28+
# Nginx handles caching with TTLs + ?fresh_tiles=1 bypass.
2929
cache_size_mb: 0
3030
3131
postgres:

images/tiler-server-martin/static/index.html

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@
6868
#map-controls button { background: rgba(22,33,62,0.9); border: 1px solid rgba(255,255,255,0.15); color: #eee; padding: 6px 12px; border-radius: 6px; font-size: 12px; cursor: pointer; }
6969
#map-controls button:hover { background: rgba(22,33,62,1); }
7070
#map-controls button.active { background: #0f3460; border-color: #4fc3f7; color: #4fc3f7; }
71-
#map-controls button.purge { border-color: #e57373; color: #e57373; }
72-
#map-controls button.purge:hover { background: rgba(229,115,115,0.15); }
73-
#map-controls button.purge.active { background: #e57373; color: #fff; border-color: #e57373; }
71+
#map-controls button.fresh-tiles { border-color: #e57373; color: #e57373; }
72+
#map-controls button.fresh-tiles:hover { background: rgba(229,115,115,0.15); }
73+
#map-controls button.fresh-tiles.active { background: #e57373; color: #fff; border-color: #e57373; }
7474
#zoom-level { background: rgba(22,33,62,0.9); padding: 8px 14px; border-radius: 6px; font-size: 13px; pointer-events: auto; }
7575

7676
/* Tile info */
@@ -135,7 +135,7 @@ <h2>Martin</h2>
135135
<div id="map-header">
136136
<div id="map-controls">
137137
<button id="btn-grid" onclick="toggleGrid()">Grid</button>
138-
<button id="btn-purge" class="purge" onclick="togglePurge()" title="Toggle cache bypass: tiles load fresh from Martin">Purge Cache</button>
138+
<button id="btn-fresh-tiles" class="fresh-tiles" onclick="toggleFreshTiles()" title="Toggle cache bypass: tiles load fresh from Martin">Req Fresh Tiles</button>
139139
</div>
140140
<div id="zoom-level">z0</div>
141141
</div>
@@ -198,20 +198,20 @@ <h2>Martin</h2>
198198
}
199199
document.getElementById('btn-grid').classList.add('active');
200200

201-
// Purge mode: toggle ?purge=1 on all tile requests to bypass nginx cache
201+
// Fresh tiles mode: toggle ?fresh_tiles=1 on all tile requests to bypass nginx cache
202202
// cacheBuster is appended to tile URLs to defeat MapLibre's in-memory cache.
203-
// It is incremented each time purge is toggled off, so MapLibre sees new URLs
203+
// It is incremented each time fresh tiles is toggled off, so MapLibre sees new URLs
204204
// and re-fetches from nginx (which already has the fresh tiles from BYPASS).
205-
let purgeMode = false;
205+
let freshTilesMode = false;
206206
let cacheBuster = 0;
207207

208-
function togglePurge() {
209-
purgeMode = !purgeMode;
210-
const btn = document.getElementById('btn-purge');
211-
btn.classList.toggle('active', purgeMode);
212-
btn.textContent = purgeMode ? 'Purge ON' : 'Purge Cache';
208+
function toggleFreshTiles() {
209+
freshTilesMode = !freshTilesMode;
210+
const btn = document.getElementById('btn-fresh-tiles');
211+
btn.classList.toggle('active', freshTilesMode);
212+
btn.textContent = freshTilesMode ? 'Fresh Tiles ON' : 'Fresh Tiles';
213213

214-
if (!purgeMode) {
214+
if (!freshTilesMode) {
215215
// Increment cache buster so MapLibre treats all tile URLs as new
216216
cacheBuster++;
217217
}
@@ -224,10 +224,10 @@ <h2>Martin</h2>
224224
if (!source || !source.tiles) return;
225225
const urls = source.tiles.map(url => {
226226
const base = url.split('?')[0];
227-
if (purgeMode) {
228-
return base + '?purge=1&_v=' + cacheBuster;
227+
if (freshTilesMode) {
228+
return base + '?fresh_tiles=1&_v=' + cacheBuster;
229229
}
230-
// cacheBuster > 0 means we've done at least one purge cycle
230+
// cacheBuster > 0 means we've done at least one fresh tiles cycle
231231
return cacheBuster > 0 ? base + '?_v=' + cacheBuster : base;
232232
});
233233
source.setTiles(urls);
@@ -429,7 +429,7 @@ <h2>Martin</h2>
429429
async function addCompositeSource(group) {
430430
const compositeFns = group.functions.join(',');
431431
const sourceId = `src-composite-${group.name}`;
432-
// Use /maps/{group}/ route which goes through nginx cache + purge support,
432+
// Use /maps/{group}/ route which goes through nginx cache + fresh_tiles support,
433433
// instead of Martin's native TileJSON URLs which bypass cache.
434434
const cachedTileUrl = `${MARTIN_BASE}/maps/${group.name}/{z}/{x}/{y}.pbf`;
435435
const tileJsonUrl = `${MARTIN_BASE}/${compositeFns}`;
@@ -470,7 +470,7 @@ <h2>Martin</h2>
470470
});
471471

472472
activeSources['__composite__'] = { sourceId, layerIds, color: '#4fc3f7' };
473-
if (purgeMode || cacheBuster > 0) applyTileUrls();
473+
if (freshTilesMode || cacheBuster > 0) applyTileUrls();
474474
} catch (e) {
475475
console.error('Failed to add composite source:', e);
476476
}
@@ -608,7 +608,7 @@ <h2>Martin</h2>
608608
}
609609

610610
activeSources[name] = { sourceId, layerIds, color };
611-
if (purgeMode || cacheBuster > 0) applyTileUrls();
611+
if (freshTilesMode || cacheBuster > 0) applyTileUrls();
612612
const el = document.getElementById(`src-item-${name}`);
613613
if (el) el.classList.add('active');
614614
}

0 commit comments

Comments
 (0)