raffis / mongodb-query-exporter

Prometheus MongoDB aggregation query exporter
MIT License
95 stars 27 forks source link

Deploying the basic image using docker desktop #275

Open cj19 opened 1 month ago

cj19 commented 1 month ago

Describe the bug

I am trying to run the image using docker desktop, but after I set the env variables I get this error:

panic: open C:\DevEnv\mongodb-query-exporter\config.yaml: no such file or directory

I am running the docker desktop on windows. Does not matter what i set into the config path, i get this type of error.

To Reproduce

Start the image on windows 10?

Expected behavior

The docker starts properly.

Environment

raffis commented 1 month ago

Please clarify how you start the container. Are you actually mounting the config?

cj19 commented 1 month ago

well, i adapted my compose file a bit:

version: '3.8'

services:
  mongodb-query-exporter:
    image: raffis/mongodb-query-exporter:latest
    container_name: mongodb-query-exporter
    environment:
      - MY_USERNAME=mongodb_query_exporter
      - MY_PASSWORD=xxxx
      - MDBEXPORTER_MONGODB_URI=mongodb://${MY_USERNAME}:${MY_PASSWORD}@localhost:27017
      - MDBEXPORTER_CONFIG=/config/config.yml
      - PATH=/usr/local/bin:/config/bin
      - SSL_CERT_FILE=/config/ssl/cert.crt
    volumes:
      - C:\DevEnv\mongodb-query-exporter\config.yml:/config/config.yaml
      - C:\DevEnv\mongodb-query-exporter\bin:/config/bin
      - C:\DevEnv\mongodb-query-exporter\ssl:/config/ssl
    ports:
      - "9216:9216"

I am not sure about the MDBEXPORTER_CONFIG, PATH, SSL_CERT_FILE. Do I need to change the values or they can have the default config values? Also i am using the default config values from the readme file and the new error I receive at startup is:

time="2024-09-24T16:27:45+02:00" level=warning msg="C:\\DevEnv\\mongodb-query-exporter\\docker-compose.yml: `version` is obsolete"
[+] Running 1/1
 ✘ mongodb-query-exporter Error manifest for raffis/mongodb-query-exporter:latest not found: manifest unknown: manifest unknown                                                                                                                                                                                                                                       1.6s
Error response from daemon: manifest for raffis/mongodb-query-exporter:latest not found: manifest unknown: manifest unknown
raffis commented 1 month ago

Your MDBEXPORTER_CONFIG points to /config/config.yml while you're mounting it to /config/config.yaml

cj19 commented 1 month ago

I changed every file extension to yml and i still get the same error.

raffis commented 1 month ago

I doubt this relates to the exporter, you are rather have an error somewhere. pls check if C:\DevEnv\mongodb-query-exporter\config.yml actually exists. Also mounting the bin directory makes no sense. Also pls post the exporter config.

If things still not work try start an ubuntu container with the same settings start a shell and execute cat /config/config.yaml to actually make sure everything else is fine.

cj19 commented 1 month ago

yeah, it is more like a discussion now, but I would like to understand what I am doing wrong.

Which is the easiest way to run the docker image on windows with the environments listed above?