-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from ntampakas/main
Introduce GH Actions to trigger Fargate deployment
- Loading branch information
Showing
4 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
# Download poaps | ||
aws s3 cp s3://tlsn-plugin-demo/poaps.txt server/util/ | ||
|
||
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin 490752553772.dkr.ecr.eu-central-1.amazonaws.com | ||
|
||
docker build -t tlsn-plugin-demo . | ||
docker tag tlsn-plugin-demo:latest 490752553772.dkr.ecr.eu-central-1.amazonaws.com/tlsn-plugin-demo:latest | ||
docker push 490752553772.dkr.ecr.eu-central-1.amazonaws.com/tlsn-plugin-demo:latest | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
tasks="tlsn-plugin-demo" | ||
for task in $tasks; do | ||
revision=$(aws ecs describe-task-definition --task-definition $task --query "taskDefinition.revision") | ||
aws ecs update-service --cluster tlsn-plugin-demo --service $task --force-new-deployment --task-definition $task:$revision | ||
done | ||
|
||
for loop in {1..3}; do | ||
[ "$loop" -eq 3 ] && exit 1 | ||
aws ecs wait services-stable --cluster tlsn-plugin-demo --services $tasks && break || continue | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Deploy | ||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: arn:aws:iam::490752553772:role/tlsn-plugin-demo-ecs-deploy-slc | ||
role-duration-seconds: 1800 | ||
aws-region: eu-central-1 | ||
|
||
- name: Build and Push images to ECR | ||
run: | | ||
.github/scripts/build.sh | ||
- name: Trigger Deployment | ||
run: | | ||
.github/scripts/deploy.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM node:20-alpine | ||
|
||
ARG PORT=3030 | ||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN npm install | ||
RUN touch server/util/poaps.txt | ||
RUN touch server/util/assignments.json | ||
RUN npm run build | ||
|
||
EXPOSE ${PORT} | ||
CMD ["node", "build/server/index.bundle.js"] |