Skip to content

Commit

Permalink
update db instance
Browse files Browse the repository at this point in the history
  • Loading branch information
tevko committed Feb 23, 2025
1 parent 7cece99 commit c47c490
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions cdk/lib/cdk-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class CdkStack extends cdk.Stack {

const db = new rds.DatabaseInstance(this, 'Database', {
engine: rds.DatabaseInstanceEngine.postgres({version: rds.PostgresEngineVersion.VER_17 }),
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO),
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.LARGE),
vpc,
allocatedStorage: 20,
storageType: rds.StorageType.GP2,
Expand Down Expand Up @@ -223,7 +223,10 @@ export class CdkStack extends cdk.Stack {
}
EOF`,
'sudo systemctl restart docker',
'sudo systemctl status docker'
'sudo systemctl status docker',
`echo "Writing service type '${service}' to /tmp/service_type.txt"`,
`echo "${service}" > /tmp/service_type.txt`,
`echo "Contents of /tmp/service_type.txt: $(cat /tmp/service_type.txt)"`
);
return ld;
};
Expand All @@ -236,7 +239,7 @@ EOF`,
securityGroup: webSecurityGroup,
keyPair: props.enableSSHAccess ? webKeyPair : undefined, // Conditionally add key pair
role: instanceRole,
});
});

const mathWorkerLaunchTemplate = new ec2.LaunchTemplate(this, 'MathWorkerLaunchTemplate', {
machineImage: machineImageMathWorker,
Expand Down
6 changes: 5 additions & 1 deletion scripts/after_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ sed -i "s|^DATABASE_SSL=.*|DATABASE_SSL=true|" .env

echo "Updated DATABASE_URL in .env file and SSL"

SERVICE_FROM_FILE=$(cat /tmp/service_type.txt) # Read file content into variable

echo "DEBUG: Service type read from /tmp/service_type.txt: [$SERVICE_FROM_FILE]"

# Set environment variable for docker-compose (already present)
# export IMAGE_TAG
/usr/local/bin/docker-compose config # Validate
/usr/local/bin/docker-compose up -d $SERVICE # Start Docker Compose service
/usr/local/bin/docker-compose up -d $SERVICE_FROM_FILE # Start Docker Compose service

0 comments on commit c47c490

Please sign in to comment.