Skip to content

Commit 8e85127

Browse files
committed
chore: wip
1 parent 559bc6a commit 8e85127

File tree

3 files changed

+13
-32
lines changed

3 files changed

+13
-32
lines changed

storage/framework/core/cloud/deploy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const appKey = config.app.key
1717
const domain = config.app.url
1818
const appName = config.app.name?.toLowerCase() ?? 'stacks'
1919
const slug = slugify(appName)
20-
const name = `${slug}-cloud-${appEnv}`
20+
const name = `${slug}-cloud`
2121
const account = env.AWS_ACCOUNT_ID
2222
// const region = env.AWS_DEFAULT_REGION
2323
const region = 'us-east-1' // currently, us-east-1 is the only fully-supported region
@@ -69,7 +69,7 @@ export const options = {
6969

7070
new Cloud(app, name, {
7171
...options,
72-
description: `Stacks Cloud ${appEnv} deployment`,
72+
description: `The Stacks Cloud`,
7373
})
7474

7575
app.synth()

storage/framework/core/cloud/src/cloud/compute.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* 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'
44
import type { Construct } from 'constructs'
55
import { path as p } from '@stacksjs/path'
66
import { env } from '@stacksjs/env'
@@ -25,17 +25,14 @@ export class ComputeStack {
2525
if (!fileSystem)
2626
throw new Error('The file system is missing. Please make sure it was created properly.')
2727

28-
// const dockerImageAsset = new ecr_assets.DockerImageAsset(scope, 'ServerBuildImage', {
29-
// directory: p.cloudPath('src/server'),
30-
// })
31-
3228
const cluster = new ecs.Cluster(scope, 'StacksCluster', {
3329
vpc,
3430
})
3531

3632
const taskDefinition = new ecs.FargateTaskDefinition(scope, 'TaskDef', {
3733
memoryLimitMiB: 512, // Match your Lambda memory size
3834
cpu: 256, // Choose an appropriate value
35+
portMappings: [{ containerPort: 80 }],
3936
})
4037

4138
const container = taskDefinition.addContainer('WebServerContainer', {
@@ -54,6 +51,10 @@ export class ComputeStack {
5451
taskDefinition,
5552
desiredCount: 1, // Start with 1 task instance
5653
// 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,
5758
})
5859

5960
const volumeName = `${props.slug}-${props.appEnv}-efs`

storage/framework/core/cloud/src/cloud/network.ts

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,14 @@ export class NetworkStack {
1717
natGateways: 0,
1818
subnetConfiguration: [
1919
{
20-
cidrMask: 21,
21-
name: `${props.slug}-${props.appEnv}-public-subnet-1`,
20+
name: 'public-subnet-1',
2221
subnetType: ec2.SubnetType.PUBLIC,
22+
cidrMask: 24,
2323
},
2424
{
25-
cidrMask: 21,
26-
name: `${props.slug}-${props.appEnv}-public-subnet-2`,
27-
subnetType: ec2.SubnetType.PUBLIC,
28-
},
29-
{
30-
cidrMask: 21,
31-
name: `${props.slug}-${props.appEnv}-public-subnet-3`,
32-
subnetType: ec2.SubnetType.PUBLIC,
33-
},
34-
{
35-
cidrMask: 21,
36-
name: `${props.slug}-${props.appEnv}-private-subnet-1`,
37-
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
38-
},
39-
{
40-
cidrMask: 21,
41-
name: `${props.slug}-${props.appEnv}-private-subnet-2`,
42-
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
43-
},
44-
{
45-
cidrMask: 21,
46-
name: `${props.slug}-${props.appEnv}-private-subnet-3`,
25+
name: 'private-subnet-1',
4726
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
27+
cidrMask: 28,
4828
},
4929
],
5030
})

0 commit comments

Comments
 (0)