Skip to content

Commit

Permalink
feat: remove alternate domain support
Browse files Browse the repository at this point in the history
  • Loading branch information
botanical committed Aug 16, 2024
1 parent 5e2705a commit 4b18b20
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 294 deletions.
44 changes: 0 additions & 44 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

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
Expand Down Expand Up @@ -70,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(
Expand All @@ -88,7 +84,6 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
vpc=vpc.vpc,
database=database,
raster_api=raster_api,
domain=domain,
)

website = VedaWebsite(
Expand Down Expand Up @@ -123,15 +118,13 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
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(
Expand All @@ -144,43 +137,6 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
db_vpc_subnets=database.vpc_subnets,
)

# TODO this conditional supports deploying a second set of APIs to a separate custom domain and should be removed if no longer necessary
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()
Expand Down
9 changes: 0 additions & 9 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,6 @@ def cdk_env(self) -> dict:
else:
return {}

def alt_domain(self) -> bool:
"""True if alternative domain and host parameters provided"""
return all(
[
self.veda_domain_alt_hosted_zone_id,
self.veda_domain_alt_hosted_zone_name,
]
)

def stage_name(self) -> str:
"""Force lowercase stage name"""
return self.stage.lower()
Expand Down
49 changes: 0 additions & 49 deletions domain/infrastructure/config.py

This file was deleted.

148 changes: 0 additions & 148 deletions domain/infrastructure/construct.py

This file was deleted.

15 changes: 0 additions & 15 deletions ingest_api/infrastructure/construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@

from .config import IngestorConfig

if typing.TYPE_CHECKING:
from domain.infrastructure.construct import DomainConstruct


class ApiConstruct(Construct):
def __init__(
self,
Expand All @@ -30,7 +26,6 @@ def __init__(
db_secret: secretsmanager.ISecret,
db_vpc: ec2.IVpc,
db_vpc_subnets=ec2.SubnetSelection,
domain: Optional["DomainConstruct"] = None,
**kwargs,
) -> None:
super().__init__(scope, construct_id, **kwargs)
Expand Down Expand Up @@ -95,7 +90,6 @@ def __init__(
self.api: aws_apigatewayv2_alpha.HttpApi = self.build_api(
construct_id=construct_id,
handler=self.api_lambda,
domain=domain,
custom_host=config.custom_host,
)

Expand Down Expand Up @@ -193,7 +187,6 @@ def build_api(
*,
construct_id: str,
handler: aws_lambda.IFunction,
domain,
custom_host: Optional[str],
) -> aws_apigatewayv2_alpha.HttpApi:
integration_kwargs = dict(handler=handler)
Expand All @@ -212,20 +205,12 @@ def build_api(
)
)

domain_mapping = None
# Legacy method to use a custom subdomain for this api (i.e. <stage>-ingest.<domain-name>.com)
# If using a custom root path and/or a proxy server, do not use a custom subdomain
if domain and domain.ingest_domain_name:
domain_mapping = aws_apigatewayv2_alpha.DomainMappingOptions(
domain_name=domain.ingest_domain_name
)
stack_name = Stack.of(self).stack_name

return aws_apigatewayv2_alpha.HttpApi(
self,
f"{stack_name}-{construct_id}",
default_integration=ingest_api_integration,
default_domain_mapping=domain_mapping,
)

def build_jwks_url(self, userpool_id: str) -> str:
Expand Down
Loading

0 comments on commit 4b18b20

Please sign in to comment.