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
55 changes: 55 additions & 0 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI/CD Workflow

on:
pull_request:
types: [opened]
workflow_dispatch:

env:
AWS_REGION: ap-northeast-2

jobs:
build-and-push:
name: Build and Push to ECR
runs-on: ubuntu-latest
strategy:
matrix:
service:
- name: 'eureka-server'
ecr_repository: 'ticketping/eureka-server'
dockerfile_path: './eureka-server/Dockerfile'
context_path: './eureka-server'

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

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Test with Gradle Wrapper
run: ./gradlew build -x test

- 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: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
docker build -t $ECR_REGISTRY/${{ matrix.service.ecr_repository }} -f ${{ matrix.service.dockerfile_path }} ${{ matrix.service.context_path }}
docker push $ECR_REGISTRY/${{ matrix.service.ecr_repository }}
39 changes: 0 additions & 39 deletions .github/workflows/pull_request_notification.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
.run

### STS ###
.apt_generated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,24 @@ jar {
enabled = true
}

ext {
set('springCloudVersion', "2023.0.3")
}

dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}

dependencies {
api 'io.github.resilience4j:resilience4j-spring-boot3:2.2.0'
implementation project(':common:core')

implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'

// Resilience4j
api 'io.github.resilience4j:resilience4j-spring-boot3:2.2.0'
}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package resilience4j.config;
package circuitbreaker.config;

import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
import io.github.resilience4j.circuitbreaker.event.CircuitBreakerOnErrorEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.ticketPing.auth.infrastructure.config;
package circuitbreaker.config;

import feign.Request;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CustomFeignConfig {

@Bean
public Request.Options requestOptions() {
return new Request.Options(1000, 12000);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package resilience4j.config;
package circuitbreaker.config;

import io.github.resilience4j.retry.RetryRegistry;
import io.github.resilience4j.retry.event.RetryOnRetryEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ticketPing.auth.common.exception;
package circuitbreaker.exception;

import exception.ErrorCase;
import lombok.Getter;
Expand All @@ -8,6 +8,7 @@
@Getter
@RequiredArgsConstructor
public enum CircuitBreakerErrorCase implements ErrorCase {

SERVICE_UNAVAILABLE(HttpStatus.SERVICE_UNAVAILABLE, "서비스가 연결 불가능합니다. 잠시 후 다시 시도해주세요."),
SERVICE_IS_OPEN(HttpStatus.SERVICE_UNAVAILABLE, "서비스가 연결 불가능합니다. 관리자에게 문의해주세요.");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.ticketPing.order.common.utils;
package circuitbreaker.utils;

import com.ticketPing.order.common.exception.CircuitBreakerErrorCase;
import circuitbreaker.exception.CircuitBreakerErrorCase;
import exception.ApplicationException;
import feign.FeignException;
import io.github.resilience4j.circuitbreaker.CallNotPermittedException;
import feign.RetryableException;
import io.github.resilience4j.circuitbreaker.CallNotPermittedException;

public class FeignFallbackUtils {

Expand All @@ -30,4 +30,5 @@ else if (cause instanceof FeignException) {
throw new ApplicationException(CircuitBreakerErrorCase.SERVICE_UNAVAILABLE);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package audit;
package auditing;

import jakarta.persistence.Column;
import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import java.time.LocalDateTime;
import lombok.Getter;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package audit;
package auditing;

import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
Expand Down
6 changes: 1 addition & 5 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ services:
image: ticketping/eureka-server:latest
ports:
- "10000:10000"
env_file:
- .env
environment:
- EUREKA_SERVER=${EUREKA_SERVER}

gateway-server:
container_name: gateway-server
Expand Down Expand Up @@ -93,14 +89,14 @@ services:
- PERFORMANCE_POSTGRES_URL=${PERFORMANCE_POSTGRES_URL}
- PERFORMANCE_POSTGRES_USERNAME=${PERFORMANCE_POSTGRES_USERNAME}
- PERFORMANCE_POSTGRES_PASSWORD=${PERFORMANCE_POSTGRES_PASSWORD}
- DISCORD_WEBHOOK_URL=${GF_DISCORD_WEBHOOK_URL}
- REDIS_NODE_1=${REDIS_NODE_1}
- REDIS_NODE_2=${REDIS_NODE_2}
- REDIS_NODE_3=${REDIS_NODE_3}
- REDIS_NODE_4=${REDIS_NODE_4}
- REDIS_NODE_5=${REDIS_NODE_5}
- REDIS_NODE_6=${REDIS_NODE_6}
- ZIPKIN=${ZIPKIN}
- DISCORD_WEBHOOK_URL=${GF_DISCORD_WEBHOOK_URL}
depends_on:
eureka-server:
condition: service_started
Expand Down
17 changes: 0 additions & 17 deletions docker-compose/end_service.sh

This file was deleted.

32 changes: 0 additions & 32 deletions docker-compose/start_service.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
@EnableEurekaServer
@SpringBootApplication
public class EurekaServerApplication {

public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}

}
6 changes: 2 additions & 4 deletions eureka-server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ server:

eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: ${EUREKA_SERVER}
register-with-eureka: false
fetch-registry: false
instance:
hostname: eureka-server
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@Getter
@RequiredArgsConstructor
public enum CircuitBreakerErrorCase implements ErrorCase {

SERVICE_UNAVAILABLE(HttpStatus.SERVICE_UNAVAILABLE, "서비스가 연결 불가능합니다. 잠시 후 다시 시도해주세요."),
CONNECTION_TIMEOUT(HttpStatus.GATEWAY_TIMEOUT, "서비스 요청 시간이 초과되었습니다. 잠시 후 다시 시도해주세요."),
SERVICE_IS_OPEN(HttpStatus.SERVICE_UNAVAILABLE, "서비스가 연결 불가능합니다. 관리자에게 문의해주세요.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@AllArgsConstructor
public enum SecurityErrorCase implements ErrorCase {

USER_CACHE_IS_NULL(HttpStatus.INTERNAL_SERVER_ERROR, "내부 서버 오류"),
UNAUTHORIZED(HttpStatus.UNAUTHORIZED, "인증이 필요합니다."),
EXPIRED_TOKEN(HttpStatus.UNAUTHORIZED, "토큰이 만료되었습니다.");

private final HttpStatus httpStatus;
Expand Down
Loading
Loading