generated from CS3219-AY2324S1/course-assessment-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac743a3
commit 724c978
Showing
10 changed files
with
649 additions
and
1 deletion.
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,62 @@ | ||
name: Ai Service CD | ||
|
||
on: | ||
push: | ||
branches: [ "main", "staging" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
environment: production | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up environment | ||
run: | | ||
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> .env | ||
cat .env # Verify that secrets are set | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- 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 }} | ||
IMAGE_TAG: latest | ||
run: | | ||
# Build a docker container and | ||
# push it to ECR so that it can | ||
# be deployed to ECS. | ||
docker-compose -f docker-compose-deployment.yml build | ||
# Push ai-service container to ecr | ||
docker tag ay2324s1-course-assessment-g58_ai:$IMAGE_TAG $ECR_REGISTRY/ay2324s1-course-assessment-g58-ai:$IMAGE_TAG | ||
docker push $ECR_REGISTRY/ay2324s1-course-assessment-g58-ai:$IMAGE_TAG | ||
echo "push image=ai" >> $GITHUB_OUTPUT | ||
- name: Download ai-service task definition | ||
run: | | ||
aws ecs describe-task-definition --task-definition peerprep-ai-service --query taskDefinition > ai-task-definition.json | ||
- name: Deploy Amazon ECS ai-service task | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a | ||
with: | ||
task-definition: ai-task-definition.json | ||
service: ai | ||
cluster: peerprep_t | ||
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,57 @@ | ||
name: Collaboration Service CD | ||
|
||
on: | ||
push: | ||
branches: [ "main", "staging" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
environment: production | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- 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 }} | ||
IMAGE_TAG: latest | ||
run: | | ||
# Build a docker container and | ||
# push it to ECR so that it can | ||
# be deployed to ECS. | ||
docker-compose -f docker-compose-deployment.yml build | ||
# Push collaboration container to ecr | ||
docker tag ay2324s1-course-assessment-g58_collaboration:$IMAGE_TAG $ECR_REGISTRY/ay2324s1-course-assessment-g58-collaboration:$IMAGE_TAG | ||
docker push $ECR_REGISTRY/ay2324s1-course-assessment-g58-collaboration:$IMAGE_TAG | ||
echo "push image=collaboration" >> $GITHUB_OUTPUT | ||
- name: Download collaboration-service task definition | ||
run: | | ||
aws ecs describe-task-definition --task-definition peerprep-collaboration-service --query taskDefinition > collaboration-task-definition.json | ||
- name: Deploy Amazon ECS collaboration-service task | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a | ||
with: | ||
task-definition: collaboration-task-definition.json | ||
service: collaboration | ||
cluster: peerprep_t | ||
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,57 @@ | ||
name: Compiler Service CD | ||
|
||
on: | ||
push: | ||
branches: [ "main", "staging" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
environment: production | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- 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 }} | ||
IMAGE_TAG: latest | ||
run: | | ||
# Build a docker container and | ||
# push it to ECR so that it can | ||
# be deployed to ECS. | ||
docker-compose -f docker-compose-deployment.yml build | ||
# Push compiler-service container to ecr | ||
docker tag ay2324s1-course-assessment-g58_compiler:$IMAGE_TAG $ECR_REGISTRY/ay2324s1-course-assessment-g58-compiler:$IMAGE_TAG | ||
docker push $ECR_REGISTRY/ay2324s1-course-assessment-g58-compiler:$IMAGE_TAG | ||
echo "push image=compiler" >> $GITHUB_OUTPUT | ||
- name: Download compiler-service task definition | ||
run: | | ||
aws ecs describe-task-definition --task-definition peerprep-compiler-service --query taskDefinition > compiler-task-definition.json | ||
- name: Deploy Amazon ECS compiler-service task | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a | ||
with: | ||
task-definition: compiler-task-definition.json | ||
service: compiler | ||
cluster: peerprep_t | ||
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,63 @@ | ||
name: Email Service CD | ||
|
||
on: | ||
push: | ||
branches: [ "main", "staging" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
environment: production | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up environment | ||
run: | | ||
echo "FRONTEND_URL=${{ secrets.FRONTEND_URL }}" >> .env | ||
echo "SMTP_PASSWORD=${{ secrets.SMTP_PASSWORD }}" >> .env | ||
cat .env # Verify that secrets are set | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- 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 }} | ||
IMAGE_TAG: latest | ||
run: | | ||
# Build a docker container and | ||
# push it to ECR so that it can | ||
# be deployed to ECS. | ||
docker-compose -f docker-compose-deployment.yml build | ||
# Push email-service container to ecr | ||
docker tag ay2324s1-course-assessment-g58_email:$IMAGE_TAG $ECR_REGISTRY/ay2324s1-course-assessment-g58-email:$IMAGE_TAG | ||
docker push $ECR_REGISTRY/ay2324s1-course-assessment-g58-email:$IMAGE_TAG | ||
echo "push image=email" >> $GITHUB_OUTPUT | ||
- name: Download email-service task definition | ||
run: | | ||
aws ecs describe-task-definition --task-definition peerprep-email-service --query taskDefinition > email-task-definition.json | ||
- name: Deploy Amazon ECS email-service task | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a | ||
with: | ||
task-definition: email-task-definition.json | ||
service: email | ||
cluster: peerprep_t | ||
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,57 @@ | ||
name: Gateway CD | ||
|
||
on: | ||
push: | ||
branches: [ "main", "staging" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
environment: production | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- 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 }} | ||
IMAGE_TAG: latest | ||
run: | | ||
# Build a docker container and | ||
# push it to ECR so that it can | ||
# be deployed to ECS. | ||
docker-compose -f docker-compose-deployment.yml build | ||
# Push gateway container to ecr | ||
docker tag ay2324s1-course-assessment-g58_gateway:$IMAGE_TAG $ECR_REGISTRY/ay2324s1-course-assessment-g58-gateway:$IMAGE_TAG | ||
docker push $ECR_REGISTRY/ay2324s1-course-assessment-g58-gateway:$IMAGE_TAG | ||
echo "push image=gateway" >> $GITHUB_OUTPUT | ||
- name: Download gateway-service task definition | ||
run: | | ||
aws ecs describe-task-definition --task-definition peerprep-api-gateway --query taskDefinition > gateway-task-definition.json | ||
- name: Deploy Amazon ECS api-gateway task | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a | ||
with: | ||
task-definition: gateway-task-definition.json | ||
service: api-gateway | ||
cluster: peerprep_t | ||
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,57 @@ | ||
name: Matching Service CI | ||
|
||
on: | ||
push: | ||
branches: [ "main", "staging" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
environment: production | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- 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 }} | ||
IMAGE_TAG: latest | ||
run: | | ||
# Build a docker container and | ||
# push it to ECR so that it can | ||
# be deployed to ECS. | ||
docker-compose -f docker-compose-deployment.yml build | ||
# Push matching-service container to ecr | ||
docker tag ay2324s1-course-assessment-g58_matching:$IMAGE_TAG $ECR_REGISTRY/ay2324s1-course-assessment-g58-matching:$IMAGE_TAG | ||
docker push $ECR_REGISTRY/ay2324s1-course-assessment-g58-matching:$IMAGE_TAG | ||
echo "push image=matching" >> $GITHUB_OUTPUT | ||
- name: Download matching-service task definition | ||
run: | | ||
aws ecs describe-task-definition --task-definition peerprep-matching-service --query taskDefinition > matching-task-definition.json | ||
- name: Deploy Amazon ECS matching-service task | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a | ||
with: | ||
task-definition: matching-task-definition.json | ||
service: matching | ||
cluster: peerprep_t | ||
wait-for-service-stability: true |
Oops, something went wrong.