pyrmon / nightscout-docker

Comprehensive Docker Setup for Nightscout CGM Monitor on Raspberry Pi 4
6 stars 24 forks source link

MongoDB connection failed! Double check the MONGODB_URI setting in Heroku. #1

Open WOLFERSER opened 1 month ago

WOLFERSER commented 1 month ago

MongoDB connection failed! Double check the MONGODB_URI setting in Heroku.

pyrmon commented 1 month ago

Hi! Did you deploy the application on your own server? If so could you show me what you put in your compose.yml (or docker-compose.yml)? This error message usually comes if there is an issue with how you setup the connection between nightscout and mongodb.

WOLFERSER commented 1 month ago
version: '3'
services:
  cgm-remote-monitor:
    image: "pyrmon/nightscout:latest"
    container_name: "nightscout"
    environment:
      ## settings according to
      ## https://github.com/nightscout/cgm-remote-monitor/blob/master/README.md#environment

      # MongoDB connection within the stack
      - MONGO_CONNECTION=mongodb://mongo:27017/Nightscout
      # admin secret
      - API_SECRET=556677556677
      # the URL to this Nightscout instance
      - BASE_URL=https://wolferser.fun
      # using a reverse proxy with SSL offloading
      - INSECURE_USE_HTTP=true
      # deny access by default
      - AUTH_DEFAULT_ROLES=denied

      # device info fields to show
      - PUMP_FIELDS=reservoir battery status
      # required for other plugins (i.e. upbat)
      - DEVICESTATUS_ADVANCED=true
      # enable plugins
      - ENABLE=careportal delta direction upbat timeago pump bwg rawbg devicestatus openaps
      # tune BG target and alarm ranges (since nightscout 13.0.0 in *display* units)
      - BG_HIGH=190
      - BG_TARGET_TOP=120
      - BG_TARGET_BOTTOM=80
      - BG_LOW=60

      # website title by default
      - CUSTOM_TITLE=Nightscout TL
      # use SI units by default
      - DISPLAY_UNITS=mmol
      # use 24h time format by default
      - TIME_FORMAT=24
      # switch to "colors" theme by default
      - THEME=colors
      # switch to German by default
      - LANGUAGE=en
      # show basal rate by default
      - BASAL_RENDER=default
      # show plugins by default
      - SHOW_PLUGINS=pump openaps
      # do not allow treatment editing
      - EDIT_MODE=off
      # disable any alarms by default (if using Nightscout as time series visualization)
      - ALARM_URGENT_HIGH=off
      - ALARM_HIGH=off
      - ALARM_URGENT_LOW=off
      - ALARM_LOW=off
      - ALARM_TIMEAGO_WARN=off
      - ALARM_TIMEAGO_URGENT=off
    ports:
      - 1337:1337
    depends_on:
      - mongo 

  mongo:
    image: mongo:latest
    container_name: nightscout_mongo
    volumes:
      - ./mongodb:/data/db
      - ./mongodump:/dump
    ports:
      - 27017:27017
WOLFERSER commented 1 month ago

I have never worked with mongodb and have no idea where to insert it

pyrmon commented 1 month ago

I see two things that might be the issue:

WOLFERSER commented 1 month ago

image

It doesn't work anyway.

I am using ubuntu 20.04 VDS

pyrmon commented 1 month ago

Hmm that's weird. Maybe the ip range of the docker containers is not aligned. Not to worry as we are publishing the mongo db port to the local port 27017 of the machine maybe it works for you to make this line: "- MONGO_CONNECTION=mongodb://localhost:27017/Nightscout". You can also for testing try to make the port 27017 publicly available and use the software MongoDB Compass to try to connect to your server on port 27017. But make sure to disable the access again afterwards as the mongo Db is not secured.