We removed our free Sandbox April 25th.
You can read more on our blog.
DotCloud features Redis 2.4.11. if you don’t know Redis yet, the full docs and some awesome tutorials are available at http://redis.io/.
If your application requires a Redis data store for caching or other purposes, all you need to do is to add the following lines to your dotcloud.yml Build Files:
data: type: redis
You can give your database or cache service any name you like instead of “data”. If for some reason your application needs multiple databases, you can either use multiple independant services (by repeating the database section multiple times in dotcloud.yml, each with a different name instead of just “db”), or create multiple users and databases inside one single service. The first option (multiple services) will bring more resources, but keep in mind that when you go to production, this will generally incur higher costs as well.
Your data service will be globally available. This means that you can use it with applications running on other platforms.
If for some reason, you want to use DotCloud just to deploy a standalone data service, create a two-lines “dotcloud.yml” file in an empty directory, and from this directory, just run:
$ dotcloud create mynicedb $ dotcloud push mynicedb $ dotcloud info mynicedb.data
In less than one minute, your data service will be up and running, and the “dotcloud info” command will show its connection credentials.
Configure Your Application¶
There are two ways to configure your app to use your new data service:
- manually, by hard-coding the host, port, user and password;
- automatically, by retrieving those parameters from the Environment File.
Check your service parameters using “dotcloud info”:
$ dotcloud info ramen.data cluster: wolverine config: redis_password: lshYSDfQDe created_at: 1310511988.2404289 ports: - name: ssh url: ssh://email@example.com:7473 - name: redis url: redis://redis:lshYSDfQDe@bd0715e0.dotcloud.com:7474 state: running type: redis
When your application is built by the DotCloud platform, a file named environment.json is created in the home directory of each of your services.
This file contains a JSON-formatted dictionary with most of the configuration informations of the services in your stack. You can use it to retrieve automatically the host, port, and password, of your databases, caches, and so on.
You will find snippets of code to retrieve the connection information of your databases in the Environment Guide.
Your ramen.data service will expose the following variables:
Note that DATA will be replaced by the (upper-cased) name of your service.
To start playing with Redis (or for debugging purposes), you can get a Redis shell. Using the password shown by “dotcloud info”, just use the following command:
$ dotcloud run ramen.data redis-cli redis> AUTH <password> OK redis>
You can then issue standard Redis commands.