Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verdaccio plugins not working #107

Open
bab5470 opened this issue Oct 5, 2022 · 3 comments
Open

Verdaccio plugins not working #107

bab5470 opened this issue Oct 5, 2022 · 3 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@bab5470
Copy link

bab5470 commented Oct 5, 2022

I'm installing verdaccio using helm and I need to install some additional verdaccio plugins notably:
verdaccio-ldap verdaccio-memory verdaccio-auth-memory

I'm doing that with the extraInitContainers in values.yml:

extraInitContainers:
   - name: populate-workdir
     image: verdaccio/verdaccio:5.2.0
     command:
       - 'sh'
       - '-c'
       - 'cp -a /opt/* /tmp/tmpopt/ > /dev/null 2>&1'
     volumeMounts:
     - name: verdoptio
       mountPath: /tmp/tmpopt/
   - name: install-plugins
     image: node:14.18.1-alpine
     command:
       - 'sh'
       - '-c'
       - |
         cd /opt/verdaccio/
         yarn config set enableProgressBars false
         yarn add verdaccio-ldap verdaccio-memory verdaccio-auth-memory
         yarn cache clean
         yarn workspaces focus --production > /dev/null 2>&1
         chown -R root /opt/
         chown 10001 /opt/verdaccio/
     volumeMounts:
     - name: verdoptio
       mountPath: /opt/

Then I have the following persistence defined:

persistence:
  accessMode: ReadWriteOnce
  enabled: true
  mounts:
    - mountPath: /opt/
      name: verdoptio
      readOnly: false
  selector: {}
  size: 8Gi
  volumes:
    - name: verdoptio
      emptyDir: {}

I've modified the verdaccio config.yml configmap as follows:

store:
  memory:
    limit: 1000

However, the pod is stuck in a crashloopbackoff with the error:

# k logs verdaccio-568c6599d9-bjs2p
Defaulted container "verdaccio" out of: verdaccio, populate-workdir (init), install-plugins (init)
 warn --- config file  - /verdaccio/conf/config.yaml
 error--- plugin not found. try npm install verdaccio-memory
(node:8) UnhandledPromiseRejectionWarning: Error:
        verdaccio-memory plugin not found. try "npm install verdaccio-memory"
    at /opt/verdaccio/build/lib/plugin-loader.js:110:13
    at Array.map (<anonymous>)
    at loadPlugin (/opt/verdaccio/build/lib/plugin-loader.js:62:37)
    at LocalStorage._loadStorePlugin (/opt/verdaccio/build/lib/local-storage.js:873:47)
    at LocalStorage._loadStorage (/opt/verdaccio/build/lib/local-storage.js:857:26)
    at new LocalStorage (/opt/verdaccio/build/lib/local-storage.js:49:31)
    at Storage.init (/opt/verdaccio/build/lib/storage.js:64:25)
    at _default (/opt/verdaccio/build/api/index.js:123:17)
    at startVerdaccio (/opt/verdaccio/build/lib/bootstrap.js:66:22)
    at InitCommand.execute (/opt/verdaccio/build/lib/cli/commands/init.js:65:37)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:8) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:8) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

So it seems like the verdaccio-memory plugin isn't being found but I am not sure why. If I run grep on package.json I do see it listed:

grep  grep package.json -e "verdaccio-memory"
    "verdaccio-memory": "10.3.0"

Can anyone help me understand why this isn't working?

Thanks
Brad

@renatomjr
Copy link

I've had better luck with the following approach:

extraInitContainers:
  - name: install-plugins
    image: node:lts-alpine
    command:
      - "sh"
      - "-c"
      - |
        cd /verdaccio/plugins/
        npm install --global-style --no-bin-links --omit=optional verdaccio-aws-s3-storage
        mv node_modules/* .
        rm -fr node_modules package*.json
        chown 10001 /verdaccio/plugins/
    volumeMounts:
      - name: verdoptio
        mountPath: /verdaccio/plugins/

persistence:
  enabled: true
  volumes:
    - name: verdoptio
      emptyDir: {}
  mounts:
    - mountPath: /verdaccio/plugins/
      name: verdoptio
      readOnly: false

configMap: |
  plugins: /verdaccio/plugins # Important!
  ...

It's based on this example: https://github.com/verdaccio/verdaccio/tree/master/docker-examples/v5/plugins/docker-build-install-plugin

@juanpicado
Copy link
Member

juanpicado commented Nov 19, 2022

Docs were updated recently maybe that also helps https://verdaccio.org/docs/docker#plugins a Kubernetes (Helm) section for plugins also would be great to have.

@juanpicado juanpicado added documentation Improvements or additions to documentation question Further information is requested labels Nov 19, 2022
@julietesnardo
Copy link

@juanpicado is there any documentation for helm plugins available? trying to install a gcs plugin module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants