rancher/agent + rancher/server on the same box

1,011 views
Skip to first unread message

Luca G. Soave

unread,
Apr 21, 2015, 4:49:03 PM4/21/15
to ranc...@googlegroups.com

Hi there,

having many docker containers running on my laptop as a 3-tier app,
I'd like to import them all to rancher/server on the same laptop box (outside Vagrant).

I started both the agent and the server on my laptop :

lsoave@basenode:~$ docker ps
CONTAINER ID        IMAGE                   COMMAND                CREATED             STATUS              PORTS                              NAMES
39ffc6af91f8        rancher/agent:v0.5.2    "/run.sh http://127.   18 minutes ago      Up 6 minutes                                           trusting_meitner   
3b76c33f3e12        rancher/server:latest   "/usr/bin/s6-svscan    39 minutes ago      Up 39 minutes       3306/tcp, 0.0.0.0:8080->8080/tcp   cocky_lumiere      

but "localhost" never join the server as a new host of course, because of the different network i guess, infact the agent log says:

lsoave@basenode:~$ docker logs 39ffc6af91f8
ERROR: http://10.36.36.91/v1 is not accessible
ERROR: Could not reach http://10.36.36.91/v1. Giving up.

while the server log says :

lsoave@basenode:~$ docker logs -f 3b76c33f3e12
time="2015-04-21T20:41:54Z" level=error msg="Unable to create EventRouter" Err="Get http://127.0.0.1/v1: dial tcp 127.0.0.1:80: connection refused"
time="2015-04-21T20:41:54Z" level=info msg="Exiting go-machine-service..."

any idea about how to config that (without Vagrant support) ?

Will Chan

unread,
Apr 21, 2015, 6:16:55 PM4/21/15
to ranc...@googlegroups.com
Hi Luca, 

What command did you execute to run the agent container?  From the brief logs you've shown, it looks like you may have registered your host IP wrong after you attempted to "Add Host".  It looks like you may have specified 127.0.0.1:80 as your host for your agents to connect to but it's listening on port 8080.  

Will

Luca G. Soave

unread,
Apr 22, 2015, 6:00:29 PM4/22/15
to ranc...@googlegroups.com

I just followed custom provider Add Host instructions in my rancher/server dashboard ( http://127.0.0.1:8080/static/hosts/add/custom ) at step 3:

Copy, paste, and run the command below to register the host with Rancher:
sudo docker run -d --privileged -v /var/run/docker.sock:/var/run/docker.sock rancher/agent:v0.5.2 http://127.0.0.1/v1/scripts/11C598D0FE2F04666DC5:1429732800000:epL7Smr8yCs1XxgR4wtdVS08ve4

... anyway I tried adding 8080 port :

sudo docker run -d --privileged -v /var/run/docker.sock:/var/run/docker.sock rancher/agent:v0.5.2 http://127.0.0.1:8080/v1/scripts/11C598D0FE2F04666DC5:1429732800000:epL7Smr8yCs1XxgR4wtdVS08ve4

what I got is the agent(s) exited :

lsoave@basenode:~$ docker ps -a
CONTAINER ID        IMAGE                                                                     COMMAND                CREATED             STATUS                      PORTS                              NAMES
7be2cc23e04e        9687c2da5bdc70f7016d2ee49d6d8e85b2343b43ee9d62bb999fd6c5e9faa22b:latest   "/run.sh state"        53 seconds ago      Exited (0) 53 seconds ago                                      rancher-agent-state  
9be0da494389        rancher/agent:v0.5.2                                                      "/run.sh http://127.   56 seconds ago      Exited (1) 51 seconds ago                                      sleepy_lumiere       
3b76c33f3e12        rancher/server:latest                                                     "/usr/bin/s6-svscan    25 hours ago        Up 26 minutes               3306/tcp, 0.0.0.0:8080->8080/tcp   cocky_lumiere        

logging the following :

lsoave@basenode:~$ docker logs 7be2cc23e04e
Rancher State

lsoave@basenode:~$ docker logs 9be0da494389
INFO: Attempting to connect to: http://10.36.36.91:8080/v1
INFO: http://10.36.36.91:8080/v1 is accessible
Rancher State
Traceback (most recent call last):
  File "./register.py", line 9, in <module>
    secret_key=os.environ['CATTLE_REGISTRATION_SECRET_KEY'])
  File "/usr/local/lib/python2.7/dist-packages/cattle.py", line 34, in from_env
    return gdapi.from_env(prefix=prefix, factory=Client, **kw)
  File "/usr/local/lib/python2.7/dist-packages/gdapi.py", line 601, in from_env
    return _from_env(prefix=prefix, factory=factory, **args)
  File "/usr/local/lib/python2.7/dist-packages/gdapi.py", line 620, in _from_env
    return factory(**result)
  File "/usr/local/lib/python2.7/dist-packages/cattle.py", line 12, in __init__
    super(Client, self).__init__(*args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/gdapi.py", line 194, in __init__
    self._load_schemas()
  File "/usr/local/lib/python2.7/dist-packages/gdapi.py", line 306, in _load_schemas
    response = self._get_response(self._url)
  File "/usr/local/lib/python2.7/dist-packages/gdapi.py", line 257, in _get_response
    headers=HEADERS)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 469, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 457, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 569, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 407, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(111, 'Connection refused'))

the server log was the same as before :

time="2015-04-22T21:56:12Z" level=error msg="Unable to create EventRouter" Err="Get http://127.0.0.1/v1: dial tcp 127.0.0.1:80: connection refused"
time="2015-04-22T21:56:12Z" level=info msg="Exiting go-machine-service..."

this last it seems to me just a parsing/truncation typo/bug but I don't know really ...

Luca G. Soave

unread,
Apr 22, 2015, 6:04:52 PM4/22/15
to ranc...@googlegroups.com


...  docker version was:

lsoave@basenode:~$ docker -v
Docker version 1.6.0, build 4749651

Will Chan

unread,
Apr 23, 2015, 11:59:56 AM4/23/15
to ranc...@googlegroups.com
HI Luca, 

It looks like someone else might be experiencing the same issue as you as described here.


Will

On Tuesday, April 21, 2015 at 1:49:03 PM UTC-7, Luca G. Soave wrote:
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages