Skip to content

Commit cff84e5

Browse files
committed
Add application configuration files for backend and frontend
- Created application1.properties for backend configuration including database, JWT, storage, logging, and OAuth2 settings. - Added .env file for frontend configuration with API URL and ZegoCloud settings. - Created a backup of the frontend .env file for environment variable management.
1 parent 312d07c commit cff84e5

47 files changed

Lines changed: 2416 additions & 2902 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
target
2+
node_modules
3+
.git
4+
.gitignore
5+
.DS_Store
6+
logs
7+
syncora_frontend/node_modules
8+
syncora_frontend/dist
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy Backend to AWS App Runner (ap-south-1)
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'src/**'
8+
- 'pom.xml'
9+
- 'Dockerfile'
10+
- '.github/workflows/backend-deploy.yml'
11+
workflow_dispatch:
12+
13+
env:
14+
AWS_REGION: ap-south-1 # change if needed
15+
ECR_REPOSITORY: syncora-backend
16+
IMAGE_TAG: latest
17+
APP_RUNNER_SERVICE_ARN: arn:aws:apprunner:ap-south-1:705166993774:service/syncora-backend/REPLACE_WITH_SERVICE_ID
18+
19+
jobs:
20+
deploy-backend:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
id-token: write
24+
contents: read
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Configure AWS Credentials (OIDC)
30+
uses: aws-actions/configure-aws-credentials@v4
31+
with:
32+
role-to-assume: arn:aws:iam::705166993774:role/github-actions-apprunner
33+
aws-region: ${{ env.AWS_REGION }}
34+
35+
- name: Login to Amazon ECR
36+
id: login-ecr
37+
uses: aws-actions/amazon-ecr-login@v2
38+
39+
- name: Build and Push Docker image
40+
env:
41+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
42+
run: |
43+
docker build -t $ECR_REGISTRY/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} .
44+
docker push $ECR_REGISTRY/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
45+
46+
- name: Deploy to App Runner
47+
env:
48+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
49+
run: |
50+
aws apprunner update-service \
51+
--service-arn $APP_RUNNER_SERVICE_ARN \
52+
--source-configuration '{"ImageRepository":{"ImageIdentifier":"'$ECR_REGISTRY'/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}","ImageRepositoryType":"ECR"},"AutoDeploymentsEnabled":true}'
53+
54+
- name: Output service URL
55+
run: |
56+
aws apprunner describe-service --service-arn $APP_RUNNER_SERVICE_ARN --query 'Service.ServiceUrl' --output text
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Deploy Frontend to S3 + CloudFront
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'syncora_frontend/**'
8+
- '.github/workflows/frontend-deploy.yml'
9+
workflow_dispatch:
10+
11+
env:
12+
AWS_REGION: us-east-1 # change if needed
13+
S3_BUCKET: syncora-frontend-bucket # replace with your bucket name
14+
CLOUDFRONT_DISTRIBUTION_ID: ABCDEFGHIJKL # replace with your distribution id
15+
16+
jobs:
17+
deploy-frontend:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
id-token: write
21+
contents: read
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Configure AWS Credentials (OIDC)
27+
uses: aws-actions/configure-aws-credentials@v4
28+
with:
29+
role-to-assume: arn:aws:iam::123456789012:role/github-actions-frontend # replace with your role
30+
aws-region: ${{ env.AWS_REGION }}
31+
32+
- name: Setup Node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 18
36+
cache: npm
37+
cache-dependency-path: syncora_frontend/package-lock.json
38+
39+
- name: Install dependencies
40+
working-directory: syncora_frontend
41+
run: npm ci
42+
43+
- name: Build frontend
44+
working-directory: syncora_frontend
45+
run: npm run build
46+
47+
- name: Sync to S3
48+
run: |
49+
aws s3 sync syncora_frontend/dist s3://$S3_BUCKET/ --delete --cache-control max-age=31536000,public
50+
aws s3 cp syncora_frontend/dist/index.html s3://$S3_BUCKET/index.html --cache-control max-age=300,public --content-type text/html
51+
52+
- name: Invalidate CloudFront cache
53+
run: |
54+
aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Scale ECS Service (pause/resume)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
desired_count:
7+
description: "Desired task count (0 to pause, 1+ to resume)"
8+
required: true
9+
default: "0"
10+
cluster:
11+
description: "ECS cluster name"
12+
required: true
13+
default: "syncora-cluster"
14+
service:
15+
description: "ECS service name"
16+
required: true
17+
default: "syncora-backend"
18+
19+
env:
20+
AWS_REGION: us-east-1 # change if needed
21+
22+
jobs:
23+
scale:
24+
runs-on: ubuntu-latest
25+
permissions:
26+
id-token: write
27+
contents: read
28+
steps:
29+
- name: Configure AWS Credentials (OIDC)
30+
uses: aws-actions/configure-aws-credentials@v4
31+
with:
32+
role-to-assume: arn:aws:iam::123456789012:role/github-actions-ecs-scale # replace with your role ARN
33+
aws-region: ${{ env.AWS_REGION }}
34+
35+
- name: Scale service
36+
run: |
37+
aws ecs update-service \
38+
--cluster "${{ github.event.inputs.cluster }}" \
39+
--service "${{ github.event.inputs.service }}" \
40+
--desired-count ${{ github.event.inputs.desired_count }}
41+
42+
- name: Show service status
43+
run: |
44+
aws ecs describe-services \
45+
--cluster "${{ github.event.inputs.cluster }}" \
46+
--services "${{ github.event.inputs.service }}" \
47+
--query 'services[0].{desired:desiredCount,running:runningCount,status:status}'

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ target/
1616
*.iws
1717
*.iml
1818
*.ipr
19+
*.application.properties
1920

2021
/nbproject/private/
2122
/nbbuild/
@@ -48,7 +49,7 @@ logs/
4849
*.log
4950

5051
# Environment variables
51-
.env
52+
# .env
5253
.env.local
5354
.env.*.local
5455
application-local.properties

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Multi-stage build for Syncora Spring Boot app (Java 21)
2+
# Builder stage: compiles and packages the app
3+
FROM maven:3.9.9-eclipse-temurin-21 AS builder
4+
WORKDIR /workspace
5+
COPY pom.xml .
6+
# Pre-fetch dependencies for faster incremental builds
7+
RUN mvn -B dependency:go-offline
8+
COPY src ./src
9+
RUN mvn -B -DskipTests package
10+
11+
# Runtime stage: slim JRE image
12+
FROM eclipse-temurin:21-jre
13+
WORKDIR /app
14+
COPY --from=builder /workspace/target/*.jar /app/app.jar
15+
ENV JAVA_OPTS="-XX:+UseG1GC -XX:MaxRAMPercentage=75 -Dserver.port=8080"
16+
EXPOSE 8080
17+
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"]

0 commit comments

Comments
 (0)