Deploying menu.json to Home Assistant (MacBook → Ubuntu host)¶
Status¶
Active — one-command deploy from a MacBook to the Home Assistant Docker stack on the Ubuntu Mac Mini.
Overview¶
| Local | menu.json on the MacBook, next to deploy-menu.sh (project folder such as HAGarminMenu on the desktop). |
| Remote | Ubuntu Mac Mini (Seamoth, 10.0.0.20 on the home LAN) — Home Assistant runs in Docker here (see projects/Self-Hosted-Services, projects/Home-Network). |
| Target file | ~/docker/homeassistant/config/www/menu.json on that host. |
| After copy | Remote script runs sudo docker compose up -d from ~/docker/homeassistant/ to reload the stack. |
| SSH auth | No private key file on disk on the MacBook — key material comes from Vaultwarden (Synology) via Bitwarden Desktop with the SSH agent integrated into macOS SSH (~/.ssh/config). |
Note on naming: Sometimes this flow is described loosely as involving the “Synology server.” In this setup the Synology hosts Vaultwarden (where the SSH private key is stored); Home Assistant itself is not on the NAS — it is on the Macmini5,1 Ubuntu box above.
1. SSH key management (MacBook)¶
- Private SSH key lives in Vaultwarden (self-hosted on the Synology — projects/Self-Hosted-Services).
- Bitwarden Desktop on the MacBook: vault unlocked, SSH agent enabled for the key.
- macOS OpenSSH is pointed at Bitwarden’s agent via
~/.ssh/config(per Bitwarden’s SSH agent documentation).
2. Server-side configuration (Ubuntu / Docker host)¶
- Passwordless
sudofor Docker only, so the remote step does not prompt (narrow rule — adjust user name if yours differs):
Install under /etc/sudoers.d/ with visudo / correct permissions.
-
Directory
~/docker/homeassistant/config/www/is writable by the same SSH user soscpcan overwritemenu.json. -
Compose project lives under
~/docker/homeassistant/(used bydocker compose up -d).
3. Deployment script (deploy-menu.sh)¶
Reference copy lives on the MacBook in the HAGarminMenu project (alongside menu.json). Behaviour:
#!/bin/bash
LOCAL_FILE="menu.json"
# Replace with your Unix login on the HA host (must match sudoers.d Docker rule).
REMOTE_USER="YOUR_SSH_USER"
REMOTE_HOST="10.0.0.20"
REMOTE_DEST_PATH="~/docker/homeassistant/config/www/menu.json"
echo "🚀 Deploying menu.json to Home Assistant (via Vaultwarden SSH agent)..."
echo "📤 Copying menu.json ..."
scp -q "${LOCAL_FILE}" "${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_DEST_PATH}"
if [ $? -ne 0 ]; then
echo "❌ SCP failed."
exit 1
fi
echo "✅ menu.json copied successfully."
echo "🔄 Restarting Home Assistant..."
ssh -q "${REMOTE_USER}@${REMOTE_HOST}" << 'EOF' 2>/dev/null
cd ~/docker/homeassistant/
echo "🐳 Running: docker compose up -d"
sudo docker compose up -d >/dev/null
echo "✅ Restart completed."
EOF
echo "🎉 Deployment finished successfully!"
How to use¶
- Bitwarden Desktop running; vault unlocked (so the SSH agent can offer the key).
- Put the updated
menu.jsonin the same directory asdeploy-menu.sh. - Run:
Typical run: a few seconds, no password prompts (agent + NOPASSWD docker).
Benefits (why it’s set up this way)¶
- No long-lived private key file on the MacBook disk.
- Single command deploy after editing
menu.json. - Small, readable script; easy to repeat safely.
Related work¶
- projects/Self-Hosted-Services — where Home Assistant, Vaultwarden, and the Mac Mini / Synology roles are defined.
Raw sources¶
- User-provided procedure; script copied from MacBook project
HAGarminMenu/deploy-menu.sh(see log).