bityoga/fabric_as_code

CouchDb port not available issue when adding more peers

Opened this issue · 0 comments

CouchDb port not available issue when adding more peers

  • spiros reported a error on couch_db when trying to add new peer.
  • For every new peer which uses couchdb, a new couchdb service with name "couchdb_PEERNAME" will be started. For example, the service names would be couchdb_peer3, couchdb_peer4, etc.
  • But the couch_db port number 5984 is hard coded in the couch_db playbook. This works for the default organisation set up as only one peer(peer2) is using couchdb.
  • When a new couchdb_peer3 service starts it fails as port is already occupied by couchdb_peer2

Here is the error from spiros:

"msg": "An unexpected docker error occurred: 400 Client Error for http+docker://localhost/v1.41/services/create: Bad Request ("rpc error: code = InvalidArgument desc = port '5984' is already in use by service 'couchdb_peer2' (j9h35naenfg9j4z07ie87gonz) as an ingress port")",
"exception": "Traceback (most recent call last):\n File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 268, in raise_for_status\n response.raise_for_status()\n File "/usr/lib/python3/dist-packages/requests/models.py", line 935, in raise_for_status\n raise HTTPError(http_error_msg, response=self)\nrequests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.41/services/create\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/tmp/ansible_docker_swarm_service_payload_m388bywu/ansible_docker_swarm_service_payload.zip/ansible/modules/cloud/docker/docker_swarm_service.py", line 2974, in main\n File "/tmp/ansible_docker_swarm_service_payload_m388bywu/ansible_docker_swarm_service_payload.zip/ansible/modules/cloud/docker/docker_swarm_service.py", line 2656, in run_safe\n File "/tmp/ansible_docker_swarm_service_payload_m388bywu/ansible_docker_swarm_service_payload.zip/ansible/modules/cloud/docker/docker_swarm_service.py", line 2646, in run\n File "/tmp/ansible_docker_swarm_service_payload_m388bywu/ansible_docker_swarm_service_payload.zip/ansible/modules/cloud/docker/docker_swarm_service.py", line 2476, in create_service\n File "/usr/local/lib/python3.6/dist-packages/docker/utils/decorators.py", line 34, in wrapper\n return f(self, args, *kwargs)\n File "/usr/local/lib/python3.6/dist-packages/docker/api/service.py", line 190, in create_service\n self._post_json(url, data=data, headers=headers), True\n File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 274, in result\n self._raise_for_status(response)\n File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 270, in _raise_for_status\n raise create_api_error_from_http_exception(e)\n File "/usr/local/lib/python3.6/dist-packages/docker/errors.py", line 31, in create_api_error_from_http_exception\n raise cls(e, response=response, explanation=explanation)\ndocker.errors.APIError: 400 Client Error for http+docker://localhost/v1.41/services/create: Bad Request ("rpc error: code = InvalidArgument desc = port '5984' is already in use by service 'couchdb_peer2' (j9h35naenfg9j4z07ie87gonz) as an ingress port")\n",