-
Notifications
You must be signed in to change notification settings - Fork 5
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 #128 from infinitybase/FEAT/get-ci
Feat/get ci
- Loading branch information
Showing
14 changed files
with
367 additions
and
38 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,59 @@ | ||
name: '[API] Deploy to Amazon ECS' | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
deploy: | ||
name: '[API] Deploy to Amazon ECS' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.BAKO_AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.BAKO_AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- name: Login to Amazon ECR | ||
id: login_ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Build, tag, and push image to Amazon ECR | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login_ecr.outputs.registry }} | ||
ECR_REPOSITORY: bako-safe-api | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
# Build a docker container and push it to ECR | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG ./packages/api | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | ||
- name: Fill in the new image ID in the Amazon ECS task definition | ||
id: task-def | ||
uses: aws-actions/amazon-ecs-render-task-definition@v1 | ||
with: | ||
task-definition: ./packages/api/prod_api_task_definition.json | ||
container-name: bako-safe-api | ||
image: ${{ steps.build-image.outputs.image }} | ||
|
||
- name: Deploy Amazon ECS task definition | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | ||
with: | ||
task-definition: ${{ steps.task-def.outputs.task-definition }} | ||
service: bako-safe-api-service | ||
cluster: Bako-Safe-ECS | ||
wait-for-service-stability: true |
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,59 @@ | ||
name: '[Socket Server] Deploy to Amazon ECS' | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
deploy: | ||
name: '[Socket Server] Deploy to Amazon ECS' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.BAKO_AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.BAKO_AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- name: Login to Amazon ECR | ||
id: login_ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Build, tag, and push image to Amazon ECR | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login_ecr.outputs.registry }} | ||
ECR_REPOSITORY: bako-safe-socket-server-api | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
# Build a docker container and push it to ECR | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG ./packages/socket-server | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | ||
- name: Fill in the new image ID in the Amazon ECS task definition | ||
id: task-def | ||
uses: aws-actions/amazon-ecs-render-task-definition@v1 | ||
with: | ||
task-definition: ./packages/socket-server/prod_socket_task_definition.json | ||
container-name: bako-safe-socket-server-api | ||
image: ${{ steps.build-image.outputs.image }} | ||
|
||
- name: Deploy Amazon ECS task definition | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | ||
with: | ||
task-definition: ${{ steps.task-def.outputs.task-definition }} | ||
service: bako-safe-socket-server-api-service | ||
cluster: Bako-Safe-ECS | ||
wait-for-service-stability: true |
This file was deleted.
Oops, something went wrong.
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
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
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,106 @@ | ||
{ | ||
"taskDefinitionArn": "arn:aws:ecs:us-east-1:392170836981:task-definition/bako-safe-api:4", | ||
"containerDefinitions": [ | ||
{ | ||
"name": "bako-safe-api", | ||
"image": "392170836981.dkr.ecr.us-east-1.amazonaws.com/bako-safe-api:v1", | ||
"cpu": 0, | ||
"portMappings": [ | ||
{ | ||
"name": "port-3333", | ||
"containerPort": 3333, | ||
"hostPort": 3333, | ||
"protocol": "tcp", | ||
"appProtocol": "http" | ||
} | ||
], | ||
"essential": true, | ||
"environment": [], | ||
"environmentFiles": [ | ||
{ | ||
"value": "arn:aws:s3:::bako-safe-env/bako-safe-api-prod.env", | ||
"type": "s3" | ||
} | ||
], | ||
"mountPoints": [], | ||
"volumesFrom": [], | ||
"ulimits": [], | ||
"logConfiguration": { | ||
"logDriver": "awslogs", | ||
"options": { | ||
"awslogs-group": "/ecs/bako-safe-api", | ||
"awslogs-create-group": "true", | ||
"awslogs-region": "us-east-1", | ||
"awslogs-stream-prefix": "ecs" | ||
}, | ||
"secretOptions": [] | ||
}, | ||
"systemControls": [] | ||
} | ||
], | ||
"family": "bako-safe-api", | ||
"taskRoleArn": "arn:aws:iam::392170836981:role/ecs-api-bsafe-s3-bako-safe-env", | ||
"executionRoleArn": "arn:aws:iam::392170836981:role/ecsTaskExecutionRole", | ||
"networkMode": "awsvpc", | ||
"revision": 4, | ||
"volumes": [], | ||
"status": "ACTIVE", | ||
"requiresAttributes": [ | ||
{ | ||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs" | ||
}, | ||
{ | ||
"name": "ecs.capability.execution-role-awslogs" | ||
}, | ||
{ | ||
"name": "com.amazonaws.ecs.capability.ecr-auth" | ||
}, | ||
{ | ||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19" | ||
}, | ||
{ | ||
"name": "ecs.capability.env-files.s3" | ||
}, | ||
{ | ||
"name": "com.amazonaws.ecs.capability.task-iam-role" | ||
}, | ||
{ | ||
"name": "ecs.capability.execution-role-ecr-pull" | ||
}, | ||
{ | ||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18" | ||
}, | ||
{ | ||
"name": "ecs.capability.task-eni" | ||
}, | ||
{ | ||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29" | ||
} | ||
], | ||
"placementConstraints": [], | ||
"compatibilities": [ | ||
"EC2", | ||
"FARGATE" | ||
], | ||
"requiresCompatibilities": [ | ||
"FARGATE" | ||
], | ||
"cpu": "512", | ||
"memory": "1024", | ||
"runtimePlatform": { | ||
"cpuArchitecture": "ARM64", | ||
"operatingSystemFamily": "LINUX" | ||
}, | ||
"registeredAt": "2024-06-21T19:04:43.968Z", | ||
"registeredBy": "arn:aws:iam::392170836981:user/jota", | ||
"tags": [ | ||
{ | ||
"key": "environment", | ||
"value": "prod" | ||
}, | ||
{ | ||
"key": "nome", | ||
"value": "bako-safe-api-task" | ||
} | ||
] | ||
} |
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
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
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 |
---|---|---|
|
@@ -34,4 +34,4 @@ export class SocketClient { | |
disconnect() { | ||
this.socket.disconnect(); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM node:18.18.2 | ||
FROM arm64v8/node:18.18.2-alpine | ||
|
||
# Create app directory | ||
WORKDIR socket | ||
|
Oops, something went wrong.