Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/ci-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# .github/workflows/ci-prod.yml
name: CI-PROD

on:
pull_request:
branches: [main]
push:
branches: [main]

permissions:
contents: read
id-token: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

- name: Run tests
run: ./gradlew test --no-daemon

- name: Generate image tag
if: github.event_name == 'push'
run: echo "IMAGE_TAG=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Configure AWS credentials (OIDC)
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION }}

- name: Login to Amazon ECR
if: github.event_name == 'push'
uses: aws-actions/amazon-ecr-login@v2

- name: Build Docker image
if: github.event_name == 'push'
run: |
docker build -t ${{ vars.ECR_REGISTRY }}/${{ vars.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} .

- name: Push Docker image to ECR
if: github.event_name == 'push'
run: |
docker push ${{ vars.ECR_REGISTRY }}/${{ vars.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ dependencies {
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.springframework.security:spring-security-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

implementation 'org.springframework.boot:spring-boot-starter-actuator'

}

dependencyManagement {
Expand Down
30 changes: 30 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
server:
port: ${SERVER_PORT:19000}

eureka:
client:
enabled: ${EUREKA_ENABLED:true}
service-url:
defaultZone: http://${EUREKA_HOST}:${EUREKA_PORT}/eureka/
instance:
prefer-ip-address: true

spring:
cloud:
inetutils:
ignored-interfaces:
- "lo"
- "docker.*"
- "veth.*"
preferred-networks:
- "10.0"
use-only-site-local-interfaces: true

management:
endpoints:
web:
exposure:
include: health,info,prometheus
endpoint:
health:
show-details: always
20 changes: 10 additions & 10 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,54 @@ spring:
webflux:
routes:
- id: user-service
uri: lb://USER-SERVICE
uri: lb://user-service
predicates:
- Path=/api/v1/users/**,/api/v1/admin/users/**,/api/v1/auth/**,/api/v1/admin/auth/**

- id: timeslot-service
uri: lb://TIMESLOT-SERVICE
uri: lb://timeslot-service
predicates:
- Path=/api/v1/restaurants/*/time-slots/**,/api/v1/admin/restaurants/*/time-slots/**

- id: restaurant-service
uri: lb://RESTAURANT-SERVICE
uri: lb://restaurant-service
predicates:
- Path=/api/v1/restaurants/**,/api/v1/admin/restaurants/**

- id: reservation-service
uri: lb://RESERVATION-SERVICE
uri: lb://reservation-service
predicates:
- Path=/api/v1/reservations/**,/api/v1/admin/reservations/**

- id: catalog-service
uri: lb://CATALOG-SERVICE
uri: lb://catalog-service
predicates:
- Path=/api/v1/products/**
- Method=GET

- id: inventory-service
uri: lb://INVENTORY-SERVICE
uri: lb://inventory-service
predicates:
- Path=/api/v1/products/**,/api/v1/admin/products/**
- Method=POST,PUT,PATCH,DELETE

- id: order-service
uri: lb://ORDER-SERVICE
uri: lb://order-service
predicates:
- Path=/api/v1/orders/**,/api/v1/admin/orders/**

- id: waiting-service
uri: lb://WAITING-SERVICE
uri: lb://waiting-service
predicates:
- Path=/api/v1/waitings/**,/api/v1/admin/waitings/**

- id: notification-service
uri: lb://NOTIFICATION-SERVICE
uri: lb://notification-service
predicates:
- Path=/api/v1/notifications/**,/api/v1/admin/notifications/**

- id: payment-service
uri: lb://PAYMENT-SERVICE
uri: lb://payment-service
predicates:
- Path=/api/v1/payments/**,/api/v1/admin/payments/**

Expand Down
Loading