Open mbenguig opened 4 years ago
pymongo.errors.ServerSelectionTimeoutError: database:27017: [Errno -2] Name or service not known
You should also change the names of the service/docker volumes, the db cannot connect
Thank you for your quick reply! but I already did this..
As you can see in my docker-compose.yml, there is no "database" occurence... Moreover, from the annotator_webclient-dev container, I cannot ping database, but I can ping database-dev. "database" (and messageq) is probably hardcoded somewhere... or maybe an env variable can be set at the docker-compose.yml level to target the right names ....
Take a look at https://github.com/jsbroks/coco-annotator/blob/master/backend/config/config.py you will need to change some values
Thanks a lot.. I replaced 2 "database" occurences by "database-dev" ... and I docker-compose up again... but still the same error ("database:27017: [Errno -2] Name or service not known"). Even If I think I covered all occurences (.txt below)
(thx again for your help)
if you make changes in coco code, you must use docker-compose.build.yml because normal docker-compose.yml get images from docker repo without your changes
I am trying to run 2 coco installations on the same machine. The first installation perfectly works using your default docker-compose file. But to make the second install run on the same host without conflict, I need to "instantiate" the docker-compose file by updating, the container names (webserver-dev, workers-dev, messageq-dev, database-dev) , the volume names (mongodb_data-dev), the network name (cooannotator-dev) and the mapped UI port (xxx:5000. But at docker-compose start, the web server keeps restarting again and again.
Not sure this is a COCO issue.. I maybe missed something somewhere (hostname, env variable in docker-compose?) since it still refers to "database" and "messageq" ... (but no documentation about that).
The logs:
| [2020-07-13 13:50:46 +0000] [10] [ERROR] Exception in worker process annotator_webclient-dev | Traceback (most recent call last): annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker annotator_webclient-dev | worker.init_process() annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/geventlet.py", line 102, in init_process annotator_webclient-dev | super(EventletWorker, self).init_process() annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process annotator_webclient-dev | self.load_wsgi() annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi annotator_webclient-dev | self.wsgi = self.app.wsgi() annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi annotator_webclient-dev | self.callable = self.load() annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load annotator_webclient-dev | return self.load_wsgiapp() annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp annotator_webclient-dev | return util.import_app(self.app_uri) annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app annotator_webclient-dev | import(module) annotator_webclient-dev | File "/workspace/webserver/init.py", line 63, in
annotator_webclient-dev | app = create_app()
annotator_webclient-dev | File "/workspace/webserver/init.py", line 57, in create_app
annotator_webclient-dev | ImageModel.objects.update(annotating=[])
annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/mongoengine/queryset/manager.py", line 37, in get
annotator_webclient-dev | queryset = queryset_class(owner, owner._get_collection())
annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/mongoengine/document.py", line 208, in _get_collection
annotator_webclient-dev | db.client.is_primary:
annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 857, in is_primary
annotator_webclient-dev | return self._server_property('is_writable')
annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 689, in _server_property
annotator_webclient-dev | writable_server_selector)
annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/pymongo/topology.py", line 224, in select_server
annotator_webclient-dev | address))
annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/pymongo/topology.py", line 183, in select_servers
annotator_webclient-dev | selector, server_timeout, address)
annotator_webclient-dev | File "/usr/local/lib/python3.6/site-packages/pymongo/topology.py", line 199, in _select_servers_loop
annotator_webclient-dev | self._error_message(selector))
annotator_webclient-dev | pymongo.errors.ServerSelectionTimeoutError: database:27017: [Errno -2] Name or service not known
annotator_webclient-dev | [2020-07-13 13:50:46 +0000] [10] [INFO] Worker exiting (pid: 10)
annotator_webclient-dev | [2020-07-13 13:50:47 +0000] [6] [INFO] Shutting down: Master
annotator_webclient-dev | [2020-07-13 13:50:47 +0000] [6] [INFO] Reason: Worker failed to boot.
annotator_webclient-dev exited with code 3
annotator_webclient-dev | [2020-07-13 13:50:50 +0000] [6] [DEBUG] Current configuration:
annotator_webclient-dev | config: webserver/gunicorn_config.py
annotator_webclient-dev | bind: ['0.0.0.0:5000']
annotator_webclient-dev | backlog: 2048
........
[2020-07-13 13:50:39,816: ERROR/MainProcess] consumer: Cannot connect to amqp://user:**@messageq:5672//: failed to resolve broker hostname. annotator_workers-dev | Trying again in 16.00 seconds... annotator_workers-dev |
........
If you have any idea .. (thxx again) Regards Michael