Ability to Connect to External PostgreSQL and Redis Clusters
What problem will this feature address?
Currently, Dokploy seems limited to deploying and managing its own PostgreSQL and Redis instances. For users who already rely on externally managed database clusters (e.g., PostgreSQL and Redis) provided by their cloud providers—complete with built-in high availability, backups, and ongoing maintenance—it’s challenging to integrate these resources with Dokploy. As a result, they cannot leverage their existing fault-tolerant infrastructure and must settle for local instances that may not meet their redundancy and reliability needs.
Describe the solution you'd like
I would like Dokploy to support configuring and connecting to externally managed PostgreSQL and Redis clusters. This means providing a straightforward configuration method (e.g., environment variables, configuration files, or UI fields) where users can specify connection details (host, port, credentials, SSL settings) for their existing database and cache clusters. Dokploy should then seamlessly interact with these external services as if they were its own managed resources.
Describe alternatives you've considered
Local Deployments: Running PostgreSQL and Redis locally within the Dokploy environment, but this compromises high availability and ease of maintenance.
Custom Integration Scripts: Writing custom scripts or proxy services outside of Dokploy to route traffic to the external databases. However, this increases complexity and reduces the benefits of a single integrated solution.
Forking/Modifying Dokploy Code: Making code changes to Dokploy to hardcode external connections, but this is not sustainable for future updates or for non-technical users.
Additional context
By enabling direct connections to managed clusters, Dokploy can become more versatile in enterprise settings where externally provisioned, fully managed services are standard. This integration would improve resilience, reduce operational overhead for users, and ultimately help Dokploy fit into more complex infrastructure scenarios.
Will you send a PR to implement it?
No
I'm able to do this in my application code with the help of environment variables.
I noticed some inconsistency in how Redis is configured across the codebase.
For example, in apps/schedules/src/queue.ts, the code uses REDIS_URL:
export const connection = new IORedis(process.env.REDIS_URL!, {
maxRetriesPerRequest: null,
});
But in apps/dokploy/server/queues/redis-connection.ts, it only uses REDIS_HOST.
This raises two questions:
- Is there a plan to standardize the naming (
REDIS_URLvsREDIS_HOST)? - Would you consider supporting more complete connection options (host, port, username, password, db), so external Redis/Valkey instances can be used properly?
My use case: I’d like to use an existing Valkey (Redis drop-in replacement) instance running outside of Docker Swarm. Currently, with only REDIS_HOST available, it’s not possible to connect to Redis/Valkey instances that are protected with ACLs.
I would also like to inquire where and how we need to set REDIS_URL as this envvar was not documented to be set anywhere.
What does apps/schedules/.. do anyway?
Update 12/15/2025 -
REDIS_HOSTis being passed as a connection object to BullMQ which handles most of the functionalityREDIS_URLseems to be used as a test:apps/dokploy/__test__/env/environment.test.ts
In order to be explicit when using external DBs (both postgres and redis, it is important to specify the various parts of the connection: host, port, database, user, etc). For postgres, which is handled by the postgres URL (@mcandylab note external PGSQL is already supported using the existing envvars)
Problem: But for redis, we default to specifying the HOST only. If users have a different port or database index they like to use instead of the default 0, there is no way to configure this.
[TODO] Enhancement (pull request to be made at a later date unless someone beats me to it):
- Add
REDIS_PORTandREDIS_DB_INDEXas ENVVARS to further specify the connection object - Include these as checks to the connection object in
apps/dokploy/serverqueues/redis-connection.tsso that the object contains host, port, and db:
// apps/dokploy/serverqueues/redis-connection.ts
...
export const redisConfig: ConnectionOptions = {
host:
process.env.NODE_ENV === "production"
? process.env.REDIS_HOST || "dokploy-redis"
: "127.0.0.1",
++ port:
++ process.env.REDIS_PORT || "6379",
++ db:
++ process.env.REDIS_DB_INDEX || "0",
};
- for the test file (
apps/schedules/src/queue.ts) we can ignore it since it is a test, or we can buildREDIS_URLfromREDIS_[HOST, PORT, DB_INDEX]