Skip to content

Commit 20e787d

Browse files
AdaInTheLabclaude
andcommitted
deploy: git pull on VPS before reload, sync cards/ down
Drag-drop on the live board was 404-ing for cards added from a developer's local repo. Root cause: the running app's git-sync layer pushes API mutations but doesn't pull, so cards landing in main from any path other than the API never reach the VPS disk. The UI renders them anyway because content collections are bundled into dist/ at build time, which IS in sync with main. The mismatch produces a 404 on every move/edit of those cards. Fix: git fetch && git pull --rebase --autostash inside the deploy workflow, between rsync and pm2 reload. Catches the VPS's cards/ up to main on every deploy. --autostash defends the debounced- commit window in the unlikely case it fires during the pull. Long-term fix would be to have the running app pull on a timer (or on startup), so VPS state never drifts beyond a deploy cadence. Worth doing in a follow-up but the deploy-time pull covers the main pain point. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1d822d5 commit 20e787d

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,24 @@ jobs:
7575
echo "${{ secrets.DH_SSH_KEY }}" > ~/.ssh/deploy_key
7676
chmod 600 ~/.ssh/deploy_key
7777
78+
- name: Pull latest cards into VPS working tree
79+
# The running app's git-sync layer commits + pushes API mutations
80+
# to origin, but never pulls. So a card created from a developer's
81+
# local machine (or any commit landing on main outside the API
82+
# path) never reaches the VPS disk ~ and any attempt to mutate it
83+
# via the API 404s with "No card with id ..." even though the UI
84+
# renders it (the UI shows cards bundled into dist/ at build time,
85+
# which is in sync with main).
86+
#
87+
# Catch the VPS up before reloading. --autostash protects any
88+
# uncommitted change the debounced commit hasn't gotten to yet
89+
# (extremely unlikely in the deploy window, but cheap to be
90+
# defensive about).
91+
run: |
92+
ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=yes \
93+
"$DH_USER@$DH_HOST" \
94+
"cd $DH_PATH && git fetch origin main && git pull --rebase --autostash origin main"
95+
7896
- name: Rsync dist/ + ecosystem cjs to VPS
7997
run: |
8098
# Use --delete on dist/ so stale chunks get cleaned up between deploys.

0 commit comments

Comments
 (0)