Following @Kusalananda's comment, I finally spent a few hours testing Syncthing for this use case and it works great. It automatically detects changes on both sides and the replication is very fast.
Example: imagine you're working locally on server.py
in your favorite Notepad software, you hit CTRL+S (Save). A few seconds later it's automatically replicated on the distant server (without any popup dialog).
One great thing I've noticed is that you don't have to think about the IP of the home computer and server with Syncthing: each "device" (computer, server, phone, etc.) has a unique DeviceID and if you share the ID with another device, it will find out automatically how they should connect to each other.
To do:
Home computer side (Windows or Linux):
Use the normal Syncthing in-browser configuration tool
VPS side:
First connect the VPS with a port forwarding:
ssh <user>@<VPS_IP> -L 8385:localhost:8384
The latter option will redirect the VPS's Syncthing web-configuration tool listening on port 8384 to the home computer's port 8385.
Then run this on VPS:
wget https://github.com/syncthing/syncthing/releases/download/v0.14.52/syncthing-linux-amd64-v0.14.52.tar.gz
tar xvfz syncthing-linux-amd64-v0.14.52.tar.gz
nohup syncthing-linux-amd64-v0.14.52/syncthing &
Then on the home computer's browser, open http://localhost:8385 : this will be the VPS's Syncthing configuration!
Other solution I tried:
Additional advantages of Syncthing I've just noticed:
you can reduce fsWatcherDelayS
in the config.xml
from 10
to 2
seconds so that after doing CTRL+S, 2 seconds later (+the time to upload, i.e. less than 1 second for a small text file) it's on the other computer
if you sync two computers which are in the same local network (by just giving the DeviceID to each other, no need to care about local IP addresses), it will automatically notice that it doesn't need to transit via internet, but it can deal locally. This is great and allows a very fast speed transfer (4 MB/s!) sync of phone <--> computer
both connected to the same home router via WiFi... ...whereas it would be stuck at 100 KB/s on ADSL with a Dropbox sync! (my ADSL is limited at 100 KB/s on upload)
syncthing
.lsync
, but I don't know if it works usefully for bidirectional sync.