Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2c04982
infra: Dockerfile 추가
dev-ant Jul 23, 2025
b998a1b
infra: push-cd-dev workflows 작성
dev-ant Jul 24, 2025
b48f4df
chore: dockerignore 파일 추가
dev-ant Jul 24, 2025
e920f7e
chore: push-cd-dev 테스트용 임시 변경
dev-ant Jul 24, 2025
2ea1bae
infra: push-cd-dev 파일의 build step 추가
dev-ant Jul 24, 2025
e8d85f7
chore: dockerfile 위치 이동
dev-ant Jul 24, 2025
a5cda2c
fix: push-cd-dev 잘못된 경로 수정
dev-ant Jul 24, 2025
3824768
fix: push-cd-dev 잘못된 gradlew 수정
dev-ant Jul 24, 2025
7ad89ae
chore: jar 생성 경로 파악용 코드 추가
dev-ant Jul 24, 2025
0bc81d2
chore: dockerfile jar 경로 수정
dev-ant Jul 24, 2025
7c9ad1c
fix: dockerfile 파일 위치 이동
dev-ant Jul 24, 2025
fb1169f
fix: dockerignore build/ 라인 제거
dev-ant Jul 24, 2025
4cce7f9
fix: push-cd-dev docker build push 경로 통일
dev-ant Jul 24, 2025
2d927f0
feat: push-cd-dev pem 인증방식으로 변경
dev-ant Jul 24, 2025
56d5d10
refactor: push-cd-dev self-hosted를 사용하게 변경
dev-ant Jul 24, 2025
76669a5
feat: push-cd-dev deploy ssh key 설정
dev-ant Jul 30, 2025
b786a9a
infra: docke-compose-dev.yaml 추가
dev-ant Jul 30, 2025
b83f70e
feat: push-cd-dev에 docker-compose 관련 추가
dev-ant Jul 30, 2025
7143ae2
fix: push-cd-dev 오탈자 수정
dev-ant Jul 30, 2025
53a5bb3
fix: docke-compose-dev.yaml 파일명 오타 수정
dev-ant Jul 30, 2025
73be8de
fix: push-cd-dev ssh key 설정 추가
dev-ant Jul 30, 2025
443b6b7
fix: push-cd-dev mkdir docker compose path 명령어 추가
dev-ant Jul 30, 2025
67404ac
fix: docker-compose-dev.yaml 오탈자 수정
dev-ant Jul 30, 2025
c6cd3b3
refactor: auction history web client log 변경
dev-ant Jul 31, 2025
d22fdd0
fix: push-cd-dev .env 생성 명령어 삭제
dev-ant Jul 31, 2025
ae709c9
feat: push cd dev ssh 연결 유지 명령어 추가
dev-ant Jul 31, 2025
9ab5c36
fix: acution history client 원복
dev-ant Jul 31, 2025
030a971
feat: push-cd-dev trigger push로 변경
dev-ant Jul 31, 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
51 changes: 51 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# -----------------------------
# default
# -----------------------------
.git
.gitignore
*.log
*.md
.DS_Store
*.iml

# -----------------------------
# IDE 관련
# -----------------------------
.idea/
.vscode/
*.swp

# -----------------------------
# OS/툴 관련 캐시
# -----------------------------
Thumbs.db
ehthumbs.db
desktop.ini

# -----------------------------
# Gradle 빌드 결과물 및 캐시
# -----------------------------
build/
!build/libs/*.jar
.gradle/
!gradle/wrapper/gradle-wrapper.jar
.gradle/
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .gradle/ directory is listed twice (lines 30 and 32). Remove the duplicate entry to keep the file clean.

Suggested change
.gradle/

Copilot uses AI. Check for mistakes.

Comment on lines +32 to +33
Copy link

Copilot AI Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The '.gradle/' directory is listed twice (lines 30 and 32). Remove the duplicate entry to clean up the file.

Suggested change
.gradle/

Copilot uses AI. Check for mistakes.
# -----------------------------
# 환경/인증 관련 (보안 목적)
# -----------------------------
.env
*.pem
*.crt
*.key

# -----------------------------
# 테스트/커버리지
# -----------------------------
test-results/
test-output/
jacoco*.exec
coverage/
*.html
*.xml
*.json
79 changes: 79 additions & 0 deletions .github/workflows/push-cd-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Spring CD for Dev Push

on:
push:
branches: [ dev, main ]

permissions:
contents: read

jobs:
build-and-deploy:
name: Build Docker and Deploy to Remote Server
runs-on: ubuntu-latest

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

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

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

- name: Build JAR
run: ./gradlew clean bootJar

- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest .
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: Push Docker image
run: docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest

- name: Setup SSH key and config
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/my-key.pem
chmod 400 ~/.ssh/my-key.pem
ssh-keyscan -H ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts
echo -e "Host *\n ServerAliveInterval 60\n ServerAliveCountMax 3" >> ~/.ssh/config
- name: Create app directory on server
run: |
ssh -i ~/.ssh/my-key.pem ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} "mkdir -p /home/${{ secrets.SERVER_USER }}/app"
- name: Deploy and Restart Container
run: |
ssh -i ~/.ssh/my-key.pem ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} << 'EOF'
mkdir -p /home/${{ secrets.SERVER_USER }}/app
Copy link

Copilot AI Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The directory creation is duplicated - it's already done on line 51. This redundant command should be removed to avoid unnecessary operations.

Suggested change
mkdir -p /home/${{ secrets.SERVER_USER }}/app

Copilot uses AI. Check for mistakes.
cd /home/${{ secrets.SERVER_USER }}/app
echo "${{ secrets.ENV_FILE }}" > /home/${{ secrets.SERVER_USER }}/app/.env
docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest
docker compose -f docker-compose-dev.yaml down
docker compose -f docker-compose-dev.yaml up -d
echo "✅ Docker Compose finished. Containers should be up."
EOF
- name: Check Docker container health
run: |
ssh -i ~/.ssh/my-key.pem ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} << 'EOF'
CONTAINER_ID=$(docker ps -q --filter "ancestor=${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest")
if [ -z "$CONTAINER_ID" ]; then
echo "❌ ERROR: container does not run"
exit 1
fi
echo "✅ SUCCESS: container is running"
docker ps --filter "id=$CONTAINER_ID"
EOF
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Dockerfile
FROM openjdk:21-jdk-slim
ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]
31 changes: 31 additions & 0 deletions docker-compose-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: "3.8"

services:
spring-app:
image: ${DOCKER_USERNAME}/${DOCKER_REPO}:latest
container_name: spring-app
ports:
- "${SERVER_PORT}:${SERVER_PORT}"
env_file:
- .env
volumes:
- ./logs:/app/logs
- ./config:/app/config:ro
restart: always
networks:
- app-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:${SERVER_PORT}/actuator/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"

networks:
app-network:
driver: bridge
8 changes: 4 additions & 4 deletions src/main/resources/application-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ spring:
ignore-accept-header: true

jwt:
secret-key: ${JWT_SECRET_KEY:e4f1a5c8d2b7e9f0a6c3d1b8e5f2c7a9d4e6f3b1a2c8d5e9f0b3a7c2d1e8f5a4}
access-token-validity: ${JWT_ACCESS_TOKEN_VALIDITY:3600} # seconds (1 hour)
refresh-token-validity: ${JWT_REFRESH_TOKEN_VALIDITY:86400} # seconds (1 day)
secret-key: ${JWT_SECRET_KEY}
access-token-validity: ${JWT_ACCESS_TOKEN_VALIDITY} # seconds (1 hour)
refresh-token-validity: ${JWT_REFRESH_TOKEN_VALIDITY} # seconds (1 day)

springdoc:
swagger-ui:
Expand Down Expand Up @@ -94,7 +94,7 @@ openapi:
default-timeout-seconds: 5
auction-history:
delay-ms: 1000
cron: "0 0 */1 * * *" # 1시간마다 실행
cron: "0 0 */4 * * *" # 1시간마다 실행
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment '1시간마다 실행' (every hour) is incorrect for the cron expression '0 0 */4 * * *' which runs every 4 hours. The comment should be updated to '4시간마다 실행' (every 4 hours).

Suggested change
cron: "0 0 */4 * * *" # 1시간마다 실행
cron: "0 0 */4 * * *" # 4시간마다 실행

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is incorrect. The cron expression '0 0 */4 * * *' runs every 4 hours, not every hour. The comment should be '# 4시간마다 실행' to match the actual schedule.

Suggested change
cron: "0 0 */4 * * *" # 1시간마다 실행
cron: "0 0 */4 * * *" # 4시간마다 실행

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says '1시간마다 실행' (runs every hour) but the cron expression '0 0 */4 * * *' actually runs every 4 hours. The comment should be updated to '4시간마다 실행' (runs every 4 hours).

Suggested change
cron: "0 0 */4 * * *" # 1시간마다 실행
cron: "0 0 */4 * * *" # 4시간마다 실행

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says '1시간마다 실행' (runs every 1 hour) but the cron expression '0 0 */4 * * *' runs every 4 hours. The comment should be updated to '4시간마다 실행' to match the actual schedule.

Suggested change
cron: "0 0 */4 * * *" # 1시간마다 실행
cron: "0 0 */4 * * *" # 4시간마다 실행

Copilot uses AI. Check for mistakes.
min-price:
cron: "0 0 */4 * * *"

Expand Down