On this page

File System Buckets

When you deploy an application on Clever Cloud, like most PaaS, a new virtual machine is created, the previous one is deleted. If your application generates data, for example if you let users upload pictures and you do not store it on external services like S3, you will lose anything stored on the disk.

The Git deployment does not allow you to keep generated data files between deployments. To avoid the loss of your data, you have to mount a persistent filesystem. This is why we created File System Buckets.

You will be able to retrieve generated data between two deployments.

Notes:

  • Back-ups are not included in the public cloud offer. You can still do them manually.
  • FSBuckets are not available for Docker applications because of security concerns.

Configuring your application

Buckets are configured using environment variables. Add the following to your application :

CC_FS_BUCKET=/some/empty/folder:bucket-xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-fsbucket.services.clever-cloud.com

don’t forget to replace the path of the mounted folder and the fs-bucket host with the targeted folder path (make sure the folder not exists) and your fs-bucket host

You can setup multiple buckets by appending a number at the end of the environment variable’s name.

CC_FS_BUCKET=/some/empty/folder:fs_bucket_host
CC_FS_BUCKET_1=/some/otherempty/folder:fs_bucket_other_host

Configuring your application with buckets.json (@deprecated)

To configure your application to use buckets, use the clevercloud/buckets.json file.

The clevercloud folder must be located at the root of your application.

The buckets.json file must contain the following structure:

[
  {
    "bucket" : "bucketId",
    "folder" : "/myFolder",
    "apps"   : ["app_id"]

  },
  {
    "bucket_host" : "bucket-01234567-0123-0123-0123-012345678987-fsbucket.services.clever-cloud.com",
    "folder" : "/myotherFolder",
    "apps"   : ["app_id_2"]
  }
]

It’s a json array containing objects with at least two fields:

UsageFieldDescription
RequiredbucketThe bucket id you can find in the console. It begins with `bucket_`. This is for "old-style" buckets (created before the 7 December 2015)
Requiredbucket_hostThe bucket host you can find in the console. It begins with `bucket-` and ends with `services.clever-cloud.com`. This is for "new-style" buckets.
RequiredfolderThe folder you want the bucket to be mounted in. Should start with `/`. Using the example *myFolder*, you can access your bucket via the *myFolder* folder at the root of your application (which absolute path is available in the `APP_HOME` environment variable)
OptionalappsWhitelist of the applications allowed to mount this bucket. It's helpful if you need to deploy a *preprod* app and a *prod* app using the exact same codebase but different buckets

Accessing your data inside the FS Bucket

From your application

Your bucket is mounted at the configured path, starting from your application’s root folder.

If you want to use an absolute path, you can use the APP_HOME environment variable, see special environment variables

From the addon dashboard

The File explorer tab of the addon dashboard gives you access to your files in the FS bucket.

From your favorite FTP client

The Addon information tab of your FS Bucket add-on displays the information you need to connect to your bucket using FTP.

Pricing

Comments