Does Directus have any issues with being deployed against a replicated postgres cluster? If it works, are both async and sync replication supported? Is there tooling, examples or documentation for such deployments?
Hi there and welcome to the community
Unfortunately, this isn’t something I’ve experimented with myself, so I have limited knowledge on the topic.
What I do know is that if you’re making changes directly in the database (bypassing the Directus API), Directus has no awareness that those changes are happening. It will certainly still load the data from the database obviously but there might be issues depending on your configuration.
Some potential gotchas to consider:
- Cache invalidation - If you have caching enabled and changes don’t go through the API, the cache may not be purged properly causing stale items through the API. There’s an utility for clearing cache via the API here.
- Hooks and flows - Database-level changes won’t trigger any Directus hooks or flows you might have configured
- Data validation - You’ll bypass any validation rules set up in Directus
- Audit logs - Direct database changes won’t be tracked in Directus activity logs
This is definitely something you’d need to spend significant time testing to understand the full side effects and implications for your specific setup.
If anyone else in the community have experience with replicated Postgres setups and Directus? Would love to hear your insights!