Before I created feature request in github discussions, I wanted to check here if I am maybe missing something.
After investigation and testing, I found out that these are not implemented or don’t have documentation on how to setup:
Feature request
Multiple marketplace registries
Private marketplace registries with auth token
Marketplace registries with custom endpoints
Allow installing specific version of extension from UI
Motivation
I have:
A few custom extensions that are related to our internal operations and should not be public
Extensions that I installed via market place from public registry
I cannot setup private registry with token AUTH, and I cannot setup multiple marketplace registries
The only solution is currently to build docker with the extensions and install the public extensions from registry.
If I have multiple projects where some share the extension, it is necessary to build and deploy both does not scale well and introduces a lot of other potential issues
Additional
Registry seems to be a proxy between directus instance and npmjs API, so I could essentially setup some NPMJS like proxy, but seems like something that should be supported.
Can you share some more information about what you’re trying to do?
Are you looking to have your own private marketplace? Like a custom extension registry that’s separate from the public Directus marketplace?
A bit more context on your use case would help me point you in the right direction.
I need to use both public Directus extensions (from the official marketplace) and private/internal extensions (that shouldn't be public) across multiple Directus projects. I want the ability to configure Directus to pull extensions from multiple sources - the public marketplace plus one or more private registries (with auth tokens). Or maybe Directus marketplace already allows this and I can have private extensions within the official Directus marketplace?
My approach to the limitations of marketplace in it’s current state ist to work around it.
As of Docker Compose v2.30.0 there is a Post-start hook which can be used to clone extensions right from Github and build them on container startup.
Be aware tho, that this significantly increases container startup time.
The relevant parts of the the docker-compose.yml:
name: service-stack
services:
directus:
image: directus/directus:11.2.2
post_start:
- command: >
/bin/sh -c "
# Install git
apk add --no-cache git &&
# Extension directus-extension-flexible-editor
# https://github.com/formfcw/directus-extension-flexible-editor
# Pull latest or clone the repo if it doesn't exist yet
# This does log an error, as it triggers EXTENSION_AUTO_RELOAD but there is no dist folder yet.
git -C /directus/extensions/directus-extension-flexible-editor pull || git clone https://github.com/formfcw/directus-extension-flexible-editor.git /directus/extensions/directus-extension-flexible-editor &&
# Install dependencies with production=false to include devDependencies (devDependencies needed for building the extension)
npm install --prefix /directus/extensions/directus-extension-flexible-editor --production=false &&
# Build the extension
npm run build --prefix /directus/extensions/directus-extension-flexible-editor &&
# Touch the package.json to trigger EXTENSION_AUTO_RELOAD once again (this time with dist folder in place)
touch /directus/extensions/directus-extension-flexible-editor/package.json
# Repeat for other extensions
# Extension directus-extension-generate-types
# https://github.com/maltejur/directus-extension-generate-types
git -C /directus/extensions/directus-extension-generate-types pull || git clone https://github.com/maltejur/directus-extension-generate-types.git /directus/extensions/directus-extension-generate-types &&
npm install --prefix /directus/extensions/directus-extension-generate-types --production=false &&
npm run build --prefix /directus/extensions/directus-extension-generate-types &&
touch /directus/extensions/directus-extension-generate-types/package.json
"
# Run all of this as root
user: root
volumes:
- ./data/directus/extensions:/directus/extensions
environment:
EXTENSIONS_AUTO_RELOAD: "true"
For private repos just clone with a valid token: clone https://my_token@github.com/my_user/my_repo.git
Yeah, I have a little bit different workaround - I have a custom Dockerfile which builds the image from Directus with the extensions. After that I can deploy the image in Docker of K8s. But of course this does not work well when you need to manage multiple projects that share the same extensions and also want to have maintainable code that you have in a single place.
I first tried with customized directus build, but as you said, it’s pretty hard to maintain. I found it a bit easier to just build the extensions right from github. Since it’s just git operations, it might also be possible to fetch a specific changeset instead of the latest state, which would give you some kind of control over versions, but I didn’t dive deeper into that.
Anyway, i would support your feature requests for the marketplace, because I think in it’s current state, it’s holding back evolvement of Directus.
I need to use both public Directus extensions (from the official marketplace) and private/internal extensions (that shouldn't be public) across multiple Directus projects. I want the ability to configure Directus to pull extensions from multiple sources - the public marketplace plus one or more private registries (with auth tokens). Or maybe Directus marketplace already allows this and I can have private extensions within the official Directus marketplace?
– asitanc