sregistry: ImportError: cannot import name 'MINIO_BUCKET'

Describe the bug I’m installing sregistry via the “official”(?) Ansible Role: https://github.com/grycap/ansible-role-singularity-registry. The only changes I’ve made to it is to customise the Nginx container with a custom configuration to include my TLS certificates as they’re rotated. I’ve included this code below:

- block:
    - name: Upload Nginx HTTPS config
      template:
          src: nginx-https.conf
          dest: "{{ sregistry_dir }}/nginx.conf"

    - name: Upload registry certificate
      copy:
          src: "{{ nginx_https_certificate }}"
          dest: "{{ sregistry_dir }}/registry.crt"

    - name: Upload registry key
      copy:
          src: "{{ nginx_https_key }}"
          dest: "{{ sregistry_dir }}/registry.key"
  when: nginx_use_https

From a freshly cloned copy of the sregistry repository, using the master branch (the default for the Role above), I get the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 141, in __call__
    response = self.get_response(request)
  File "/usr/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 75, in get_response
    response = self._middleware_chain(request)
  File "/usr/local/lib/python3.5/site-packages/django/core/handlers/exception.py", line 36, in inner
    response = response_for_exception(request, exc)
  File "/usr/local/lib/python3.5/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
    response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
  File "/usr/local/lib/python3.5/site-packages/django/core/handlers/exception.py", line 128, in handle_uncaught_exception
    callback, param_dict = resolver.resolve_error_handler(500)
  File "/usr/local/lib/python3.5/site-packages/django/urls/resolvers.py", line 597, in resolve_error_handler
    callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
  File "/usr/local/lib/python3.5/site-packages/django/utils/functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.5/site-packages/django/urls/resolvers.py", line 577, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/local/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 985, in _gcd_import
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "./shub/urls.py", line 19, in <module>
    from shub.apps.library import urls as library_urls
  File "./shub/apps/library/urls.py", line 12, in <module>
    from shub.apps.library import views
  File "./shub/apps/library/views/__init__.py", line 2, in <module>
    from .images import (
  File "./shub/apps/library/views/images.py", line 19, in <module>
    from shub.settings import (
ImportError: cannot import name 'MINIO_BUCKET'

This has only started happening in the week or so. I believe I was able to successfully run sregistry about two weeks ago. I notice that some of the latest commits to the master branch contain references to minio so perhaps something has been introduced that’s breaking this?

To Reproduce The steps to reproduce are either:

  1. Execute the above Ansible Role
  2. See this file for manual steps: https://github.com/grycap/ansible-role-singularity-registry/blob/master/tasks/sregistry.yml

Expected behavior A working Singularity Registry installation with my TLS certificate in place listening on 443.

If applicable, add versions and screenshots to help explain your problem.

  • Latest master branch
  • Ansible 2.9.9

Docker information:

Client: Docker Engine - Community
 Version:           19.03.11
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        42e35e61f3
 Built:             Mon Jun  1 09:13:48 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.11
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       42e35e61f3
  Built:            Mon Jun  1 09:12:26 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 38 (22 by maintainers)

Most upvoted comments

Hi @mrcrilly and @vsoch ! Sure, I also think that update my repo is the best option. @vsoch , would you give me more information about the Minio configuration for sregistry? Regarding the docker container, Do I have to modify the Dockerfile?

okay, for a quick fix I’ve released (on GitHub) the current master along with the last version without Minio 1.1.23. I’d highly suggest using the Minio backend it hugely improves memory usage and upload speed (multipart uploads!) I also added a quick fix to the docs to note the version required:

image

Let’s wait to hear from @serlophug to decide on next steps - either updating his repo for Minio support (this would be my preference, it’s a better registry) or providing a recipe here. I’m off to bed, thanks for your kind words! 😃

Thanks. And thanks for all the great work. The Department of Environment And Science, Queensland, Australia, says hi and thanks! 😃

hey @serlophug ! Would you be able to help to update the ansible role to add the newly added Minio? I think it would just come down to adding the extra envars and container. I can also take a shot and either PR to your repo or create a recipe here. Let me know your preference! In the meantime it might also make sense to add a note in the docs to say the version of sregistry supported. Thanks!

Thanks @vsoch. I’ve confirmed commit dd0600d1dd6550c68127594b4bac19b84e3e69ba works fine.

You’ll want to use an earlier version (before Minio was added) to use the ansible recipe - it isn’t “officially supported” but was contributed, so let me see if I can ping the contributor to make a version for Minio.