├── .gitattributes ├── .github └── workflows │ ├── docker-hub.yml │ └── github-packages.yml ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── custom-run.sh └── docker-compose.yml /.gitattributes: -------------------------------------------------------------------------------- 1 | # Handle line endings automatically for files detected as text 2 | # and leave all files detected as binary untouched. 3 | * text=auto 4 | 5 | # Force the following filetypes to have unix eols, so Windows does not break them 6 | *.* text eol=lf 7 | 8 | # 9 | ## These files are binary and should be left untouched 10 | # 11 | 12 | # (binary is a macro for -text -diff) 13 | *.png binary 14 | *.jpg binary 15 | *.jpeg binary 16 | *.gif binary 17 | *.ico binary 18 | *.mov binary 19 | *.mp4 binary 20 | *.mp3 binary 21 | *.flv binary 22 | *.fla binary 23 | *.swf binary 24 | *.gz binary 25 | *.zip binary 26 | *.7z binary 27 | *.ttf binary 28 | *.eot binary 29 | *.woff binary 30 | *.pyc binary 31 | *.pdf binary 32 | *.ez binary 33 | *.bz2 binary 34 | *.swp binary 35 | -------------------------------------------------------------------------------- /.github/workflows/docker-hub.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | 6 | name: Publish Docker image 7 | 8 | on: 9 | push: 10 | schedule: 11 | - cron: "0 2 1 * *" 12 | 13 | jobs: 14 | push_to_registry: 15 | name: Push Docker image to Docker Hub 16 | runs-on: ubuntu-latest 17 | environment: master 18 | steps: 19 | - name: Check out the repo 20 | uses: actions/checkout@v3 21 | 22 | - name: Set tag 23 | run: echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV 24 | 25 | - name: Is latest? 26 | if: env.TAG == 'master' 27 | run: echo "TAG=latest" >> $GITHUB_ENV 28 | 29 | - name: Set up QEMU 30 | uses: docker/setup-qemu-action@v2 31 | 32 | - name: Set up Docker Buildx 33 | id: buildx 34 | uses: docker/setup-buildx-action@v2 35 | 36 | - name: Log in to Docker Hub 37 | uses: docker/login-action@v2 38 | with: 39 | username: ${{ secrets.DOCKER_USERNAME }} 40 | password: ${{ secrets.DOCKER_PASSWORD }} 41 | 42 | - name: Build and push Docker image 43 | uses: docker/build-push-action@v4 44 | with: 45 | context: . 46 | platforms: linux/amd64,linux/arm64 47 | push: true 48 | tags: ajeje93/grafana-mongodb:${{ env.TAG }} 49 | build-args: | 50 | TAG=${{ env.TAG }} 51 | -------------------------------------------------------------------------------- /.github/workflows/github-packages.yml: -------------------------------------------------------------------------------- 1 | name: Publish Docker image to GitHub Packages 2 | on: 3 | push: 4 | schedule: 5 | - cron: "0 2 1 * *" 6 | 7 | env: 8 | REGISTRY: ghcr.io 9 | IMAGE_NAME: ${{ github.repository }} 10 | 11 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 12 | jobs: 13 | build-and-publish-latest: 14 | runs-on: ubuntu-latest 15 | permissions: 16 | contents: read 17 | packages: write 18 | 19 | steps: 20 | - name: Checkout repository 21 | uses: actions/checkout@v3 22 | 23 | - name: Set additional environment 24 | run: echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV 25 | 26 | - name: Is latest? 27 | if: env.TAG == 'master' 28 | run: echo "TAG=latest" >> $GITHUB_ENV 29 | 30 | - name: Set up QEMU 31 | uses: docker/setup-qemu-action@v2 32 | 33 | - name: Set up Docker Buildx 34 | id: buildx 35 | uses: docker/setup-buildx-action@v2 36 | 37 | - name: Log in to the Container registry 38 | uses: docker/login-action@v2 39 | with: 40 | registry: ${{ env.REGISTRY }} 41 | username: ${{ github.actor }} 42 | password: ${{ secrets.GITHUB_TOKEN }} 43 | 44 | - name: Build and push Docker image 45 | uses: docker/build-push-action@v4 46 | with: 47 | context: . 48 | platforms: linux/amd64,linux/arm64 49 | push: true 50 | tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} 51 | build-args: | 52 | TAG=${{ env.TAG }} 53 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | data 2 | docker-compose.override.yml -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts-alpine AS node 2 | 3 | FROM grafana/grafana-oss:11.6.0 4 | 5 | USER root 6 | 7 | COPY --from=node /usr/lib /usr/lib 8 | COPY --from=node /usr/local/share /usr/local/share 9 | COPY --from=node /usr/local/lib /usr/local/lib 10 | COPY --from=node /usr/local/include /usr/local/include 11 | COPY --from=node /usr/local/bin /usr/local/bin 12 | 13 | ADD ./custom-run.sh /custom-run.sh 14 | 15 | RUN apk update \ 16 | && apk upgrade \ 17 | && apk add --no-cache git \ 18 | && git clone https://github.com/SiemaApplications-attic/mongodb-grafana $GF_PATHS_PLUGINS/mongodb-grafana \ 19 | && rm -rf $GF_PATHS_PLUGINS/mongodb-grafana/.git \ 20 | && npm install --silent --prefix $GF_PATHS_PLUGINS/mongodb-grafana \ 21 | && npm cache clean --force --prefix $GF_PATHS_PLUGINS/mongodb-grafana \ 22 | && npm install pm2 -g \ 23 | && apk del --no-cache git \ 24 | && chmod +x /custom-run.sh \ 25 | && sed -i 's/;allow_loading_unsigned_plugins =.*/allow_loading_unsigned_plugins = grafana-mongodb-opensource-datasource/g' $GF_PATHS_CONFIG \ 26 | && sed -i 's/;angular_support_enabled =.*/angular_support_enabled = true/g' $GF_PATHS_CONFIG 27 | 28 | ENTRYPOINT ["/custom-run.sh"] 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 ajeje93 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Grafana MongoDB datasource Docker container 2 | 3 | [![Docker Hub](https://img.shields.io/docker/v/ajeje93/grafana-mongodb?label=Docker%20Hub&sort=date)](https://hub.docker.com/r/ajeje93/grafana-mongodb) 4 | 5 | [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fajeje93%2Fgrafana-mongodb-docker%2Fbadge%3Fref%3Dmaster&style=flat)](https://actions-badge.atrox.dev/ajeje93/grafana-mongodb-docker/goto?ref=master) 6 | 7 | ## Notes 8 | 9 | **The Grafana version has been fixed to 11.6.0 as [Grafana 12 does not support AngularJS plugins anymore](https://grafana.com/blog/2025/04/03/angularjs-support-will-be-removed-in-grafana-12-what-you-need-to-know/), if you need the latest version of consider using the [official plugin](https://grafana.com/grafana/plugins/grafana-mongodb-datasource/).** 10 | 11 | ## Credits 12 | 13 | Thank to JamesOsgood for creating the plugin . 14 | 15 | Thank to SiemaApplications for upgrading and maintaining the plugin . Refer to their repository for the plugin usage. 16 | 17 | ## Usage 18 | 19 | Just run `docker-compose up -d` to start the container. 20 | -------------------------------------------------------------------------------- /custom-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Starts proxy server with pm2 4 | pm2 start "npm run server --prefix $GF_PATHS_PLUGINS/mongodb-grafana" --name mongo-proxy 5 | 6 | # Starts your application 7 | /run.sh & 8 | P1=$! 9 | wait $P1 10 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | prod: 4 | build: 5 | context: . 6 | dockerfile: Dockerfile 7 | restart: always 8 | volumes: 9 | - ./data:/var/lib/grafana 10 | - /var/lib/grafana/plugins 11 | ports: 12 | - 3000:3000 --------------------------------------------------------------------------------