-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: remove cloudfront distribution and custom alternate domain from backend #422
Changes from 6 commits
cc74726
5e2705a
4b18b20
0cc613c
4c0628d
06b1372
f0e0884
545070c
6352853
d5d307f
8735f45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,14 +8,12 @@ | |
|
||
from config import veda_app_settings | ||
from database.infrastructure.construct import RdsConstruct | ||
from domain.infrastructure.construct import DomainConstruct | ||
from ingest_api.infrastructure.config import IngestorConfig as ingest_config | ||
from ingest_api.infrastructure.construct import ApiConstruct as ingest_api_construct | ||
from ingest_api.infrastructure.construct import IngestorConstruct as ingestor_construct | ||
from network.infrastructure.construct import VpcConstruct | ||
from permissions_boundary.infrastructure.construct import PermissionsBoundaryAspect | ||
from raster_api.infrastructure.construct import RasterApiLambdaConstruct | ||
from routes.infrastructure.construct import CloudfrontDistributionConstruct | ||
from s3_website.infrastructure.construct import VedaWebsite | ||
from stac_api.infrastructure.construct import StacApiLambdaConstruct | ||
|
||
|
@@ -71,15 +69,12 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None: | |
stage=veda_app_settings.stage_name(), | ||
) | ||
|
||
domain = DomainConstruct(veda_stack, "domain", stage=veda_app_settings.stage_name()) | ||
|
||
raster_api = RasterApiLambdaConstruct( | ||
veda_stack, | ||
"raster-api", | ||
stage=veda_app_settings.stage_name(), | ||
vpc=vpc.vpc, | ||
database=database, | ||
domain=domain, | ||
) | ||
|
||
stac_api = StacApiLambdaConstruct( | ||
|
@@ -89,23 +84,12 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None: | |
vpc=vpc.vpc, | ||
database=database, | ||
raster_api=raster_api, | ||
domain=domain, | ||
) | ||
|
||
website = VedaWebsite( | ||
veda_stack, "stac-browser-bucket", stage=veda_app_settings.stage_name() | ||
) | ||
|
||
veda_routes = CloudfrontDistributionConstruct( | ||
veda_stack, | ||
"routes", | ||
stage=veda_app_settings.stage_name(), | ||
raster_api_id=raster_api.raster_api.api_id, | ||
stac_api_id=stac_api.stac_api.api_id, | ||
origin_bucket=website.bucket, | ||
region=veda_app_settings.cdk_default_region, | ||
) | ||
|
||
# Only create a stac browser if we can infer the catalog url from configuration before synthesis (API Gateway URL not yet available) | ||
stac_catalog_url = veda_app_settings.get_stac_catalog_url() | ||
if stac_catalog_url: | ||
|
@@ -120,23 +104,27 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None: | |
db_secret_name = database.pgstac.secret.secret_name | ||
db_security_group = database.db_security_group | ||
|
||
base_api_url = f"https://{veda_app_settings.stage_name()}.{veda_app_settings.veda_custom_host}".strip( | ||
"/" | ||
) | ||
stac_api_url = f"{base_api_url}{veda_app_settings.veda_stac_root_path}/" | ||
raster_api_url = f"{base_api_url}{veda_app_settings.veda_raster_root_path}/" | ||
|
||
# ingestor config requires references to other resources, but can be shared between ingest api and bulk ingestor | ||
ingestor_config = ingest_config( | ||
stage=veda_app_settings.stage_name(), | ||
stac_db_security_group_id=db_security_group.security_group_id, | ||
stac_api_url=stac_api.stac_api.url, | ||
raster_api_url=raster_api.raster_api.url, | ||
stac_api_url=stac_api_url, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could handle inferring the cloudfront urls in config with a property or function
and then conditionally use them here so that we have a way to use the API gateway url if a cloudfront is not used.
|
||
raster_api_url=raster_api_url, | ||
) | ||
|
||
|
||
ingest_api = ingest_api_construct( | ||
veda_stack, | ||
"ingest-api", | ||
config=ingestor_config, | ||
db_secret=database.pgstac.secret, | ||
db_vpc=vpc.vpc, | ||
db_vpc_subnets=database.vpc_subnets, | ||
domain=domain, | ||
) | ||
|
||
ingestor = ingestor_construct( | ||
|
@@ -149,51 +137,6 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None: | |
db_vpc_subnets=database.vpc_subnets, | ||
) | ||
|
||
veda_routes.add_ingest_behavior( | ||
ingest_api=ingest_api.api, stage=veda_app_settings.stage_name() | ||
) | ||
|
||
# Must be done after all CF behaviors exist | ||
veda_routes.create_route_records(stage=veda_app_settings.stage_name()) | ||
|
||
|
||
# TODO this conditional supports deploying a second set of APIs to a separate custom domain and should be removed if no longer necessary | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎉 |
||
if veda_app_settings.alt_domain(): | ||
alt_domain = DomainConstruct( | ||
veda_stack, | ||
"alt-domain", | ||
stage=veda_app_settings.stage_name(), | ||
alt_domain=True, | ||
) | ||
|
||
alt_raster_api = RasterApiLambdaConstruct( | ||
veda_stack, | ||
"alt-raster-api", | ||
stage=veda_app_settings.stage_name(), | ||
vpc=vpc.vpc, | ||
database=database, | ||
domain_name=alt_domain.raster_domain_name, | ||
) | ||
|
||
alt_stac_api = StacApiLambdaConstruct( | ||
veda_stack, | ||
"alt-stac-api", | ||
stage=veda_app_settings.stage_name(), | ||
vpc=vpc.vpc, | ||
database=database, | ||
raster_api=raster_api, | ||
domain_name=alt_domain.stac_domain_name, | ||
) | ||
|
||
alt_ingest_api = ingest_api_construct( | ||
veda_stack, | ||
"alt-ingest-api", | ||
config=ingestor_config, | ||
db_secret=database.pgstac.secret, | ||
db_vpc=vpc.vpc, | ||
domain_name=alt_domain.ingest_domain_name, | ||
) | ||
|
||
git_sha = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip() | ||
try: | ||
git_tag = subprocess.check_output(["git", "describe", "--tags"]).decode().strip() | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't
VEDA_CUSTOM_HOST
already include the stage name?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah it does!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f0e0884