External Database Configuration
Use of external database resources in Cloud Providers (e.g. AWS) charges your account. This example if run will take 1 hour of managed database service time. Please make sure to perform the cleanup per the notes at the bottom of the lab.
The following example focuses on using Docker Desktop to more quickly deploy for demo purposes.
Requirements
To configure Retool to use an external database you will need:
- Retool running on Docker Compose (e.g. EC2 instance, locally via Docker Desktop)
- AWS Account with user that has admin privileges to create a database
Retool Self-hosted automatically comes with a PostgreSQL container / pod that can be used for POC purposes. Retool recommends that you configure an external database for production purposes. The following lab will cover creation of an external database in Amazon RDS. Because there are no existing Retool Apps, Workflows stored in the database, no export of the Retool Postgres container will be performed into the Amazon RDS database. Instead a database will be created, Retool (Docker Compose) configured to use the new database, and Retool (Docker Compose) is then restarted.
Create Amazon Aurora Database
Through the AWS Management Console, select RDS > Easy Create > Aurora (PostgreSQL Compatible). Select Create. This will then display the RDS Console as the database is created.
When complete the writer / reader instance will display as shown in the following figure:
Selecting database-1-instance-1, modifying the database to update the master password and make it publicly accessible is performed next.
Update Password
Select the Writer instance to access the database password that can be then be updated.
Make Publicly Accessible
Select Additional configuration to update Public access, so that Retool if running on a laptop can access the instance. If Retool is running on EC2, keeping the instance Not publicly accessible would be the recommendation.
Update Retool with Amazon Aurora Settings
Edit your docker.env to have the host, port, username and password specified. Modify the first entry as shown below:
## Set and generate postgres credentials, not RDS uses postgres for DB unless you modify the name under Advanced configuration.
POSTGRES_DB=postgres
POSTGRES_USER=<username>
POSTGRES_HOST=<RDS hostname>
POSTGRES_PORT=5432
POSTGRES_PASSWORD=<password>
Restart Retool
Start Retool via docker-compose and check the jobs-runner container logs using the following command to get the container list and then examine the jobs-runner or api logs.
docker compose down
docker compose up -d
docker ps
docker logs <container id or container name>
Access Retool in the browser again, recreate the organization and admin user. This should confirm successful integration with the database.
Cleanup of Retool and RDS Installation
The following steps can be used to cleanup the Amazon RDS.
Delete Database
- Within the AWS Management Console, go to Amazon RDS.
- Select the database that you created previously.
- Select Actions > Delete and enter the confirm me prompt to start the deletion process.
- If asked to create a Final Snapshot, confirm you want to delete without taking a snapshot.