PostgreSQL is the official addon provided by Scalingo, details on the available plans can be found here. This addon gives your app instant access to a PostgreSQL database running in its own Docker container.

Adding PostgreSQL to your app

You can add the PostgreSQL addon through the dashboard or through the command line interface. The capacity of your database is elastic, you will be able to upgrade it later.

This command will provision the application my-app with a 1g PostgreSQL database plan.

To find out what other plans are available:

$ scalingo addons-plans postgresql

Getting your connection URI

Once the addon is provisioned, 2 environment variables are added to your app: SCALINGO_POSTGRESQL_URL and DATABASE_URL. DATABASE_URL is an alias to SCALINGO_POSTGRESQL_URL. To find out how to use it in your code please refer to Application environment.

In most cases, you can pass the variable directly to the client library you are using in your code. But sometimes the library requires a specific URI format, you’ll need to add a little bit of code to suit the library.

You can get environment variables from the dashboard or the command line interface.

Remote access your database

If you need to access your database from other places than your app please follow the Access your database guide.

Force TLS connections

PostgreSQL support
TLS to
encrypt all of its network traffic between the client and the
server.

By default, all new PostgreSQL databases have TLS activated. If you want to
connect to it, you have nothing to do. psql will automatically first try to
connect using TLS, and if it fails will try without TLS. psql will display an
informative message if you succeed to connect using TLS:

Some existing databases may not have yet TLS support. To activate TLS, you need
to restart the database. Any action leading to the restart will activate TLS
(e.g. plan update, upgrade of the database).

TLS is an option, you can still access your database without it if needed.

If you want to force connections to your database to use TLS, head to the
database dashboard and click on the toggle button:

Note that you must have configured your application to use TLS when connecting
to the database.

Changing plans

You can upgrade or downgrade your database plan whenever you need it. This
operation happens instantly thanks to Docker containers and no manual input is
required. When you change the plan, your database will be stopped then
restarted on a new host with new parameters of the chosen plan. During the
operation the connection is dropped between your app and the database. Finally,
after the operation is successful, the related app will be restarted.

Database dashboard

The PostgreSQL dashboard is the central place for administrative tasks such as:

Monitor database and system stats

Upgrade the database engine version

Activate database specific features

Manage database users

Manage backups

Database Upgrade

When the database vendor releases a new version of your database engine, we will try to provide it as soon as possible. You will have the choice to upgrade your database with one click through your database dashboard.

This operation is similar to changing your database plan; your database will be stopped and
restarted with the new database version. Thanks to Docker containers this happens seamlessly and
quickly without manual action. When this operation finishes, your application will be restarted.

Beware that no downgrade is possible once your database has been upgraded.

Container Stats

CPU usage

Current CPU usage.

Memory usage

Display the current, hightest and free memory. Highest is the maximum memory recorded since database restarted.

Swap usage

Display the current, hightest and free swap. Highest is the maximum swap recorded since database restarted.

Database Stats

Database connections

Number of currently open and maximum connections.

Data size

Logical space reported by the database.

Database on disk size

Effective physical space used.

Backups

If your database is in a paid plan (i.e. it’s not “free plan”), we’ll make automated backups of your database on a daily basis, at around 1 AM Central European Time (CET or UTC+0100). However, we don’t keep those backups forever. The following rules are applied for backups storing:

Manual database backup

All databases created after the 6th of January 2019 have encryption at rest enabled. In other words,
all your data are encrypted before being stored on disk.

For databases created before this date, encryption at rest is activable on-demand through the
support. Activating it is achieved with a short downtime for your database, from seconds to minutes
depending on the amount of data.