Move Hermes config into volume, add pre-deploy sync check
Config.yaml was bind-mounted, blocking runtime writes (/sethome). Move it into the Docker volume via docker cp instead. Add hermes-sync Makefile target that diffs remote config against local before deploying, to catch runtime changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
24
Makefile
24
Makefile
@@ -1,4 +1,4 @@
|
||||
.PHONY: build serve deploy ssh setup miniflux gitea goatcounter hermes hermes-chat enrich
|
||||
.PHONY: build serve deploy ssh setup miniflux gitea goatcounter hermes hermes-sync hermes-chat enrich
|
||||
|
||||
# Load .env if it exists
|
||||
-include .env
|
||||
@@ -37,10 +37,30 @@ goatcounter:
|
||||
@test -n "$(MONOTROPE_HOST)" || (echo "Error: MONOTROPE_HOST is not set"; exit 1)
|
||||
ansible-playbook -i "$(MONOTROPE_HOST)," -u root infra/ansible/playbook.yml --tags goatcounter
|
||||
|
||||
hermes:
|
||||
hermes: hermes-sync
|
||||
@test -n "$(MONOTROPE_HOST)" || (echo "Error: MONOTROPE_HOST is not set"; exit 1)
|
||||
ansible-playbook -i "$(MONOTROPE_HOST)," -u root infra/ansible/playbook.yml --tags hermes
|
||||
|
||||
hermes-sync:
|
||||
@test -n "$(MONOTROPE_HOST)" || (echo "Error: MONOTROPE_HOST is not set"; exit 1)
|
||||
@echo "Checking for remote config changes..."
|
||||
@ssh root@$(MONOTROPE_HOST) docker cp hermes:/opt/data/config.yaml - 2>/dev/null | tar -xO > /tmp/hermes-remote-config.yaml || true
|
||||
@if ! diff -q infra/hermes/config.yaml /tmp/hermes-remote-config.yaml >/dev/null 2>&1; then \
|
||||
echo ""; \
|
||||
echo "Remote config.yaml differs from local:"; \
|
||||
echo "─────────────────────────────────────"; \
|
||||
diff -u infra/hermes/config.yaml /tmp/hermes-remote-config.yaml || true; \
|
||||
echo "─────────────────────────────────────"; \
|
||||
echo ""; \
|
||||
read -p "Overwrite remote with local? [y/N] " ans; \
|
||||
if [ "$$ans" != "y" ] && [ "$$ans" != "Y" ]; then \
|
||||
echo "Aborting. Merge remote changes into infra/hermes/config.yaml first."; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
else \
|
||||
echo "Config in sync."; \
|
||||
fi
|
||||
|
||||
hermes-chat:
|
||||
@test -n "$(MONOTROPE_HOST)" || (echo "Error: MONOTROPE_HOST is not set"; exit 1)
|
||||
ssh -t root@$(MONOTROPE_HOST) docker exec -it hermes hermes chat
|
||||
|
||||
Reference in New Issue
Block a user