big update
This commit is contained in:
29
server/deploy/push.ps1
Normal file
29
server/deploy/push.ps1
Normal file
@@ -0,0 +1,29 @@
|
||||
# Push the game + server to the Hetzner box and restart. Run from Windows PowerShell (needs OpenSSH: ssh/scp).
|
||||
# .\server\deploy\push.ps1
|
||||
# .\server\deploy\push.ps1 -Server root@91.99.166.238
|
||||
param(
|
||||
[string]$Server = "root@91.99.166.238",
|
||||
[string]$App = "/opt/robotclash"
|
||||
)
|
||||
$ErrorActionPreference = "Stop"
|
||||
$repo = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
|
||||
Write-Host "Deploy from $repo -> ${Server}:$App"
|
||||
|
||||
# make sure target dirs exist
|
||||
ssh $Server "mkdir -p $App/game $App/server"
|
||||
|
||||
# game/ (no node_modules inside) - full tree incl. assets
|
||||
Write-Host "Uploading game/ ..."
|
||||
scp -r -q "$repo\game" "${Server}:$App/"
|
||||
|
||||
# server source only: skip .env, node_modules and the live DB
|
||||
Write-Host "Uploading server/ source ..."
|
||||
Get-ChildItem "$repo\server" -File |
|
||||
Where-Object { $_.Name -ne ".env" -and $_.Name -notlike "*.sqlite*" } |
|
||||
ForEach-Object { scp -q $_.FullName "${Server}:$App/server/" }
|
||||
|
||||
# install deps + restart
|
||||
Write-Host "Installing deps + restarting ..."
|
||||
ssh $Server "cd $App/server && (npm ci --omit=dev 2>/dev/null || npm install --omit=dev) && systemctl restart robotclash && sleep 1 && systemctl --no-pager --lines=5 status robotclash"
|
||||
|
||||
Write-Host "Done. https://roboclash.michael-media.de/"
|
||||
Reference in New Issue
Block a user