Cloud Storage

You want to store files but you can’t decide between FS Buckets and Cellar. This article will compare them: usage, pros/cons, pricing.

Clever Cloud uses immutable disposable VMs. Every time you redeploy your application, you lose the old instances and all the files stored on their filesystems. If you want to avoid that, you have to store your important files outside of your instances.

Cellar and FS Buckets both allow you to store files outside of your instances for later use. But there are some differences between them.

ℹ️
If you are coding a new project and need to store files, use Cellar. It will be cheaper and give you way more flexibility. If your want to run a WordPress site or some OSS PHP application and are in a hurry, you may not get to choose: use FS Buckets.

What is FS Bucket?

Configuring FS Buckets in your application will give you a folder in your filesystem. This folder is shared between instances/applications. It’s mounted over the network. As for any network filesystem there are upsides and downsides.

Upsides of FS Bucket

If your application manages files on a filesystem, you don’t have to change anything. Just setup your FS Bucket to mount on a given folder, setup your application to write in that folder and you are good to go!

Since the folder is mounted over the network, multiple instances/applications can read it like any file on the system. At the same time.

Downsides of FS Bucket

Since it’s a file on a filesystem, you can be tempted to store a SQLite (or equivalent) database in it. This would be wrong. If many instances try to write in it at the same time, you might end up with a corrupted database.

For the same reason, anything accessing a file in write at the same time might corrupt the data you put in it.

What is Cellar?

Cellar is an Amazon S3 API implementation using Ceph Rados Gateway. It provides an HTTP API that can be used with any S3 API Client. Clients exist for a lot of languages. You can use any S3 Client, from the official Amazon ones to the community ones.

If you already use S3, you will be in your element.

To store a file, issue a PUT HTTP request to Cellar’s API. To get a file, issue a GET request to the API. You need secret and public keys to authenticate your requests. You can manage ACLs and generate signed URLs with an expiration date.

Upsides of Cellar

You can move the file uploads to your client entirely. Just give it a temporary signed URL (generated by your backend) and it will be able to upload directly to Cellar. That way, you don’t have to handle the receive-and-upload part on the server side.

Your files are stored in a secure way outside of your apps FS. So an attacker will have a harder time to find it.

You can delegate the authorization part to Cellar by giving signed urls for file downloads and uploads.

The files are stored with a replication factor of 3, meaning that there are 2 replicas in addition of the original data.

Downsides of Cellar

When deploying an application you did not write, file uploads may already be developed using local files. Like in WordPress, PrestaShop, etc. So you would have to use plugins or hack it to upload to Cellar.

What should I choose?

Well, you read the upsides and downsides of both. You may understand where our preference goes, by now! If you can, use Cellar. S3 Client library exist in almost all languages. It’s cheaper. It’s more resilient to hardware failures. It gives you free processing power: when using files on your filesystem, you have to process them yourself. When using Cellar, you can delegate the handling of the upload to Cellar itself.

If you don’t have a choice, use whatever you have to use.

Last updated on

Did this documentation help you ?