Hello community,
i’d like to ask you for best practices on how to deploy custom extensions within a self hosted deployment.
Situation:
I’m self-hosting a Directus project on a private VPS, and the deployment is handled via the Coolify PaaS. Both the docker-compose.yml for my Directus setup and a customized Directus Dockerfile are versioned in a GitHub repository.
Whenever a new commit is pushed to the main branch, a webhook triggers Coolify to redeploy the project. Behind the scenes, Coolify orchestrates the entire process: pulling the latest state of the repository, building new images, creating new containers, removing old ones, and even performing automatic rollbacks if something goes wrong — and much more.
Overall, it’s a very convenient CI/CD workflow since everything runs automatically without any manual intervention.
Problem:
How do i “correctly“ include / deploy custom developed extension within that workflow? The extensions are just for that directus project. They shall be automatically installed when the project is deployed (as described above). I alredy have defined marked place extensions within the customized Dockerfile like so, and it does it’s job. But since my own extension arent in the markedplace, where to put them?
Example Dockerfile:
FROM directus/directus:11.7.2
RUN corepack enable
USER node
RUN pnpm install directus-extension-schema-management-module
Excerp docker-compose.yml:
services:
directus:
build:
context: ./
volumes:
- "directus-uploads:/directus/uploads"
- "directus-extensions:/directus/extensions"
- "directus-templates:/directus/templates"
- "directus-snapshots:/directus/snapshots"
With that configuration, the “extensions” directory gets a persisted named volume. So how do I now put my own developed extensions there?
In my local dev environment, the “extensions” directory is a bind mount. Within that, I develop each extension (npx create-directus-extension@latest) and build them (npm run dev). Directus automatically loads them (EXTENSIONS_AUTO_RELOAD enabled). So far, so good.
But how can I organize the build and deployment process in a way that the source code of my extensions is part of the project’s monorepo and gets automatically built and shipped during deployment?
It feels “wrong” to me to commit the built extension code into the repo.
At the end of the day, I “just” want a repo where I do all the project-related coding, hit commit & push, and everything is placed in the right spot automatically. Is that even possible?
Am I missing something?
Thanks for any hints that might push me in the right direction