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

Adding speedy, big uploads #134

Merged
merged 10 commits into from
Jul 10, 2018
Merged

Adding speedy, big uploads #134

merged 10 commits into from
Jul 10, 2018

Conversation

vsoch
Copy link
Member

@vsoch vsoch commented Jun 12, 2018

This will add a web interface view and command line (sregistry-cli) way to upload images using chunks. This will close #123 #133 #109.

Overview

The client to test the new upload (from the command line) is provided as a PR here, and you will need to install this version first:

singularityhub/sregistry-cli#127

# Do this until it tells you not installed
pip uninstall sregistry

# Install the PR branch
git clone -b add/chunked-upload https://www.github.com/vsoch/sregistry-cli
cd sregistry-cli
python setup.py install
  • It's recommended to test this on a fresh docker-compose up -d (e.g., never update your previous sregistry server for testing!) and you will notice that the nginx image needs to be built. It will do this automatically.
  • Don't forget you need to create accounts (user / superuser) before you can be granted a token (in your user menu).
  • The token json needs to be downloaded to $HOME/.sregistry

Then when you use sregistry client, it's helpful to set the client to be registry by exporting

export SREGISTRY_CLIENT=registry

and then a typical push looks like this:

sregistry push manbat.simg --name superhero/batman:mobile

This is all in the docs (and I'm repeating) but please don't hesitate to ask if you have questions.

Nginx Upload

I first had intended to install chunked_upload, and spent quite some time getting this to work in the web interface and command line. It wasn't super speedy but worked generally ok. After frustration with figuring out how to "trick" my server from the command line I took a 180 and implemented the nginx upload module --> https://www.nginx.com/resources/wiki/modules/upload which is a bit weird to get your head around, but largely it works like this:

client submits multipart form data --> 
nginx block has location for upload --> 
nginx processes upload, sends to temporary location --> 
server is forwarded the request (authentication and permissions checked) and the image kept or discarded

It is SO fast and I'm really happy with it :) I had originally intended to keep both the upload module (chunked upload version) and this one, but the latter is so much better I removed the chunked upload dependency.

@vsoch vsoch changed the title [WIP] Adding chunked uploads Allowing large uploads with nginx upload module Jun 16, 2018
@vsoch vsoch changed the title Allowing large uploads with nginx upload module Adding speedy, big uploads Jun 16, 2018
@vsoch
Copy link
Member Author

vsoch commented Jun 28, 2018

ping @victorsndvg !

@vsoch
Copy link
Member Author

vsoch commented Jul 4, 2018

hey @victorsndvg I'm going to address the changes needed here so they are easy to find! You ran into the issue of getting an integrity error when trying to push a frozen container, and the bug was triggered under the condition that the container was frozen (meaning that create_new remained true) but then we didn't check that the version was already existing (I'm guessing you tried to push a container with the exact same name / collection / version that was frozen?

I made some changes that should address, but I didn't test in full, so let me know if there are any issues!

@victorsndvg
Copy link
Contributor

victorsndvg commented Jul 6, 2018

Hi @vsoch ,

I checked it and now it's working for me :) This is the reponse trying to overwrite the frozen container:

[1. Collection return status 200 OK]
[================================] 88/88 MB - 00:00:00
[Return status 200 test/test:test@c6c536e5a32959fbfdbd49fb15e11ddf already exists.]

Here is a piece of your first comment inthis PR:

It's recommended to test this on a fresh docker-compose up -d (e.g., never update your previous sregistry server for testing!) and you will notice that the nginx image needs to be built. It will do this automatically.

Do you think this is ready for updating my production version? It's dangerous?

Thanks!

@vsoch
Copy link
Member Author

vsoch commented Jul 6, 2018

If all reviewers are happy then that is good condition for merging! As for updating, I would say this is of course up to you - you would get support for larger images. My recommendation would be to back up the database and your containers before doing the update. It looks like there are many ways, and django-archive is one idea.

If you find a backup routine that seems ok, and write down the steps, we can add to the docs.

When/if you are satisfied with this PR (and the matching for the client) please let me know so that I can merge!

@vsoch
Copy link
Member Author

vsoch commented Jul 6, 2018

@victorsndvg ready for merge?

@victorsndvg
Copy link
Contributor

For me yes. I did not deploy it in production yet, but this is not going to happen soon.

Thanks!,
Víctor

@vsoch
Copy link
Member Author

vsoch commented Jul 10, 2018

Awesome! Merging and will release then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for large image uploads with nginx upload module
2 participants