WordPress is spinning on the CentOS server, and accepts media files uploaded to a folder. It is necessary to synchronize it into a bunch on S3 , since from there files are distributed to site visitors.
- The first attempt, in a simple way: with the help of FUSE and S3FS, the bouquet was monitored as a device, and the files were loaded directly into it. It turned out badly: slowly, and often there were errors handling the downloaded files.
- The second step: began to keep the local folder in which the download occurs; using lsyncd, it was synchronized into a mounted S3 bouquet. Better, but occasional, elusive mistakes sometimes occur, and some files do not pass, appearing in a bouquet with a zero size. And later, these zero files are not updated to the full-size version.
Therefore, now in search of a "third" option. How to synchronize the aploads, with a minimum leg, and with concrete reliability, from a local folder in a bouquet on Amazon?
Dirty tricks:
- the remote FS of a mounted S3 bouquet works far from instantly; copying one mp3 may take several. seconds;
- at the time of synchronization, some files can be opened - say, they are right now being downloaded by someone directly to the server, or the pictures are reduced and their reduced copies are recorded.