System architecture of self-hosted Retool deployments
Learn about Retool's self-hosted architecture.
Organizations that have on-premise requirements can deploy the Retool platform on their own infrastructure. Each deployment instance uses a distributed set of containers with services for different functions. These work together to securely run the platform within your VPN or VPC.
Self-hosted deployments support classic apps out of the box. To build apps using AI and natural language prompts, you must enable services for the new app builder in your Helm values and have blob storage configured and your Retool ingress in place. Set rr.enabled: true to enable the js-executor, agent-sandbox, and rr.gitServer services together. Set mcp.enabled: true separately to enable the MCP service.
Containers and services
A standard deployment instance includes the following services. Most run as a single container. The exception is agent-sandbox, which consists of multiple cooperating containers. Refer to the agent-sandbox section for the full component breakdown. The SERVICE_TYPE environment variable values determine which services certain containers run.
| Container | Image | Repository | Services |
|---|---|---|---|
| api | backend | tryretool/backend | MAIN_BACKENDDB_CONNECTORDB_SSH_CONNECTOR |
| jobs-runner | backend | tryretool/backend | JOBS_RUNNER |
| workflows-worker | backend | tryretool/backend | WORKFLOW_TEMPORAL_WORKER |
| workflows-backend | backend | tryretool/backend | WORKFLOW_BACKENDDB_CONNECTORDB_SSH_CONNECTOR |
| agent-worker | backend | tryretool/backend | AGENT_TEMPORAL_WORKER |
| agent-eval-worker | backend | tryretool/backend | AGENT_EVAL_TEMPORAL_WORKER |
| code-executor | code-executor-service | tryretool/code-executor-service | No service type. |
| js-executor | js-executor-service | tryretool/js-executor-service | No service type. |
| agent-sandbox | agent-sandbox-service | tryretool/agent-sandbox-service | No service type. Consists of multiple containers (refer to agent-sandbox). |
api
The api container manages the core functionality for a Retool deployment instance, such as:
- Frontend interactions (e.g., building apps and workflows).
- Hosting apps and workflows.
- Managing users and permissions.
api runs the following services:
MAIN_BACKEND
The core service for a Retool deployment instance. It handles most logic for frontend interactions.
DB_CONNECTOR
Handles query requests to resources (databases, APIs, etc.).
DB_SSH_CONNECTOR
Handles query requests to resources that use SSH tunnels. Operates the same way as DB_CONNECTOR but exclusively for resources configured with SSH proxies.
Network ingress and egress
api requires ingress from client interactions, such as loading an app in a browser. These are typically handled by a load balancer (e.g., nginx) which proxies the requests.
The following table displays ingress and egress requirements for api.
| Container | Network ingress | Network egress |
|---|---|---|
| code-executor | ||
| postgres (platform database) | ||
| retooldb-postgres | ||
| Temporal | ||
| Resources |
Replicas
You can replicate api as you scale to manage higher volumes of workflow traffic.
Resource query trace
The following diagram illustrates a typical resource query trace as it processes through a self-hosted deployment.
jobs-runner
The jobs-runner container manages background tasks, runs database migrations for Retool version upgrades, and Source Control. It runs the following service:
JOBS_RUNNER
Performs database migrations and manages Source Control.
Network ingress and egress
The following table displays ingress and egress requirements for jobs-runner.
| Container | Network ingress | Network egress |
|---|---|---|
| postgres |
Replicas
You must not replicate jobs-runner. It performs tasks and migrations that must be performed as a single container.
workflows-worker
The workflows-worker container continuously polls the Temporal Cluster for tasks required to either start or execute blocks within a workflow. It makes requests to code-executor to execute blocks and process results, then reports back to Temporal to continue or complete workflow execution.
workflows-worker runs the following service.
WORKFLOW_TEMPORAL_WORKER
Polls the Temporal Cluster for tasks required to start or execute workflow blocks.