fix: 调整 NAS 部署配置与脚本清理逻辑
This commit is contained in:
@@ -4,6 +4,6 @@ BACKEND_PORT=62318
|
|||||||
LSFX_MOCK_PORT=62320
|
LSFX_MOCK_PORT=62320
|
||||||
|
|
||||||
# Spring Boot 运行配置
|
# Spring Boot 运行配置
|
||||||
SPRING_PROFILES_ACTIVE=local
|
SPRING_PROFILES_ACTIVE=nas
|
||||||
RUOYI_PROFILE=/app/data/ruoyi
|
RUOYI_PROFILE=/app/data/ruoyi
|
||||||
JAVA_OPTS=-Xms512m -Xmx1024m
|
JAVA_OPTS=-Xms512m -Xmx1024m
|
||||||
|
|||||||
@@ -33,7 +33,18 @@ function Ensure-Command {
|
|||||||
function Reset-Directory {
|
function Reset-Directory {
|
||||||
param([string]$Path)
|
param([string]$Path)
|
||||||
if (Test-Path $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
|
New-Item -ItemType Directory -Path $Path | Out-Null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ services:
|
|||||||
container_name: ccdi-backend
|
container_name: ccdi-backend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-local}
|
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-nas}
|
||||||
RUOYI_PROFILE: ${RUOYI_PROFILE:-/app/data/ruoyi}
|
RUOYI_PROFILE: ${RUOYI_PROFILE:-/app/data/ruoyi}
|
||||||
JAVA_OPTS: ${JAVA_OPTS:--Xms512m -Xmx1024m}
|
JAVA_OPTS: ${JAVA_OPTS:--Xms512m -Xmx1024m}
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
container_name: lsfx-mock-server
|
container_name: lsfx-mock-server
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "62320:8000"
|
||||||
environment:
|
environment:
|
||||||
- APP_NAME=流水分析Mock服务
|
- APP_NAME=流水分析Mock服务
|
||||||
- APP_VERSION=1.0.0
|
- APP_VERSION=1.0.0
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ REPO_ROOT = Path(__file__).resolve().parents[2]
|
|||||||
DEPLOY_PS1 = REPO_ROOT / "deploy" / "deploy.ps1"
|
DEPLOY_PS1 = REPO_ROOT / "deploy" / "deploy.ps1"
|
||||||
DEPLOY_BAT = REPO_ROOT / "deploy" / "deploy-to-nas.bat"
|
DEPLOY_BAT = REPO_ROOT / "deploy" / "deploy-to-nas.bat"
|
||||||
DOCKER_COMPOSE = REPO_ROOT / "docker-compose.yml"
|
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):
|
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 '${LSFX_MOCK_PORT:-62320}:8000' in compose_text
|
||||||
assert 'network_mode: "service:backend"' 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
|
||||||
|
|||||||
Reference in New Issue
Block a user