Skip to content

Commit f2187e8

Browse files
authored
feat(release)!: keycloak auth integration and rio-tiler upgrade (#490)
## Breaking - Cognito auth removed - Keycloak auth added - Rio-tiler v06 to v07 https://cogeotiff.github.io/rio-tiler/migrations/v7_migration/ ## Upgraded - Core titiler v0.18 to <v0.2. https://github.com/developmentseed/titiler/blob/main/CHANGES.md#0190-2024-11-07 - Python upgraded from v3.11 to v3.12 ## Changed - Database VPC subnet selection override removed - Unit test step in deployment action can now be suppressed with an environment variable
2 parents ddd143e + 7aa2606 commit f2187e8

File tree

34 files changed

+170
-186
lines changed

34 files changed

+170
-186
lines changed

.example.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ VEDA_CLIENT_SECRET=secret
3333
VEDA_DATA_ACCESS_ROLE_ARN=
3434
VEDA_COGNITO_DOMAIN=
3535
VEDA_OPENID_CONFIGURATION_URL=
36-
VEDA_KEYCLOAK_CLIENT_ID=
36+
VEDA_KEYCLOAK_STAC_API_CLIENT_ID=
37+
VEDA_KEYCLOAK_INGEST_API_CLIENT_ID=
3738

3839
STAC_BROWSER_BUCKET=
3940
STAC_URL=

.github/actions/cdk-deploy/action.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ inputs:
1212
required: false
1313
type: string
1414
default: "."
15+
skip_tests:
16+
required: false
17+
type: boolean
18+
default: false
1519

1620
runs:
1721
using: "composite"
@@ -21,7 +25,7 @@ runs:
2125
- name: Set up Python
2226
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
2327
with:
24-
python-version: '3.11'
28+
python-version: '3.12'
2529
cache: 'pip'
2630
cache-dependency-path: |
2731
${{ inputs.dir }}/setup.py
@@ -54,34 +58,43 @@ runs:
5458
python -m pip install -e .[dev,deploy,test]
5559
python -m pip install boto3
5660
61+
# === Only run these steps if skip_tests is false ===
62+
5763
- name: Launch services
64+
if: ${{ inputs.skip_tests == false }}
5865
shell: bash
5966
working-directory: ${{ inputs.dir }}
6067
run: docker compose up --build -d
6168

6269
- name: Ingest Stac Items/Collection
70+
if: ${{ inputs.skip_tests == false }}
6371
shell: bash
6472
working-directory: ${{ inputs.dir }}
6573
run: |
6674
./scripts/load-data-container.sh
6775
6876
- name: Sleep for 10 seconds
69-
run: sleep 10s
77+
if: ${{ inputs.skip_tests == false }}
7078
shell: bash
7179
working-directory: ${{ inputs.dir }}
80+
run: sleep 10s
7281

7382
- name: Integrations tests
83+
if: ${{ inputs.skip_tests == false }}
7484
shell: bash
7585
working-directory: ${{ inputs.dir }}
7686
run: python -m pytest .github/workflows/tests/ -vv -s
7787

7888
- name: Stop services
89+
if: ${{ inputs.skip_tests == false }}
7990
shell: bash
8091
working-directory: ${{ inputs.dir }}
8192
run: |
8293
docker compose down --rmi all --volumes
8394
sudo rm -rf .pgdata
8495
96+
# ===================================================
97+
8598
- name: Get relevant environment configuration from aws secrets
8699
shell: bash
87100
working-directory: ${{ inputs.dir }}

.github/workflows/pr.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Set up Python
1111
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
1212
with:
13-
python-version: '3.11'
13+
python-version: '3.12'
1414

1515
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
1616
with:
@@ -48,7 +48,7 @@ jobs:
4848
- name: Set up Python
4949
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
5050
with:
51-
python-version: '3.11'
51+
python-version: '3.12'
5252

5353
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
5454
with:
@@ -80,9 +80,6 @@ jobs:
8080
- name: Install reqs for stac api
8181
run: python -m pip install stac_api/runtime/
8282

83-
- name: Install veda auth for ingest api
84-
run: python -m pip install common/auth
85-
8683
- name: Ingest unit tests
8784
run: NO_PYDANTIC_SSM_SETTINGS=1 python -m pytest ingest_api/runtime/tests/ -vv -s
8885

@@ -102,7 +99,7 @@ jobs:
10299
- name: Set up Python
103100
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
104101
with:
105-
python-version: '3.11'
102+
python-version: '3.12'
106103

107104
- name: Setup Node
108105
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e4 #v4.3.0

.github/workflows/tests/conftest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
RASTER_SEARCHES_ENDPOINT = "http://0.0.0.0:8082/searches"
1919
RASTER_HEALTH_ENDPOINT = "http://0.0.0.0:8082/healthz"
2020
TILEMATRIX = {"z": 15, "x": 8589, "y": 12849}
21+
TMS_ID = "WebMercatorQuad"
2122

2223
SEARCHES = [
2324
{
@@ -228,6 +229,17 @@ def seeded_tilematrix():
228229
return TILEMATRIX
229230

230231

232+
@pytest.fixture
233+
def seeded_tms_id():
234+
"""
235+
Fixture providing a matrix of seeded data for integration testing.
236+
237+
Returns:
238+
string: A valid TileMatrixSet ID
239+
"""
240+
return TMS_ID
241+
242+
231243
@pytest.fixture
232244
def searches():
233245
"""

.github/workflows/tests/test_raster.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def setup(
2121
raster_health_endpoint,
2222
seeded_tilematrix,
2323
searches,
24+
seeded_tms_id,
2425
):
2526
"""
2627
Set up the test environment with the required fixtures.
@@ -31,6 +32,7 @@ def setup(
3132
self.raster_health_endpoint = raster_health_endpoint
3233
self.seeded_tilematrix = seeded_tilematrix
3334
self.searches = searches
35+
self.seeded_tms_id = seeded_tms_id
3436

3537
def test_raster_api_health(self):
3638
"""test api."""
@@ -53,17 +55,16 @@ def test_mosaic_api(self):
5355

5456
searchid = resp.json()["id"]
5557
assert resp.status_code == 200
56-
5758
resp = httpx.get(
58-
f"{self.raster_searches_endpoint}/{searchid}/-85.6358,36.1624/assets"
59+
f"{self.raster_searches_endpoint}/{searchid}/point/-85.6358,36.1624/assets"
5960
)
6061
assert resp.status_code == 200
6162
assert len(resp.json()) == 1
6263
assert list(resp.json()[0]) == ["id", "bbox", "assets", "collection"]
6364
assert resp.json()[0]["id"] == self.seeded_id
6465

6566
resp = httpx.get(
66-
f"{self.raster_searches_endpoint}/{searchid}/tiles/15/8589/12849/assets"
67+
f"{self.raster_searches_endpoint}/{searchid}/tiles/{self.seeded_tms_id}/15/8589/12849/assets"
6768
)
6869

6970
assert resp.status_code == 200
@@ -72,7 +73,7 @@ def test_mosaic_api(self):
7273
assert resp.json()[0]["id"] == self.seeded_id
7374

7475
resp = httpx.get(
75-
f"{self.raster_searches_endpoint}/{searchid}/tiles/{self.seeded_tilematrix['z']}/{self.seeded_tilematrix['x']}/{self.seeded_tilematrix['y']}",
76+
f"{self.raster_searches_endpoint}/{searchid}/tiles/{self.seeded_tms_id}/{self.seeded_tilematrix['z']}/{self.seeded_tilematrix['x']}/{self.seeded_tilematrix['y']}",
7677
params={"assets": "cog"},
7778
headers={"Accept-Encoding": "br, gzip"},
7879
timeout=10.0,
@@ -82,7 +83,7 @@ def test_mosaic_api(self):
8283
assert "content-encoding" not in resp.headers
8384

8485
resp = httpx.get(
85-
f"{self.raster_searches_endpoint}/{searchid}/tiles/{self.seeded_tilematrix['z']}/{self.seeded_tilematrix['x']}/{self.seeded_tilematrix['y']}/assets"
86+
f"{self.raster_searches_endpoint}/{searchid}/tiles/{self.seeded_tms_id}/{self.seeded_tilematrix['z']}/{self.seeded_tilematrix['x']}/{self.seeded_tilematrix['y']}/assets"
8687
)
8788
assert resp.status_code == 200
8889

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ nvm install 20 # .github/workflows/pr.yml uses node version 20
8787
#### Virtual environment example
8888

8989
```bash
90-
# `pipes` package required by the `fire` package deprecated in python >3.11
91-
pyenv install 3.11
92-
pyenv shell 3.11
90+
# `pipes` package required by the `fire` package deprecated in python >3.12
91+
pyenv install 3.12
92+
pyenv shell 3.12
9393
python3 -m venv .venv
9494
source .venv/bin/activate
9595
```

app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
118118
config=ingestor_config,
119119
db_secret=database.pgstac.secret,
120120
db_vpc=vpc.vpc,
121-
db_vpc_subnets=database.vpc_subnets,
122121
)
123122

124123
ingestor = ingestor_construct(
@@ -128,7 +127,6 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
128127
table=ingest_api.table,
129128
db_secret=database.pgstac.secret,
130129
db_vpc=vpc.vpc,
131-
db_vpc_subnets=database.vpc_subnets,
132130
)
133131

134132
git_sha = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip()

config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class vedaAppSettings(BaseSettings):
8484
description="Boolean if Cloudfront Distribution should be deployed",
8585
)
8686

87-
veda_custom_host: str = Field(
87+
veda_custom_host: Optional[str] = Field(
8888
None,
8989
description="Complete url of custom host including subdomain. Used to infer url of stac-api before app synthesis.",
9090
)

database/infrastructure/construct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(
4848
self,
4949
"lambda",
5050
handler="handler.handler",
51-
runtime=aws_lambda.Runtime.PYTHON_3_11,
51+
runtime=aws_lambda.Runtime.PYTHON_3_12,
5252
code=aws_lambda.Code.from_docker_build(
5353
path=os.path.abspath("./"),
5454
file="database/runtime/Dockerfile",

database/runtime/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=linux/amd64 public.ecr.aws/sam/build-python3.11:latest
1+
FROM --platform=linux/amd64 public.ecr.aws/sam/build-python3.12:latest
22

33
ARG PGSTAC_VERSION
44
RUN echo "Using PGSTAC Version ${PGSTAC_VERSION}"

0 commit comments

Comments
 (0)