Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added docker configuration, updated dependencies #142

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
.vscode/
dist/
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:20.12.0

WORKDIR /app

COPY package.json package-lock.json ./

RUN npm ci

COPY . .

EXPOSE 3333

CMD ["npm", "run", "server"]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ Allows MongoDB to be used as a data source for Grafana by providing a proxy to c
* Run `npm install` to install the node.js dependencies
* Run `npm run server` to start the REST API proxy to MongoDB. By default, the server listens on http://localhost:3333

### Install using docker

* Use `docker compose up` to start the mongodb_proxy, mongodb and grafana
* Execute `docker cp ./* grafana:/var/lib/grafana/plugins/mongodb-grafana` to install the mongodb proxy plugin in grafana.
* Restart the grafana container to load the plugin: `docker container restart grafana`

## Examples

Create a new data source of type MongoDB as shown below. The MongoDB details are :
Expand Down
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: "3.8"
services:
db:
container_name: db
image: mongo
restart: always
ports:
- 27017:27017
environment:
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=adminadmin

grafana:
image: grafana/grafana
container_name: grafana
restart: unless-stopped
environment:
- GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=grafana-mongodb,grafana-mongodb-datasource
ports:
- 3000:3000
volumes:
- grafana-storage:/var/lib/grafana

mongodb_proxy:
image: mongodb_proxy
build: .
container_name: mongodb_proxy
restart: unless-stopped
ports:
- 3333:3333

volumes:
grafana-storage:
Loading