Environment Synchronization Procedures
This guide details how to keep the Local Development environment in sync with the Remote Production server.
Direction: Remote -> Local
To pull the latest data, code, and configuration from Production (<remote_host>) to your local machine:
1. The Command
Run this from the project root (<local_root>):
rsync -avz --exclude 'vania-novikau.me' -e "ssh" root@<remote_host>:<local_root>/ ./
2. Critical Flags
--exclude 'vania-novikau.me': MANDATORY.- Reason: The remote file structure might contain a nested backup or recursive link (e.g.,
<local_root>/vania-novikau.me). Without this,rsyncwill enter an infinite loop or copy terabytes of duplicated data.
- Reason: The remote file structure might contain a nested backup or recursive link (e.g.,
-a: Archive mode (preserves permissions, owners, dates).-v: Verbose.-z: Compress during transfer (saves bandwidth).
Direction: Local -> Remote
WARNING: Generally, we use Git to push changes to Remote, not rsync.
However, if updating Documentation builds purely:
cd documentation && npm run build
rsync -avz -e "ssh -o StrictHostKeyChecking=no" <local_root>/documentation/build/ root@<remote_host>:/var/www/html/documentation/
Git Merging Strategy (Production Mirror)
We maintain a main branch that mirrors Production.
When conflicts occur between main (Local logic) and Production files:
- Prioritize Production: The Production environment is the source of truth for runtime configurations (e.g.,
wp-config.php, connection scripts). - Resolution Command:
(Assuming you are merging Production-into-Main).
git checkout --theirs <path/to/conflicted/file>