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.
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
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.