Web applications often need to store assets uploaded by users such as profile pictures or documents. The most convenient place to store these may be the web server’s local file system.
This is usually fine to begin with but eventually either your assets outgrow the disk space on your server or your application outgrows the web server and you need to scale to additional servers.
Adding more disk space might not be too hard, but when adding more servers you need to think about how they’ll all be able to access the assets. This is often achieved with a networked file system (such as NFS, or GlusterFS).
That doesn’t even consider making the storage highly available and making backups.
Our cloud storage service, Orbit, is ideal for this kind of situation. Assets can be stored in Orbit using the OpenStack Swift HTTP API and either retrieved when needed, or served directly to the user. Everything in Orbit is automatically replicated to three different servers across two UK datacentres and you can scale to hundreds of terrabytes of storage without changing a thing. Just pay as you go, per gigabyte per month.
Carrierwave is a file upload library for Ruby applications that support Orbit as a backend storage system.
We’ve prepared a guide to setting up Carrierwave within a Rails application that accepts file uploads and stores them in Orbit, freeing you from having to think about scaling your asset storage.
Orbit data storage and data transfer are free until February 2015. So give it a go today.
If you’re not already a Brightbox customer you can get signed up in 2 minutes. We’ll even apply an additional £20 credit to get you started with our other services.