mirror of
https://github.com/kellymichels/zscripts-token-savers
synced 2026-10-06 07:08:17 +00:00
Some checks failed
tests / test (push) Has been cancelled
Build stamp catch-up for 4 merged PR(s) since v1.0.0.0.27:b26be3cchore: write the site name as evomedia.net, lowercase (#92)22a7387feat(site): link preview for zscripts.evomedia.net, with a card in the page's own colours (#91)86938d0chore: publish the zec2 and zec2online comment updates to the mirror (#87)90f4301fix: pin the .txt twins to LF so regenerating them stops reporting a change (#89)
52 lines
1.6 KiB
PowerShell
52 lines
1.6 KiB
PowerShell
# evomedia.net Token Savers — https://github.com/evomedia-net/evo.zscripts
|
|
# Created by Kelly Michels · dev@evomedia.net
|
|
# Licensed under the MIT License. See LICENSE.
|
|
# Version: v1.0.0.0.28
|
|
|
|
# zstop.ps1 — stop docker compose stacks on the server without removing data or files.
|
|
#
|
|
# Usage:
|
|
# zstop <project> [<project> ...]
|
|
#
|
|
# Examples:
|
|
# zstop pyapp
|
|
# zstop viteapp nextapp edge
|
|
#
|
|
# Data volumes are preserved. Run zdeploy <project> to bring a stack back up.
|
|
#
|
|
param(
|
|
[Parameter(Position = 0, ValueFromRemainingArguments = $true)]
|
|
[string[]]$Projects = @()
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
. (Join-Path $PSScriptRoot "ZHelpers.ps1")
|
|
Start-ZTracking
|
|
|
|
$cfg = Get-ZConfig
|
|
|
|
if ($Projects.Count -eq 0) {
|
|
$keys = (Get-ZProjectKeys) -join ', '
|
|
Write-Host ""
|
|
Write-Host "Usage: zstop <project> [<project> ...]" -ForegroundColor Yellow
|
|
Write-Host " Projects in zconfig.json: $keys" -ForegroundColor Gray
|
|
Stop-ZTracking; exit 1
|
|
}
|
|
|
|
foreach ($key in $Projects) {
|
|
$proj = Get-ZProject -Key $key
|
|
$composeDir = Get-RemoteComposeDir -Key $key
|
|
|
|
Write-Host "`n--- Stopping $($proj.label) ---" -ForegroundColor Cyan
|
|
$cmd = "cd $composeDir && sudo docker compose down 2>&1 || true"
|
|
ssh -o StrictHostKeyChecking=no -i $cfg.ec2.pemKey (Get-Ec2Target) $cmd
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host " WARNING: docker compose down returned exit $LASTEXITCODE for $($proj.label)" -ForegroundColor Yellow
|
|
} else {
|
|
Write-Host " $($proj.label) stopped." -ForegroundColor Green
|
|
}
|
|
}
|
|
|
|
Write-Host "`nDone. Data volumes are intact. Run zdeploy <project> to restart." -ForegroundColor DarkGray
|
|
Stop-ZTracking
|