python-microservices / pyms

Library of utils to create REST Python Microservices
https://python-microservices.github.io/home/
GNU General Public License v3.0
265 stars 45 forks source link

Not able to start microservice_service_discovery_consul : main.py #233

Closed chetans4 closed 3 years ago

chetans4 commented 3 years ago

Not able to start microservice_service_discovery_consul : main.py I have setup consule app on my windows system. and wen ever I try to run main.py it always give bellow error on startup. Kindle help what I am missing?

Traceback (most recent call last): File "C:\Users\Lenovo\Desktop\Chetan_Code\py-micro\mirco_setup\service_consul\main.py", line 6, in <module> app = ms.create_app() File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pyms\flask\app\create_app.py", line 166, in create_app self.init_services_actions() File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pyms\flask\app\create_app.py", line 67, in init_services_actions srv_action(self) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pyms\flask\services\service_discovery.py", line 57, in init_action self._client.register_service(healtcheck_url=self.healtcheck_url, app_name=app_name, interval=self.interval) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pyms\flask\services\service_discovery.py", line 37, in register_service self.client.agent.check.register( File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\consulate\api\agent.py", line 109, in register return self._put_no_response_body( File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\consulate\api\base.py", line 113, in _put_no_response_body return utils.response_ok(self._adapter.put(self._build_uri(url_parts, query), payload)) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\consulate\adapters.py", line 45, in inner return fun(*args, **kwargs) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\consulate\adapters.py", line 122, in put raise exceptions.RequestError(str(err)) consulate.exceptions.RequestError: HTTPConnectionPool(host='localhost', port=8500): Max retries exceeded with url: /v1/agent/check/register (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000023E2127FE20>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

alexppg commented 3 years ago

It would seem that wherever that is pointing the app, the consul is not there. Could the URL be pointing somewhere else? If not, please add you code to further help you.

chetans4 commented 3 years ago

Hi @alexppg, Thank you for suggestion, I checked there was some problem with consul. After rectifying that app is up and running.