Skip to content

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 sudo for Docker only, so the remote step does not prompt (narrow rule — adjust user name if yours differs):
YOUR_SSH_USER ALL=(ALL) NOPASSWD: /usr/bin/docker

Install under /etc/sudoers.d/ with visudo / correct permissions.

  • Directory ~/docker/homeassistant/config/www/ is writable by the same SSH user so scp can overwrite menu.json.

  • Compose project lives under ~/docker/homeassistant/ (used by docker 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

  1. Bitwarden Desktop running; vault unlocked (so the SSH agent can offer the key).
  2. Put the updated menu.json in the same directory as deploy-menu.sh.
  3. Run:
./deploy-menu.sh

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.

Raw sources

  • User-provided procedure; script copied from MacBook project HAGarminMenu / deploy-menu.sh (see log).