Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
558bd15
feat: Create gradle.yml
bleuxsy Aug 1, 2025
728e0a1
fix: Change git file
bleuxsy Aug 1, 2025
ad483f6
fix: Modify file
bleuxsy Aug 1, 2025
f542193
Merge pull request #23 from GoormOne/release-1
bleuxsy Aug 1, 2025
0309f22
feat: Add EC2 Configuration
bleuxsy Aug 1, 2025
9d6f1aa
fix: Modify deploy.yml
bleuxsy Aug 1, 2025
aa05329
fix: Modify FIle
bleuxsy Aug 1, 2025
2d1ff5d
fix: Modify deploy.yml
bleuxsy Aug 1, 2025
4bed9c0
fix: Update deploy.yml
bleuxsy Aug 1, 2025
c11cf8a
fix: Modify deploy.yml
bleuxsy Aug 1, 2025
210c219
feat: Create gradle.yml
bleuxsy Aug 1, 2025
bbb4414
fix: Change git file
bleuxsy Aug 1, 2025
5d14392
fix: Modify file
bleuxsy Aug 1, 2025
109fadb
feat: Add EC2 Configuration
bleuxsy Aug 1, 2025
b68f4e4
fix: Modify deploy.yml
bleuxsy Aug 1, 2025
dabfddc
fix: Modify FIle
bleuxsy Aug 1, 2025
633b7d3
fix: Modify deploy.yml
bleuxsy Aug 1, 2025
f0ab502
fix: Update deploy.yml
bleuxsy Aug 1, 2025
2fc85c0
fix: Modify deploy.yml
bleuxsy Aug 1, 2025
c56a71f
Merge remote-tracking branch 'origin/release' into release
bleuxsy Aug 4, 2025
840248d
chore: Connect with Swagger #26
bleuxsy Aug 4, 2025
936b76f
fix: Modify the deploy.yml #26
bleuxsy Aug 4, 2025
13fc8d9
fix: Modify the deploy.yml #26
bleuxsy Aug 4, 2025
fa7387e
fix: Modify the deploy.yml #26
bleuxsy Aug 4, 2025
0608fb2
fix: Update the database #26
bleuxsy Aug 4, 2025
bf6135a
fix: Update the application.yml #26
bleuxsy Aug 4, 2025
8580b55
fix: Update the application.yml #26
bleuxsy Aug 4, 2025
bef7f02
fix: Update the Usercontroller #26
bleuxsy Aug 4, 2025
b8abbd5
fix: Update the application.yaml #26
bleuxsy Aug 4, 2025
bcfc95a
Merge branch 'develop' into release
bleuxsy Aug 4, 2025
3183597
Merge branch 'develop' into release
bleuxsy Aug 4, 2025
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
58 changes: 58 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Java CI + CD

on:
push:
branches: [ "release" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Build with Gradle
run: ./gradlew build --exclude-task test

- name: Upload JAR file
uses: actions/upload-artifact@v4
with:
name: springboot-jar
path: build/libs/${{ secrets.JAR_NAME }}

deploy:
name: Deploy to EC2
needs: build
runs-on: ubuntu-latest
steps:
- name: Download JAR file from build
uses: actions/download-artifact@v4
with:
name: springboot-jar
path: .

- name: Prepare SSH Key
run: |
echo "${{ secrets.EC2_KEY }}" > private_key.pem
chmod 600 private_key.pem

- name: Check JAR existence
run: |
ls -l ${{ secrets.JAR_NAME }}

- name: Copy JAR to EC2
run: |
scp -o StrictHostKeyChecking=no -i private_key.pem ${{ secrets.JAR_NAME }} \
${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:${{ secrets.DEPLOY_PATH }}/app.jar

- name: Run JAR on EC2
run: |
ssh -o StrictHostKeyChecking=no -i private_key.pem ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << EOF
pkill -f 'java -jar' || true
nohup java -jar ${{ secrets.DEPLOY_PATH }}/app.jar > ${{ secrets.DEPLOY_PATH }}/app.log 2>&1 &
EOF
17 changes: 7 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.5.4'
id 'org.springframework.boot' version '3.2.5'
id 'io.spring.dependency-management' version '1.1.7'
}

Expand All @@ -24,17 +24,14 @@ repositories {
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'jakarta.validation:jakarta.validation-api:3.0.2'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'org.hibernate.validator:hibernate-validator:8.0.1.Final'
implementation 'org.glassfish:jakarta.el:4.0.2'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
implementation 'com.google.code.findbugs:jsr305:3.0.2'

annotationProcessor 'org.projectlombok:lombok'

compileOnly 'org.projectlombok:lombok'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
runtimeOnly 'org.postgresql:postgresql'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/com/profect/delivery/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.profect.delivery.config;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

@Configuration
@EnableWebMvc
public class SwaggerConfig {

@Bean
public OpenAPI openAPI() {
return new OpenAPI()
.components(new Components())
.info(apiInfo());
}

private Info apiInfo() {
return new Info()
.title("API Title") // API의 제목
.description("This is my Swagger UI") // API에 대한 설명
.version("1.0.0"); // API의 버전
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class UserController {

@GetMapping
public ResponseEntity<ApiResponse<UserResponseDto>> getUser() {
String currentUserId = "user002";//인증인가 가져오면 유저 id 추출
String currentUserId = "U000000001";//인증인가 가져오면 유저 id 추출

return userService.getUserById(currentUserId)
.map(UserResponseDto::fromEntity) // Entity를 DTO로 변환
Expand All @@ -40,7 +40,7 @@ public ResponseEntity<ApiResponse<UserResponseDto>> getUser() {
public ResponseEntity<ApiResponse<?>> patchUser(
@RequestBody UserUpdateRequestDto userUpdateRequestDto) {

String currentUserId = "user001";//인증인가에서 가져온 유저 id
String currentUserId = "U000000001";//인증인가에서 가져온 유저 id
String updateby="admin";//인증인가에서 가져온 업데이트한 사람

userService.updateUser(userUpdateRequestDto,currentUserId,updateby);
Expand All @@ -53,7 +53,7 @@ public ResponseEntity<ApiResponse<?>> patchUser(

@GetMapping("/addresses")
public ResponseEntity<ApiResponse<List<UserAddressesResponseDto>>> getUserAddresses() {
String currentUserId = "user001";
String currentUserId = "U000000001";

List<UserAddressesResponseDto> addresses = userAddressService.findByUserId(currentUserId).stream()
.map(UserAddressesResponseDto::fromEntity) // 각 엔티티를 DTO로 변환
Expand All @@ -68,7 +68,7 @@ public ResponseEntity<ApiResponse<List<UserAddressesResponseDto>>> getUserAddres
public ResponseEntity<ApiResponse<?>> postUserAddressses(
@RequestBody UserAddressesRequestDto userAddressesRequestDto) {

String currentUserId = "user001";
String currentUserId = "U000000001";

userAddressService.CreateUserAddress(userAddressesRequestDto,currentUserId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,14 @@ public ResponseEntity<ApiResponse<?>> handleValidationExceptions(MethodArgumentN
@ExceptionHandler(Exception.class)
public ResponseEntity<ApiResponse<?>> handleAllUncaughtException(Exception e,
HttpServletRequest request) {
ErrorResponse err = ErrorResponse.of(50000, "서버 내부 오류가 발생했습니다.", request.getRequestURI());
saveErrorLog(e, request, 50000);

// Swagger 요청이면 예외를 다시 던져 Spring 기본 처리로 넘김
String path = request.getRequestURI();
if (path.contains("/v3/api-docs") || path.contains("/swagger-ui")) {
throw new RuntimeException(e);
}

ErrorResponse err = ErrorResponse.of(50000, "서버 내부 오류가 발생했습니다.", path);

return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(ApiResponse.failure(err));
Expand Down
11 changes: 6 additions & 5 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
server:
address: 0.0.0.0
port: 8080
spring:
application:
name: sample-project

datasource:
# url: jdbc:postgresql://localhost:5432/sample
# driver-class-name: org.postgresql.Driver
# username: user
# password: password
url: jdbc:postgresql://43.200.244.12:5432/sample

url: jdbc:postgresql://43.200.244.12/sample

driver-class-name: org.postgresql.Driver
username: postgres
password: password
Expand Down