perf: [deploy] rsync 전송량 4.1GB→100MB 최적화
- .next/cache 제외 (서버 런타임에 불필요, 3.1GB 절감) - node_modules rsync 대신 서버에서 npm install (931MB 절감) - package-lock.json 추가 전송 (서버 install 정확성) - 예상: rsync 130초 → ~30초
This commit is contained in:
13
Jenkinsfile
vendored
13
Jenkinsfile
vendored
@@ -122,10 +122,11 @@ pipeline {
|
||||
sh """
|
||||
rsync -az --delete \
|
||||
--exclude='.git' --exclude='.env*' --exclude='ecosystem.config.*' \
|
||||
.next package.json next.config.ts public node_modules \
|
||||
--exclude='.next/cache' \
|
||||
.next package.json package-lock.json next.config.ts public \
|
||||
${DEPLOY_USER}@114.203.209.83:/home/webservice/react/
|
||||
scp .env.production ${DEPLOY_USER}@114.203.209.83:/home/webservice/react/.env.production
|
||||
ssh ${DEPLOY_USER}@114.203.209.83 'cd /home/webservice/react && pm2 restart sam-react'
|
||||
ssh ${DEPLOY_USER}@114.203.209.83 'cd /home/webservice/react && npm install --prefer-offline --no-audit --no-fund && pm2 restart sam-react'
|
||||
"""
|
||||
}
|
||||
}
|
||||
@@ -144,10 +145,12 @@ pipeline {
|
||||
sh """
|
||||
ssh ${DEPLOY_USER}@${PROD_SERVER} 'mkdir -p /home/webservice/react-stage/releases/${RELEASE_ID}'
|
||||
rsync -az --delete \
|
||||
.next package.json next.config.ts public node_modules \
|
||||
--exclude='.next/cache' \
|
||||
.next package.json package-lock.json next.config.ts public \
|
||||
${DEPLOY_USER}@${PROD_SERVER}:/home/webservice/react-stage/releases/${RELEASE_ID}/
|
||||
scp .env.production ${DEPLOY_USER}@${PROD_SERVER}:/home/webservice/react-stage/releases/${RELEASE_ID}/.env.production
|
||||
ssh ${DEPLOY_USER}@${PROD_SERVER} '
|
||||
cd /home/webservice/react-stage/releases/${RELEASE_ID} && npm install --prefer-offline --no-audit --no-fund &&
|
||||
ln -sfn /home/webservice/react-stage/releases/${RELEASE_ID} /home/webservice/react-stage/current &&
|
||||
cd /home/webservice && pm2 reload sam-front-stage 2>/dev/null || pm2 start react-stage/current/node_modules/.bin/next --name sam-front-stage -- start -p 3100 &&
|
||||
cd /home/webservice/react-stage/releases && ls -1dt */ | tail -n +4 | xargs rm -rf 2>/dev/null || true
|
||||
@@ -197,10 +200,12 @@ pipeline {
|
||||
sh """
|
||||
ssh ${DEPLOY_USER}@${PROD_SERVER} 'mkdir -p /home/webservice/react/releases/${RELEASE_ID}'
|
||||
rsync -az --delete \
|
||||
.next package.json next.config.ts public node_modules \
|
||||
--exclude='.next/cache' \
|
||||
.next package.json package-lock.json next.config.ts public \
|
||||
${DEPLOY_USER}@${PROD_SERVER}:/home/webservice/react/releases/${RELEASE_ID}/
|
||||
scp .env.production ${DEPLOY_USER}@${PROD_SERVER}:/home/webservice/react/releases/${RELEASE_ID}/.env.production
|
||||
ssh ${DEPLOY_USER}@${PROD_SERVER} '
|
||||
cd /home/webservice/react/releases/${RELEASE_ID} && npm install --prefer-offline --no-audit --no-fund &&
|
||||
ln -sfn /home/webservice/react/releases/${RELEASE_ID} /home/webservice/react/current &&
|
||||
cd /home/webservice && pm2 reload sam-front &&
|
||||
cd /home/webservice/react/releases && ls -1dt */ | tail -n +6 | xargs rm -rf 2>/dev/null || true
|
||||
|
||||
Reference in New Issue
Block a user