Skip to content

Commit

Permalink
Merge pull request #121 from CS3219-AY2324S1/staging
Browse files Browse the repository at this point in the history
Upgrade staging to master
  • Loading branch information
ryanchua00 authored Nov 15, 2023
2 parents 5eeb3ae + a0ab801 commit f0e213e
Show file tree
Hide file tree
Showing 236 changed files with 26,021 additions and 2,391 deletions.
Binary file modified .DS_Store
Binary file not shown.
62 changes: 62 additions & 0 deletions .github/workflows/ai.service.deploy.yml
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
63 changes: 63 additions & 0 deletions .github/workflows/collaboration.service.deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
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: Set up environment
run: |
echo "NEXT_PUBLIC_PORT_NUMBER=3001" >> .env
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> .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 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
14 changes: 7 additions & 7 deletions .github/workflows/collaboration.service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ name: Collaboration service CI

on:
push:
branches: [ "master" ]
branches: [ "master", "staging" ]
pull_request:
branches: [ "master" ]
branches: [ "master", "staging" ]

jobs:
build:

runs-on: ubuntu-latest
defaults:
run:
working-directory: ./collaboration-service/
working-directory: ./backend/collaboration-service/
strategy:
matrix:
node-version: [18.x]
Expand All @@ -28,13 +28,13 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: ./collaboration-service/package-lock.json
cache-dependency-path: ./backend/collaboration-service/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: ./collaboration-service
working-directory: ./backend/collaboration-service
- name: Build
run: npm run build --if-present
working-directory: ./collaboration-service
working-directory: ./backend/collaboration-service
- name: Test
run: npm test
working-directory: ./collaboration-service
working-directory: ./backend/collaboration-service
63 changes: 63 additions & 0 deletions .github/workflows/compiler.service.deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
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: Set up environment
run: |
echo "NEXT_PUBLIC_PORT_NUMBER=3001" >> .env
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> .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 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
14 changes: 7 additions & 7 deletions .github/workflows/compiler.service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ name: Compiler service CI

on:
push:
branches: [ "master" ]
branches: [ "master", "staging" ]
pull_request:
branches: [ "master" ]
branches: [ "master", "staging" ]

jobs:
build:

runs-on: ubuntu-latest
defaults:
run:
working-directory: ./compiler-service/
working-directory: ./backend/compiler-service/
strategy:
matrix:
node-version: [18.x]
Expand All @@ -28,13 +28,13 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: ./compiler-service/package-lock.json
cache-dependency-path: ./backend/compiler-service/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: ./compiler-service
working-directory: ./backend/compiler-service
- name: Build
run: npm run build --if-present
working-directory: ./compiler-service
working-directory: ./backend/compiler-service
- name: Test
run: npm test
working-directory: ./compiler-service
working-directory: ./backend/compiler-service
63 changes: 63 additions & 0 deletions .github/workflows/email.service.deploy.yml
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
4 changes: 2 additions & 2 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Frontend CI

on:
push:
branches: [ "master" ]
branches: [ "master", "staging" ]
pull_request:
branches: [ "master" ]
branches: [ "master", "staging" ]

jobs:
build:
Expand Down
Loading

0 comments on commit f0e213e

Please sign in to comment.