Skip to content

Commit

Permalink
feat: custom runtimes, optional VPC, python 3.11
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

* database and bootstrapper constructs merged to make the bootstrapper runtime configurable

* switched to `Function` for all Lambda deployments to allow for flexibility
  • Loading branch information
emileten committed Oct 31, 2023
2 parents a7aea2b + 239b0a9 commit d4859f6
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 18 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [5.4.1](https://github.com/developmentseed/eoapi-cdk/compare/v5.4.0...v5.4.1) (2023-10-05)


### Bug Fixes

* synchronize pgstac versions -> 0.7.9 across constructs ([c6bb921](https://github.com/developmentseed/eoapi-cdk/commit/c6bb9213f745f1161d193b120083fac1e7943eb5))

# [5.4.0](https://github.com/developmentseed/eoapi-cdk/compare/v5.3.0...v5.4.0) (2023-09-05)


Expand Down
2 changes: 1 addition & 1 deletion lib/database/bootstrapper_runtime/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import json

import boto3
import psycopg
import httpx
import psycopg
from psycopg import sql
from psycopg.conninfo import make_conninfo
from pypgstac.db import PgstacDB
Expand Down
2 changes: 1 addition & 1 deletion lib/ingestor-api/runtime/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
httpx
moto[dynamodb, ssm]>=4.0.9
moto[dynamodb, ssm]>=4.0.9
2 changes: 1 addition & 1 deletion lib/ingestor-api/runtime/src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import boto3
import pydantic
from fastapi.encoders import jsonable_encoder
from pypgstac.db import PgstacDB
from pypgstac.load import Methods
from fastapi.encoders import jsonable_encoder

from .loader import Loader
from .schemas import Ingestion
Expand Down
5 changes: 3 additions & 2 deletions lib/ingestor-api/runtime/tests/test_collection.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import os
from unittest.mock import Mock, patch

import pytest
import src.collection as collection
from pypgstac.load import Methods
from src.utils import DbCreds
import src.collection as collection
import os


@pytest.fixture()
Expand Down
3 changes: 1 addition & 2 deletions lib/ingestor-api/runtime/tests/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
from typing import TYPE_CHECKING, List
from unittest.mock import call, patch

from fastapi.encoders import jsonable_encoder
import pytest

from fastapi.encoders import jsonable_encoder

if TYPE_CHECKING:
from fastapi.testclient import TestClient
Expand Down
2 changes: 1 addition & 1 deletion lib/ingestor-api/runtime/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from unittest.mock import Mock, patch

import pytest
from pypgstac.load import Methods
from fastapi.encoders import jsonable_encoder
from pypgstac.load import Methods
from src.utils import DbCreds


Expand Down
1 change: 1 addition & 0 deletions lib/stac-api/runtime/src/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import asyncio
import os

from mangum import Mangum

from .app import app
Expand Down
13 changes: 6 additions & 7 deletions lib/tipg-api/runtime/src/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@

import asyncio
import os

from mangum import Mangum
from utils import load_pgstac_secret

load_pgstac_secret(os.environ["PGSTAC_SECRET_ARN"]) # required for the below imports

# skipping linting rule that wants all imports at the top
from tipg.main import app # noqa: E402
from tipg.collections import register_collection_catalog # noqa: E402
from tipg.database import connect_to_db # noqa: E402
from tipg.settings import ( # noqa: E402
CustomSQLSettings, # noqa: E402
DatabaseSettings, # noqa: E402
PostgresSettings, # noqa: E402
) # noqa: E402

# skipping linting rule that wants all imports at the top
from tipg.main import app # noqa: E402
from tipg.settings import CustomSQLSettings # noqa: E402
from tipg.settings import DatabaseSettings # noqa: E402
from tipg.settings import PostgresSettings # noqa: E402; noqa: E402

postgres_settings = PostgresSettings()
db_settings = DatabaseSettings()
Expand Down
3 changes: 2 additions & 1 deletion lib/tipg-api/runtime/src/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import base64
import json
import boto3
import os

import boto3


def load_pgstac_secret(secret_name: str):
"""Retrieve secrets from AWS Secrets Manager
Expand Down
3 changes: 2 additions & 1 deletion lib/titiler-pgstac-api/runtime/src/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import asyncio
import os

from mangum import Mangum
from utils import get_secret_dict

Expand All @@ -20,8 +21,8 @@
}
)

from titiler.pgstac.main import app # noqa: E402
from titiler.pgstac.db import connect_to_db # noqa: E402
from titiler.pgstac.main import app # noqa: E402


@app.on_event("startup")
Expand Down
1 change: 1 addition & 0 deletions lib/titiler-pgstac-api/runtime/src/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import base64
import json

import boto3


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eoapi-cdk",
"version": "5.4.0",
"version": "5.4.1",
"description": "A set of constructs deploying pgSTAC with CDK",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down

0 comments on commit d4859f6

Please sign in to comment.