-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
259 changed files
with
11,641 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ "main", "develop" ] | ||
pull_request: | ||
branches: [ "main", "develop" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Github Repository 에 올린 파일들을 볼러오기 | ||
uses: actions/checkout@v4 | ||
|
||
- name: JDK 17 버전 설치 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
|
||
- name: application.yml 파일 만들기 | ||
run: | | ||
mkdir -p ./src/main/resources | ||
echo "${{ secrets.APPLICATION_YML }}" > ./src/main/resources/application.yml | ||
echo "${{ secrets.APPLICATION_COMMON }}" > ./src/main/resources/application-common.yml | ||
echo "${{ secrets.APPLICATION_DEV }}" > ./src/main/resources/application-dev.yml | ||
echo "${{ secrets.APPLICATION_PROD }}" > ./src/main/resources/application-prod.yml | ||
echo "${{ secrets.APPLICATION_LOCAL }}" > ./src/main/resources/application-local.yml | ||
echo "${{ secrets.APPLICATION_TEST }}" > ./src/main/resources/application-test.yml | ||
- name: gradlew 실행 권한 부여 | ||
run: chmod +x ./gradlew | ||
|
||
- name: 테스트 및 빌드하기 (main 브랜치) | ||
if: github.ref == 'refs/heads/main' | ||
run: ./gradlew clean build -PspringProfile=prod --warning-mode all --scan | ||
|
||
- name: 테스트 및 빌드하기 (develop 브랜치) | ||
if: github.ref == 'refs/heads/develop' | ||
run: | | ||
./gradlew clean test -PspringProfile=test | ||
./gradlew build -x test -PspringProfile=dev --warning-mode all --scan | ||
- name: 빌드된 파일 이름 변경 | ||
run: mv ./build/libs/*SNAPSHOT.jar ./project.jar | ||
|
||
- name: SCP로 EC2에 빌드된 파일 전송 | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
source: project.jar | ||
target: /home/ubuntu/solitour-server/tobe | ||
|
||
- name: SSH로 EC2 접속 | ||
if: github.ref == 'refs/heads/main' | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
script_stop: true | ||
script: | | ||
rm -rf /home/ubuntu/solitour-server/current | ||
mkdir /home/ubuntu/solitour-server/current | ||
mv /home/ubuntu/solitour-server/tobe/project.jar /home/ubuntu/solitour-server/current/project.jar | ||
cd /home/ubuntu/solitour-server/current | ||
sudo fuser -k -n tcp 8080 || true | ||
nohup java -jar -Dspring.profiles.active=prod project.jar & > ./output.log 2>&1 & | ||
rm -rf /home/ubuntu/solitour-server/tobe | ||
- name: SSH로 EC2 접속 | ||
if: github.ref == 'refs/heads/develop' | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
script_stop: true | ||
script: | | ||
rm -rf /home/ubuntu/solitour-server/current | ||
mkdir /home/ubuntu/solitour-server/current | ||
mv /home/ubuntu/solitour-server/tobe/project.jar /home/ubuntu/solitour-server/current/project.jar | ||
cd /home/ubuntu/solitour-server/current | ||
sudo fuser -k -n tcp 8080 || true | ||
nohup java -jar -Dspring.profiles.active=dev project.jar > ./output.log 2>&1 & | ||
rm -rf /home/ubuntu/solitour-server/tobe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "gradle/wrapper/config"] | ||
path = gradle/wrapper/config | ||
url = https://github.com/TripInfoWeb/config.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,76 @@ | ||
plugins { | ||
id 'java' | ||
id 'org.springframework.boot' version '3.3.0' | ||
id 'io.spring.dependency-management' version '1.1.5' | ||
id 'org.asciidoctor.jvm.convert' version '3.3.2' | ||
id 'java' | ||
id 'org.springframework.boot' version '3.3.0' | ||
id 'io.spring.dependency-management' version '1.1.5' | ||
id 'org.asciidoctor.jvm.convert' version '3.3.2' | ||
} | ||
|
||
group = 'solitour-backend' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
} | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
} | ||
} | ||
|
||
configurations { | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenCentral() | ||
} | ||
|
||
ext { | ||
set('snippetsDir', file("build/generated-snippets")) | ||
set('snippetsDir', file("build/generated-snippets")) | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc' | ||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' | ||
implementation 'org.springframework.boot:spring-boot-starter-jdbc' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
compileOnly 'org.projectlombok:lombok' | ||
runtimeOnly 'com.mysql:mysql-connector-j' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc' | ||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc' | ||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' | ||
implementation 'org.springframework.boot:spring-boot-starter-validation' | ||
|
||
|
||
implementation 'io.jsonwebtoken:jjwt-api:0.12.6' | ||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.6' | ||
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.6' | ||
|
||
implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE' | ||
compileOnly 'org.projectlombok:lombok' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
testAnnotationProcessor 'org.projectlombok:lombok' | ||
|
||
implementation 'org.mapstruct:mapstruct:1.5.5.Final' | ||
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.5.Final' | ||
|
||
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta' | ||
// queryDsl 라이브러리 | ||
annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jakarta" | ||
annotationProcessor "jakarta.annotation:jakarta.annotation-api" | ||
annotationProcessor "jakarta.persistence:jakarta.persistence-api" | ||
|
||
runtimeOnly 'com.mysql:mysql-connector-j' | ||
|
||
testImplementation 'com.h2database:h2' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc' | ||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher' | ||
} | ||
|
||
tasks.named('test') { | ||
outputs.dir snippetsDir | ||
useJUnitPlatform() | ||
outputs.dir snippetsDir | ||
useJUnitPlatform() | ||
} | ||
|
||
tasks.named('asciidoctor') { | ||
inputs.dir snippetsDir | ||
dependsOn test | ||
inputs.dir snippetsDir | ||
dependsOn test | ||
} | ||
|
||
//clean { | ||
// delete file('src/main/generated') | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
version: '3' | ||
services: | ||
solitour: | ||
image: library/mysql:8.3 | ||
container_name: solitour-db | ||
restart: always | ||
ports: | ||
- "3306:3306" | ||
environment: | ||
MYSQL_ROOT_PASSWORD: 1234 | ||
MYSQL_DATABASE: solitour | ||
MYSQL_USER: soli | ||
MYSQL_PASSWORD: 1234 | ||
TZ: Asia/Seoul | ||
DB_HOST: host.docker.internal | ||
command: | ||
- --character-set-server=utf8mb4 | ||
- --collation-server=utf8mb4_unicode_ci | ||
volumes: | ||
- ./db/mysql/data:/var/lib/mysql | ||
- ./db/mysql/config:/etc/mysql/conf.d | ||
- ./db/mysql/init:/docker-entrypoint-initdb.d | ||
platform: linux/x86_64 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/solitour_backend/solitour/admin/controller/AdminController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package solitour_backend.solitour.admin.controller; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import solitour_backend.solitour.admin.dto.UserListWithPage; | ||
import solitour_backend.solitour.admin.service.AdminService; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/admin") | ||
public class AdminController { | ||
|
||
private final AdminService adminService; | ||
|
||
@GetMapping("/user/list") | ||
public ResponseEntity<UserListWithPage> getUserInfoList(@RequestParam(defaultValue = "1") int page, | ||
@RequestParam(defaultValue = "") String nickname) { | ||
UserListWithPage response = adminService.getUserInfoList(nickname, page); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/solitour_backend/solitour/admin/controller/BannerController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package solitour_backend.solitour.admin.controller; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestPart; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.multipart.MultipartFile; | ||
import solitour_backend.solitour.admin.entity.Banner; | ||
import solitour_backend.solitour.admin.service.BannerService; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/banner") | ||
public class BannerController { | ||
private final BannerService bannerService; | ||
|
||
@RequestMapping(method = RequestMethod.POST) | ||
public ResponseEntity createBanner(@RequestPart("imageFile") MultipartFile imageFile, | ||
@RequestPart("directory") String directory) { | ||
Banner banner = bannerService.createBanner(imageFile, directory); | ||
return ResponseEntity | ||
.status(HttpStatus.OK) | ||
.body(banner); | ||
} | ||
|
||
@RequestMapping(method = RequestMethod.GET) | ||
public ResponseEntity getBannerList() { | ||
return bannerService.getBannerList(); | ||
} | ||
|
||
@RequestMapping(method = RequestMethod.DELETE, value = "/{id}") | ||
public ResponseEntity<String> deleteBanner(@PathVariable Long id) { | ||
return bannerService.deleteBanner(id); | ||
} | ||
|
||
} |
Oops, something went wrong.