Skip to content

Commit 9ca48dd

Browse files
committed
added CI/CD pipelines for event-service, and changed SERVER_PORT to 8082 in api-gateway
1 parent 3328f51 commit 9ca48dd

2 files changed

Lines changed: 57 additions & 1 deletion

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy Event Service to Amazon ECS
2+
3+
on:
4+
push:
5+
branches: [ "main" ] # Pipeline runs every time you push to main
6+
7+
env:
8+
AWS_REGION: us-east-1
9+
ECR_REPOSITORY: event-service
10+
ECS_SERVICE: event-service
11+
ECS_CLUSTER: stream-seat-cluster
12+
CONTAINER_NAME: event-service-container # Make sure this matches your Task Definition
13+
14+
jobs:
15+
deploy:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout Code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up JDK 17
22+
uses: actions/setup-java@v3
23+
with:
24+
java-version: '17'
25+
distribution: 'temurin'
26+
cache: maven
27+
28+
- name: Build JAR with Maven
29+
run: mvn clean package -DskipTests
30+
31+
- name: Configure AWS credentials
32+
uses: aws-actions/configure-aws-credentials@v1
33+
with:
34+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
35+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
36+
aws-region: ${{ env.AWS_REGION }}
37+
38+
- name: Login to Amazon ECR
39+
id: login-ecr
40+
uses: aws-actions/amazon-ecr-login@v1
41+
42+
- name: Build, Tag, and Push Image to ECR
43+
env:
44+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
45+
run: |
46+
# Use buildx for the AMD64 architecture we need for Fargate
47+
docker buildx create --use
48+
docker buildx build --platform linux/amd64 \
49+
-t $ECR_REGISTRY/$ECR_REPOSITORY:latest \
50+
--push .
51+
52+
- name: Force ECS Deployment
53+
run: |
54+
aws ecs update-service --cluster ${{ env.ECS_CLUSTER }} \
55+
--service ${{ env.ECS_SERVICE }} \
56+
--force-new-deployment

‎api-gateway/src/main/resources/application.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
spring.application.name=api-gateway
2-
server.port=8080
2+
server.port=8082
33

44
# 1. FIX: Use the service name defined in docker-compose
55
eureka.client.service-url.defaultZone=${EUREKA_URL:http://discovery-server:8761/eureka/}

0 commit comments

Comments
 (0)