Directus + Coolify: Should You Decouple Postgres and Redis?
Part 2 of the Directus and Coolify series exploring whether to separate your database and cache services from the main stack.

Stock photo for illustration only, not from the actual event
- Single bundled Docker Compose setups are recommended for running a single application.
- Coolify allows independent service restarts and dedicated S3 backups even within a bundled stack.
- The real reasons to decouple are CPU/memory metrics collection and sharing databases across multiple apps.
This is Part 2 of the Directus and Coolify series. If you are new here, the first method involved coupling all services into a single Docker Compose file, which automatically handles container networking and prevents race conditions during startup.
While bundled setups work best for a single app on a Coolify-managed VPS, the author initially assumed several reasons to split services—such as better control over backups, monitoring, and restarts. Each assumption was tested on a live Coolify instance before recommending any decoupling.
The first assumption was that restarting Directus would restart Redis and Postgres alongside it. In reality, Coolify provides an independent restart button for Directus, Database, and Cache right in the same view, eliminating the need to decouple for this reason alone.
The second assumption concerned backups. Even when Postgres is bundled inside the Directus Compose file, Coolify grants a dedicated Backups option complete with S3 support, proving it is not restricted to separate resources only.
Similarly, Coolify exposes a scheduled tasks tab per service within a bundled stack, featuring a container name dropdown to target cron jobs specifically at the database or Directus without separating anything.
Understanding Docker architecture and platform constraints helps optimize server resource management. Decoupling services should be driven by genuine architectural requirements—such as multi-app database sharing or monitoring visibility—rather than assumptions about basic operational controls.

Stock photo for illustration only, not from the actual event
However, two genuine reasons to decouple emerged. First, CPU and memory metrics collection is explicitly not available for Docker Compose-based deployments according to Coolify documentation. To view per-container resource usage through built-in monitoring, the service must be deployed as a standalone resource.
Second, sharing a database across multiple apps is restricted by Docker networking rules. A database defined inside one app's Compose file lives on a private network and cannot be reached by a separate application without explicit bridging. Desktop and mobile apps requiring the same Postgres instance mandate an independent database resource from the start.
The Directus resource Compose file uses the image "directus/directus:12.2.0", exposes port 8055, mounts uploads and extensions volumes, and configures a healthcheck targeting "127.0.0.1:8055/server/ping" to bypass the unhealthy bug encountered in Part 1.
A critical detail regarding the Redis connection URL is that Coolify appends the generated username (such as redis) into the string format "redis://username:password@host:port". Since Directus requires only the password, that username segment must be stripped out to form "redis://:password" to ensure successful connection.
Source: Dev.to
Found something wrong in this article? Report an issue with this article
Comments
Leave a Comment