Horizontal scaling for self-hosted deployments
Learn about horizontally scaling self-hosted Retool deployments.
Retool is packaged as a single stateless Docker container. The only dependency it has is a Postgres database that Retool uses for storing data like user information, organization settings, audit logs, and applications.
At startup, Retool checks and runs any pending migrations on the database, and then starts itself up. The Retool server serves the API and frontend assets.
Scale a Retool instance
These are the general steps for scaling a Retool instance:
- Host the Postgres database on an external system like AWS RDS.
- Start multiple Retool containers that use the same Postgres database.
- Use a load balancer to route traffic between the Retool server containers.
See our GitHub repo for a full list of deployment options.
Zero downtime upgrades
When you upgrade to a Retool version that requires running database migrations, it's possible for multi-container setups to run into downtime issues. This is because every container tries to run the migration at startup, which can lead to a deadlock. Follow these steps to avoid downtime.
- Know when you need to run a migration. Whenever Retool increments a major version—from
2.0.0
to2.1.0
for example—a migration is required. - When you upgrade a major version, deploy a single Retool container with the newest version and allow that container to finish running the migrations. Because Retool makes sure that migrations are backwards compatible, this doesn't cause downtime.
- After the migration succeeds on the single Retool container, you can rollout the other containers.
- After all the migrations are complete, remove the container created in step two.
Updated 24 days ago