Deploy Caddyfile to valhalla / deploy (push) Failing after 44s
Jellyfin 10.11 writes metadata to /config/data/metadata, not /config/metadata — the old bind left bulk artwork on the root disk. Moved existing metadata to /storage1 and corrected the compose mount. Also sets TranscodingTempPath=/transcode. Caddy deploy: job containers never saw /config/caddy; write via a host-bind docker run instead. apply-compose.ps1 -Caddy stages through /tmp + sudo. GITHUB_STACKS_PAT updated to the live Gitea PAT.
78 lines
3.3 KiB
PowerShell
78 lines
3.3 KiB
PowerShell
# Manual ops helper for the management plane + Caddyfile + Vault.
|
|
#
|
|
# Post-split topology: every application stack lives under stacks/<domain>/ and
|
|
# is deployed by Portainer's git poll — there is no monolithic root compose any
|
|
# more, so this script no longer pushes one. The runner workflow (deploy.yml)
|
|
# handles Caddyfile reload on push automatically; -Caddy here is for ad-hoc
|
|
# pushes when you don't want to wait for the runner.
|
|
#
|
|
# Usage (flags combine; no flags = .env + Caddyfile):
|
|
# powershell -File apply-compose.ps1 # .env + Caddyfile
|
|
# powershell -File apply-compose.ps1 -EnvFile # .env only (mgmt plane / vault unseal)
|
|
# powershell -File apply-compose.ps1 -Caddy # Caddyfile only + hot-reload Caddy
|
|
# powershell -File apply-compose.ps1 -Portainer # portainer-compose.yml + vault.hcl + up -d
|
|
# powershell -File apply-compose.ps1 -VaultUnseal # unseal vault after restart (keys from .env)
|
|
|
|
param(
|
|
[switch]$Caddy,
|
|
[switch]$EnvFile,
|
|
[switch]$Portainer,
|
|
[switch]$VaultUnseal
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
# Make a non-zero exit from scp/ssh abort the script instead of silently continuing.
|
|
$PSNativeCommandUseErrorActionPreference = $true
|
|
|
|
$server = "ginnoir@valhalla"
|
|
$caddyLocal = Join-Path $PSScriptRoot "Caddyfile"
|
|
$envLocal = Join-Path $PSScriptRoot ".env"
|
|
$portainerLocal = Join-Path $PSScriptRoot "portainer-compose.yml"
|
|
$vaultConfigLocal = Join-Path $PSScriptRoot "vault.hcl"
|
|
|
|
# Default (no flags): push .env + Caddyfile.
|
|
if (-not $Caddy -and -not $EnvFile -and -not $Portainer -and -not $VaultUnseal) {
|
|
$EnvFile = $true; $Caddy = $true
|
|
}
|
|
|
|
if ($EnvFile) {
|
|
Write-Host "Pushing .env ..."
|
|
scp $envLocal "${server}:~/valhalla-lab/.env"
|
|
}
|
|
|
|
if ($Caddy) {
|
|
# /config/caddy is root-owned on valhalla — scp directly fails with
|
|
# "Permission denied". Stage via /tmp and sudo-install.
|
|
Write-Host "Pushing Caddyfile ..."
|
|
scp $caddyLocal "${server}:/tmp/Caddyfile.new"
|
|
ssh $server "sudo cp /tmp/Caddyfile.new /config/caddy/Caddyfile && sudo chown root:root /config/caddy/Caddyfile && rm -f /tmp/Caddyfile.new"
|
|
Write-Host "Reloading Caddy ..."
|
|
ssh $server "docker exec caddy caddy reload --config /etc/caddy/Caddyfile"
|
|
}
|
|
|
|
if ($Portainer) {
|
|
Write-Host "Pushing portainer-compose.yml ..."
|
|
scp $portainerLocal "${server}:~/valhalla-lab/portainer-compose.yml"
|
|
Write-Host "Pushing vault.hcl (Vault lives in the management plane) ..."
|
|
ssh $server "mkdir -p /config/vault/config /config/vault/data /config/vault/logs"
|
|
scp $vaultConfigLocal "${server}:/config/vault/config/vault.hcl"
|
|
Write-Host "Applying management plane (portainer, vault, gitea, registry, watchtower) ..."
|
|
ssh $server "docker compose -f ~/valhalla-lab/portainer-compose.yml --env-file ~/valhalla-lab/.env up -d"
|
|
}
|
|
|
|
if ($VaultUnseal) {
|
|
# Load the three unseal keys from .env
|
|
$envContent = Get-Content $envLocal | Where-Object { $_ -match "^VAULT_UNSEAL_KEY_[123]=" }
|
|
$keys = $envContent | ForEach-Object { ($_ -split "=", 2)[1] }
|
|
if ($keys.Count -lt 3) {
|
|
Write-Error "Could not find VAULT_UNSEAL_KEY_1/2/3 in .env"
|
|
exit 1
|
|
}
|
|
Write-Host "Unsealing Vault (3 of 5 keys) ..."
|
|
foreach ($key in $keys) {
|
|
ssh $server "docker exec vault vault operator unseal $key 2>&1 | grep -E 'Sealed|Error'"
|
|
}
|
|
}
|
|
|
|
Write-Host "Done."
|