2 · Server sync — capture server changes
Objective — capture changes made on the server (admin-panel uploads, installer output, config) back into git before the next deploy silently wipes them — and do it without ever committing secrets.
Background
Section titled “Background”A deployed app has two sources of truth that can drift apart: git (your code) and the server (files written after deploy — a logo uploaded through the admin panel, files the web installer generated, an admin config change). Your deploy pipeline clears and replaces server directories on every release — so anything the server wrote that git doesn’t know about gets erased on the next deploy.
Server sync closes that gap: it pulls those server-side changes back into git first, so the next deploy preserves them instead of destroying them.
flowchart LR A["Server writes file<br/>upload · installer · config"] --> B["Capture into git<br/>commit on production"] B --> C["Review file list<br/>no secrets"] C --> D["Merge to develop<br/>safe to deploy"]The risk runs the other way too: server files can include .env, private keys, or logs with personal data. Capturing those into git would leak secrets — so every sync is review-first, never auto-merge.
For the command-only card, see the Server sync capture runbook.
1. Confirm the change is worth capturing
Section titled “1. Confirm the change is worth capturing”Not every server change needs syncing. Match what changed against the table so you only capture real, durable files — and never sweep secrets in by accident.
-
Match the change against the capture table.
Change type Example Capture? Admin-panel uploads Logo, favicon, images ✅ Yes Web installer output Generated files, storage/installed✅ Yes Composer install on server Package installed on the server ✅ Yes Admin-panel config SMTP, payment keys ⚠️ Maybe — .env.exampleupdates only- ✅ You’ve confirmed the change is a real, durable file worth keeping in git.
2. Capture the changes into git
Section titled “2. Capture the changes into git”Two ways to capture: the GitHub Action does it for you (preferred), or you do it by hand over SSH. Either way, the server’s new files land as a commit on the production branch.
-
Preferred — trigger the ServerSync GitHub Action. From the repository’s Actions tab, run the capture workflow (e.g.
capture-production.yml) for the right environment. It SSHes in, captures the shared directories, and commits toproductionfor you.- ✅ The workflow run finishes and a capture commit appears on
production.
- ✅ The workflow run finishes and a capture commit appears on
-
Manual fallback — capture over SSH, screening for secrets first. Use this only if the Action isn’t available.
Terminal window ssh [SSH_PRODUCTION_ALIAS]cd [DEPLOY_PATH]git status# Expected: a list of changed files. If .env, *.key, *.pem, or credentials appear, DO NOT stage them.git add .git commit -m "🔄 ⬛ T5 ServerSync-Upload: Capture [description]"git push origin production# Expected: the server-side files are committed and pushed on production- ✅ The captured files are committed on
productionand no secret file is staged.
- ✅ The captured files are committed on
3. Review what was captured
Section titled “3. Review what was captured”This is the human gate. A sync commit can include deletions caused by config drift, not just safe additions — so a person reads the file list before it merges anywhere.
-
Pull the capture locally and inspect the file list.
Terminal window git checkout production && git pull origin productiongit log --oneline -3git show --stat HEAD# Expected: the capture commit, and a file list of exactly what changed- ✅ Every captured file is an intentional
ADDED/MODIFIEDasset — no surpriseDELETEDfiles, no secrets.
- ✅ Every captured file is an intentional
If you see DELETED files you didn’t expect, that’s drift between the deploy config’s clear_paths and the sync workflow’s GIT_ONLY_PATHS — fix the symmetry before trusting another sync, rather than committing the deletions.
4. Merge back to develop
Section titled “4. Merge back to develop”Once reviewed, fold the capture into develop so your everyday branch carries the server’s truth and the next ship doesn’t reintroduce the drift.
-
Merge production into develop and push.
Terminal window git checkout develop && git merge production && git push origin develop# Expected: develop now contains the captured server files- ✅
developcarries the captured changes; you can resume normal development and ship when ready.
- ✅
Checklist
Section titled “Checklist”Do not mark this step done until every box below is checked.
- 👤 Worth capturing — the change is a durable server file (upload / installer output / config), not noise.
- 🤖 No secrets staged — no
.env,*.key,*.pem, logs, or credentials in the commit. - 🤖 Committed on production — captured via the GitHub Action or manual SSH, with a
T5 ServerSyncmessage. - 👤 File list reviewed — inspected
git show --stat; no unexpectedDELETEDfiles; not auto-merged. - 🤖 Merged to develop —
productionfolded back intodevelopand pushed.