diff --git a/deploy/scripts/deploy-blue-green-service.sh b/deploy/scripts/deploy-blue-green-service.sh index ad1f4b5b0..4b7435f70 100644 --- a/deploy/scripts/deploy-blue-green-service.sh +++ b/deploy/scripts/deploy-blue-green-service.sh @@ -166,10 +166,16 @@ needs_worker() { start_worker_candidate() { docker rm -f "$worker_candidate" >/dev/null 2>&1 || true echo "启动单例 Worker: $worker_candidate" + if [ "$SERVICE" = file ]; then + worker_java_options="-Xms512m -Xmx2g -XX:+ExitOnOutOfMemoryError -Dfile.encoding=UTF-8" + else + worker_java_options="-Xms256m -Xmx1g -XX:+ExitOnOutOfMemoryError -Dfile.encoding=UTF-8" + fi if ! compose run -d --no-deps --name "$worker_candidate" \ -e "NACOS_REGISTER_ENABLED=false" \ -e "BAIYUE_RUNTIME_SCHEDULING_ENABLED=true" \ -e "BAIYUE_DEPLOY_SLOT=${target_slot}-worker" \ + -e "JAVA_TOOL_OPTIONS=$worker_java_options" \ -e "BAIYUE_RELEASE_ID=$IMAGE_TAG" "$SERVICE" >/dev/null; then return 1 fi diff --git a/scripts/blue-green-deployment-contract.test.mjs b/scripts/blue-green-deployment-contract.test.mjs index 259f4b28f..bdb38832a 100644 --- a/scripts/blue-green-deployment-contract.test.mjs +++ b/scripts/blue-green-deployment-contract.test.mjs @@ -20,6 +20,8 @@ test('all backend business services have blue-green runtime contracts', async () assert.match(script, /BAIYUE_RUNTIME_SCHEDULING_ENABLED=false/) assert.match(script, /NACOS_REGISTER_ENABLED=false/) assert.match(script, /start_worker_candidate/) + assert.match(script, /worker_java_options="-Xms512m -Xmx2g/) + assert.match(script, /worker_java_options="-Xms256m -Xmx1g/) assert.match(script, /connect_routing_aliases "\$candidate" "\$ROUTING_ALIAS" "\$NACOS_SERVICE"/) assert.match(script, /file,file-service:file/) assert.match(script, /docker stop --time "\$STOP_TIMEOUT" "\$active_container"/)