GeoNetAgent, LDAPWeb, server-audit, server-connection
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

60 lines
2.5 KiB

# Deploy Geonet Console ke reverse proxy (10.100.1.24)
# Usage: .\scripts\deploy-geonet-console.ps1
# .\scripts\deploy-geonet-console.ps1 -NoBuild
# .\scripts\deploy-geonet-console.ps1 -RemoteStack /opt/stacks/databaselist
# (gunakan -RemoteStack databaselist selama Fase 1; ganti ke geonet-console di Fase 2)
param(
[switch]$NoBuild,
[string]$RemoteStack = "/opt/stacks/geonet-console"
)
$ErrorActionPreference = "Stop"
$HostAddr = "10.100.1.24"
$SshPort = 22
$SshMac = "hmac-sha1"
$SshUser = "root"
$ProjectRoot = Split-Path $PSScriptRoot -Parent
$StackDir = Join-Path $ProjectRoot "geonet-console"
$Tarball = Join-Path $ProjectRoot "geonet-console-deploy.tar.gz"
if (-not (Test-Path $StackDir)) {
throw "Folder tidak ditemukan: $StackDir"
}
Write-Host "==> Pack geonet-console (tanpa .env)..."
Push-Location $StackDir
tar -czf $Tarball --exclude=".env" --exclude="vendor" --exclude="node_modules" .
Pop-Location
Write-Host "==> Upload ke $HostAddr ($RemoteStack)..."
scp -o BatchMode=yes -o MACs=$SshMac -P $SshPort $Tarball "${SshUser}@${HostAddr}:/tmp/geonet-console-deploy.tar.gz"
Write-Host "==> Extract + fix CRLF..."
$ExtractCmd = @"
mkdir -p $RemoteStack && cd $RemoteStack && cp .env /tmp/geonet-console.env.bak 2>/dev/null || true && tar -xzf /tmp/geonet-console-deploy.tar.gz && find docker -name '*.sh' -exec sed -i 's/\r$//' {} + && chmod +x docker/postgres-init/*.sh 2>/dev/null || true
"@
ssh -o BatchMode=yes -m $SshMac "${SshUser}@${HostAddr}" -p $SshPort $ExtractCmd
if ($NoBuild) {
Write-Host "==> Restart container (tanpa rebuild)..."
ssh -o BatchMode=yes -m $SshMac "${SshUser}@${HostAddr}" -p $SshPort "cd $RemoteStack && docker compose up -d"
} else {
Write-Host "==> Docker compose build + up..."
ssh -o BatchMode=yes -m $SshMac "${SshUser}@${HostAddr}" -p $SshPort "cd $RemoteStack && docker compose up -d --build"
}
Write-Host "==> Health check..."
Start-Sleep -Seconds 8
ssh -o BatchMode=yes -m $SshMac "${SshUser}@${HostAddr}" -p $SshPort @"
docker ps --filter name=databaselist --filter name=geonet-console --format 'table {{.Names}}\t{{.Status}}'
curl -sf -o /dev/null -w 'localhost /up: %{http_code}\n' http://127.0.0.1:8091/up
curl -sk -o /dev/null -w 'console HTTPS: %{http_code}\n' https://console.gisportal.id/up
"@
Write-Host ""
Write-Host "Deploy selesai."
Write-Host " https://console.gisportal.id/"
Write-Host " https://console.gisportal.id/ldap-users"
Write-Host " https://databaselist.gisportal.id/ (legacy, sampai redirect Fase 3)"