Setup: External database

DeepSource Enterprise uses a PostgreSQL database to store persistent data. By default, an embedded database is provisioned within the Kubernetes cluster. However, for production deployments, we highly recommend bringing your own PostgreSQL database. This document walks through the steps to set up an external database.

Recommended version: PostgreSQL 12

Setting up your database

On a fresh PostgreSQL database, you would have to create a new database and set up a user with sufficient privileges before configuring it for use with DeepSource app.

Following are sample steps to do this on a generic PostgreSQL database. Your steps may vary in case you are using a managed database like AWS RDS or Google CloudSQL.

Log into your database with the postgres user:

psql postgres

Create a new database:

CREATE DATABASE <db-name>;

Create a new PostgreSQL user for the application to use:

CREATE USER <user-name> WITH ENCRYPTED PASSWORD '<password>;

Grant privileges to the database user:

GRANT ALL PRIVILEGES ON DATABASE <db-name> TO <user-name>;

Important: Ensure that the max_connections parameter for the PostgreSQL application is set to at least 500. You will have to set a suitable shared_buffers value for this value.

Configuring your app to use the external database

  1. Log into the Admin Console.
  2. Navigate to the Config section in the admin console.
  3. Select No for the field Deploy embedded database?
  4. Enter the folllowing values for the corresponding fields:
    1. Application database name: Enter the name of your database name that was created for DeepSource.
    2. Application database hostname: Enter the hostname/IP of your PostgreSQL server.
    3. Application database port: Enter the port on which your PostreSQL instance is configured. The default value for this field is 5432.
    4. Application database username: Enter the database username that you created for the database.
    5. Application database password: Enter the database password for the datbase user you used in the previous step.
  5. Click on Save Config to persist this configuration.
  6. Navigate to the Version History page.
  7. Click Deploy.
  8. The application will be redeployed with the new database.