- deploy/systemd: kintex.service(백엔드 8021) + kintex-nanobanana.service(워커, GEMINI env 워커 한정) - deploy/nginx: kintex.zioinfo.kr vhost(/ static, /api·/ws → 8021) - deploy/deploy_kintex.sh: 검증→원자교체→헬스체크→롤백(WISE 패턴) - deploy/setup_kintex_service.py: 멱등 프로비저닝(유닛·venv·nginx) - deploy/deploy_server_kintex_block.py: 서버 webhook 블록 정본 사본 - Jenkinsfile: push→build(vite+bootJar)→deploy→health - .gitattributes: 배포 산출물 LF 강제 포트 8021 배정(8003~8020 기존 GUARDiA 예약). 시크릿은 서버 env only(미커밋). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
73 lines
2.8 KiB
Groovy
73 lines
2.8 KiB
Groovy
// KINTEX 자동전시시스템 — CI/CD 파이프라인 (git push → Gitea webhook → 빌드 → 배포 → 헬스체크)
|
|
// 실행 노드: 서버(101.79.17.164) Jenkins. 프론트(vite)→/var/www/kintex, 백엔드(bootJar)→/opt/kintex/app/app.jar,
|
|
// kintex.service + kintex-nanobanana.service 재기동. 배포 단계는 sudo(deploy_kintex.sh) 위임.
|
|
// ※ 상시 자동배포는 deploy_server.py(webhook, 포트 9999)의 kintex 블록이 1차 경로. 본 파이프라인은 Jenkins 병행 트랙.
|
|
pipeline {
|
|
agent any
|
|
options {
|
|
timeout(time: 40, unit: 'MINUTES')
|
|
timestamps()
|
|
buildDiscarder(logRotator(numToKeepStr: '10'))
|
|
}
|
|
environment {
|
|
WEB_ROOT = '/var/www/kintex'
|
|
APP_JAR = '/opt/kintex/app/app.jar'
|
|
BACKEND_PORT = '8021'
|
|
}
|
|
stages {
|
|
stage('Checkout') {
|
|
steps { checkout scm }
|
|
}
|
|
stage('Frontend Build') {
|
|
steps {
|
|
dir('src/frontend') {
|
|
sh 'npm ci --silent || npm install --silent'
|
|
sh 'NODE_OPTIONS=--max-old-space-size=4096 npm run build'
|
|
}
|
|
}
|
|
}
|
|
stage('Backend Build') {
|
|
steps {
|
|
dir('src/backend') {
|
|
sh 'chmod +x gradlew'
|
|
sh './gradlew clean bootJar -x test -q --no-daemon'
|
|
}
|
|
}
|
|
}
|
|
stage('Verify Jar') {
|
|
steps {
|
|
sh '''
|
|
JAR=$(ls -1 src/backend/build/libs/kintex-backend-*.jar | grep -v plain | head -1)
|
|
[ -n "$JAR" ] || { echo "jar not found"; exit 1; }
|
|
unzip -l "$JAR" | grep -q 'BOOT-INF/classes/com/zioinfo/kintex/KintexApplication.class' \
|
|
|| { echo "invalid jar (no main class)"; exit 1; }
|
|
echo "jar OK: $JAR"
|
|
'''
|
|
}
|
|
}
|
|
stage('Deploy') {
|
|
steps {
|
|
// 권한 필요한 배포는 deploy_kintex.sh 로 위임(sudo NOPASSWD 권장).
|
|
sh 'sudo /opt/kintex/deploy_kintex.sh "$WORKSPACE"'
|
|
}
|
|
}
|
|
stage('Health Check') {
|
|
steps {
|
|
sh '''
|
|
for i in $(seq 1 15); do
|
|
code=$(curl -s -m 6 -o /dev/null -w '%{http_code}' http://127.0.0.1:'"$BACKEND_PORT"'/health || true)
|
|
echo "health try $i: $code"
|
|
if [ "$code" = "200" ]; then exit 0; fi
|
|
sleep 5
|
|
done
|
|
echo "health check failed"; systemctl is-active kintex.service || true; exit 1
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
success { echo 'KINTEX 배포 성공 (kintex.zioinfo.kr, 백엔드 8021)' }
|
|
failure { echo 'KINTEX 빌드/배포 실패 — 롤백은 deploy_kintex.sh 가 수행' }
|
|
}
|
|
}
|