silverstripe / silverstripe-assets

Silverstripe Assets component
BSD 3-Clause "New" or "Revised" License
9 stars 67 forks source link

More documentation on implementing a custom File Storage integration #199

Open webbower opened 5 years ago

webbower commented 5 years ago

I'm trying to implement a custom File Storage system using the new swappable capabilities in SS4. However, the documentation on the SS code is fairly shallow and I've had dig into the code debugging with stack traces and such to see how things happens and code paths. I have a decent understanding of Flysystem but it's the SS integration code that is proving difficult to grok (DBFile, FlysystemAssetStore, etc). The alternate storage system is a standalone service (a la Service Oriented Architecture) that stores and serves our images, including cached variant sizes so it doesn't behave quite like Flysystem's Local or an S3 bucket.

I'd be more than happy to help expand the documentation after completing this custom integration, so maybe someone can help me on Slack initially? I'm in the SilverStripe Users group, same handle as GH.

Thanks in advance.

kinglozzer commented 5 years ago

We’d definitely appreciate more docs if you do get the time to write them!

There’s the S3 storage implementation here if you’ve not already seen it: https://github.com/silverstripe/silverstripe-s3. That may provide you with a little guidance on which interfaces need building out. In the absence of any other in-the-wild storage implementations or docs, asking on Slack may be your best bet. Good luck!

webbower commented 5 years ago

I posted on Slack, but only nightjarnz responded and he/she didn't know much. https://silverstripe-users.slack.com/archives/C36U3BDHN/p1545175072253100 I'll see if the S3 bucket one helps.

I would love to help expand the docs, but I need to understand how to implement my custom solution first and the asset management code is pretty extensive and it's hard to track down in the code where everything is happening since tracing class instantiations is tricky with Injector. Who at SS would have the most context? I saw that @tractorcow has his name on a lot of the code for the Assets package, but nightjarnz said he's no longer with the company.

maxime-rainville commented 5 years ago

I think the S3 module @kinglozzer reference is the only serious effort we made at building a non-local file storage implementation. It's not quite production ready and it's got some rough edges.

To be honest, part of the reason we don't have proper doc on this is we don't quite know how to do it ourselves and haven't sorted out all the quirks.

webbower commented 5 years ago

Alrighty then. I guess I'll be back once I figure this thing out to help flesh out the docs on how to implement custom File/Image backends.

webbower commented 5 years ago

To close the loop of my personal journey, I got in touch @tractorcow and explained my situation and he advised me that my case would not be able to make use of this new feature in SS4.