purpleworks / fleet-ui

Web based UI for fleet
http://fleetui.com/
MIT License
233 stars 39 forks source link

CoreOS - No log in unit detail view #20

Closed ungarida closed 9 years ago

ungarida commented 9 years ago

Hello, I'm running purpleworks/fleet-ui:0.1.6 on CoreOS. I configured fleet-ui as follow:

[Unit]
Description=fleet-ui
After=fleet.service docker.service
Requires=fleet.service docker.service

[Service]
Restart=on-failure
RestartSec=20
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill fleet-ui
ExecStartPre=-/usr/bin/docker rm fleet-ui
ExecStartPre=/usr/bin/docker pull purpleworks/fleet-ui
ExecStart=/usr/bin/docker run \
    --name fleet-ui \
    -e ETCD_PEER=XXX.XXX.XXX.XXX \
    -p 3000:3000 \
    -v /home/core/.ssh/id_rsa:/root/id_rsa \
    purpleworks/fleet-ui
ExecStop=/usr/bin/docker stop fleet-ui

[Install]
WantedBy=multi-user.target

Everything is working fine, I see every machines, I see fleet metadata, I can start, stop and destroy units. But I can not see logs in unit detail view. Could you help me to fix this problem?

subicura commented 9 years ago

Hi, ungarida! Log viewer requires ssh tunneling. So /home/core/.ssh/id_rsa private key should have permission to connect other server.

If you want to test, connect to server running fleetui and run command.

$ ssh-add ~/.ssh/id_rsa
$ fleetctl journal -f servicename
ungarida commented 9 years ago

I tried running this commands with the core user:

$ eval `ssh-agent -s`
$ ssh-add ~/.ssh/id_rsa
$ fleetctl journal -f servicename

The last command is printing correctly the log but if I open the unit detail view I do not see anything. What else I'm messing?

subicura commented 9 years ago

Do you connect fleetui server direct or with nginx(something else..)?

ungarida commented 9 years ago

Directly.

subicura commented 9 years ago

What is fleetctl version in coreos?

ungarida commented 9 years ago

I'm using CoreOS 640.0.0 with fleetctl version 0.9.2 and etcd version 0.4.9.

subicura commented 9 years ago

It seems fleetctl version issue. Fleetui uses 0.9.1 now. I'll update fleetctl and test as soon as possible. Thank you for reporting.

ungarida commented 9 years ago

Thank you, let me know if I could help in any way.

subicura commented 9 years ago

I update fleetctl version! Please try again!

ungarida commented 9 years ago

I updated but nothing changes, the client is doing requests like:

GET /api/v1/units/docker-registry.service HTTP/1.1
Host: granito:3000
Connection: keep-alive
Accept: application/json, text/plain, */*
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36
Referer: http://granito:3000/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: it,en;q=0.8,en-US;q=0.6

but the response are always:

{"Unit":"docker-registry.service","Load":"loaded","Active":"active","Sub":"running","Machine":"9ab922b36049470e9c1913edc17e2727/XXX.XXX.XXX.XXX"}

Instead executing the command fleetctl journal -f docker-registry:

-- Logs begin at Tue 2015-04-07 07:11:44 UTC. --
Apr 08 05:43:20 granito docker[7446]: 08/Apr/2015:05:43:20 +0000 WARNING: Cache storage disabled!
Apr 08 05:43:20 granito docker[7446]: 08/Apr/2015:05:43:20 +0000 WARNING: LRU cache disabled!
Apr 08 05:43:21 granito docker[7446]: 08/Apr/2015:05:43:21 +0000 INFO: Boto based storage initialized
Apr 08 05:43:21 granito docker[7446]: [2015-04-08 05:43:21 +0000] [1] [INFO] Starting gunicorn 19.1.1
Apr 08 05:43:21 granito docker[7446]: [2015-04-08 05:43:21 +0000] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)
Apr 08 05:43:21 granito docker[7446]: [2015-04-08 05:43:21 +0000] [1] [INFO] Using worker: gevent
Apr 08 05:43:21 granito docker[7446]: [2015-04-08 05:43:21 +0000] [16] [INFO] Booting worker with pid: 16
Apr 08 05:43:21 granito docker[7446]: [2015-04-08 05:43:21 +0000] [17] [INFO] Booting worker with pid: 17
Apr 08 05:43:21 granito docker[7446]: [2015-04-08 05:43:21 +0000] [18] [INFO] Booting worker with pid: 18
Apr 08 05:43:21 granito docker[7446]: [2015-04-08 05:43:21 +0000] [19] [INFO] Booting worker with pid: 19

And I checked journalctl -ru fleet-ui has no error:

-- Logs begin at Tue 2015-04-07 07:11:44 UTC, end at Wed 2015-04-08 05:52:11 UTC. --
Apr 08 05:52:11 granito docker[6685]: [negroni] Completed 200 OK in 21.593674ms
Apr 08 05:52:11 granito docker[6685]: 2015/04/08 05:52:11 unit all
Apr 08 05:52:11 granito docker[6685]: [negroni] Started GET /api/v1/units
Apr 08 05:52:10 granito docker[6685]: [negroni] Completed 200 OK in 34.270261ms
Apr 08 05:52:10 granito docker[6685]: 2015/04/08 05:52:10 unit detail - docker-registry.service
Apr 08 05:52:10 granito docker[6685]: [negroni] Started GET /api/v1/units/docker-registry.service
Apr 08 05:52:08 granito docker[6685]: [negroni] Completed 200 OK in 39.829361ms
Apr 08 05:52:08 granito docker[6685]: 2015/04/08 05:52:08 unit detail - docker-registry.service
Apr 08 05:52:08 granito docker[6685]: [negroni] Started GET /api/v1/units/docker-registry.service
Apr 08 05:52:06 granito docker[6685]: [negroni] Completed 200 OK in 30.587164ms
Apr 08 05:52:06 granito docker[6685]: [negroni] Completed 200 OK in 30.583984ms
Apr 08 05:52:06 granito docker[6685]: 2015/04/08 05:52:06 unit detail - docker-registry.service
Apr 08 05:52:06 granito docker[6685]: [negroni] Started GET /api/v1/units/docker-registry.service
Apr 08 05:52:06 granito docker[6685]: 2015/04/08 05:52:06 unit all
Apr 08 05:52:06 granito docker[6685]: [negroni] Started GET /api/v1/units
Apr 08 05:52:04 granito docker[6685]: [negroni] Completed 200 OK in 35.748516ms
``
subicura commented 9 years ago

Thank you for detail logging! I think.. there is websocket issue. "/api/v1/units/docker-registry.service" is detail API. Log viewer uses websocket instead of HTTP request. (http://xxxx/ws/journal/servicename) Can you check websocket log?

ungarida commented 9 years ago

The websocket is connected:

GET ws://granito:3000/ws/journal/docker-registry.service HTTP/1.1
Host: granito:3000
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: http://granito:3000
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: it,en;q=0.8,en-US;q=0.6
Sec-WebSocket-Key: tsG6G93rIGY/t64bFUwIzA==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

But the connection setup is stalled in status 101 and no frames are visible. So it is definitely a problem on the web socket, I tried different clients and OS but nothing changes.

subicura commented 9 years ago

101 status code is normal. It seems all is OK. It's very weird problem. I'll add useful log message soon!

ungarida commented 9 years ago

Maybe is something about my configuration of CoreOS on CloudStack, I will let you know.

ungarida commented 9 years ago

I found an error that can be related to:

-- Reboot --
Apr 08 21:12:41 granito systemd[1]: cloudstack-ssh-key.service failed.
Apr 08 21:12:41 granito systemd[1]: Unit cloudstack-ssh-key.service entered failed stat
Apr 08 21:12:41 granito systemd[1]: Failed to start Sets SSH key from metadata.
Apr 08 21:12:41 granito systemd[1]: cloudstack-ssh-key.service: main process exited, co
Apr 08 21:12:41 granito cloudstack-ssh-key[523]: /home/core/.ssh/authorized_keys.d/clou
Apr 08 21:12:41 granito cloudstack-ssh-key[523]: Adding/updating cloudstack:
Apr 08 21:12:39 localhost systemd[1]: Starting Sets SSH key from metadata...

What do you think about it?

subicura commented 9 years ago

Hi! We finally add useful error message. Sorry for late. Please try again!

subicura commented 9 years ago

Close issue. Please let me know, if you have any problem!