Giter VIP home page Giter VIP logo

mongoku's Introduction

Mongoku

MongoDB client for the web. Query your data directly from your browser. You can host it locally, or anywhere else, for you and your team.

It scales with your data (at Hugging Face we use it on a 1TB+ cluster) and is blazing fast for all operations, including sort/skip/limit. Built on TypeScript/Node.js/Angular.

Demo

mongoku

Install & Run

This is the easy and recommended way of installing and running Mongoku.

# Install
npm install -g mongoku

# Run from your current terminal
mongoku start

You can also run Mongoku as a daemon, using either PM2 or Forever.

mongoku start --pm2
# or
mongoku start --forever

Docker

Using the Docker HUB image

docker run -d --name mongoku -p 3100:3100 huggingface/mongoku

# Run with customized default hosts
docker run -d --name mongoku -p 3100:3100 --env MONGOKU_DEFAULT_HOST="mongodb://user:[email protected]:8888" huggingface/mongoku

Build your own image

If you want to build your own docker image, just clone this repository and run the following:

# Build
docker build -t yournamehere/mongoku .

# Run
docker run -d --name mongoku -p 3100:3100 yournamehere/mongoku

Manual Build

If you want to manually build and run mongoku, just clone this repository and run the following:

# Install the angular cli if you don't have it already
npm install -g typescript @angular/cli
npm install

# Build the front
cd app
npm install
ng build

# And the back
cd ..
tsc

# Run
node dist/server.js

Configuration

You can also specify a few things using environment variables:

# Use some customized default hosts (Default = localhost:27017)
MONGOKU_DEFAULT_HOST="mongodb://user:password@localhost:27017;localhost:27017"

# Use another port. (Default = 3100)
MONGOKU_SERVER_PORT=8000

# Use a specific file to store hosts (Default = $HOME/.mongoku.db)
MONGOKU_DATABASE_FILE="/tmp/mongoku.db"

# Timeout before falling back to estimated documents count in ms (Default = 5000)
MONGOKU_COUNT_TIMEOUT=1000

# Read-only mode
MONGOKU_READ_ONLY_MODE=true

mongoku's People

Contributors

clmnt avatar julien-c avatar lampapetrol avatar mcpatate avatar n1t0 avatar pierrci avatar zallison avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mongoku's Issues

Mongoku with Atlas doesn't work

I'm trying to connect Mongoku with my Atlas database, but something doesn't work when I run this code:
docker run --name mongoku -p 3100:3100 --env MONGOKU_DEFAULT_HOST="mongodb://admin:[email protected]:27017, prova1-shard-00-01-9usas.mongodb.net:27017, prova1-shard-00-02-9usas.mongodb.net:27017" huggingface/mongoku:1.3.0

This is the output:
[Mongoku] Starting... (node:6) ExperimentalWarning: The fs.promises API is experimental Error while connecting to prova1-shard-00-00-9usas.mongodb.net: undefined no mongos proxy available [Mongoku] listening on port 3100
The code keep running, but when I search "http://prova1-shard-00-00-9usas.mongodb.net:3100/" on browser, I don't see anything and the page reach the connection timeout.
Any suggest? Thanks to everyone

Replica set

Attempt to connect to replica set ejaculates "Malformed URL" error. And I'm not even trying to pass any options

Document Link Missing HREF

Issue

The collection view has a href="#" stub for document ID links. Navigation is handled by a JavaScript click event. This breaks the UX of copying links or opening them in a new tab.

Background

<a href="#" (click)="goToDocument($event)">{{ json._id?.$value }}</a>

goToDocument(event) {
event.preventDefault();
this.go.emit(this.json._id.$value);
}

go(documentId) {
this.router.navigate([
'servers', this.server,
'databases', this.database,
'collections', this.collection,
'documents', documentId
]);
}

Proposal

Use a routerLink directive in pretty-json.component.html.

Unable to add an auth enabled server

When I start mongoku, I get the following output (error).

[Mongoku] Starting...
[localhost:27017] Connected to localhost:27017
[Mongoku] listening on port 3100
(node:7634) UnhandledPromiseRejectionWarning: MongoError: command listDatabases requires authentication
    at Connection.<anonymous> (/home/bd/node_modules/mongodb-core/lib/connection/pool.js:443:61)
    at emitTwo (events.js:126:13)
    at Connection.emit (events.js:214:7)
    at processMessage (/home/bd/node_modules/mongodb-core/lib/connection/connection.js:364:10)
    at Socket.<anonymous> (/home/bd/node_modules/mongodb-core/lib/connection/connection.js:533:15)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)hen I 
    at Socket.Readable.push (_stream_readable.js:208:10)
(node:7634) 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:7634) [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.

As mongoku doesn't have the auth details, I tried to add the server using the GUI. I noticed that the add server input field was not editable.

Showing count of results

It seems that we cannot see the count of the result when we do a query.
The total number of document does not change and this seems to be a bug to me.
Is there a way to show the count of the results only for the queries?
For example the result of the query of the following does not change the 1 - 20 of $TOTAL Documents.
$TOTAL seems to be the same no matter what the query is.

db.getCollection('events').find({
timestamp: {
$gte: ISODate("2017-10-13T03:00:00.993Z"),
$lt: ISODate("2017-10-14T16:59:09.993Z")
}
}).count()

Mongodb in docker

Hi all,

How to set the MONGOKU_DEFAULT_HOST when our mongodb in docker? The default localhost will not work.

I wonder to know how to set this environment variable when I have not set my user and password.

Thanks for your help.

Best Regards

Unable to host MongoDB behind nginx proxy_pass server

As per the topic, I'm trying to host Mongoku on a webserver, and need some kind of password protection. I am unable to proxy_pass it with Nginx as it seems Mongoku passes to root. I've tried to rewrite to no avail. Any solutions?

Edit, my nginx code is as follows:
location /mongoku/ { rewrite ^/mongoku/?(.*)$ /$1 break; proxy_pass http://127.0.0.1:3100; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }

[BUG] Cannot delete doc

Firstly, awesome package!

I don't know if this is related to this issue: #35

When i navigate to a collection, press the delete button nothing happens; no console message and nothing is sent to the server.

Linux Mint 19.
Node12 LTS
mongoku 1.3.0

Installation issue

After installation on MAC OS trying to run mongoku start and get permission denied: mongoku. Trying to run under sudo and get sudo: mongoku: command not found. Any help?

How to create a default host?

Hey,
Thanks a lot for this.

I'm running it with docker-compose and I would like to set the default host to host.docker.localhost.

Is there a way?

Taking a minute to get the first page when Mongoku is served in closed network

It takes a minute to get the first page when Mongoku is served in closed network(cannot access to the Internet).

Mongoku is trying to get some css information from fonts.googleapis.com, and the first page is not showing anything until it fails.

Please, check the screenshot below.
mongoku_delay_issue_in_cloased_network

Is there any way to serve Mongoku more elegantly in the closed network?

Authorization support request

Are there any plans to add authorization support, so public IP can be attached to Mongoku? Or are there already some workarounds to prevent anyone who knows the public IP from viewing & modifying the data without permission?

Thanks.

[QUESTION] create collection or document

I m looking for a mongo webui and found your module. looks promising.

I cannot see any button to create collection or document inside a collection. is there something I m missing or is it planned in the future?

Unable to edit database entries

I'm using the latest mongoku docker image on an Ubuntu 16.04, The Mongo Server is the latest from docker hub too.

Whenever I edit a database entry I have this screen showing up:
Screenshot from 2020-02-24 17-05-38

All 6 buttons have no effect.

Here is the console output from Chrome:

POST http://192.168.1.253:3100/api/servers/192.168.1.253/databases/sacred/collections/runs/documents/undefined?partial=true 500 (Internal Server Error)
[...]

main.655e64f2fe8da11ef927.js:1 ERROR TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
    at e.t.appendChild (main.655e64f2fe8da11ef927.js:1)
    at t.ngOnInit (main.655e64f2fe8da11ef927.js:1)
    at main.655e64f2fe8da11ef927.js:1
    at main.655e64f2fe8da11ef927.js:1
    at Yo (main.655e64f2fe8da11ef927.js:1)
    at _s (main.655e64f2fe8da11ef927.js:1)
    at Object.updateDirectives (main.655e64f2fe8da11ef927.js:1)
    at Object.updateDirectives (main.655e64f2fe8da11ef927.js:1)
    at Zo (main.655e64f2fe8da11ef927.js:1)
    at ss (main.655e64f2fe8da11ef927.js:1)
[...]

main.655e64f2fe8da11ef927.js:1 ERROR TypeError: Cannot read property '_id' of undefined
    at Object.updateDirectives (main.655e64f2fe8da11ef927.js:1)
    at Object.updateDirectives (main.655e64f2fe8da11ef927.js:1)
    at Zo (main.655e64f2fe8da11ef927.js:1)
    at ss (main.655e64f2fe8da11ef927.js:1)
    at is (main.655e64f2fe8da11ef927.js:1)
    at Zo (main.655e64f2fe8da11ef927.js:1)
    at ss (main.655e64f2fe8da11ef927.js:1)
    at os (main.655e64f2fe8da11ef927.js:1)
    at Zo (main.655e64f2fe8da11ef927.js:1)
    at ss (main.655e64f2fe8da11ef927.js:1)
[...]

main.655e64f2fe8da11ef927.js:1 ERROR TypeError: Cannot read property '_id' of undefined
    at Object.updateDirectives (main.655e64f2fe8da11ef927.js:1)
    at Object.updateDirectives (main.655e64f2fe8da11ef927.js:1)
    at Zo (main.655e64f2fe8da11ef927.js:1)
    at ss (main.655e64f2fe8da11ef927.js:1)
    at is (main.655e64f2fe8da11ef927.js:1)
    at Zo (main.655e64f2fe8da11ef927.js:1)
    at ss (main.655e64f2fe8da11ef927.js:1)
    at os (main.655e64f2fe8da11ef927.js:1)
    at Zo (main.655e64f2fe8da11ef927.js:1)
    at ss (main.655e64f2fe8da11ef927.js:1)

Thank you.

failed to connect to server

$ mongoku start
  __  __                         _          
 |  \/  | ___  _ __   __ _  ___ | | ___   _ 
 | |\/| |/ _ \| '_ \ / _` |/ _ \| |/ / | | |
 | |  | | (_) | | | | (_| | (_) |   <| |_| |
 |_|  |_|\___/|_| |_|\__, |\___/|_|\_\\__,_|
                     |___/                  
[Mongoku] Starting...
(node:33597) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(Use `node --trace-warnings ...` to show where the warning was created)
Error while connecting to localhost:27017: undefined failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED ::1:27017
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1283:16) {
  name: 'MongoNetworkError'
}]
[Mongoku] listening on port 3100
$ mongosh
Current Mongosh Log ID:	6397161dd4cd5a191e2d4185
Connecting to:		mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.1
Using MongoDB:		6.0.3
Using Mongosh:		1.6.1

For mongosh info see: https://docs.mongodb.com/mongodb-shell/

------
   The server generated these startup warnings when booting
   2022-12-12T19:42:21.536+08:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
   2022-12-12T19:42:21.725+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   2022-12-12T19:42:21.725+08:00: vm.max_map_count is too low
------

------
   Enable MongoDB's free cloud-based monitoring service, which will then receive and display
   metrics about your deployment (disk utilization, CPU, operation statistics, etc).
   
   The monitoring data will be available on a MongoDB website with a unique URL accessible to you
   and anyone you share the URL with. MongoDB may use this information to make product
   improvements and to suggest MongoDB products and deployment options to you.
   
   To enable free monitoring, run the following command: db.enableFreeMonitoring()
   To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
------

Mongoku + DocumentDB

Have anyone been able to use Mongoku with DocumentDB?

I have tried to use the url provided to me by AWS which looks more or less like this:

mongodb://username:[email protected]:27017/?ssl=true&ssl_ca_certs=rds-combined-ca-bundle.pem&retryWrites=false

but I'm getting this error

failed to connect to server [server] on first connect [
  Error: unable to get local issuer certificate at TLSSocket.onConnectSecure (_tls_wrap.js:1515:34) at TLSSocket.emit (events.js:400:28) at TLSSocket._finishInit (_tls_wrap.js:937:8) at TLSWrap.ssl.onhandshakedone (_tls.wrap.js:709:12) 
{ name: 'MongoNetworkError'}]

I have tried to download the rds-combined-ca-bundle.pem and place it in node_modules/mongoku/dist/ and node_modules/mongoku/dist/config/ folder without any luck.

Any ideas?

Also the documentation says that it is possible to define some configuration environment variables. Is it possible to set these in a specific file?

Is there any feature or option for login in ssl-enabled mongo ?

I have ssl-enabled mongo v3.4.20 and I want it's graphical interface for client but I didn't find any sslca or sslkey option in mongoku, however it works really fine without ssl

Currently, I'm logging in mongo via terminal i.e.

mongo --ssl -host localhost --sslCAFile /etc/ssl/ca.pem --sslPEMKeyFile /etc/ssl/key.pem

Any help appreciated!

Querying - how?

I'm trying to figure out the query syntax, if there is any...

Anyone else cracked this?

Please let me know thanks

Add option to exit 1 if unable to connect

Using docker-compose and starting both mongoku and mongo provokes a permanent error message in the UI. If mongoku exited with code 1 if it's unable to connect to the database, we could add a restart: on-failure and then the next time it will connect.

Is it possible to add an environment variable to exit 1 if it's unable to connect? I can PR if needed.

Thanks you!

Cannot use the app using non-admin user accounts

I am trying to use the app for allowing normal users(non administrators) to browse the collections and documents within a particular database. But, the application is throwing error as it is trying to listDatabases since the user doesn't have admin rights that would allow him/her to list the databases. Is there any workaround to resolve this ? I dont want the users to be admins in order to just browse the documents within a database.

Docker amd64 only image

Running a cluster of Raspberry Pis (or similar ARM boards) is very common. At the moment buildx allows to build images for multiple Docker architechtures.

Could you publish at least ARM64 and ARM (armhf) as well?

Security concern while using mongoku in docker

First of all, thank you for mongoku. It works well and its fast as well.

Docker setup

Both of these containers (mongodb & mongoku) runs within the same docker network

version: "3.9"
services:
  mongoku:
    image: huggingface/mongoku
    container_name: mongoku
    hostname: mongoku
    ports:
      - 3100:3100
  mongo:
    image: mongo
    container_name: mongo
    hostname: mongo
    restart: always
    ports:
      - 27017:27017     # server access
    environment:
      MONGO_INITDB_ROOT_USERNAME: ${MONGODB_ADMIN_USERNAME}
      MONGO_INITDB_ROOT_PASSWORD: ${MONGODB_ADMIN_PASSWORD}
      MONGO_INITDB_DATABASE: ${MONGODB_INITDB_DATABASE}

What happens

From my host machine If I access the web UI, it prompts to add a server.
Once you add the server, I guess the connection string including username/password is persisted inside the container and not the user HTTP session.

Security Issue

When you open another browser (in private mode) and open the Web UI, you see the server which was added by the previous session. This becomes a security concern since any user can open the UI and see the servers added by other users.

Do let me know if there is a way around this.

Fix

The server list should be persisted in the user HTTP session and not inside the docker container.

Does Mongoku is working with clusters ?

Hi team,
I have a mongo cluster with several nodes, I configured MongoKu with a list of nodes (mongodb://usermongo:passmongo@host1:27017;host2:27017;host3:27017) and everything works when host1 is primary.

When host1 is down, a new primary is elected, but mongoku dont switch to the new primary and UI is running into Gateway Timeout :-(

Is Mongoku compatible with clusters ?

PS : I'm using Mongoku 1.3.0

Regards,
Gilles.

Add Dockerfile

Would be great to have a Dockerfile so that we can easily deploy on server.

Thx!

Node 14: reports of circular dependencies inside dependencies

Probably just need to upgrade the mongo driver

(node:623) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:623) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
(node:623) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
(node:623) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency

Call Mongoku programatically

First of all, congrats for this lib, it's amazing !

Is there a way to start Mongoku programatically (not with a npm install -g), and define the connection string as a parameter ?

Regads,
Sylvain

Slow response time

I am using Mongoku for a large sharded cluster. If i provide a query for any collection the response time is about 5-15 secs on the UI, if I run it in the shell it is < 1 sec. Seems something makes response through mongoku very slow. Any ideas?

pm2 or forever not working

Platform: Mac
shell: zsh

$ mongoku --forever start 
  __  __                         _          
 |  \/  | ___  _ __   __ _  ___ | | ___   _ 
 | |\/| |/ _ \| '_ \ / _` |/ _ \| |/ / | | |
 | |  | | (_) | | | | (_| | (_) |   <| |_| |
 |_|  |_|\___/|_| |_|\__, |\___/|_|\_\\__,_|    
Error while launching with forever:  Error: Command failed: forever --uid mongoku start -a /usr/local/lib/node_modules/mongoku/dist/server.js
/bin/sh: forever: command not found

    at ChildProcess.exithandler (child_process.js:308:12)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
    at Socket.<anonymous> (internal/child_process.js:439:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:673:12) {
  killed: false,
  code: 127,
  signal: null,
  cmd: 'forever --uid mongoku start -a /usr/local/lib/node_modules/mongoku/dist/server.js'
}

Docker - ConnectionString after restart not correct

When we use Mongoku in docker, we add connection string like 'mongoku:27101'.
Mongoku seems to resolve the ip of the host and replace it in the connection string.

As we restart our docker, it will retrieve a new internal docker ip, so the connection string is invalid, I would suggest, to resolve the ip while connecting and not by replacing the connction string

[bug?] MONGOKU_DEFAULT_HOST - Not able to set it correctly

configuring the Mongo DB via MogoKU GUI:
clicking on "Add server" > "admin:admin@mongo_db:27017" -> connection set .

it doesn't work using the variable MONGOKU_DEFAULT_HOST in docker-compose .

docker-compose:

  mongo_gui:
    image: huggingface/mongoku
    container_name: mongo_gui
    ports:
      - "${MONGOGUI_PORT:-3100}:3100"
    networks:
      - dockers_default
    depends_on:
        - mongo_db
    environment:
      - MONGOKU_DEFAULT_HOST="mongodb://admin:admin@mongo_db:27017"

Tried also:
MONGOKU_DEFAULT_HOST="mongo_db://admin:admin@mongo_db:27017"
MONGOKU_DEFAULT_HOST="mongodb://admin:admin@localhost:27017"
MONGOKU_DEFAULT_HOST="admin:admin@mongo_db:27017"

It doesn't connect and there's an error "unescaped slash in user info section "

Support Mongo Database deployed on Atlas Clusters

Currently, it seems we can connect only on mongo databases deployed on dedicated servers or localhost it would be good if you can extend support to connect mongo clusters deployed on cloud such as Atlas.

Adding support for exporting to csv

HI.

I just reached out to your project, tested it and seems really nice. To visualize your data is perfect. I'm wondering if you plan to add support to exporting data into different formats?

At least some csv support initially would be great.

Thx, will keep watching for progress.

Doesn't scale with large amount of collections

I'm trying to use mongoku with a database that has around 4000 collections (it's an odd topology I know). It works great on small databases running locally but it fails to load when I point it at a db with a lot of collections. There doesn't seem to be an issue open for this so I wanted to open this to discuss solutions. I'm willing to work on a PR to fix this but I thought I should ask for some input on if this is feasible in the first place before diving in.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.