The default setup is that files are stored in /data/assets on a volume at the same server.
This has pros:
- the app is in full control of everything, .e.g. if you delete an asset, and remove it from the disk, it will be gone immediately (no extra cdn cache invalidation etc.)
This has cons:
- costs are higher for volume storage than for block storage
- server has more to do, has to handle not only the page requests but also requests to assets
- potentially higher bandwidth costs too (but that's depending on how the hosting is charging this)
- not suitable if you want to serve a lot of videos for instance
I still believe that pure self-contained approach is a great default, and for a lot of small sites this will just be perfect. I guess every page should start with that setup... until:
- its getting under high load
- costs for storage are getting too high
- overall "the site grew up" and is not a high traffic site
This is the time when it makes sense to decouple the assets from the web server. To make that change you'd have to:
- move the assets into an s3 bucket and remove it from the volume.
- Setup a CDN that delivers those files at https://cdn.mywebsites.com/*
- Next you need change env var ASSET_STORAGE="s3" and then provide the S3_* credentials so that new files are uploaded to the right place
- Setup ASSET_BASE = https://cdn.mywebsite.com/
Now you can redeploy your app.
Important to consider:
- You will need to use your cdn provider's manual cache purging interfaces if you want an asset url to disappear
- EW may implement some hook where people can implement their own cache invalidation logic, but that's for the future, not for 2.0
The default setup is that files are stored in /data/assets on a volume at the same server.
This has pros:
This has cons:
I still believe that pure self-contained approach is a great default, and for a lot of small sites this will just be perfect. I guess every page should start with that setup... until:
This is the time when it makes sense to decouple the assets from the web server. To make that change you'd have to:
Now you can redeploy your app.
Important to consider: