littlebizzy / slickstack

Lightning-fast WordPress on Nginx
https://slickstack.io
GNU General Public License v3.0
643 stars 113 forks source link

Pushing static assets (media files) to remote object storage #120

Closed anorouzi closed 2 years ago

anorouzi commented 3 years ago

Hi everyone, I am going to use services such as S3 or minio to serpat media file from wordpress. Is there possibility of using bash script to do this or use plugins such as wp-offload media or Media Cloud or other plugin to be in the mu plugin of SlickStack. Please leave a comment or a recommendation.

jessuppi commented 3 years ago

Thanks for commenting @anorouzi as suggested earlier in our chat room.

I don't have anything to say here immediately but just for context, you had mentioned trying to use SlickStack perhaps for a type of load balancing or multi-server approach including a remote database, and thus were looking at hosting all media files in a central location using Amazon S3 buckets.

If anyone has anything to suggest in this regard please feel free to comment on this thread --

jessuppi commented 2 years ago

Just an update here,

Some teams often consider S3 for a shared media drive so they can use it for multiple environments. Well, SlickStack now shares the /uploads/ directory from production with our staging sites using Linux symlinks:

https://wordpress.stackexchange.com/a/408075/152624

In the past several months we have also successfully tested and are currently running a remote database with live SlickStack websites so that is confirmed working too... to support this, we added a new DB_PORT option in ss-config...

I'm not sure if we want to support "pushing" media files to remote object storage... I'm not totally opposed to it, however it seems like a niche feature that wouldn't apply to 95% of cases. Some of our main values are portability and avoiding data loss whenever possible, and I'm not sure this would fall into our vision per se.

Personally I have seen MANY clients mess up their websites with those types of plugins, since most teams don't realize that local files will be permanently deleted, and reverse-engineering that mess is a nightmare. But for advanced teams who know what they are doing, I understand the potential benefits...

Another concept I've thought about is symlinking /uploads/ to a local add-on object storage drive, like those offered by providers such as DigitalOcean... I'm not sure it would work with multi-server load balancing etc, but it seems like an option for websites that have massive amounts of media files, and potentially other situations too...

jessuppi commented 2 years ago

The long story short here is that without syncing Attachments in the database, remote storage is pointless, and that goes beyond what a bash script could do... it requires WordPress (or plugins) to organize that stuff:

Ref: https://wordpress.stackexchange.com/questions/29273/is-it-possible-to-share-wordpress-media-files-among-different-domains

And since only a few users would be interested in using a plugin like WP Offload Media, it wouldn't make sense to include that in SlickStack as a MU plugin, you can simply install as a normal plugin instead.

For now I'm going to close this, but further comments and discussion of remote object storage is welcome.