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
Docker upgrade to 4.0.0 not working, missing all packages #1324
Comments
TL;DR: workaround below I confirm this behavior, tested with 4.0.1 I bind-mount a host directory into the container at On a 4.0.1 container, the contents of
I think its because the Dockerfile for 3.x and 4.x define volumes differently:
I'm no Docker expert so no idea if our issue is caused by a Docker bug, quirk or if it's defined behavior. Workaround (fixed the problem for me): define three bind mounts for Disadvantages: (verbose and) error-prone in case of new directories in the future Update: found the reasoning for the change in Dockerfile: #836 (comment) and #836 (comment) @dlouzan in #836 you wrote "I'm not sure about this involving breaking changes". I'm OK with the change but it's breaking and should be documented at https://verdaccio.org/blog/2019/02/24/migrating-verdaccio#migrating-from-verdaccio-3x-to-verdaccio-4x |
I'm using Kubernetes and your workaround did not work for me. As it was my default already. |
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 |
@johnruck are you using I'm running Docker Desktop on current macOS |
I am just using the docker structure they provided - docker pull verdaccio/verdaccio:latest I try to be as simple as I can :) |
hmm, in looking through the migration document, they say VERDACCIO_USER_UID | 10001 | the user id being used to apply folder permissions does this mean that I need to have a user with id of 10001 on the host machine with permissions on the Docker mount directories? (I havent really completely figured out docker and if/how it maps permissions between the docker image instance and the host on volumes yet so I am wondering if this is why verdaccio cant create the directories). Right now the new directories are root:root ownership on the host filesystem. I just checked host /etc/passwd, there is no user with id 10001. UPDATE- well, I tried passing in via the -e for VERDACCIO_USER_NAME and VERDACCIO_USER_ID to match my user credential information and I am still getting the same permission denied on the mkdir commands so that doesnt seem to be the cure. |
Ok, this time I did a docker run without the -d, here is all of the initial output up until the first errors
|
In case it helps, my config.yaml (originated with verdaccio 3):
|
I'm joining late as usual :-/ @sbusch Yeah you're right, I wasn't sure at the time and this seems to be causing some headaches to users. We'll need to document this migration better. Named volumes have been the preferred solution recommended by Docker itself for some time now, but this is not directly compatible with bind mounts that people were using. @johnruck Your issue is most probably caused because of using a bind mount instead of a volume mount for the storage. I'm doing some local tests to paste here a small guide. |
@johnruck To be clear: you shouldn't need to change any env variables, just copy the contents of your bind mount to a named volume and reference the volume for verdaccio. As I said, I'm making some tests locally. |
I am using bind mounts because they make sense to me (since there is easy access to the files in the host file system and they are in a place where I know where the files are). I still haven't figured out named volumes yet - any tutorials you can point me at that make sense? :) |
@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 |
ok, before I switch over this a few questions, Is the volume create a one time thing, redo on reboot thing? Any side effects of switching to these volumes after doing docker stop commands (I have bash scripts that I use to start and stop docker instances, I am wondering if using named volumes causes any oddities in the behavior - I am paranoid since before I found the --rm arguments for run I was having to do the docker rm commands before doing another start (and the reason why I have start/stop bash scropts to make sure I did all of the necessary stop steps). Background - so far I have been using Docker as an easier virtual machine system, I havent really gotten too deep into it yet. And doing a docker volume list on my machine comes up with over 50 numbered volumes that I have no idea what they are from :) which is the other reason I havent done named volumes before. |
For now you don't need to "switch over", the commands I added do not touch your existing storage directly, apart from making a copy into a named volume. Named volumes are the preferred approach for mounting external, persistent directories into containers. They have several advantages, between them that they are portable between operating systems and allow locations other than local (e.g. NFS or AWS S3). The main difference in day to day is that you don't mount a specific directory in your filesystem. You work with the |
I hate to say this, no difference in the behavior john@tohsaka:~$ ./start-npm start-npm contents:
NOTE - I used my older verdaccio 3 storage directory instead of the newer verdaccio 4 one that was still empty (mainly because I have some private packages in there that I am hoping not to lose). |
hmm, I just redid the volume creation without the copy attempt and that seems to be happy. So on an internals question, what do I need to do to get my old private packages back into this new instance ? Is it as easy as copy in the package subdirectories from my old storage location and chown the files to 10001:65533 ownership ? for reference, the same ls -al with verdaccio readding the packages: drwxr-xr-x 2 10001 65533 4096 Jun 12 18:02 yargs |
@johnruck Well I'm not sure why your storage has the id of the But yes, it should be as easy as to copy & chown on the volume contents. |
Ok, I have gotten back to broken state that I was in before when I accidentally triggered the version 4 update, I guess I will pick up that debugging in the other issue's existing ticket. Thank you for your guidance on getting past this issue at least. Btw - copying in the files got them into verdaccio, but it doesnt know they are private packages at the moment (verdaccio says I have no packages published yet) - that will clear whenever I push the next package build though. |
I confirm this issue with 4.0.4 |
Does anyone with enough Docker knowledge in volumes could help with this migration problem? A short guide how to do it would help. |
@juanpicado we are also still stuck at the older version. It is strange that it is an issue due to the volumes are just mount points. |
I've moved Verdaccio from 3.x to 4.3,and encountered the 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 |
@ishowman This command should be executed on the host mathine. |
@savokiss this did not work for me. Here is some log output:
/verdaccio/storage/@lws/react-matrix-sdk $ ls -ln
But the interface shows that no packages are published yet. |
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. |
🤖This thread has been automatically locked 🔒 since there has not been any recent activity after it was closed. |
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:
verdaccio/verdaccio:4.0.0
Expected behavior
See all NPM packages
Kubernetes (please complete the following information):
Configuration File (cat ~/.config/verdaccio/config.yaml)
$ cat /verdaccio/conf/config.yaml
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?
The text was updated successfully, but these errors were encountered: