Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,28 @@ updates:
cooldown:
default-days: 30

- package-ecosystem: uv
directory: /cdk/runtimes/eoapi/raster
schedule:
interval: monthly
groups:
python-dependencies:
patterns:
- "*"
cooldown:
default-days: 30

- package-ecosystem: uv
directory: /cdk/runtimes/eoapi/stac
schedule:
interval: monthly
groups:
python-dependencies:
patterns:
- "*"
cooldown:
default-days: 30

- package-ecosystem: pre-commit
directory: /
schedule:
Expand Down
37 changes: 24 additions & 13 deletions cdk/handlers/raster_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,21 @@
from eoapi.raster.main import app
from eoapi.raster.utils import get_secret_dict
from fastapi import Request
from fastapi.routing import APIRoute
from mangum import Mangum
from snapshot_restore_py import register_after_restore, register_before_snapshot

try:
from snapshot_restore_py import register_after_restore, register_before_snapshot
except ImportError:

def register_before_snapshot(func):
"""Leave snapshot hooks inert outside the Lambda SnapStart runtime."""
return func

def register_after_restore(func):
"""Leave snapshot hooks inert outside the Lambda SnapStart runtime."""
return func


from titiler.pgstac.db import connect_to_db
from titiler.pgstac.settings import PostgresSettings

Expand All @@ -28,11 +40,11 @@
secret = get_secret_dict(pgstac_secret_arn)

pg_settings = PostgresSettings(
postgres_host=pgbouncer_host or secret["host"],
postgres_dbname=secret["dbname"],
postgres_user=secret["username"],
postgres_pass=secret["password"],
postgres_port=secret["port"],
pghost=pgbouncer_host or secret["host"],
pgdatabase=secret["dbname"],
pguser=secret["username"],
pgpassword=secret["password"],
pgport=secret["port"],
)


Expand All @@ -57,12 +69,11 @@ async def startup_event() -> None:
templates_start = time.monotonic()
logger.info("FastAPI startup: Building route templates")
app.state.path_templates = {}
for route in app.routes:
if isinstance(route, APIRoute):
# replace : with _ to make it regexable
route_path = route.path.replace(":", "__")
pattern = re.sub(r"{([^}]+)}", r"(?P<\1>[^/]+)", route_path)
app.state.path_templates[re.compile(f"^{pattern}$")] = route_path
for route_path in app.openapi()["paths"]:
# Replace : with _ to make it regexable, and template params with groups.
route_path = route_path.replace(":", "__")
pattern = re.sub(r"{([^}]+)}", r"(?P<\1>[^/]+)", route_path)
app.state.path_templates[re.compile(f"^{pattern}$")] = route_path

logger.info(
"FastAPI startup: Route templates built in "
Expand Down
28 changes: 26 additions & 2 deletions cdk/runtimes/eoapi/raster/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# eoapi.raster
# Raster runtime

![raster docs](https://user-images.githubusercontent.com/10407788/151455911-c455a043-3313-4c26-b980-042cb80787a3.png)
The runtime targets Python 3.12 and uses TiTiler pgSTAC 3.2.0 with TiTiler core, mosaic, and extensions 2.3.0. Dependencies are locked in `uv.lock`.

## Route migration

pgSTAC tile endpoints now use an explicit tile matrix set. For example:

- `/searches/{search_id}/tiles/WebMercatorQuad/{z}/{x}/{y}`
- `/searches/{search_id}/WebMercatorQuad/tilejson.json`
- `/searches/{search_id}/WebMercatorQuad/map.html`

The same route families are available under `/collections/{collection_id}`. Compatibility redirects are intentionally limited to the documented missing-TMS `/mosaic` and collection tile, TileJSON, and map-viewer aliases, plus the implemented TMS-qualified WMTS capability aliases and the existing `/mosaic`-to-`/searches` prefix remapping. These redirects use HTTP 307. Legacy `@{scale}x` tiles become unscaled tile paths with `tilesize=256*scale`; an explicit `tilesize` wins. Legacy TileJSON `tile_scale` becomes `tilesize` (including the old default scale of 1). TMS-qualified WMTS capability paths redirect to the native unqualified endpoint, which advertises all configured TMSs; the released WMTS extension has no parameter to limit the document to one TMS. This is not full compatibility for every old `/searches` endpoint or TMS-qualified scaling path or query.

The custom `/mosaics` creation and resource API remains available, but plural `/mosaics` URLs are not compatibility-redirected. Its native tile routes are TMS-qualified, for example `/mosaics/{mosaic_id}/tiles/WebMercatorQuad/{z}/{x}/{y}`.

For local Compose, raster database settings use the TiTiler pgSTAC `PGUSER`, `PGPASSWORD`, `PGDATABASE`, `PGHOST`, and `PGPORT` variables. Other services retain their own environment names.

## Focused checks

From this directory, run:

```sh
MOSAIC_BACKEND=dynamodb:// MOSAIC_HOST=us-west-2/test-table \
uv run --locked --extra lambda --extra psycopg-binary --with pytest \
pytest -q tests/test_runtime.py
```
Loading
Loading