Repository navigation
feat(health): resolve every platform backend the way its integrations query it - #687
Merged
Merged
Conversation
… query it
Extend platform endpoints from Overpass to Nominatim, Photon, Pelias, OSRM,
Valhalla, self-hosted MOTIS and Transitous. Integrations ask for the
instance with ctx.resolvePlatformEndpoint(id), and ${endpoint:<id>} health
checks resolve it through the same function: the self-hosted service the
integration requires, its own URL setting (manifest endpointConfigKeys),
the operator's environment URL, then the public default.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What changed and why
Follow-up to #685. #685 made Overpass health checks probe the instance the integrations query. Every other backend a deployment can keep anywhere still had the same split between its runtime and its health check. Often the integrations of one backend also disagreed with each other.
geocoding-nominatimused service → itsendpointsetting → public. Thegeocodingplace lookups used theirnominatimUrlsetting → service → public. The sharing integrations used service →NOMINATIM_URL→ public. The health check always probed the public Nominatim.endpointsetting →MOTIS_URL.transit-motisprobed only the setting.live-transit-motisprobed only the service.geocoding-motisprobed Transitous ateurope.motis-project.de, which it never queries.TRANSITOUS_URLonly in the rental client; probes were hard-coded.PHOTON_URL/OSRM_URL. The probe always hit the public instance.localhost:4300, but the probe resolved only the service.routing-valhallaused service → setting → Stadia and ignoredVALHALLA_URL. The API's own Valhalla helper used service →VALHALLA_URL→ Stadia. Probes resolved only the service.A self-hosted MOTIS configured through the
endpointsetting on an internal host was also reported down. The host refused to probe the non-public address its queries used.One order, one function
All eight backends are now platform endpoints:
overpass,nominatim,photon,pelias,osrm,valhalla,motis(a self-hosted MOTIS) andtransitous. Each resolves in one order:endpointConfigKeys(for example{ "motis": "endpoint", "transitous": "transitousUrl" });motisandpeliashave no public default.ctx.resolvePlatformEndpoint(id).${endpoint:<id>}, which the host resolves through the same framework function,resolveIntegrationPlatformEndpoint, with the integration's own resolved requirements and settings. A probe and its integration's queries therefore reach the same instance by construction.PLATFORM_ENDPOINTS) also supply the env-var names the stack render writes for co-deployed services.What moved:
ctx.resolvePlatformEndpoint. The three duplicated MOTIS chains (resolveLocalMotisUrlamong them) and the shared geocodingresolveEndpointhelper are gone.${endpoint:<id>}templates:transit-motisnow also probes Transitous;overlay-hikingdeclares its optionaloverpassrequirement, so its probe sees the self-hosted Overpass its queries use.PLATFORM_ENDPOINT_IDS(renamed from feat(health): probe platform backends where the deployment keeps them #685's unreleasedHEALTH_CHECK_ENDPOINT_IDS) lists the eight ids. Validation rejects unknown ids andendpointConfigKeysentries that name an undeclaredconfigSchemaproperty. The JSON schema gainsendpointConfigKeys.Behaviour changes for operators
geocodingintegration'snominatimUrlsetting, as it already did for every other Nominatim consumer.NOMINATIM_URL,OSRM_URL,VALHALLA_URL,TRANSITOUS_URL,PHOTON_URLandPELIAS_URLnow apply wherever no service or setting is set. app-api's manifest already passes the first four, defaulting to the same public instances as before. So a deployment that never set them behaves as before.Verification
Resolver: core tests cover the full precedence: service over setting over operator URL over default, the missing MOTIS default, and non-string settings.
Contract: tests cover the ids and
endpointConfigKeysvalidation.manifest-smokevalidates every shipped manifest.Host: across the migrated integrations, each test runs a real manifest with a given service, setting or environment, and checks the exact URL probed and which host is trusted:
PHOTON_URLand via its default;OSRM_URL;endpointsetting on an internal host;MOTIS_URL.Pelias and MOTIS without an instance report unconfigured.
Integration tests: the
transit-motisandlive-transit-motistests now resolve through the real manifests and the shared function.Repository checks:
pnpm lint,pnpm check-types,pnpm check:policy,pnpm check-openapi(regenerated: the admin integration model gainsendpointConfigKeys) and the contract schema check pass. The full Vitest suite passed except two tests this change had left stale: the resolver's id list and the OpenAPI freshness check. After fixing both, those tests and the affected suites pass.Not run: a deployment. On openmapx.com the status page changes once this ships.
Release and upgrade impact
Product impact: ordinary
The changeset releases
@openmapx/extension-contracts(minor:PLATFORM_ENDPOINT_IDS,endpointConfigKeysand their validation) and rebuilds@openmapx/extension-cli(patch).