Mirror the three production files (docker-compose.yml, .env, Caddyfile) that live on valhalla, plus the push/pull PowerShell scripts, CLAUDE.md, .gitignore/.gitattributes, and .claude/skills for ssh/apply/sync.
38 lines
1.7 KiB
Markdown
38 lines
1.7 KiB
Markdown
---
|
|
name: homelab-apply
|
|
description: Push local config changes (docker-compose.yml, .env, Caddyfile) to the valhalla server and apply them to the live Docker stack. Use after editing homelab config to deploy it. This mutates the running production stack.
|
|
---
|
|
|
|
# homelab-apply
|
|
|
|
Deploys local repo changes to the live stack on valhalla. **This mutates production** — sync and review your diff first (see the `homelab-sync` skill).
|
|
|
|
## Run it
|
|
|
|
```powershell
|
|
powershell -File apply-compose.ps1 # push .env + Caddyfile + compose, then apply
|
|
powershell -File apply-compose.ps1 -EnvFile # .env only
|
|
powershell -File apply-compose.ps1 -Caddy # Caddyfile only + hot-reload Caddy
|
|
powershell -File apply-compose.ps1 -Compose # docker-compose.yml only + dc pull + dc up -d
|
|
```
|
|
|
|
Flags combine (e.g. `-Caddy -Compose`); no flags pushes & applies all three.
|
|
|
|
## What each step does
|
|
|
|
- **`.env` / compose** → `scp` to `~/htpc-download-box/`, then `dc pull` (latest images) + `dc up -d` (recreates only containers whose resolved config changed).
|
|
- **Caddyfile** → `scp` to `/config/caddy/Caddyfile`, then `dc exec caddy caddy reload …` — a hot reload with no downtime. If the new Caddyfile is invalid the reload fails and the old config keeps running; read the output.
|
|
|
|
## After applying, verify
|
|
|
|
```powershell
|
|
ssh ginnoir@valhalla "bash -ic 'dc ps'"
|
|
ssh ginnoir@valhalla "bash -ic 'dc logs --tail=50 <service>'"
|
|
```
|
|
|
|
## Notes
|
|
|
|
- Compose is **v1.27.4** (`docker-compose`, hyphenated); `dc` runs over `bash -ic` to load the alias.
|
|
- Editing config without applying does nothing — the server only sees pushed files.
|
|
- Cosmetic/whitespace-only compose edits are no-ops to running containers; `dc up -d` won't recreate them.
|