I did install rancher with:
docker run -d --restart=always -p 8000:8080 --name=rancher-server \
-e "CATTLE_API_ALLOW_CLIENT_OVERRIDE=true" \
-e "CATTLE_HOST_API_PROXY_SCHEME=wss" rancher/server
and then proxied it from another NGINX server with:
upstream rancher {
server rancher-server:8000;
}
server {
listen 443 ssl;
server_name rancher.domain.tld;
ssl_certificate /data/ssl/domain.tld.crt;
ssl_certificate_key /data/ssl/domain.tld.key;
proxy_buffering off;
proxy_buffer_size 512;
location / {
proxy_set_header X-API-request-url $scheme://<host>$request_uri;
proxy_pass http://rancher;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
listen 80;
server_name rancher.domain.tld;
return 301 https://$server_name$request_uri;
}
I then had this error in the chrome console when I accessed rancher.domain.tld:
OPTIONS https://%3Chost%3E/v1/projects?all=true&limit=1000 net::ERR_NAME_NOT_RESOLVED
and the logs were full with:
time="2015-07-18T11:38:33Z" level=info msg="Starting go-machine-service..." gitcommit=102d311
time="2015-07-18T11:38:33Z" level=error msg="Unable to create EventRouter" Err="Get https://<host>/v1/schemas: dial tcp: lookup <host>: no such host"
time="2015-07-18T11:38:33Z" level=info msg="Exiting go-machine-service..."
I could fix this by replacing <host>
with my hostname.
But now I got 2 different additional issues now. I am getting this error in the rancher-server console when I select the standard “rancher.mydomain.tld” as Host Registration:
time="2015-07-18T14:50:58Z" level=error msg="Unable to start EventRouter" Err="websocket: bad handshake"
time="2015-07-18T14:50:58Z" level=info msg="Exiting go-machine-service..."
time="2015-07-18T14:50:59Z" level=info msg="Setting log level" logLevel=info
time="2015-07-18T14:50:59Z" level=info msg="Starting go-machine-service..." gitcommit=102d311
time="2015-07-18T14:50:59Z" level=info msg="Initializing event router" workerCount=10
time="2015-07-18T14:51:00Z" level=error msg="Failed to subscribe to events." error="websocket: bad handshake" subscribeUrl="ws://rancher.mydomain.tld/v1/subscribe?eventNames=physicalhost.create%3Bhandler%3DgoMachineService&eventNames=physicalhost.bootstrap%3Bhandler%3DgoMachineService&eventNames=physicalhost.remove%3Bhandler%3DgoMachineService&eventNames=ping%3Bhandler%3DgoMachineService"
Problem = Not using HTTPS
This happens about 2 times every second.
This error doesn’t come up when I don’t select the standard rancher.mydomain.tld and instead manually put https://rancher.mydomain.tld into the Host Registration. Instead this one is showing in the rancher-agent console:
time="2015-07-18T14:59:43Z" level="info" msg="Starting event router."
time="2015-07-18T14:59:43Z" level="info" msg="Watching state directory: /var/lib/rancher/state/containers"
time="2015-07-18T14:59:43Z" level="info" msg="Processing event: &docker.APIEvents{Status:\"start\", ID:\"2a6baa8257e30382bb21022e0904cb1dbb4dabe512b6ba0d464a344351c3e92e\", From:\"-simulated-\", Time:0}"
time="2015-07-18T14:59:43Z" level="info" msg="Connecting to proxy." url="wss://https://rancher.mydomain.tld/v1/connectbackend?token=eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MzcyMzE4ODQsInN1YiI6ImNhdHRsZSIsImlzcyI6Imh0dHA6XC9cL2NhdHRsZS5pbyIsInJlcG9ydGVkVXVpZCI6IjI1MzA0ZGNmLWMzOWEtNDcwNS1iMDU5LTUxMTIyYjJhZTJhZSIsImlhdCI6MTQzNzIzMTU4NCwia2lkIjoiZGVmYXVsdCJ9.cnr734y-o5youdnFr9xYd2L7vLjxp6T8WuA9YlEsY-oU9dQzyC0BYsCY2k9ln5LX--hSf79nxH4qPPBhkuHekQidH2TBuIwYBFW8Izm396HfMlGm3qE2tT-sYyJ2ifIsqSN6KhlrO8vtrRpqGTbI3XwtvEiXgu9DxjbiB0QKtkkOfmNtZCW2FhQ7vhIg83hckjAYrH4AkflkE0rTgDrZC_mYu7iIljdQZMLmoAZPoyc4hPtQe7Z1HVQBcIfZdxNOgLu3E-eJPeOsYliXG4UJcGo1Wjp_P_mprkdNVt2f4dMTLAXeADonruc_RAfWURBuk4wE--kHGrJ9_nTu5wwKnw"
time="2015-07-18T14:59:43Z" level="fatal" msg="Failed to connect to proxy." error="dial tcp 46.101.xxx.xxx:0: connection refused"
Problem = wss://https://
That is why I am kind of in a dilemma because no matter what I do, there will occur an error on one of the both sides rancher-server and rancher-agent.
Has anybody an idea on how to fix this?
Cheers,
ApfelUser