Repository navigation
build(smg): ship the DB-IP City Lite database in the Cap Web image - #22
Merged
Merged
Conversation
Railway sends no location headers, so views need a GeoIP database to get a country and city. The Railway Dockerfile generator now adds a geoip stage that downloads the current month's DB-IP City Lite file (falling back to the previous month) and sets CAP_GEOIP_DATABASE_PATH. RAILWAY_GIT_COMMIT_SHA busts the build cache so every deploy takes the latest file. A failed download leaves views without a location instead of failing the build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
#21 lets Cap Web look up view locations in a GeoIP
.mmdbfile. This puts that file in our image.What
scripts/smg/lib/railway-dockerfile.ts:smgWebDockerfile()=railwayDockerfile()+withGeoIpDatabase(), which adds ageoipstage beforerunner:dbip-city-lite-YYYY-MM.mmdb.gz), falling back to the previous month at the start of a month. ~60 MB download, 127 MB on disk.ARG RAILWAY_GIT_COMMIT_SHAbusts the build cache, so every deploy takes the latest monthly file instead of a cached one./app/geoipand setsCAP_GEOIP_DATABASE_PATH.FROM base AS runner,USER nextjs), so a sync can't silently drop the stage.smg/web.Dockerfileregenerated.SMG.md: ledger row forfeat/self-hosted-geoipand a note with the data source and its CC BY 4.0 attribution.Merge order doesn't matter: without #21 the variable is ignored, and without this PR #21 changes nothing.
Verified
bun test scripts/smg: 37 pass, including the newwithGeoIpDatabasetests and the up-to-date check.docker build --target geoipwith the generated Dockerfile: downloads the 2026-11 file (GeoIP: DB-IP City Lite 2026-11 (commit test123)).datecomputes the previous month innode:24.22.1-alpine.