Please note that these documents apply to OpenShift Online v2 only (accounts created before August 1st, 2016).
If you are using one of the OpenShift 3 products, please refer to documents available at

Using PostgreSQL with OpenShift Online

The postgresql cartridge(s) provides PostgreSQL on OpenShift. PostgreSQL is an open-source object-relational database system. With OpenShift you can easily deploy and run applications backed by PostgreSQL using your favorite servers and frameworks. OpenShift Online currently supports PostgreSQL 8.4 and 9.2.

The PostgreSQL Cartridge

Environment Variables

The postgresql cartridge provides several environment variables to reference for ease of use:

Variable Description


Numeric host address




DB Username


DB Password


Directory for log files


PID of current Postgres server


Postgres socket location


Full server URL of the form "postgresql://user:password@host:port"


PostgreSQL version in the form X.Y

You can fine-tune the PostgreSQL server performance by using the rhc tool and changing the default values for these variables:

Variable Description


The shared_buffers configuration parameter determines how much memory is dedicated to PostgreSQL to use for caching data.


max_connections sets exactly that: the maximum number of client connections allowed.

For more details, please refer to the PostgreSQL wiki page.

Example Use

Getting a Python app with a PostgreSQL backend deployed onto OpenShift is as easy as executing two commands:

$ rhc app create MyApp python-3.3
$ rhc cartridge add postgresql-9.2 -a MyApp

These two commands create your "server" and install and configure Python, PostgreSQL, and a git repository on the server. You can now visit your application on the web at: