diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5d24c50 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM amazoncorretto:21 + +# healthcheck용 curl 설치 +RUN yum -y install curl && yum clean all + +WORKDIR /api + +# build/libs 아래 산출물 이름이 바뀌어도 대응 +ARG JAR_FILE=build/libs/*.jar +COPY ${JAR_FILE} api.jar + +ENV JAVA_OPTS="" + +ENTRYPOINT ["sh","-c","java $JAVA_OPTS -jar /api/api.jar"] diff --git a/Jenkinsfile.pjt b/Jenkinsfile.pjt new file mode 100644 index 0000000..1aa89cb --- /dev/null +++ b/Jenkinsfile.pjt @@ -0,0 +1,30 @@ +pipeline { + agent any + + options { + timestamps() + disableConcurrentBuilds() + } + + environment { + // ===== Registry ===== + } + + stages { + stage('1) Git check out') { + steps { + checkout scm + } + } + + stage('2) Build (Gradle)') { + steps { + sh ''' + set -e + chmod +x ./gradlew + ./gradlew clean build -x test + ''' + } + } + } +} diff --git a/deploy/pjt/compose/api-compose.pjt.yml b/deploy/pjt/compose/api-compose.pjt.yml new file mode 100644 index 0000000..cc18bfa --- /dev/null +++ b/deploy/pjt/compose/api-compose.pjt.yml @@ -0,0 +1,37 @@ +services: + app: + image: registry.pjt.kr/alist/api:${IMAGE_TAG} + restart: always + + ports: + - "127.0.0.1:8006:8080" + + env_file: + - /srv/project/alist/env/api/.env + + # 🔴 핵심: 로그 볼륨 연결 + volumes: + - /srv/project/alist/logs/api/app:/logs + + environment: + JAVA_OPTS: >- + -Dspring.profiles.active=${SPRING_PROFILE} + -Xms${JVM_XMS} + -Xmx${JVM_XMX} + -XX:MaxMetaspaceSize=${JVM_META} + -Dfile.encoding=UTF-8 + -Duser.timezone=Asia/Seoul + + healthcheck: + test: ["CMD-SHELL", "curl -fsS http://localhost:8080/actuator/health || exit 1"] + interval: 10s + timeout: 3s + retries: 10 + start_period: 30s + + # 🟡 보험: 도커 로그 폭주 방지 + logging: + driver: json-file + options: + max-size: "10m" + max-file: "5" diff --git a/src/main/resources/application-local.yaml b/src/main/resources/application-local.yaml new file mode 100644 index 0000000..642f4b9 --- /dev/null +++ b/src/main/resources/application-local.yaml @@ -0,0 +1,5 @@ +spring: + application: + name: api +logging: + config: classpath:logback-local.xml diff --git a/src/main/resources/application-pjt.yaml b/src/main/resources/application-pjt.yaml new file mode 100644 index 0000000..792502f --- /dev/null +++ b/src/main/resources/application-pjt.yaml @@ -0,0 +1,5 @@ +spring: + application: + name: api +logging: + config: classpath:logback-pjt.xml diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt new file mode 100644 index 0000000..f4139a7 --- /dev/null +++ b/src/main/resources/banner.txt @@ -0,0 +1,16 @@ + + q p ,, + db \ / `7MMF' db mm + ;MM:o=--*--=o MM MM + ,V^MM. / \ MM `7MM ,pP"Ybd mmMMmm + ,M `MM d b MM MM 8I `" MM + AbmmmqMA MM , MM `YMMMa. MM + A' VML MM ,M MM L. I8 MM +.AMA. .AMMA. .JMMmmmmMMM .JMML.M9mmmP' `Mbmo + + +:: ALIST API :: +Application : ${spring.application.name} +Profile : ${spring.profiles.active} +Spring Boot : ${spring-boot.version} +Java : ${java.version} \ No newline at end of file diff --git a/src/main/resources/logback-local.xml b/src/main/resources/logback-local.xml new file mode 100644 index 0000000..eb719dd --- /dev/null +++ b/src/main/resources/logback-local.xml @@ -0,0 +1,22 @@ + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + diff --git a/src/main/resources/logback-pjt.xml b/src/main/resources/logback-pjt.xml new file mode 100644 index 0000000..07198af --- /dev/null +++ b/src/main/resources/logback-pjt.xml @@ -0,0 +1,50 @@ + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + ${LOG_PATH}/app.log + + + + + + ${LOG_PATH}/%d{yyyy/MM}/app.%d{yyyy-MM-dd}.%i.log.gz + + + + 50MB + + + 180 + true + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %logger - %msg%n + + + + + + + + + + + + +