Please help me to create docker-compose file for Verdaccio+LDAP. Typical compose file
version: '3'
services:
verdaccio:
image: verdaccio/verdaccio:latest
container_name: verdaccio
ports:
- "4873:4873"
volumes:
- verdaccio:/verdaccio
volumes:
verdaccio:
driver: local
But i didn't find how to add LDAP plugin to this configuration and how to add special volume for builds?
First of all, it depends how you are deploying Verdaccio, but, I'll assume you are using Docker.
There there is a full example how to set up Verdaccio + OpenLDAP
https://github.com/verdaccio/docker-examples/tree/master/ldap-verdaccio
The key to adding plugins to the Docker images extends the official one
FROM verdaccio/verdaccio
RUN npm i && npm install verdaccio-ldap
That will extends the official installing the LDAP plugin, just that easy.
Then you have to add the specific LDAP configuration to config.yaml
file like this
auth:
ldap:
type: ldap
client_options:
url: "ldap://openldap:389"
# Only required if you need auth to bind
adminDn: "cn=admin,dc=example,dc=org"
adminPassword: "admin"
# Search base for users
searchBase: "ou=People,dc=example,dc=org"
searchFilter: "(cn={{username}})"
# If you are using groups, this is also needed
groupDnProperty: 'cn'
groupSearchBase: 'ou=Groups,dc=example,dc=org'
# If you have memberOf support on your ldap
searchAttributes: ['*', 'memberOf']
# Else, if you don't (use one or the other):
# groupSearchFilter: '(memberUid={{dn}})'
#
# Optional, default false.
# If true, then up to 100 credentials at a time will be cached for 5 minutes.
cache: false
# Optional
reconnect: true
And that's all. Please check the complete example for other minor configuration topics that are merely Docker part.
Aside from Docker, you can use purely npm
. First of all, ensure you have installed Verdaccio globally and then proceed to install the ldap plugin globally like this.
npm install --global verdaccio-ldap
As the last step, follow the same configuration above in the yaml file.
I hope that helps.