Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

more work on infra

Dane Schneider0eabb492aeeb
diff --git a/app/Dockerfile.server b/app/Dockerfile.server
index 9026509e..8f883f80 100644
--- a/app/Dockerfile.server
+++ b/app/Dockerfile.server
@@ -16,4 +16,7 @@ COPY ./shared ./shared
RUN cd server && go build -o plandex-server .
+ENV PORT=8080
+EXPOSE 8080
+
CMD ["./server/plandex-server"]
diff --git a/infra/.gitignore b/infra/.gitignore
new file mode 100644
index 00000000..3cb1c7ff
--- /dev/null
+++ b/infra/.gitignore
@@ -0,0 +1 @@
+cdk.out/
\ No newline at end of file
diff --git a/infra/deploy.sh b/infra/deploy.sh
index 9633e914..0e8ae7e6 100755
--- a/infra/deploy.sh
+++ b/infra/deploy.sh
@@ -65,10 +65,10 @@ deploy_or_update_stack() {
if [ -z "$STACK_NAME" ]; then
# Deploy the stack if it does not exist
- npx cdk deploy --require-approval never --app "npx ts-node infra/src/main.ts" --context stackTag=$STACK_TAG "plandex-stack-$STACK_TAG"
+ npx cdk deploy --require-approval never --app "npx ts-node src/main.ts" --context stackTag=$STACK_TAG "plandex-stack-$STACK_TAG"
else
# Update the stack if it exists
- npx cdk deploy "$STACK_NAME" --require-approval never --app "npx ts-node infra/src/main.ts"
+ npx cdk deploy "$STACK_NAME" --require-approval never --app "npx ts-node src/main.ts"
fi
}
diff --git a/infra/src/main.ts b/infra/src/main.ts
index 43856e1b..e5667a0c 100644
--- a/infra/src/main.ts
+++ b/infra/src/main.ts
@@ -16,6 +16,7 @@ import * as cloudwatchActions from "@aws-cdk/aws-cloudwatch-actions";
const tag = process.env.STACK_TAG;
const notifyEmail = process.env.NOTIFY_EMAIL;
const notifySms = process.env.NOTIFY_SMS;
+const certificateArn = process.env.CERTIFICATE_ARN;
export class PlandexStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
@@ -26,6 +27,9 @@ export class PlandexStack extends cdk.Stack {
if (!notifySms) {
throw new Error("NOTIFY_SMS environment variable is not set");
}
+ if (!certificateArn) {
+ throw new Error("CERTIFICATE_ARN environment variable is not set");
+ }
super(scope, id, props);
@@ -67,10 +71,10 @@ export class PlandexStack extends cdk.Stack {
`plandex-rds-instance-${tag}`,
{
engine: rds.DatabaseInstanceEngine.postgres({
- version: rds.PostgresEngineVersion.VER_14_2,
+ version: rds.PostgresEngineVersion.VER_14,
}),
instanceType: ec2.InstanceType.of(
- ec2.InstanceClass.BURSTABLE2,
+ ec2.InstanceClass.BURSTABLE4_GRAVITON,
ec2.InstanceSize.MICRO
),
vpc,
@@ -132,7 +136,7 @@ export class PlandexStack extends cdk.Stack {
portMappings: [
{
containerPort: 8080,
- hostPort: 80,
+ hostPort: 8080,
protocol: ecs.Protocol.TCP,
},
],
@@ -165,7 +169,7 @@ export class PlandexStack extends cdk.Stack {
// Define the ingress rule for the security group to allow the Fargate service to communicate with the RDS instance
fargateServiceSecurityGroup.addIngressRule(
ec2.Peer.anyIpv4(),
- ec2.Port.tcp(dbInstance.dbInstanceEndpointPort),
+ ec2.Port.tcp(5432),
"Allow Fargate service to access RDS instance"
);
@@ -218,7 +222,7 @@ export class PlandexStack extends cdk.Stack {
const certificate = acm.Certificate.fromCertificateArn(
this,
"Certificate",
- "arn:aws:acm:region:account-id:certificate/certificate-id"
+ certificateArn
);
const listener = alb.addListener("plandexListener", {
@@ -232,7 +236,6 @@ export class PlandexStack extends cdk.Stack {
targets: [fargateService],
});
- // Adjust the security group for the ALB to allow inbound traffic
listener.addRedirectResponse("HTTPtoHTTPSRedirect", {
statusCode: "HTTP_301",
protocol: "HTTPS",