mirror of
https://github.com/DeNNiiInc/Connect-5.git
synced 2026-04-24 17:15:59 +00:00
Docs: Update README with Proxmox deployment guide and add deployment scripts
This commit is contained in:
53
deploy-remote.ps1
Normal file
53
deploy-remote.ps1
Normal file
@@ -0,0 +1,53 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Automated Update Script for Vendor Inventory (Remote)
|
||||
.DESCRIPTION
|
||||
Reads configuration from deploy-config.json.
|
||||
Connects to the remote server, pulls the latest code, installs dependencies, and restarts the service.
|
||||
#>
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$ConfigPath = Join-Path $PSScriptRoot "deploy-config.json"
|
||||
|
||||
if (-not (Test-Path $ConfigPath)) {
|
||||
Write-Error "Configuration file not found: $ConfigPath"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$Config = Get-Content $ConfigPath | ConvertFrom-Json
|
||||
$HostName = $Config.host
|
||||
$User = $Config.username
|
||||
$Password = $Config.password
|
||||
$RemotePath = $Config.remotePath
|
||||
|
||||
Write-Host "Connecting to $User@$HostName for update..." -ForegroundColor Cyan
|
||||
|
||||
# Check for plink
|
||||
if (-not (Get-Command "plink" -ErrorAction SilentlyContinue)) {
|
||||
Write-Error "Plink (PuTTY Link) is required but not found. Please install PuTTY."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Commands to run on remote
|
||||
$RemoteCommands = "
|
||||
echo '📂 Navigating to $RemotePath...'
|
||||
cd $RemotePath
|
||||
|
||||
echo '⬇️ Pulling latest changes...'
|
||||
git pull
|
||||
|
||||
echo '📦 Installing dependencies...'
|
||||
npm install
|
||||
|
||||
echo '🚀 Restarting Service...'
|
||||
systemctl restart connect5
|
||||
|
||||
echo '✅ Status Check:'
|
||||
systemctl status connect5 --no-pager
|
||||
"
|
||||
|
||||
# Execute
|
||||
$RemoteCommands = $RemoteCommands -replace "`r`n", "`n"
|
||||
echo y | plink -ssh -P 22 -t -pw $Password "$User@$HostName" $RemoteCommands
|
||||
|
||||
Write-Host "`nUpdate Sequence Completed." -ForegroundColor Green
|
||||
Reference in New Issue
Block a user