JustOneDB Add-On for EngineYard

The JustOneDB add-on provides the rich functionality of a relational database where commands to define and manipulate data can be issued via either;

- REST (without using SQL)

- Standard DBI or ActiveRecord interfaces

Provisioning a Database

Once you have signed up with JustOneDB, either select an application and press ‘Activate’ to get a free trial database, or click on the ‘JustOneDB Dashboard’ link to change to any of our paid plans. The currently selected plan is used for all new Activations, but it can be different for each of your applications.

Deploying to EngineYard – Lambda and Sigma

Database provisioning is carried out synchronously. Once the request has completed, you’re good to go. Enjoy.

Deploying to EngineYard – Subscription Plans on dedicated hardware

Database provisioning is carried out asynchronously, so please wait until the creation and initialization of the database is complete.

Using the REST Interface

Applications can communicate with their JustOneDB instance over HTTPS using REST requests and responses with JSON content.

You will be provided with a URI for REST access to your JustOneDB instance, which contains the required authentication information.

e.g.      https://user:pass@localhost:port/justonedb/database/justonedb

This URI is a combination of the environment variables JUSTONEDB_REST_BASE and JUSTONEDB_REST_DB. This split is maintained, for ease of use within a REST client library.

Example Code

An example Rails application using the REST API can be downloaded at

JustOneDB Rails Example (Linux)

JustOneDB Rails Example (Windows)

Using DBI or ActiveRecord

Applications can communicate with their JustOneDB instance using the standard DBI interface or ActiveRecord using the PostgreSQL drivers and adaptors.

You will be provided with a URI for DBI or ActiveRecord access to your JustOneDB instance which contains the required authentication information.

e.g.      postgres://user:pass@host:port/database

This URI will be set in the environment variable JUSTONEDB_DBI_URL by the provisioning process.

Moving data between JustOneDB and other PostgreSQL databases

If you have an existing PostgreSQL database it’s simple to move your data into JustOneDB. Should you want to move your data away from JustOneDB to another PostgreSQL database that’s easy too!

Importing into JustOneDB from a PostgreSQL database

Use either the standard pg_dump tool or another backup tool to create a PostgreSQL dump file. The dump file can be held locally or accessed remotely via a URL (for example, on S3). You will need the credentials from your JustOne DBI URL

i.e. postgres://user:pass@host:port/database

Note: Use -Fp option on pg_dump

To restore the database from a local backup, use the credentials above in the following restore command:

$ PGPASSWORD=pass psql -h host -p port -U user -d database -f filename

To restore the database via a URL, obtain the remote URL, then copy and paste it and use the credentials in the following restore command:

$ curl 'URL' | PGPASSWORD=pass  psql -h host -p port -U user -d database -f filename

Exporting from JustOneDB

Should you want to move your data out of JustOneDB, use the credentials in the following pg_dump command to export your data:

$ PGPASSWORD=pass pg_dump database --verbose -Fp --no-acl --no-owner --no-tablespaces -h host  -p port -U user > filename

Backups

Daily backups are automatically taken on your behalf and kept for 7 days.

Should you want to manually create your own additional backup and store it locally then use the credentials in the following command to create a backup of your data:

$ PGPASSWORD=pass pg_dump database --verbose -Fp --no-acl --no-owner --no-tablespaces -h host  -p port -U user > filename

To restore the database from a local backup, use the credentials above in the following restore command:

$ PGPASSWORD=pass psql -h host -p port -U user -d database -f filename

Further Reading

See JustOneDB REST Reference Guide for details about using JustOneDB with the REST interface.

See JustOneDB EngineYard Reference Guide for details about using JustOneDB on EngineYard.

© JustOne Database Inc. 2012