# Fast deploy: ship ONLY the server assembly, not the 286 MB tarball. # # PackageServer.ps1 + DeployCampusServer.bat re-upload everything, and Data/ alone is 36 GB on the # VPS / ~280 MB in the tarball - none of which changes when you edit C#. This publishes the same # Release/linux-x64 build, copies out CampusServer.dll (~2 MB) and restarts the service. # # Use the full PackageServer.ps1 path when Data/, Web/, Website/ or AdminPanel/ content changed, # or when a NuGet dependency was added (a new .dll in the publish output would not be uploaded here). $ErrorActionPreference = "Stop" $root = $PSScriptRoot $csproj = Join-Path $root "Server\2025-RecRoom-Server-E12354-main\CampusServer.csproj" $out = Join-Path $env:TEMP "campus-fastdeploy" $pw = (Get-Content (Join-Path $root "Password.txt") -Raw).Trim() $vps = "root@50.114.179.17" Write-Host " [1/3] publish (Release, linux-x64) ..." dotnet publish $csproj -c Release -r linux-x64 --self-contained true -o $out -v quiet -clp:ErrorsOnly if ($LASTEXITCODE -ne 0) { throw "publish failed" } $dll = Join-Path $out "CampusServer.dll" $size = [math]::Round((Get-Item $dll).Length / 1MB, 2) Write-Host " [2/3] upload CampusServer.dll ($size MB) ..." & pscp -batch -pw $pw $dll "${vps}:/opt/campus/CampusServer.dll.new" if ($LASTEXITCODE -ne 0) { throw "upload failed" } Write-Host " [3/3] swap + restart ..." # Swapped into place with the service stopped: overwriting a DLL under a running process is what # caused the SIGBUS/BadImageFormat crashes documented in the deploy notes. & plink -batch -pw $pw $vps "systemctl stop campus && mv /opt/campus/CampusServer.dll.new /opt/campus/CampusServer.dll && systemctl start campus && sleep 12 && systemctl is-active campus && journalctl -u campus --since '-1min' --no-pager | grep -cE 'Now listening'" if ($LASTEXITCODE -ne 0) { throw "restart failed" } Write-Host " done."