Ruboka
Ruboka

Reputation: 63

Verdaccio custom groups

Is verdaccio-groups still the way to implement groups for controlling the access level of the different scopes?

I tried installing it like this.

FROM node:lts-alpine as builder
RUN mkdir -p /verdaccio/plugins \
  && cd /verdaccio/plugins \
  && npm install -g verdaccio-groups
FROM verdaccio/verdaccio:5.30.3
ADD docker.yaml /verdaccio/conf/config.yaml
COPY --chown=$VERDACCIO_USER_UID:root --from=builder \
  /verdaccio/plugins/node_modules/verdaccio-groups

my compose file

version: "5.30.3"
services:
  verdaccio:
    image: verdaccio/verdaccio:5.30.3
    restart: unless-stopped
    container_name: 'verdaccio'
    environment:
      - VERDACCIO_PORT=4873
      - VERDACCIO_PUBLIC_URL='https://registry.example.com"
    ports:
      - '127.0.0.1:4873:4873'
    volumes:
      - './storage:/verdaccio/storage'
      - './conf:/verdaccio/conf'
      - './plugins:/verdaccio/plugins'
    tty: true

my ~/verdaccio/conf/config.yaml( which is the same as the ~/verdaccio/docker.yaml

storage: /verdaccio/storage
listen: localhost:4873
plugins: /verdaccio/plugins
web:
  enable: true
  primary_color: "#098aff"
  pkgManagers:
    - npm
    - yarn
  showInfo: false
  showFooter: false
auth:
  htpasswd:
    file: /verdaccio/conf/htpasswd
    max_users: -1
    algorithm: bcrypt
    rounds: 8
  groups:
    file: ~/verdaccio/conf/people.yaml
packages:
  "@proj/*":
    access: $authenticated #admin pipeline
    publish: $authenticated #admin
    unpublish: $authenticated #admin
    proxy: npmjs
  "**":
    {}
 -------
#conf/people.yaml with adjusted permissions and user roles
#-rw-r--r-- 1 10001 65533   60 Apr 11 12:40 people.yaml
groups:
  admin:
    - admin
  pipeline:
    - pipeline

My verdaccio is up and running but I can't get this to work.

~/verdaccio$ll
drwxr-xr-x  5              4096 Apr 11 12:48 .
drwx------ 11              4096 Apr 11 12:09 ..
drwxr-xr-x  2              4096 Apr 11 12:46 conf
-rw-r--r--  1              423 Apr 11 12:33 docker-compose.yaml
-rw-r--r--  1              423 Apr 11 12:48 Dockerfile
-rw-r--r--  1              830 Apr 11 12:45 docker.yaml
drwxr-xr-x  2 10001 65533 4096 Apr 10 13:01 plugins
drwxr-xr-x  3 10001 65533 4096 Apr 11 09:24 storage

I can't find any information about adding group feature which gets mentioned on the documentation https://verdaccio.org/docs/protect-your-dependencies

Here the error after running docker compose up. I see it says it seems not like a valid plugin, but if it is not, how would I get groups into verdaccio?

docker compose up
[+] Running 1/1
 ✔ Container verdaccio  Recreated                                                                            0.1s
Attaching to verdaccio
verdaccio  |  info --- config file  - /verdaccio/conf/config.yaml
verdaccio  |  info --- using htpasswd file: /verdaccio/conf/htpasswd
verdaccio  |  info --- plugin successfully loaded: verdaccio-htpasswd
verdaccio  |  error--- error loading a plugin groups: {
verdaccio  |   errno: -2,
verdaccio  |   code: 'ENOENT',
verdaccio  |   syscall: 'open',
verdaccio  |   path: '~/verdaccio/conf/people.yaml'
verdaccio  | }
verdaccio  |  error--- verdaccio-groups doesn't look like a valid plugin
verdaccio  |  fatal--- uncaught exception, please report this
verdaccio  | Error: sanity check has failed, "groups" is not a valid plugin
verdaccio  |     at /usr/local/lib/node_modules/verdaccio/build/lib/plugin-loader.js:166:13
verdaccio  |     at Array.map (<anonymous>)
verdaccio  |     at loadPlugin (/usr/local/lib/node_modules/verdaccio/build/lib/plugin-loader.js:61:37)
verdaccio  |     at Auth._loadPlugin (/usr/local/lib/node_modules/verdaccio/build/lib/auth.js:49:38)
verdaccio  |     at new Auth (/usr/local/lib/node_modules/verdaccio/build/lib/auth.js:29:25)
verdaccio  |     at defineAPI (/usr/local/lib/node_modules/verdaccio/build/api/index.js:39:16)
verdaccio  |     at _default (/usr/local/lib/node_modules/verdaccio/build/api/index.js:122:16)
verdaccio  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
verdaccio exited with code 0

Upvotes: 0

Views: 121

Answers (0)

Related Questions