Move retool "internal" postgres database external


I'm succesfully running Retool Onprem now with an external Postgres database in Azure for the Retool settings and apps.

I've changed these settings in docker.env. I've used a connection string as the separate values didn't work, perhaps because there is no setting for SSL?

I can see in the env file that there are 2 blocks of settings for the postgres database, the top/first one is clearly Retools own settings db. The second perhaps the internal/storage database?

## Set and generate postgres credentials
# POSTGRES_DB=hammerhead_production
# POSTGRES_USER=retool_internal_user
# POSTGRES_HOST=postgres


## Set and generate retooldb postgres credentials

Now I also want to have the internal/storage postgres database to be in Azure.
So what I've done so far:

  • created a new database in Azure (same server as the Retool settings db) with same credentials
  • Followed instructions from here and filled in the details for the new database. The connection test was succesful.

However, when going to the database in Retool and check the connection settings here:


I see that the "database" is just a random string. When looking at the azure postgres server I can also see that a two new databases have been created with random names, one of them matches the one in the connection string. Oddly I don't seem to have the priviliges to access those with pgadmin or heidisql.

I've tried again to add the database by filling out the form on {your-domain}/resources?setupRetoolDB=1 and again a 2 new database with random names were created.

Any idea what I'm doing wrong? And how I can move the database?

BTW, (how) can I disable the postgres containers in Docker-compose.yml once the database are both external? They don't need to spin up anymore.


Hey @mbruijnpff!

Apologies for the late reply here. It doesn't look like you're doing anything wrong! RetoolDB spins up new databases for each environment that you have on your instance. If you want to move any existing data over you'll need to do that with something like pg_dump. You should be able to connect to them using the connection string in the settings that you posted though (docs), is that where you ran into permissions issues?

And yes, once you have all of your Postgres databases externalized you should be able to remove the Postgres container which can, for instance, by commenting it out or removing it from your docker-compose.yml file along with any references and links to it in that same file.