verdaccio: Docker upgrade to 4.0.0 not working, missing all packages

Describe the bug Docker upgrade to 4.0.0 not working, missing all packages. The UI did not show any packages and also install a package did not work

To Reproduce Steps to reproduce the behavior:

  1. Go to Update the docker image to verdaccio/verdaccio:4.0.0
  2. Open the website
  3. No packages available

Expected behavior See all NPM packages

Kubernetes (please complete the following information):

  • Docker verdaccio tag: verdaccio/verdaccio:4.0.0

Configuration File (cat ~/.config/verdaccio/config.yaml) $ cat /verdaccio/conf/config.yaml

storage: /verdaccio/storage/
max_body_size: 1000mb
auth:
  htpasswd:
    file: ./htpasswd
uplinks:
  npmjs:
    url: https://registry.npmjs.org/
packages:
  '@*/*':
    access: $all
    publish: $authenticated
    proxy:
    storage: '/verdaccio/storage'
  '**':
    access: $all
    publish: $authenticated
    proxy:
    storage: '/verdaccio/storage'
logs:
  - {type: stdout, format: pretty, level: debug}
#  - {type: stdout, format: pretty, level: http}


security:
   token:
      web: 24h # by default
      api: never # by defaukt
   algorithm: HS256 # by default

Additional context Spoke on Discord and got these links: https://verdaccio.org/blog/2019/02/24/migrating-verdaccio and https://verdaccio.org/blog/2019/05/13/the-new-docker-image-verdaccio-4

None where clear to me what the changes are, I use kubernetes with no ENV variables and separate volume mounts. What are the real breaking changes?

---

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: npm-registry
  namespace: backoffice
  name: npm-registry
spec:
  # Stop old container before starting new one
  strategy:
    type: Recreate
    rollingUpdate: null
  selector:
    matchLabels:
      app: npm-registry
  replicas: 1
  template:
    metadata:
      labels:
        app: npm-registry
    spec:
      containers:
      - name: npm-registry
        image: verdaccio/verdaccio:4.0.0
        imagePullPolicy: Always
        resources:
          requests:
            cpu: 300m
            memory: 200Mi
          limits:
            cpu: 300m
            memory: 250Mi
        ports:
        - containerPort: 4873
          name: http
        volumeMounts:
        - mountPath: /verdaccio/storage
          name: npmdata-rook-ceph-block
          subPath: storage
        - mountPath: /verdaccio/plugins
          name: npmdata-rook-ceph-block
          subPath: plugins
        - mountPath: /verdaccio/conf
          name: npmdata-rook-ceph-block
          subPath: conf
        readinessProbe:
          httpGet:
            path: /
            port: 4873
          initialDelaySeconds: 5
          periodSeconds: 20
        livenessProbe:
          httpGet:
            path: /
            port: 4873
          timeoutSeconds: 2
      volumes:
      - name: npmdata-rook-ceph-block
        persistentVolumeClaim:
          claimName: npmdata-rook-ceph-block

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 27 (6 by maintainers)

Most upvoted comments

@johnruck Ok please try this:

Please test creating a named volume and copying the contents of your storage directory in the host to it. Then start your verdaccio referencing this volume.

PLEASE backup your storage directory before trying this, just in case, it shouldn’t break anything but you never know.

# Create a docker volume for storage
docker volume create verdaccio-storage

# Run a temp container to mount your local storage directory
# Copy the storage to the named volume
docker run -it --rm -v verdaccio-storage:/verdaccio/storage -v /home/john/verdaccio4/storage:/backup ubuntu bash -c "cp -a /backup/. /verdaccio/storage"

# Start your verdaccio referencing the volume
docker run -d --rm -it -v /home/john/verdaccio4/conf:/verdaccio/conf -v verdaccio-storage:/verdaccio/storage -v /home/john/verdaccio4/plugins:/verdaccio/plugins -p 4873:4873 --name npm-server verdaccio/verdaccio

Work around did not work for me as well (I was also already doing 3 independent volume mounts. I have also just tried new mount directories with no effect. One thing I have noticed is that I think it might be permissions on the mount directories that is the problem (for point of reference, I let Docker create the new directories and then copied in the config.yaml file after it created them). Attaching the docker instance gets me the following output on the new directories on my first attempt to use the “new” server.

 http --> 200, req: 'GET https://registry.npmjs.org/@angular%2Fcli' (streaming)
 http --> 200, req: 'GET https://registry.npmjs.org/@types%2Fjasmine' (streaming)
 http --> 200, req: 'GET https://registry.npmjs.org/@angular%2Fcli', bytes: 0/1414339
 error--- unexpected error: EACCES: permission denied, mkdir '/verdaccio/storage/@angular'
Error: EACCES: permission denied, mkdir '/verdaccio/storage/@angular'
 http <-- 500, user: null(172.16.121.185), req: 'GET /@angular%2fcli', error: internal server error
 http --> 200, req: 'GET https://registry.npmjs.org/@types%2Fjasmine', bytes: 0/133927
 error--- unexpected error: EACCES: permission denied, mkdir '/verdaccio/storage/@types'
Error: EACCES: permission denied, mkdir '/verdaccio/storage/@types'

note this is with the “Latest” docker image. Verdaccio web ui says version 4.01.

Any suggestions? I have even tried turning off the caching and it still outputs these errors and fails.

In case it matters - this was on Ubuntu 18.04.2 LTS

command used:

docker run -d --rm -it -v /home/john/verdaccio4/conf:/verdaccio/conf -v /home/john/verdaccio4/storage:/verdaccio/storage -v /home/john/verdaccio4/plugins:/verdaccio/plugins -p 4873:4873 --name npm-server verdaccio/verdaccio

image info
verdaccio/verdaccio                latest              d13802d13b71        2 weeks ago         116MB

I have it solved 🎉

In my config I had:

packages:
  '@*/*':
    access: $all
    publish: $authenticated
    proxy:
    storage: '/verdaccio/storage'
  '**':
    access: $all
    publish: $authenticated
    proxy:
    storage: '/verdaccio/storage'

And now it works with:

packages:
  '@*/*':
    access: $all
    publish: $authenticated
  '**':
    access: $all
    publish: $authenticated

And by removing the proxy and storage lines it worked. Followed the example

Also the chown was needed to fix the permissions as @ishowman suggested. It was a double issue with file permissions and config.

My complete config is now:

storage: /verdaccio/storage
max_body_size: 1000mb
auth:
  htpasswd:
    file: ./htpasswd

uplinks:
  npmjs:
    url: https://registry.npmjs.org/

packages:
  '@*/*':
    access: $all
    publish: $authenticated
  '**':
    access: $all
    publish: $authenticated

logs:
  - {type: stdout, format: pretty, level: debug}

security:
  legacy: true
  token:
     web: 24h # by default
     api: never # by defaukt
  algorithm: HS256 # by default
  api:
    jwt:
      sign:
        expiresIn: 60d
        notBefore: 0
  web:
    sign:
      expiresIn: 7d

Also looked at issue #1481 for the authentication.

I’ve moved Verdaccio from 3.x to 4.3,and encountered the permission denied issue. In case someone need it, just use this to give storage to user verdaccio in the container.

sudo chown -R 10001:65533 storage

For more info: https://medium.com/@mccode/understanding-how-uid-and-gid-work-in-docker-containers-c37a01d01cf

I’ve moved Verdaccio from 3.x to 4.3,and encountered the permission denied issue. In case someone need it, just use this to give storage to user verdaccio in the container.

sudo chown -R 10001:65533 storage

For more info: https://medium.com/@mccode/understanding-how-uid-and-gid-work-in-docker-containers-c37a01d01cf

I using docker exec -it <container ID> /bin/sh to enter the running container, and input the command you offered, get message “/bin/sh: sudo: not found”.