graham wrote:
When a file is uploaded to one server, I'd like it to magically also be on the other server (for example when a user updates their profile picture).
If you're willing to accept some small latency, I like Unison for this - keeps two filesystem trees in sync, even bi-directionally. I typically set up a periodic (say 1-5 minutes depending on requirements) cron job that automatically syncs the two locations.
If uploads will always go to one server, you can use Unison in a purely mirrored approach, but if they might get updated on either server depending on which one handled the web request, Unison will figure out which needs to be updated.
You can certainly also trigger Unison from the web server so it only happens following a known update or to cut down on latency during an update.
It'll work fine directly over two filesystems, if you have the remote system mounted via NFS, for example, but can also run just fine over SSH.
-- David