vivekratnavel / omniboard

Web-based dashboard for Sacred
MIT License
544 stars 46 forks source link

Omniboard not connecting to MongoDB in docker #111

Closed CarloLucibello closed 5 years ago

CarloLucibello commented 5 years ago

Hi, recently I have not been able to use omniboard since it just displays an essentially blank page just saying "loading".
This is happening when connecting to a very small database. No filters applied, just first connection to the server. The console is showing no error. Any ideas? How can I investigate the issue?

vivekratnavel commented 5 years ago

It might be similar to #108 . Can you try disabling ad-blocker and try again?

CarloLucibello commented 5 years ago

no luck

vivekratnavel commented 5 years ago

Can you check the network console to see if there is any response received from the servers for the requests made? Which browser are you using? Can you try in incognito window?

Also, check omniboard server logs for any errors and post here.

razorx89 commented 5 years ago

I am experiencing the same issue. When using the latest docker image it just displays an empty list with "loading". Chrome and Firefox, both, incognito and normal session.

omniboard_1_4b195b1bdc23 | ::ffff:172.22.0.1 - - [13/Jun/2019:12:39:49 +0000] "GET / HTTP/1.1" 200 509 0.440 ms
omniboard_1_4b195b1bdc23 | ::ffff:172.22.0.1 - - [13/Jun/2019:12:39:49 +0000] "GET /api/v1/Omniboard.Columns HTTP/1.1" - - - ms
omniboard_1_4b195b1bdc23 | ::ffff:172.22.0.1 - - [13/Jun/2019:12:39:49 +0000] "GET /api/v1/Omniboard.Settings HTTP/1.1" - - - ms
omniboard_1_4b195b1bdc23 | ::ffff:172.22.0.1 - - [13/Jun/2019:12:39:49 +0000] "GET /static/css/main.a2015c6f.css HTTP/1.1" 200 170746 0.856 ms
omniboard_1_4b195b1bdc23 | ::ffff:172.22.0.1 - - [13/Jun/2019:12:39:49 +0000] "GET /static/js/main.68b94776.js HTTP/1.1" 200 5485472 0.661 ms
omniboard_1_4b195b1bdc23 | ::ffff:172.22.0.1 - - [13/Jun/2019:12:39:49 +0000] "GET /static/media/glyphicons-halflings-regular.448c34a5.woff2 HTTP/1.1" 200 18028 0.643 ms
omniboard_1_4b195b1bdc23 | ::ffff:172.22.0.1 - - [13/Jun/2019:12:39:50 +0000] "GET /api/v1/database HTTP/1.1" 200 16 0.502 ms

Omniboard.Columns and Omniboard.Settings are listed as pending requests in the developer tools of chrome and as you can see from the above logs, both requests don't seem to be handled properly. However, downgrading the docker image to e.g. 1.0.0 solves it and I can view the stored runs.

vivekratnavel commented 5 years ago

I looked further into this issue and found out that it is caused by Omniboard not connected to the Mongo DB. You should see this message in the server logs: Error: connect ECONNREFUSED <hostname>:<portname>

This is because Omniboard is not retrying to connect to Mongo after some timeout. I am working on a patch and will fix this soon.

@CarloLucibello @razorx89 Thanks for raising this issue!

CarloLucibello commented 5 years ago

Thanks for the fix! Could you tag a new release?

vivekratnavel commented 5 years ago

I am working on it. There seems to be an issue with signing commits with gpg in travis.

vivekratnavel commented 5 years ago

:tada: This issue has been resolved in version 1.7.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

vivekratnavel commented 5 years ago

@CarloLucibello @razorx89 Could you please try the latest version of Omniboard and verify if you are able to see the experiments?

CarloLucibello commented 5 years ago

nay, unfortunately now I get an entirely blank screen

CarloLucibello commented 5 years ago
[carlo@europa SacredDNN]$ omniboard localhost:9000:dnn_test
Omniboard is listening on port 9000!
Connection to mongodb://localhost/sacred established successfully!
::ffff:10.1.102.116 - - [27/Jun/2019:16:36:03 +0000] "GET / HTTP/1.1" 304 - 6.553 ms
::ffff:10.1.102.116 - - [27/Jun/2019:16:36:03 +0000] "GET /static/css/main.e64d45ec.css HTTP/1.1" 304 - 1.299 ms
::ffff:10.1.102.116 - - [27/Jun/2019:16:36:03 +0000] "GET /static/js/main.993ad6e8.js HTTP/1.1" 304 - 2.163 ms
::1 - - [27/Jun/2019:16:36:11 +0000] "GET / HTTP/1.1" 304 - 0.452 ms
::1 - - [27/Jun/2019:16:36:11 +0000] "GET /static/css/main.e64d45ec.css HTTP/1.1" 304 - 0.773 ms
::1 - - [27/Jun/2019:16:36:11 +0000] "GET /static/js/main.b26eab37.js HTTP/1.1" 304 - 0.836 ms
::1 - - [27/Jun/2019:16:36:20 +0000] "GET / HTTP/1.1" 304 - 0.356 ms
::1 - - [27/Jun/2019:16:36:20 +0000] "GET /static/css/main.e64d45ec.css HTTP/1.1" 304 - 0.490 ms
::1 - - [27/Jun/2019:16:36:20 +0000] "GET /static/js/main.993ad6e8.js HTTP/1.1" 200 509 1.654 ms
::1 - - [27/Jun/2019:16:36:20 +0000] "GET /favicon.ico?v=1 HTTP/1.1" - - - ms
CarloLucibello commented 5 years ago

Also, I don't know how to handle this warning

[carlo@europa SacredDNN]$ sudo npm install -g omniboard
/usr/bin/omniboard -> /usr/lib/node_modules/omniboard/dist/start.js
npm WARN express-restify-mongoose@4.3.0 requires a peer of mongoose@^4.0.0 but none is installed. You must install peer dependencies yourself.

+ omniboard@1.7.1
updated 1 package in 9.572s
vivekratnavel commented 5 years ago

@CarloLucibello Do you see any errors in the browser console? Can you try incognito mode?

If the above doesn't work, can you try yarn install -g omniboard?

CarloLucibello commented 5 years ago

I realized that omniboard is just ignoring the database name. I have all my runs in the a mongodb database dnn, but omniboard seems to be defaulting to a sacred database

[carlo@europa SacredDNN]$ omniboard localhost:9000:dnn
Omniboard is listening on port 9000!
Connection to mongodb://localhost/sacred established successfully!

In fact, a few runs which I observed in the sacred database correctly show up in omniboard

vivekratnavel commented 5 years ago

@CarloLucibello Can you try omniboard -m localhost:9000:dnn or omniboard --mu mongodb://localhost:9000/dnn ?

CarloLucibello commented 5 years ago

Ops, I forgot the -m flag indeed. But with either omniboard -m localhost:9000:dnn or omniboard --mu mongodb://localhost:9000/dnn I get the following error

[carlo@europa ~]$ omniboard -m localhost:9000:dnn
Omniboard is listening on port 9000!
2019-06-30T08:32:41.958Z 'MongoNetworkError: failed to connect to server [localhost:9000] on first connect [[object Object]]'
Retrying in 3 seconds...
(node:27885) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:9000] on first connect [[object Object]]
    at Pool.<anonymous> (/usr/lib/node_modules/omniboard/node_modules/mongodb-core/lib/topologies/server.js:431:11)
    at Pool.emit (events.js:193:13)
    at connect (/usr/lib/node_modules/omniboard/node_modules/mongodb-core/lib/connection/pool.js:557:14)
    at callback (/usr/lib/node_modules/omniboard/node_modules/mongodb-core/lib/connection/connect.js:109:5)
    at runCommand (/usr/lib/node_modules/omniboard/node_modules/mongodb-core/lib/connection/connect.js:129:7)
    at Connection.errorHandler (/usr/lib/node_modules/omniboard/node_modules/mongodb-core/lib/connection/connect.js:321:5)
    at Object.onceWrapper (events.js:281:20)
    at Connection.emit (events.js:193:13)
    at Socket.<anonymous> (/usr/lib/node_modules/omniboard/node_modules/mongodb-core/lib/connection/connection.js:498:20)
    at Socket.emit (events.js:193:13)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:276:11)
    at Socket.Readable.push (_stream_readable.js:231:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:154:17)
(node:27885) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:27885) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Retrying first connect...
(node:27885) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
2019-06-30T08:32:44.967Z 'MongoNetworkError: failed to connect to server [localhost:9000] on first connect [[object Object]]'
Retrying in 3 seconds...
Retrying first connect...

These are different attempts where I get no errors but the runs don't show up in the dashboard

$ omniboard -m localhost:dnn:9000
Omniboard is listening on port 9000!
Connection to mongodb://localhost:dnn/9000 established successfully!
[carlo@europa ~]$ omniboard localhost:dnn:9000
Omniboard is listening on port 9000!
Connection to mongodb://localhost/sacred established successfully!
[carlo@europa ~]$ omniboard localhost:9000:dnn
Omniboard is listening on port 9000!
Connection to mongodb://localhost/sacred established successfully!
vivekratnavel commented 5 years ago

@CarloLucibello Is your mongo running in docker? From the error, it looks like Omniboard is not able to connect to the mongo instance.

CarloLucibello commented 5 years ago

No it's not running in docker. Also, my mongodb server seems to be allright, I can store sacred expeimrents with the -m flag and retrieve them from the mongodb shell.I'm on mongodb 4.0

vivekratnavel commented 5 years ago

That is strange. Can you try connecting to localhost:9000:dnn from another mongo client like Mongo Express?

lliuz commented 5 years ago

@vivekratnavel I encountered a similar problem when I tried to connect to mongo:

omniboard_1_44c86dff174b | Omniboard is listening on port 9000!
mongo_1_5682fe2cfb67 | 2019-09-10T15:03:56.272+0000 I  NETWORK  [listener] connection accepted from 172.19.0.3:47216 #1 (1 connection now open)
mongo_1_5682fe2cfb67 | 2019-09-10T15:03:56.278+0000 I  NETWORK  [conn1] received client metadata from 172.19.0.3:47216 conn1: { driver: { name: "nodejs", version: "3.1.10" }, os: { type: "Linux", name: "linux", architecture: "x64", version: "4.4.0-93-generic" }, platform: "Node.js v10.8.0, LE, mongodb-core: 3.1.9" }
mongo_1_5682fe2cfb67 | 2019-09-10T15:03:56.278+0000 I  SHARDING [conn1] Marking collection admin.system.users as collection version: <unsharded>
mongo_1_5682fe2cfb67 | 2019-09-10T15:03:56.278+0000 I  ACCESS   [conn1] Supported SASL mechanisms requested for unknown user 'lliuz@admin'
mongo_1_5682fe2cfb67 | 2019-09-10T15:03:56.286+0000 I  ACCESS   [conn1] SASL SCRAM-SHA-1 authentication failed for lliuz on admin from client 172.19.0.3:47216 ; UserNotFound: Could not find user "lliuz" for db "admin"
mongo_1_5682fe2cfb67 | 2019-09-10T15:03:56.293+0000 I  NETWORK  [conn1] end connection 172.19.0.3:47216 (0 connections now open)
omniboard_1_44c86dff174b | 2019-09-10T15:03:56.295Z 'MongoError: Authentication failed.'

The database was created a long time ago. When I use omniboard < 1.4, the connection is fine, but when I upgrade omniboard, the error occurs. In addition, I tested to create a new database, and there was no problem with the connection.

I'm using docker-compose for omniboard

version: '3'
services:
  mongo:
    image: mongo:4.1.13
    ports:
      - 27017:27017
    environment:
      MONGO_INITDB_ROOT_USERNAME: lliuz
      MONGO_INITDB_ROOT_PASSWORD: xxxxxxxxxxxx
      MONGO_INITDB_DATABASE: db
    expose:
      - 27017
    volumes:
      - './data:/data/db'
    networks:
      - omniboard

  omniboard:
    image: vivekratnavel/omniboard:latest
    command: ["--mu", "mongodb://lliuz:xxxxxxxxxxxx@mongo:27017/db?authSource=admin"]
    ports:
      - 9000:9000
    networks:
      - omniboard
    depends_on:
      - mongo

networks:
  omniboard:
vivekratnavel commented 5 years ago

@lliuz Omniboard v2.x only supports MongoDB >= 4.0. So, yes your observation is correct.

peschn commented 4 years ago

Ops, I forgot the -m flag indeed. But with either omniboard -m localhost:9000:dnn or omniboard --mu mongodb://localhost:9000/dnn I get the following error

[carlo@europa ~]$ omniboard -m localhost:9000:dnn
Omniboard is listening on port 9000!
2019-06-30T08:32:41.958Z 'MongoNetworkError: failed to connect to server [localhost:9000] on first connect [[object Object]]'
Retrying in 3 seconds...
(node:27885) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:9000] on first connect [[object Object]]
    at Pool.<anonymous> (/usr/lib/node_modules/omniboard/node_modules/mongodb-core/lib/topologies/server.js:431:11)
    at Pool.emit (events.js:193:13)
    at connect (/usr/lib/node_modules/omniboard/node_modules/mongodb-core/lib/connection/pool.js:557:14)
    at callback (/usr/lib/node_modules/omniboard/node_modules/mongodb-core/lib/connection/connect.js:109:5)
    at runCommand (/usr/lib/node_modules/omniboard/node_modules/mongodb-core/lib/connection/connect.js:129:7)
    at Connection.errorHandler (/usr/lib/node_modules/omniboard/node_modules/mongodb-core/lib/connection/connect.js:321:5)
    at Object.onceWrapper (events.js:281:20)
    at Connection.emit (events.js:193:13)
    at Socket.<anonymous> (/usr/lib/node_modules/omniboard/node_modules/mongodb-core/lib/connection/connection.js:498:20)
    at Socket.emit (events.js:193:13)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:276:11)
    at Socket.Readable.push (_stream_readable.js:231:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:154:17)
(node:27885) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:27885) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Retrying first connect...
(node:27885) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
2019-06-30T08:32:44.967Z 'MongoNetworkError: failed to connect to server [localhost:9000] on first connect [[object Object]]'
Retrying in 3 seconds...
Retrying first connect...

These are different attempts where I get no errors but the runs don't show up in the dashboard

$ omniboard -m localhost:dnn:9000
Omniboard is listening on port 9000!
Connection to mongodb://localhost:dnn/9000 established successfully!
[carlo@europa ~]$ omniboard localhost:dnn:9000
Omniboard is listening on port 9000!
Connection to mongodb://localhost/sacred established successfully!
[carlo@europa ~]$ omniboard localhost:9000:dnn
Omniboard is listening on port 9000!
Connection to mongodb://localhost/sacred established successfully!

Was there a solution to this? I am experiencing the same issue. Also I tested that the db is running correctly, which is the case, as I can connect with Mongo Compass to the database and view its contents. Thx

vivekratnavel commented 4 years ago

@peschn What is the error you are getting? Which version of Omniboard are you running and how are you running (npm or docker)?