eoapi-cdk 8.1.1 → 8.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/.jsii +698 -26
  2. package/lib/bastion-host/index.js +1 -1
  3. package/lib/database/index.d.ts +1 -0
  4. package/lib/database/index.js +5 -5
  5. package/lib/index.d.ts +2 -0
  6. package/lib/index.js +3 -1
  7. package/lib/ingestor-api/index.js +1 -1
  8. package/lib/stac-api/index.js +1 -1
  9. package/lib/stac-browser/index.js +1 -1
  10. package/lib/stac-item-loader/index.d.ts +337 -0
  11. package/lib/stac-item-loader/index.js +255 -0
  12. package/lib/stac-item-loader/runtime/Dockerfile +18 -0
  13. package/lib/stac-item-loader/runtime/pyproject.toml +17 -0
  14. package/lib/stac-item-loader/runtime/src/stac_item_loader/handler.py +241 -0
  15. package/lib/stactools-item-generator/index.d.ts +258 -0
  16. package/lib/stactools-item-generator/index.js +208 -0
  17. package/lib/stactools-item-generator/runtime/Dockerfile +20 -0
  18. package/lib/stactools-item-generator/runtime/pyproject.toml +16 -0
  19. package/lib/stactools-item-generator/runtime/src/stactools_item_generator/__init__.py +2 -0
  20. package/lib/stactools-item-generator/runtime/src/stactools_item_generator/handler.py +176 -0
  21. package/lib/stactools-item-generator/runtime/src/stactools_item_generator/item.py +77 -0
  22. package/lib/tipg-api/index.js +1 -1
  23. package/lib/titiler-pgstac-api/index.js +1 -1
  24. package/package.json +1 -1
  25. package/pyproject.toml +45 -0
  26. package/uv.lock +1065 -0
  27. package/.devcontainer/devcontainer.json +0 -4
  28. package/.github/pull_request_template.md +0 -4
  29. package/.github/workflows/build.yaml +0 -73
  30. package/.github/workflows/build_and_release.yaml +0 -13
  31. package/.github/workflows/conventional-pr.yaml +0 -26
  32. package/.github/workflows/deploy.yaml +0 -84
  33. package/.github/workflows/distribute.yaml +0 -46
  34. package/.github/workflows/docs.yaml +0 -26
  35. package/.github/workflows/lint.yaml +0 -26
  36. package/.github/workflows/tox.yaml +0 -26
  37. package/.nvmrc +0 -1
  38. package/.pre-commit-config.yaml +0 -23
  39. package/CHANGELOG.md +0 -471
  40. package/diagrams/bastion_diagram.excalidraw +0 -1416
  41. package/diagrams/bastion_diagram.png +0 -0
  42. package/diagrams/ingestor_diagram.excalidraw +0 -2274
  43. package/diagrams/ingestor_diagram.png +0 -0
  44. package/integration_tests/cdk/README.md +0 -55
  45. package/integration_tests/cdk/app.py +0 -186
  46. package/integration_tests/cdk/cdk.json +0 -32
  47. package/integration_tests/cdk/config.py +0 -52
  48. package/integration_tests/cdk/package-lock.json +0 -42
  49. package/integration_tests/cdk/package.json +0 -7
  50. package/integration_tests/cdk/requirements.txt +0 -7
  51. package/lib/database/lambda/package-lock.json +0 -1324
  52. package/lib/ingestor-api/runtime/tests/conftest.py +0 -270
  53. package/lib/ingestor-api/runtime/tests/test_collection.py +0 -87
  54. package/lib/ingestor-api/runtime/tests/test_collection_endpoint.py +0 -41
  55. package/lib/ingestor-api/runtime/tests/test_ingestor.py +0 -60
  56. package/lib/ingestor-api/runtime/tests/test_registration.py +0 -207
  57. package/lib/ingestor-api/runtime/tests/test_utils.py +0 -35
  58. package/lib/ingestor-api/runtime/tests/test_validators.py +0 -164
  59. package/ruff.toml +0 -23
  60. package/tox.ini +0 -16
  61. package/tsconfig.tsbuildinfo +0 -1
  62. /package/lib/{ingestor-api/runtime/tests → stac-item-loader/runtime/src/stac_item_loader}/__init__.py +0 -0
Binary file
@@ -1,55 +0,0 @@
1
-
2
- # Deployment CDK code for eoapi-cdk deployment tests
3
-
4
- This is a wrapper CDK code that is used to test a deployment of the `eoapi-cdk` constructs.
5
-
6
- ## Requirements
7
-
8
- - python
9
- - docker
10
- - node
11
- - AWS credentials environment variables configured to point to an account.
12
-
13
- ## Installation
14
-
15
- Install python dependencies with
16
-
17
- ```
18
- python -m venv .venv
19
- source .venv/bin/activate
20
- python -m pip install -r requirements.txt
21
- ```
22
-
23
- Install the latest `eoapi-cdk` either from PyPI:
24
-
25
- ```
26
- pip install eoapi-cdk
27
- ```
28
-
29
- Or alternatively, compile and package from the root of this repository to get the python version of the constructs locally.
30
-
31
- Also install node dependencies with
32
-
33
- ```
34
- npm install
35
- ```
36
-
37
- Verify that the `cdk` CLI is available. Since `aws-cdk` is installed as a local dependency, you can use the `npx` node package runner tool, that comes with `npm`.
38
-
39
- ```
40
- npx cdk --version
41
- ```
42
-
43
- ## Deployment
44
-
45
- First, synthesize the app
46
-
47
- ```
48
- npx cdk synth --all
49
- ```
50
-
51
- Then, deploy
52
-
53
- ```
54
- npx cdk deploy --all --require-approval never
55
- ```
@@ -1,186 +0,0 @@
1
- from aws_cdk import App, RemovalPolicy, Stack, aws_ec2, aws_iam, aws_rds
2
- from config import AppConfig, build_app_config
3
- from constructs import Construct
4
- from eoapi_cdk import (
5
- PgStacApiLambda,
6
- PgStacDatabase,
7
- StacIngestor,
8
- TiPgApiLambda,
9
- TitilerPgstacApiLambda,
10
- )
11
-
12
- PGSTAC_VERSION = "0.9.5"
13
-
14
-
15
- class VpcStack(Stack):
16
- def __init__(
17
- self, scope: Construct, app_config: AppConfig, id: str, **kwargs
18
- ) -> None:
19
- super().__init__(scope, id=id, tags=app_config.tags, **kwargs)
20
-
21
- self.vpc = aws_ec2.Vpc(
22
- self,
23
- "vpc",
24
- subnet_configuration=[
25
- aws_ec2.SubnetConfiguration(
26
- name="ingress", subnet_type=aws_ec2.SubnetType.PUBLIC, cidr_mask=24
27
- ),
28
- ],
29
- )
30
-
31
- self.vpc.add_interface_endpoint(
32
- "SecretsManagerEndpoint",
33
- service=aws_ec2.InterfaceVpcEndpointAwsService.SECRETS_MANAGER,
34
- )
35
-
36
- self.vpc.add_interface_endpoint(
37
- "CloudWatchEndpoint",
38
- service=aws_ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_LOGS,
39
- )
40
-
41
- self.vpc.add_gateway_endpoint(
42
- "S3", service=aws_ec2.GatewayVpcEndpointAwsService.S3
43
- )
44
-
45
- self.export_value(
46
- self.vpc.select_subnets(subnet_type=aws_ec2.SubnetType.PUBLIC)
47
- .subnets[0]
48
- .subnet_id
49
- )
50
- self.export_value(
51
- self.vpc.select_subnets(subnet_type=aws_ec2.SubnetType.PUBLIC)
52
- .subnets[1]
53
- .subnet_id
54
- )
55
-
56
-
57
- class pgStacInfraStack(Stack):
58
- def __init__(
59
- self,
60
- scope: Construct,
61
- vpc: aws_ec2.Vpc,
62
- id: str,
63
- app_config: AppConfig,
64
- **kwargs,
65
- ) -> None:
66
- super().__init__(
67
- scope,
68
- id=id,
69
- tags=app_config.tags,
70
- **kwargs,
71
- )
72
-
73
- pgstac_db = PgStacDatabase(
74
- self,
75
- "pgstac-db",
76
- vpc=vpc,
77
- engine=aws_rds.DatabaseInstanceEngine.postgres(
78
- version=aws_rds.PostgresEngineVersion.VER_14
79
- ),
80
- vpc_subnets=aws_ec2.SubnetSelection(
81
- subnet_type=aws_ec2.SubnetType.PUBLIC,
82
- ),
83
- allocated_storage=app_config.db_allocated_storage,
84
- instance_type=aws_ec2.InstanceType(app_config.db_instance_type),
85
- add_pgbouncer=True,
86
- pgbouncer_instance_props={
87
- "instanceName": "test-name",
88
- },
89
- removal_policy=RemovalPolicy.DESTROY,
90
- pgstac_version=PGSTAC_VERSION,
91
- )
92
-
93
- assert pgstac_db.security_group
94
-
95
- pgstac_db.security_group.add_ingress_rule(
96
- aws_ec2.Peer.any_ipv4(), aws_ec2.Port.tcp(5432)
97
- )
98
-
99
- stac_api = PgStacApiLambda(
100
- self,
101
- "pgstac-api",
102
- db=pgstac_db.connection_target,
103
- db_secret=pgstac_db.pgstac_secret,
104
- api_env={
105
- "NAME": app_config.build_service_name("STAC API"),
106
- "description": f"{app_config.stage} STAC API",
107
- # test that we can use the pgbouncer secret in downstream resources
108
- "POSTGRES_HOST": pgstac_db.pgstac_secret.secret_value_from_json(
109
- "host"
110
- ).to_string(),
111
- },
112
- )
113
-
114
- # make sure stac_api does not try to build before the secret has been boostrapped
115
- stac_api.node.add_dependency(pgstac_db.secret_bootstrapper)
116
-
117
- TitilerPgstacApiLambda(
118
- self,
119
- "titiler-pgstac-api",
120
- api_env={
121
- "NAME": app_config.build_service_name("titiler pgSTAC API"),
122
- "description": f"{app_config.stage} titiler pgstac API",
123
- },
124
- db=pgstac_db.connection_target,
125
- db_secret=pgstac_db.pgstac_secret,
126
- buckets=[],
127
- lambda_function_options={
128
- "allow_public_subnet": True,
129
- },
130
- )
131
-
132
- TiPgApiLambda(
133
- self,
134
- "tipg-api",
135
- db=pgstac_db.connection_target,
136
- db_secret=pgstac_db.pgstac_secret,
137
- api_env={
138
- "NAME": app_config.build_service_name("tipg API"),
139
- "description": f"{app_config.stage} tipg API",
140
- },
141
- lambda_function_options={
142
- "allow_public_subnet": True,
143
- },
144
- )
145
-
146
- s3_read_only_role = aws_iam.Role(
147
- self,
148
- "S3ReadOnlyRole",
149
- assumed_by=aws_iam.ServicePrincipal("lambda.amazonaws.com"),
150
- description="Role with read-only access to S3 buckets",
151
- )
152
-
153
- s3_read_only_role.add_managed_policy(
154
- aws_iam.ManagedPolicy.from_aws_managed_policy_name("AmazonS3ReadOnlyAccess")
155
- )
156
-
157
- StacIngestor(
158
- self,
159
- "ingestor",
160
- data_access_role=s3_read_only_role,
161
- stac_db_secret=pgstac_db.pgstac_secret,
162
- stac_db_security_group=pgstac_db.security_group,
163
- stac_url=stac_api.url,
164
- stage="test",
165
- pgstac_version=PGSTAC_VERSION,
166
- api_env={
167
- "JWKS_URL": "", # no authentication!
168
- },
169
- )
170
-
171
-
172
- app = App()
173
-
174
- app_config = build_app_config()
175
-
176
- vpc_stack_id = f"vpc{app_config.project_id}"
177
-
178
- vpc_stack = VpcStack(scope=app, app_config=app_config, id=vpc_stack_id)
179
-
180
- pgstac_infra_stack_id = f"pgstac{app_config.project_id}"
181
-
182
- pgstac_infra_stack = pgStacInfraStack(
183
- scope=app, vpc=vpc_stack.vpc, app_config=app_config, id=pgstac_infra_stack_id
184
- )
185
-
186
- app.synth()
@@ -1,32 +0,0 @@
1
- {
2
- "app": "python3 app.py",
3
- "watch": {
4
- "include": [
5
- "**"
6
- ],
7
- "exclude": [
8
- "README.md",
9
- "cdk*.json",
10
- "requirements*.txt",
11
- "source.bat",
12
- "**/*.pyc",
13
- "**/*.tmp",
14
- "**/__pycache__",
15
- "tests",
16
- "scripts",
17
- "*venv"
18
- ]
19
- },
20
- "context": {
21
- "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,
22
- "@aws-cdk/core:stackRelativeExports": true,
23
- "@aws-cdk/aws-rds:lowercaseDbIdentifier": true,
24
- "@aws-cdk/aws-lambda:recognizeVersionProps": true,
25
- "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true,
26
- "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
27
- "@aws-cdk/core:target-partitions": [
28
- "aws",
29
- "aws-cn"
30
- ]
31
- }
32
- }
@@ -1,52 +0,0 @@
1
- from typing import Dict
2
-
3
- import pydantic
4
- import yaml
5
- from pydantic_core.core_schema import FieldValidationInfo
6
- from pydantic_settings import BaseSettings, SettingsConfigDict
7
-
8
-
9
- class AppConfig(BaseSettings):
10
- model_config = SettingsConfigDict(env_file=".env")
11
- aws_default_account: str = pydantic.Field(description="AWS account ID")
12
- project_id: str = pydantic.Field(description="Project ID", default="eoapicdk")
13
- stage: str = pydantic.Field(description="Stage of deployment", default="test")
14
- # because of its validator, `tags` should always come after `project_id` and `stage`
15
- tags: Dict[str, str] | None = pydantic.Field(
16
- description="""Tags to apply to resources. If none provided,
17
- will default to the defaults defined in `default_tags`.
18
- Note that if tags are passed to the CDK CLI via `--tags`,
19
- they will override any tags defined here.""",
20
- default=None,
21
- )
22
- db_instance_type: str = pydantic.Field(
23
- description="Database instance type", default="t3.micro"
24
- )
25
- db_allocated_storage: int = pydantic.Field(
26
- description="Allocated storage for the database", default=5
27
- )
28
-
29
- @pydantic.field_validator("tags")
30
- def default_tags(cls, v, info: FieldValidationInfo):
31
- return v or {"project_id": info.data["project_id"], "stage": info.data["stage"]}
32
-
33
- def build_service_name(self, service_id: str) -> str:
34
- return f"{self.project_id}-{self.stage}-{service_id}"
35
-
36
-
37
- def build_app_config() -> AppConfig:
38
- """Builds the AppConfig object from config.yaml file if exists,
39
- otherwise use defaults"""
40
- try:
41
- with open("config.yaml") as f:
42
- print("Loading config from config.yaml")
43
- app_config = yaml.safe_load(f)
44
- app_config = (
45
- {} if app_config is None else app_config
46
- ) # if config is empty, set it to an empty dict
47
- app_config = AppConfig(**app_config)
48
- except FileNotFoundError:
49
- # if no config at the expected path, using defaults
50
- app_config = AppConfig()
51
-
52
- return app_config
@@ -1,42 +0,0 @@
1
- {
2
- "name": "eoapi-template",
3
- "version": "0.1.0",
4
- "lockfileVersion": 3,
5
- "requires": true,
6
- "packages": {
7
- "": {
8
- "name": "eoapi-template",
9
- "version": "0.1.0",
10
- "dependencies": {
11
- "aws-cdk": "2.130.0"
12
- }
13
- },
14
- "node_modules/aws-cdk": {
15
- "version": "2.130.0",
16
- "resolved": "https://registry.npmjs.org/aws-cdk/-/aws-cdk-2.130.0.tgz",
17
- "integrity": "sha512-MsjGzQ2kZv0FEfXvpW7FTJRnefew0GrYt9M2SMN2Yn45+yjugGl2X8to416kABeFz1OFqW56hq8Y5BiLuFDVLQ==",
18
- "bin": {
19
- "cdk": "bin/cdk"
20
- },
21
- "engines": {
22
- "node": ">= 14.15.0"
23
- },
24
- "optionalDependencies": {
25
- "fsevents": "2.3.2"
26
- }
27
- },
28
- "node_modules/fsevents": {
29
- "version": "2.3.2",
30
- "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
31
- "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
32
- "hasInstallScript": true,
33
- "optional": true,
34
- "os": [
35
- "darwin"
36
- ],
37
- "engines": {
38
- "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
39
- }
40
- }
41
- }
42
- }
@@ -1,7 +0,0 @@
1
- {
2
- "name": "eoapi-template",
3
- "version": "0.1.0",
4
- "dependencies": {
5
- "aws-cdk": "2.130.0"
6
- }
7
- }
@@ -1,7 +0,0 @@
1
- aws-cdk-lib==2.130.0
2
- constructs==10.3.0
3
- pydantic==2.0.2
4
- pydantic-settings==2.0.1
5
- python-dotenv==1.0.0
6
- pyyaml==6.0.2
7
- types-PyYAML==6.0.12.10