docs: CI/CD 가이드에 백엔드 배포 워크플로우 추가 #4
@ -44,10 +44,13 @@ export default function CiCdGuide() {
|
|||||||
<span className="text-accent">Gitea Actions 트리거</span> → act_runner (Docker 컨테이너)
|
<span className="text-accent">Gitea Actions 트리거</span> → act_runner (Docker 컨테이너)
|
||||||
</p>
|
</p>
|
||||||
<p className="pl-8">↓</p>
|
<p className="pl-8">↓</p>
|
||||||
<p className="pl-4">npm ci → npm run build → dist/ 생성</p>
|
|
||||||
<p className="pl-8">↓</p>
|
|
||||||
<p className="pl-4">
|
<p className="pl-4">
|
||||||
배포 경로에 복사 → <span className="text-success">Nginx 서빙</span>
|
<strong>프론트엔드:</strong> npm ci → npm run build → dist/ →{' '}
|
||||||
|
<span className="text-success">Nginx 서빙</span>
|
||||||
|
</p>
|
||||||
|
<p className="pl-4">
|
||||||
|
<strong>백엔드:</strong> mvn package → app.jar → .deploy-trigger →{' '}
|
||||||
|
<span className="text-success">systemd 자동 재시작</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -189,6 +192,16 @@ jobs: # 실행할 작업 목록
|
|||||||
<td className="px-4 py-3 text-text-secondary">Nexus npm 레지스트리 인증 (Base64)</td>
|
<td className="px-4 py-3 text-text-secondary">Nexus npm 레지스트리 인증 (Base64)</td>
|
||||||
<td className="px-4 py-3 text-text-secondary">gc-guide</td>
|
<td className="px-4 py-3 text-text-secondary">gc-guide</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td className="px-4 py-3 font-mono text-text-primary">NEXUS_USERNAME</td>
|
||||||
|
<td className="px-4 py-3 text-text-secondary">Nexus Maven 레포지토리 사용자명</td>
|
||||||
|
<td className="px-4 py-3 text-text-secondary">gc-guide-api</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td className="px-4 py-3 font-mono text-text-primary">NEXUS_PASSWORD</td>
|
||||||
|
<td className="px-4 py-3 text-text-secondary">Nexus Maven 레포지토리 비밀번호</td>
|
||||||
|
<td className="px-4 py-3 text-text-secondary">gc-guide-api</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -246,14 +259,23 @@ jobs:
|
|||||||
마운트되어 있습니다. 빌드 결과물을 복사하면 Nginx가 즉시 서빙합니다.
|
마운트되어 있습니다. 빌드 결과물을 복사하면 Nginx가 즉시 서빙합니다.
|
||||||
</Alert>
|
</Alert>
|
||||||
|
|
||||||
{/* gc-guide-api 워크플로우 예시 (향후) */}
|
{/* gc-guide-api 워크플로우 예시 */}
|
||||||
<h2 className="text-xl font-bold text-text-primary mt-10 mb-4">gc-guide-api 워크플로우 (Spring Boot, 예정)</h2>
|
<h2 className="text-xl font-bold text-text-primary mt-10 mb-4">gc-guide-api 워크플로우 (Spring Boot)</h2>
|
||||||
<p className="text-text-secondary mb-4">
|
<p className="text-text-secondary mb-4">
|
||||||
Java/Spring Boot 프로젝트의 워크플로우 예시입니다. 향후 gc-guide-api에 적용 예정입니다.
|
gc-guide-api 프로젝트의 실제 배포 워크플로우입니다.
|
||||||
|
Maven 컨테이너 이미지에서 빌드하고, JAR 파일을 배포 경로에 복사합니다.
|
||||||
|
배포 트리거 파일이 갱신되면 systemd가 자동으로 서비스를 재시작합니다.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<Alert type="warning">
|
||||||
|
Maven 이미지(<code className="bg-bg-tertiary px-1 rounded">maven:3.9-eclipse-temurin-17</code>)에는 Node.js가 없어서{' '}
|
||||||
|
<code className="bg-bg-tertiary px-1 rounded">actions/checkout@v4</code>를 사용할 수 없습니다.
|
||||||
|
대신 <code className="bg-bg-tertiary px-1 rounded">git clone</code>으로 소스를 가져옵니다.
|
||||||
|
</Alert>
|
||||||
|
|
||||||
<CodeBlock
|
<CodeBlock
|
||||||
language="yaml"
|
language="yaml"
|
||||||
filename=".gitea/workflows/deploy.yml (예정)"
|
filename=".gitea/workflows/deploy.yml"
|
||||||
code={`name: Build and Deploy API
|
code={`name: Build and Deploy API
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@ -268,12 +290,14 @@ jobs:
|
|||||||
image: maven:3.9-eclipse-temurin-17
|
image: maven:3.9-eclipse-temurin-17
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
run: |
|
||||||
|
git clone --depth=1 --branch=\$\{GITHUB_REF_NAME\} \\
|
||||||
|
http://gitea:3000/\$\{GITHUB_REPOSITORY\}.git .
|
||||||
|
|
||||||
- name: Configure Maven (settings.xml)
|
- name: Configure Maven settings
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.m2
|
mkdir -p ~/.m2
|
||||||
cat > ~/.m2/settings.xml << 'EOF'
|
cat > ~/.m2/settings.xml << 'SETTINGS'
|
||||||
<settings>
|
<settings>
|
||||||
<mirrors>
|
<mirrors>
|
||||||
<mirror>
|
<mirror>
|
||||||
@ -290,17 +314,54 @@ jobs:
|
|||||||
</server>
|
</server>
|
||||||
</servers>
|
</servers>
|
||||||
</settings>
|
</settings>
|
||||||
EOF
|
SETTINGS
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: mvn clean package -DskipTests
|
run: mvn clean package -DskipTests -B
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
run: |
|
run: |
|
||||||
cp target/*.jar /deploy/api/app.jar
|
cp target/gc-guide-api-*.jar /deploy/api/app.jar
|
||||||
# 서비스 재시작은 별도 스크립트로 처리`}
|
date '+%Y-%m-%d %H:%M:%S' > /deploy/api/.deploy-trigger
|
||||||
|
echo "Deployed at $(date '+%Y-%m-%d %H:%M:%S')"
|
||||||
|
ls -la /deploy/api/`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Alert type="info">
|
||||||
|
<code className="bg-bg-tertiary px-1 rounded">/deploy/api/</code>는 act_runner 컨테이너 설정에서
|
||||||
|
호스트의 <code className="bg-bg-tertiary px-1 rounded">/devdata/services/guide/api/</code>에
|
||||||
|
마운트되어 있습니다. <code className="bg-bg-tertiary px-1 rounded">.deploy-trigger</code> 파일이
|
||||||
|
갱신되면 systemd path watcher가 감지하여 서비스를 자동 재시작합니다.
|
||||||
|
</Alert>
|
||||||
|
|
||||||
|
<h3 className="text-lg font-semibold text-text-primary mt-6 mb-3">자동 재시작 흐름</h3>
|
||||||
|
<div className="bg-surface border border-border-default rounded-xl p-5 mb-6">
|
||||||
|
<div className="font-mono text-sm space-y-1 text-text-secondary">
|
||||||
|
<p>main 머지 → Gitea Actions 트리거 → Maven 빌드</p>
|
||||||
|
<p className="pl-8">↓</p>
|
||||||
|
<p className="pl-4">
|
||||||
|
<code>app.jar</code> 복사 + <code>.deploy-trigger</code> 갱신
|
||||||
|
</p>
|
||||||
|
<p className="pl-8">↓</p>
|
||||||
|
<p className="pl-4">
|
||||||
|
<span className="text-accent">systemd path watcher</span> 감지 →{' '}
|
||||||
|
<code>gc-guide-api.service</code> 재시작
|
||||||
|
</p>
|
||||||
|
<p className="pl-8">↓</p>
|
||||||
|
<p className="pl-4">
|
||||||
|
<span className="text-success">Spring Boot 앱 자동 기동</span> (포트 8082, prod 프로필)
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 className="text-lg font-semibold text-text-primary mt-6 mb-3">Checkout 시 주의사항</h3>
|
||||||
|
<p className="text-text-secondary mb-4">
|
||||||
|
Java 빌드에 <code className="bg-bg-tertiary px-1 rounded">container</code> 옵션으로 Maven 이미지를 직접 지정하면,
|
||||||
|
job 컨테이너에 Node.js가 설치되어 있지 않아 <code className="bg-bg-tertiary px-1 rounded">actions/checkout@v4</code>가
|
||||||
|
실패합니다. 이 경우 <code className="bg-bg-tertiary px-1 rounded">git clone</code>으로 대체하고,
|
||||||
|
Gitea 내부 네트워크 주소(<code className="bg-bg-tertiary px-1 rounded">http://gitea:3000</code>)를 사용합니다.
|
||||||
|
</p>
|
||||||
|
|
||||||
{/* Actions 확인 */}
|
{/* Actions 확인 */}
|
||||||
<h2 className="text-xl font-bold text-text-primary mt-10 mb-4">빌드 결과 확인</h2>
|
<h2 className="text-xl font-bold text-text-primary mt-10 mb-4">빌드 결과 확인</h2>
|
||||||
<StepGuide
|
<StepGuide
|
||||||
@ -483,6 +544,33 @@ cd /devdata/services && docker compose down && docker compose up -d`}
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="bg-surface border border-border-default rounded-xl p-5">
|
||||||
|
<h4 className="font-semibold text-text-primary mb-2">Maven 빌드 실패</h4>
|
||||||
|
<ul className="list-disc list-inside text-text-secondary space-y-1 text-sm">
|
||||||
|
<li>NEXUS_USERNAME, NEXUS_PASSWORD 시크릿이 올바르게 설정되어 있는지 확인</li>
|
||||||
|
<li>
|
||||||
|
<code className="bg-bg-tertiary px-1 rounded">container</code> 옵션 사용 시{' '}
|
||||||
|
<code className="bg-bg-tertiary px-1 rounded">actions/checkout@v4</code> 대신{' '}
|
||||||
|
<code className="bg-bg-tertiary px-1 rounded">git clone</code> 사용 필수 (Node.js 없음)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Checkout URL은 <code className="bg-bg-tertiary px-1 rounded">http://gitea:3000</code> 사용
|
||||||
|
(GITHUB_SERVER_URL은 github.com으로 고정됨)
|
||||||
|
</li>
|
||||||
|
<li>Nexus Maven 미러가 접근 가능한지 확인 (devnet 네트워크)</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="bg-surface border border-border-default rounded-xl p-5">
|
||||||
|
<h4 className="font-semibold text-text-primary mb-2">API 서비스가 재시작되지 않음</h4>
|
||||||
|
<ul className="list-disc list-inside text-text-secondary space-y-1 text-sm">
|
||||||
|
<li>systemd path watcher 상태: <code className="bg-bg-tertiary px-1 rounded">systemctl status gc-guide-api-watcher.path</code></li>
|
||||||
|
<li>서비스 상태: <code className="bg-bg-tertiary px-1 rounded">systemctl status gc-guide-api</code></li>
|
||||||
|
<li>.deploy-trigger 파일 확인: <code className="bg-bg-tertiary px-1 rounded">cat /devdata/services/guide/api/.deploy-trigger</code></li>
|
||||||
|
<li>서비스 로그: <code className="bg-bg-tertiary px-1 rounded">journalctl -u gc-guide-api -n 50</code></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="bg-surface border border-border-default rounded-xl p-5">
|
<div className="bg-surface border border-border-default rounded-xl p-5">
|
||||||
<h4 className="font-semibold text-text-primary mb-2">배포 후 변경 사항이 안 보임</h4>
|
<h4 className="font-semibold text-text-primary mb-2">배포 후 변경 사항이 안 보임</h4>
|
||||||
<ul className="list-disc list-inside text-text-secondary space-y-1 text-sm">
|
<ul className="list-disc list-inside text-text-secondary space-y-1 text-sm">
|
||||||
|
|||||||
불러오는 중...
Reference in New Issue
Block a user