fix: 调整 NAS 部署配置与脚本清理逻辑

This commit is contained in:
wkc
2026-03-16 14:54:42 +08:00
parent 7a5ae3f1cc
commit 0c2d738cfe
5 changed files with 31 additions and 4 deletions

View File

@@ -4,6 +4,6 @@ BACKEND_PORT=62318
LSFX_MOCK_PORT=62320
# Spring Boot 运行配置
SPRING_PROFILES_ACTIVE=local
SPRING_PROFILES_ACTIVE=nas
RUOYI_PROFILE=/app/data/ruoyi
JAVA_OPTS=-Xms512m -Xmx1024m

View File

@@ -33,7 +33,18 @@ function Ensure-Command {
function Reset-Directory {
param([string]$Path)
if (Test-Path $Path) {
[System.IO.Directory]::Delete($Path, $true)
Get-ChildItem -LiteralPath $Path -Recurse -Force -ErrorAction SilentlyContinue | ForEach-Object {
$_.Attributes = $_.Attributes `
-band (-bnot [System.IO.FileAttributes]::ReadOnly) `
-band (-bnot [System.IO.FileAttributes]::Hidden) `
-band (-bnot [System.IO.FileAttributes]::System)
}
$rootItem = Get-Item -LiteralPath $Path -Force
$rootItem.Attributes = $rootItem.Attributes `
-band (-bnot [System.IO.FileAttributes]::ReadOnly) `
-band (-bnot [System.IO.FileAttributes]::Hidden) `
-band (-bnot [System.IO.FileAttributes]::System)
Remove-Item -LiteralPath $Path -Recurse -Force
}
New-Item -ItemType Directory -Path $Path | Out-Null
}

View File

@@ -6,7 +6,7 @@ services:
container_name: ccdi-backend
restart: unless-stopped
environment:
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-local}
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-nas}
RUOYI_PROFILE: ${RUOYI_PROFILE:-/app/data/ruoyi}
JAVA_OPTS: ${JAVA_OPTS:--Xms512m -Xmx1024m}
ports:

View File

@@ -5,7 +5,7 @@ services:
build: .
container_name: lsfx-mock-server
ports:
- "8000:8000"
- "62320:8000"
environment:
- APP_NAME=流水分析Mock服务
- APP_VERSION=1.0.0

View File

@@ -6,6 +6,8 @@ REPO_ROOT = Path(__file__).resolve().parents[2]
DEPLOY_PS1 = REPO_ROOT / "deploy" / "deploy.ps1"
DEPLOY_BAT = REPO_ROOT / "deploy" / "deploy-to-nas.bat"
DOCKER_COMPOSE = REPO_ROOT / "docker-compose.yml"
ENV_EXAMPLE = REPO_ROOT / ".env.example"
LSFX_MOCK_COMPOSE = REPO_ROOT / "lsfx-mock-server" / "docker-compose.yml"
def run_powershell(*args):
@@ -79,3 +81,17 @@ def test_compose_exposes_lsfx_mock_port_via_backend_namespace():
assert '${LSFX_MOCK_PORT:-62320}:8000' in compose_text
assert 'network_mode: "service:backend"' in compose_text
def test_compose_defaults_backend_profile_to_nas():
compose_text = DOCKER_COMPOSE.read_text(encoding="utf-8")
env_text = ENV_EXAMPLE.read_text(encoding="utf-8")
assert '${SPRING_PROFILES_ACTIVE:-nas}' in compose_text
assert 'SPRING_PROFILES_ACTIVE=nas' in env_text
def test_lsfx_mock_standalone_compose_exposes_62320():
compose_text = LSFX_MOCK_COMPOSE.read_text(encoding="utf-8")
assert '"62320:8000"' in compose_text