Jacob-Griffin / TelephonePictionary2.0

New version of blowyourfaceoff.com using more modern web technology than php and raw javascript
0 stars 0 forks source link

Move to amazon S3 for image hosting #8

Closed Jacob-Griffin closed 1 year ago

Jacob-Griffin commented 1 year ago

Google storage is integrated with Firebase and works quite well as a simple way of pushing/pulling images. Also, it has a free tier that will cover some small amount of read/writes a day and 1GB of data forever. However, the latency on Google Cloud Storage reads is so slow that there can be a visible second or two where the image of a card is not loaded. The way it is now is fine for release, because I can pull the images in a stack ahead of time and cache them for a day, which will obfuscate that issue.

Long term though, I want to switch to amazon S3. Their image hosting is significantly faster, and I will still get a free tier for a year, which can hold 5GB and a suitable amount of read/writes. After that, the price of holding the images will continuously grow, but the price scaling is tremendously cheap. My large overestimate still barely scratched $1/mo. (50gb, several tens of thousands of monthly read/writes).

Currently looking at doing that once we've cleared up initial feedback and first "release"

Jacob-Griffin commented 1 year ago

I looked into S3 for hosting and discovered that it doesn't have the same robustness in terms of validating that the data is clean. S3 relies on the fact that uploaders will be authenticated, while google storage can verify that the content they're uploading is of image type and within a certain size boundary and from certain referrers.

The pre-pulling trick should work well enough, as long as there is time between opening the stack and viewing the first image. The storage costs are also not that bad on Google.

Closing in favor of keeping google storage as our image host