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.
39 lines
1.4 KiB
Markdown
39 lines
1.4 KiB
Markdown
---
|
|
name: homelab-sync
|
|
description: Pull the live production configs (docker-compose.yml, .env, Caddyfile) from the valhalla server into this repo so local matches what's deployed. Use at the start of any session that will edit homelab deployment config, or to check for drift between repo and production.
|
|
---
|
|
|
|
# homelab-sync
|
|
|
|
Production (valhalla) is the source of truth. Pull before editing so you never edit a stale copy.
|
|
|
|
## Run it
|
|
|
|
```powershell
|
|
powershell -File sync-prod.ps1
|
|
```
|
|
|
|
This `scp`s three files from valhalla, **overwriting** the local copies:
|
|
|
|
| From valhalla | Into repo |
|
|
|---------------|-----------|
|
|
| `~/htpc-download-box/docker-compose.yml` | `docker-compose.yml` |
|
|
| `~/htpc-download-box/.env` | `.env` |
|
|
| `/config/caddy/Caddyfile` | `Caddyfile` |
|
|
|
|
It overwrites local working copies — commit or stash anything you want to keep first.
|
|
|
|
## Check drift without overwriting
|
|
|
|
To see how local differs from prod before deciding direction (git is installed):
|
|
|
|
```powershell
|
|
$tmp = Join-Path $env:TEMP 'valhalla-compose.yml'
|
|
scp -o BatchMode=yes "ginnoir@valhalla:~/htpc-download-box/docker-compose.yml" $tmp
|
|
git --no-pager diff --no-index -- $tmp .\docker-compose.yml
|
|
```
|
|
|
|
(`.env` and `Caddyfile` can be compared the same way.)
|
|
|
|
After syncing, review `git status` / `git diff` to see what changed on the server since your last sync. To push local changes the other direction, use the `homelab-apply` skill.
|