forked from wangziqi/gongxue-base
fix: make deploy npm install resilient
This commit is contained in:
@@ -22,6 +22,11 @@ source "$CONFIG_FILE"
|
||||
: "${RUN_SECURITY_CHECKS:=true}"
|
||||
: "${RUN_LAUNCH_GATE:=true}"
|
||||
: "${RESTART_SERVICES:=true}"
|
||||
: "${NPM_REGISTRY:=https://registry.npmjs.org/}"
|
||||
: "${NPM_FETCH_RETRIES:=5}"
|
||||
: "${NPM_FETCH_RETRY_MINTIMEOUT:=20000}"
|
||||
: "${NPM_FETCH_RETRY_MAXTIMEOUT:=120000}"
|
||||
: "${NPM_FETCH_TIMEOUT:=300000}"
|
||||
|
||||
LOCK_FILE="${LOCK_FILE:-/tmp/tiku-saas-deploy.lock}"
|
||||
mkdir -p "$APP_ROOT" "$WWW_ROOT/student" "$WWW_ROOT/tenant-admin" "$WWW_ROOT/platform-admin"
|
||||
@@ -94,7 +99,12 @@ CURRENT_SHA="$(git rev-parse --short=12 HEAD)"
|
||||
log "Deploying commit $CURRENT_SHA"
|
||||
|
||||
log "Installing dependencies with npm ci..."
|
||||
npm ci
|
||||
npm ci \
|
||||
--registry="$NPM_REGISTRY" \
|
||||
--fetch-retries="$NPM_FETCH_RETRIES" \
|
||||
--fetch-retry-mintimeout="$NPM_FETCH_RETRY_MINTIMEOUT" \
|
||||
--fetch-retry-maxtimeout="$NPM_FETCH_RETRY_MAXTIMEOUT" \
|
||||
--fetch-timeout="$NPM_FETCH_TIMEOUT"
|
||||
|
||||
if [[ "$RUN_SECURITY_CHECKS" == "true" ]]; then
|
||||
log "Running repository security scan..."
|
||||
|
||||
7
scripts/deploy/env/deploy.env.example
vendored
7
scripts/deploy/env/deploy.env.example
vendored
@@ -16,3 +16,10 @@ RUNTIME_CONFIG_DIR=/etc/tiku-saas/runtime-config
|
||||
RUN_SECURITY_CHECKS=true
|
||||
RUN_LAUNCH_GATE=true
|
||||
RESTART_SERVICES=true
|
||||
|
||||
# Use https://registry.npmmirror.com on mainland China servers if npmjs times out.
|
||||
NPM_REGISTRY=https://registry.npmjs.org/
|
||||
NPM_FETCH_RETRIES=5
|
||||
NPM_FETCH_RETRY_MINTIMEOUT=20000
|
||||
NPM_FETCH_RETRY_MAXTIMEOUT=120000
|
||||
NPM_FETCH_TIMEOUT=300000
|
||||
|
||||
Reference in New Issue
Block a user