Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
444 changes: 25 additions & 419 deletions .github/workflows/deploy.yml

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user/app
hooks:
BeforeInstall:
- location: scripts/stop.sh
timeout: 300
runas: ec2-user
AfterInstall:
- location: scripts/install.sh
timeout: 300
runas: ec2-user
ApplicationStart:
- location: scripts/start.sh
timeout: 300
runas: ec2-user
ValidateService:
- location: scripts/validate.sh
timeout: 300
runas: ec2-user
6 changes: 6 additions & 0 deletions infra/bin/blackflow-infra.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env node
import * as cdk from 'aws-cdk-lib';
import { CodeDeployStack } from '../lib/codedeploy-stack';

const app = new cdk.App();
new CodeDeployStack(app, 'BlackflowCodeDeployStack');
21 changes: 21 additions & 0 deletions infra/lib/codedeploy-stack.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as cdk from 'aws-cdk-lib';
import * as codedeploy from 'aws-cdk-lib/aws-codedeploy';

export class CodeDeployStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);

const application = new codedeploy.ServerApplication(this, 'BlackflowApp', {
applicationName: 'BlackflowApp',
});

new codedeploy.ServerDeploymentGroup(this, 'BlackflowDG', {
application,
deploymentGroupName: 'BlackflowDG',
ec2InstanceTags: new codedeploy.InstanceTagSet({
Name: ['blackflow-ec2'],
}),
deploymentConfig: codedeploy.ServerDeploymentConfig.ONE_AT_A_TIME,
});
}
}
8 changes: 8 additions & 0 deletions infra/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "blackflow-infra",
"private": true,
"dependencies": {
"aws-cdk-lib": "^2.137.0",
"constructs": "^10.3.0"
}
}
13 changes: 13 additions & 0 deletions infra/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["es2020"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "dist"
},
"include": ["**/*.ts"]
}
4 changes: 4 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -e
cd /home/ec2-user/app
docker compose pull
4 changes: 4 additions & 0 deletions scripts/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -e
cd /home/ec2-user/app
docker compose up -d
4 changes: 4 additions & 0 deletions scripts/stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -e
cd /home/ec2-user/app
docker compose down || true
3 changes: 3 additions & 0 deletions scripts/validate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -e
curl -f http://localhost:3000/api/health