Retool's storage database

On most on-premise setups (Docker Compose and Kubernetes), user information and documents are stored in a Postgresql Docker container with a persistent volume. However, as usage grows it is often useful to switch to using an externally hosted database solution for more redundancy.


How much storage will I need?

When setting up your database for a new Retool instance, we recommend allocating at least 60GB of storage. If you are migrating an existing, large Retool instance, you might need more space.


What database permissions will the Retool user need?

Retool's database user must have the CREATEDB privilege, own the hammerhead_production database, and also own the public schema within the hammerhead_production database.

1. Exporting data from Retool's docker container

To export the data from Retool's postgres container, run the following command on the virtual machine currently hosting the Retool Docker containers.

sudo docker exec -t retool-onpremise_postgres_1 \
    pg_dump hammerhead_production --no-acl --no-owner --clean \
    -U  postgres > retool_db_dump.sql

The database dump should now be in a file called retool_db_dump.sql in the directory that you run the command above

2. Migrating the data to an external hosted database (e.g. RDS)

To then restore the dump to an external database, run the following command (where the DB_CONNECTION_URI is a Postgresql connection string that connects to your externally hosted database)

psql DB_CONNECTION_URI -f retool_db_dump.sql

Note: your DB_CONNECTION_URI should be in this this format.

3. Configuring Retool to use the external database

The docker.env files defines several options in Retool, including which database to connect to. The lines that need to be edited have the following pattern

POSTGRES_PASSWORD={a random string}

Now, simply edit those variables to correspond with your newly created database. Here is an example:


Alternatively, you may delete the five environment variables and instead specify a database connection string like so

DATABASE_URL=postgres://retool_user:[email protected]:5432/retooldb

4. Restart the Retool server

Finally, run the following command from the retool_onpremise directory to restart the server.

sudo docker-compose up -d

Did this page help you?