threefoldtecharchive / 0-templates

0-robot templates
Apache License 2.0
1 stars 1 forks source link

error when starting traefik #171

Closed zaibon closed 6 years ago

zaibon commented 6 years ago

I was trying to deploy a web gateway combination of etcd, coredns and traefik. Everything works ok until I tried to start the traefik service and got this error:

In [29]: print(t.eco.trace)
Traceback (most recent call last):
  File "/opt/code/github/threefoldtech/0-robot/zerorobot/task/task.py", line 78, in execute
    self._result = self._func()
  File "/opt/code/github/threefoldtech/0-templates/templates/traefik/traefik.py", line 82, in start
    self._traefik_sal.start()
  File "/opt/code/github/threefoldtech/jumpscale_lib/JumpscaleLib/sal_zos/traefik/Traefik.py", line 101, in start
    self.create_config()
  File "/opt/code/github/threefoldtech/jumpscale_lib/JumpscaleLib/sal_zos/traefik/Traefik.py", line 74, in create_config
    config = self._config_as_text()
  File "/opt/code/github/threefoldtech/jumpscale_lib/JumpscaleLib/sal_zos/traefik/Traefik.py", line 86, in _config_as_text
    client.put("traefik/acme/account", "")
  File "/opt/code/github/threefoldtech/jumpscale_lib/JumpscaleLib/clients/etcd/EtcdClient.py", line 55, in put
    self.api.put(key, value)
  File "/opt/code/github/threefoldtech/jumpscale_lib/JumpscaleLib/clients/etcd/EtcdClient.py", line 46, in api
    self._api = etcd3.client(**kwargs)
  File "/usr/local/lib/python3.5/dist-packages/etcd3/client.py", line 987, in client
    grpc_options=grpc_options)
  File "/usr/local/lib/python3.5/dist-packages/etcd3/client.py", line 147, in __init__
    resp = self.auth_stub.Authenticate(auth_request, self.timeout)
  File "/usr/local/lib/python3.5/dist-packages/grpc/_channel.py", line 532, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/usr/local/lib/python3.5/dist-packages/grpc/_channel.py", line 466, in _end_unary_response_blocking
    raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
    status = StatusCode.UNAVAILABLE
    details = "Connect Failed"
    debug_error_string = "{"created":"@1539960647.343920310","description":"Failed to create subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":2636,"referenced_errors":[{"created":"@1539960647.343913293","description":"Pick Cancelled","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":241,"referenced_errors":[{"created":"@1539960647.343680238","description":"Connect Failed","file":"src/core/ext/filters/client_channel/subchannel.cc","file_line":663,"grpc_status":14,"referenced_errors":[{"created":"@1539960647.343673248","description":"connect failed: [Errno 9] File descriptor was closed in another greenlet","file":"./src/core/lib/iomgr/gevent_util.h","file_line":33,"grpc_status":14}]}]}]}"

Here is my deploy script:


    def deploy(self, node_id):
        robot = j.clients.zrobot.get_by_id(node_id)

        logger.info("install zerotier client")
        zt = robot.services.find_or_create('zerotier_client', 'zt', data={'token': self._zt_token})

        tasks = []
        logger.info("install etcd")
        etcd = robot.services.find_or_create('etcd', 'etcd_'+self.name, data={
            'nics': [{'name': 'zerotier', 'type': 'zerotier', 'ztClient': 'zt', 'id': self._zt_id}],
            'token': 'cluster_%s' % self.name,
        })

        tasks.append(etcd.schedule_action("install").wait(die=True))
        tasks.append(etcd.schedule_action("start").wait(die=True))

        logger.info("install coredns")
        coredns = robot.services.find_or_create('coredns', 'coredns_'+self.name, data={
            'nics': [{'name': 'zerotier', 'type': 'zerotier', 'ztClient': 'zt', 'id': self._zt_id}],
            'etcd': etcd.name
        })

        tasks.append(coredns.schedule_action("install"))
        tasks.append(coredns.schedule_action("start"))

        logger.info("install traefik")
        traefik = robot.services.find_or_create('traefik', 'traefik_'+self.name, data={
            'nics': [{'name': 'zerotier', 'type': 'zerotier', 'ztClient': 'zt', 'id': self._zt_id}],
            'etcd': etcd.name
        })

        tasks.append(traefik.schedule_action("install"))
        tasks.append(traefik.schedule_action("start"))
        return tasks
BolaNasr commented 6 years ago

@zaibon now i think we should close this issue ? last commit: https://github.com/threefoldtech/jumpscale_lib/commit/95df09864991e9321d569255389cdeb8f9257e87

zaibon commented 6 years ago

let's wait to confirm our fixes indeed solve it completely

zaibon commented 6 years ago

fixes works : https://github.com/threefoldtech/jumpscale_lib/commit/95df09864991e9321d569255389cdeb8f9257e87