Skip to content

Commit

Permalink
Merge pull request #17 from Sage-Bionetworks-IT/dev
Browse files Browse the repository at this point in the history
Moving changes from dev to stage
  • Loading branch information
BryanFauble authored Nov 15, 2024
2 parents 40060fe + 518b31e commit ac1f4ca
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
14 changes: 11 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,23 @@
"FQDN": "prod.schematic.io",
"CERTIFICATE_ARN": "arn:aws:acm:us-east-1:878654265857:certificate/d11fba3c-1957-48ba-9be0-8b1f460ee970",
"TAGS": {"CostCenter": "NO PROGRAM / 000000"},
"SCHEMATIC_CONTAINER_LOCATION": "ghcr.io/sage-bionetworks/schematic:v0.1.94-beta",
}
case "stage":
environment_variables = {
"VPC_CIDR": "10.254.193.0/24",
"FQDN": "stage.schematic.io",
"CERTIFICATE_ARN": "arn:aws:acm:us-east-1:878654265857:certificate/d11fba3c-1957-48ba-9be0-8b1f460ee970",
"TAGS": {"CostCenter": "NO PROGRAM / 000000"},
"SCHEMATIC_CONTAINER_LOCATION": "ghcr.io/sage-bionetworks/schematic:v24.11.2-rc",
}
case "dev":
environment_variables = {
"VPC_CIDR": "10.254.192.0/24",
"FQDN": "dev.schematic.io",
"CERTIFICATE_ARN": "arn:aws:acm:us-east-1:631692904429:certificate/0e9682f6-3ffa-46fb-9671-b6349f5164d6",
"TAGS": {"CostCenter": "NO PROGRAM / 000000"},
"SCHEMATIC_CONTAINER_LOCATION": "ghcr.io/sage-bionetworks/schematic:v24.11.2-rc",
}
case _:
valid_envs_str = ",".join(VALID_ENVIRONMENTS)
Expand Down Expand Up @@ -66,7 +69,10 @@
# client service. The services need to be created in this order to prevent an time period when the frontend
# client service is running and available the public, but a backend isn't.
load_balancer_stack = LoadBalancerStack(
cdk_app, f"{stack_name_prefix}-load-balancer", network_stack.vpc
scope=cdk_app,
construct_id=f"{stack_name_prefix}-load-balancer",
vpc=network_stack.vpc,
idle_timeout_seconds=300,
)

telemetry_environment_variables = {
Expand All @@ -80,16 +86,18 @@

app_service_props = ServiceProps(
container_name="schematic-app",
container_location="ghcr.io/sage-bionetworks/schematic:v0.1.94-beta",
container_location=environment_variables["SCHEMATIC_CONTAINER_LOCATION"],
container_port=443,
container_memory=1024,
container_memory=4096,
container_env_vars=telemetry_environment_variables,
container_secrets=[
ServiceSecret(
secret_name=f"{stack_name_prefix}-DockerFargateStack/{environment}/ecs",
environment_key="SECRETS_MANAGER_SECRETS",
)
],
auto_scale_min_capacity=3,
auto_scale_max_capacity=5,
)

app_service_stack = LoadBalancedServiceStack(
Expand Down
13 changes: 11 additions & 2 deletions src/load_balancer_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,20 @@ class LoadBalancerStack(cdk.Stack):
"""

def __init__(
self, scope: Construct, construct_id: str, vpc: ec2.Vpc, **kwargs
self,
scope: Construct,
construct_id: str,
vpc: ec2.Vpc,
idle_timeout_seconds: int,
**kwargs
) -> None:
super().__init__(scope, construct_id, **kwargs)

self.alb = elbv2.ApplicationLoadBalancer(
self, "AppLoadBalancer", vpc=vpc, internet_facing=True
self,
"AppLoadBalancer",
vpc=vpc,
idle_timeout=cdk.Duration.seconds(idle_timeout_seconds),
internet_facing=True,
)
cdk.CfnOutput(self, "dns", value=self.alb.load_balancer_dns_name)

0 comments on commit ac1f4ca

Please sign in to comment.