1
1
/* eslint-disable no-new */
2
- import type { aws_certificatemanager as acm , aws_ec2 as ec2 , aws_efs as efs , aws_lambda as lambda , aws_route53 as route53 } from 'aws-cdk-lib'
3
- import { Duration , CfnOutput as Output , aws_ecs as ecs , aws_ecs_patterns as ecs_patterns , aws_logs as logs , aws_secretsmanager as secretsmanager } from 'aws-cdk-lib'
2
+ import type { aws_certificatemanager as acm , aws_efs as efs , aws_lambda as lambda , aws_route53 as route53 } from 'aws-cdk-lib'
3
+ import { Duration , CfnOutput as Output , aws_ec2 as ec2 , aws_ecs as ecs , aws_ecs_patterns as ecs_patterns , aws_logs as logs , aws_secretsmanager as secretsmanager } from 'aws-cdk-lib'
4
4
import type { Construct } from 'constructs'
5
5
import { path as p } from '@stacksjs/path'
6
6
import { env } from '@stacksjs/env'
@@ -25,17 +25,14 @@ export class ComputeStack {
25
25
if ( ! fileSystem )
26
26
throw new Error ( 'The file system is missing. Please make sure it was created properly.' )
27
27
28
- // const dockerImageAsset = new ecr_assets.DockerImageAsset(scope, 'ServerBuildImage', {
29
- // directory: p.cloudPath('src/server'),
30
- // })
31
-
32
28
const cluster = new ecs . Cluster ( scope , 'StacksCluster' , {
33
29
vpc,
34
30
} )
35
31
36
32
const taskDefinition = new ecs . FargateTaskDefinition ( scope , 'TaskDef' , {
37
33
memoryLimitMiB : 512 , // Match your Lambda memory size
38
34
cpu : 256 , // Choose an appropriate value
35
+ portMappings : [ { containerPort : 80 } ] ,
39
36
} )
40
37
41
38
const container = taskDefinition . addContainer ( 'WebServerContainer' , {
@@ -54,6 +51,10 @@ export class ComputeStack {
54
51
taskDefinition,
55
52
desiredCount : 1 , // Start with 1 task instance
56
53
// Other configurations like public load balancer, domain name, etc.
54
+ publicLoadBalancer : true ,
55
+ taskSubnets : vpc . selectSubnets ( { subnetType : ec2 . SubnetType . PUBLIC , onePerAz : true } ) ,
56
+ assignPublicIp : true ,
57
+ listenerPort : 80 ,
57
58
} )
58
59
59
60
const volumeName = `${ props . slug } -${ props . appEnv } -efs`
0 commit comments