tiddlyhost / tiddlyhost-com

Rails application for creating and hosting TiddlyWiki sites, plus resources for deploying it to https://tiddlyhost.com/
Other
187 stars 18 forks source link

Customize blob keys to include site id for better disaster recovery options #17

Open simonbaird opened 3 years ago

simonbaird commented 3 years ago

If we do lose some database changes (touch wood) blobs in S3 will still be there, but rails active storage won't know their keys. If we could discover the site id for a blob (or maybe user id and site name?), we would have a chance of recovering it.

I think S3 files have metadata. Can I poke some fields into it? If so then how?

Update (2024): I think I'll do it with custom blob keys. Updated the title.

simonbaird commented 3 years ago

There's method that can extract a site name from a ThFile object, which is better than nothing, but still I'd like to do this if it's possible.

simonbaird commented 2 years ago

I thought the rails attachment metadata would be useful here, but that is local to rails, and doesn't push any metadata up to S3. I think the s3 code supports it, but using it would take some digging into the gem internals.

simonbaird commented 2 months ago

Using a custom key that includes the site id is probably the way to do it. b8154dfdaa560bd8883e957e35612aad88314e8d does that for thumbnails, but was reverted since I suspected it was causing performance problems, but now I think it probably wasn't.