artefactual-labs / am

Development environment for Archivematica
https://archivematica.org
GNU Affero General Public License v3.0
10 stars 20 forks source link

Problem: make bootstrap fails with AttributeError (CentOS) #80

Closed jazairi closed 5 years ago

jazairi commented 5 years ago

Something very odd is going on with my environment. Here's an excerpt from the make bootstrap output:

docker-compose run \
    --rm \
    --entrypoint /src/dashboard/src/manage.py \
        archivematica-dashboard \
            install \
                --username="test" \
                --password="test" \
                --email="test@test.com" \
                --org-name="test" \
                --org-id="test" \
                --api-key="test" \
                --ss-url="http://archivematica-storage-service:8000" \
                --ss-user="test" \
                --ss-api-key="test" \
                --site-url="http://archivematica-dashboard:8000"
Starting compose_mysql_1 ... done
Starting compose_redis_1                         ... done
Starting compose_archivematica-storage-service_1 ... done
Starting compose_elasticsearch_1                 ... done
Starting compose_gearmand_1                      ... done
Traceback (most recent call last):
  File "/src/dashboard/src/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 190, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 40, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/src/dashboard/src/installer/management/commands/install.py", line 25, in <module>
    from components import helpers
  File "/src/dashboard/src/components/helpers.py", line 22, in <module>
    import requests
  File "/usr/local/lib/python2.7/site-packages/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/usr/local/lib/python2.7/site-packages/urllib3/__init__.py", line 7, in <module>
    from .connectionpool import (
  File "/usr/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 37, in <module>
    from .response import HTTPResponse
  File "/usr/local/lib/python2.7/site-packages/urllib3/response.py", line 144, in <module>
    class HTTPResponse(io.IOBase):
  File "/usr/local/lib/python2.7/site-packages/urllib3/response.py", line 344, in HTTPResponse
    DECODER_ERROR_CLASSES += (brotli.Error,)
AttributeError: 'module' object has no attribute 'Error'
make: *** [bootstrap-dashboard-db] Error

And the output from docker-compose ps:

                 Name                                Command               State                        Ports                     
----------------------------------------------------------------------------------------------------------------------------------
compose_archivematica-dashboard_1         /usr/local/bin/gunicorn -- ...   Exit 3                                                 
compose_archivematica-mcp-client_1        /src/MCPClient/lib/archive ...   Up                                                     
compose_archivematica-mcp-server_1        /src/MCPServer/lib/archive ...   Exit 1                                                 
compose_archivematica-storage-service_1   /bin/sh -c /usr/local/bin/ ...   Up       8000/tcp                                      
compose_clamavd_1                         /run.sh                          Up       127.0.0.1:62006->3310/tcp                     
compose_elasticsearch_1                   /usr/local/bin/docker-entr ...   Up       127.0.0.1:62002->9200/tcp, 9300/tcp           
compose_fits_1                            /usr/bin/fits-ngserver.sh  ...   Up       127.0.0.1:62005->2113/tcp                     
compose_gearmand_1                        docker-entrypoint.sh --que ...   Up       127.0.0.1:62004->4730/tcp                     
compose_mysql_1                           /docker-entrypoint.sh --ch ...   Up       127.0.0.1:62001->3306/tcp                     
compose_nginx_1                           nginx -g daemon off;             Up       0.0.0.0:62080->80/tcp, 0.0.0.0:62081->8000/tcp
compose_redis_1                           docker-entrypoint.sh --sav ...   Up       127.0.0.1:62003->6379/tcp
ross-spencer commented 5 years ago

Hi Adam,

If you run docker-compose logs -f archivematica-mcp-server can you see what the error is there? I'm not sure if they're related, but it might be worth checking. And if you just double check docker-compose -f archivematica-dashboard as well, we'll double-check what you're seeing there is the same as compose is outputting during bootstrap, i.e.

File "/usr/local/lib/python2.7/site-packages/urllib3/response.py", line 344, in HTTPResponse
    DECODER_ERROR_CLASSES += (brotli.Error,)
AttributeError: 'module' object has no attribute 'Error'
jazairi commented 5 years ago

Hi Ross,

Thanks for the quick reply. Yes, I'm seeing similar stack traces in the archivematica-mcp-server and archivematica-dashboard logs:

archivematica-mcp-server_1       |     class HTTPResponse(io.IOBase):
archivematica-mcp-server_1       |   File "/usr/local/lib/python2.7/site-packages/urllib3/response.py", line 344, in HTTPResponse
archivematica-mcp-server_1       |     DECODER_ERROR_CLASSES += (brotli.Error,)
archivematica-mcp-server_1       | AttributeError: 'module' object has no attribute 'Error'
compose_archivematica-mcp-server_1 exited with code 1
archivematica-dashboard_1        |     class HTTPResponse(io.IOBase):
archivematica-dashboard_1        |   File "/usr/local/lib/python2.7/site-packages/urllib3/response.py", line 344, in HTTPResponse
archivematica-dashboard_1        |     DECODER_ERROR_CLASSES += (brotli.Error,)
archivematica-dashboard_1        | AttributeError: 'module' object has no attribute 'Error'

I'm new to Docker, so I'm having difficulty troubleshooting this. Assuming it's not a known issue, I think I'll skip Docker for now and try installing with yum.

replaceafill commented 5 years ago

Our colleague @cole reported this issue a couple of days ago in our internal Slack:

If anyone else is getting AttributeError: 'module' object has no attribute 'Error' when starting MCPServer in the Docker env — it’s not you! Weird compatibility issue with urllib3 (used by requests) https://github.com/urllib3/urllib3/pull/1572. TL;DR: don’t rebuild any containers today if you can help it

I'm not sure if he was able to solve it and I haven't been able to reproduce it.

Maybe pin pointing urllib3 to 1.24.1 would work?

jazairi commented 5 years ago

Thanks, @replaceafill! Looks like they released a fix today, so I pointed urllib3 to 1.25.1 and that fixed the issue. I'm still seeing an error with MCPServer, but I think it's unrelated, so I'll go ahead and close this ticket.

cole commented 5 years ago

This was an odd one; I should have reported it publicly. If 1.25.1 is out then removing urllib from requirements (if you've added it) and rebuilding containers with no cache should work.