Upload synchronisation across multiple servers
Hi,
I have vanilla replicated across multiple servers (1 media temple and 3 load balanced rackspace cloud servers). The problem I have run into is synchronising the uploads.
Scenario
Server 1 uploads an image or document. It is stored in local Vanilla uploads directory.
If I log into Vanilla through server 2 obviously the image cannot be found as it is sitting on server 1.
I can see that there is a PATH_UPLOADS constant in constants.php and that media is stored in the database as a relative path within the specified directory. Is there a way to upload to a shared remote location via ftp or similar when an asset is uploaded?
It would need to take into account that when the asset needs to be displayed it can use the remote url.
Of course I could use rsync and get each server to use ssh to update their own upload folders but this would require that all servers are aware of and have permission to access each other.
Cheers,
Bubs.
Comments
Assuming you have a static assets server, you can set the PATH_UPLOADS constant in your bootstrap file to point to that server (or a mounted network path each server).
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.