Jump to content

[Support] Nightscout template


Recommended Posts

Posted (edited)

This is the support thread for the Nightscout docker template available via the Community Applications plugin.

 

The template pulls the official docker image build by the Nightscout team from their Docker hub. Nightscout is the front end to a remote blood glucouse monitoring system which can be used by diabetics or relatives of diabetics to monitor, log and evaluate their blood glucouse values. You can learn more over here: http://www.nightscout.info/

 

Setting the container up:

  1. Install dependencies: The Nightscout container relies on a MongoDB instance for its database. You can install MongoDB from the CA plugin.
  2. Set up database: Please refer to the official MongoDB documentation on how to set up a database and user. The user neads ReadWrite access to the database. Your db needs the following collections: activity, auth_subjects, devicestatus, entries, food, profile, settings, treatments.
    • You can also import an existing MongoDB database from another deployment by using mongodump and mongorestore. To get the dump of the remote database, enter the console of your local MongoDB container. Use this to get a local dump of the database (you can get the URI from Nightscout's configuration variable):
      mongodump --uri="<yourmongodb-uri>" -o <output-dir>

      Then use this to import the data from the dump:

      mongorestore --db <new_database_name> <path_to_dump>

      You still need to create a user that has RW permission on the new database.

  3. Install Nightscout: Download and install the template. Fill in the MongoDB URI according to the given pattern and link it to the IP address and port of the MongoDB container. Note that Nightscouts behaviour is entirely controlled by variables that can be passed through by Docker. As there are many options, only the most relevant are predefined and exposed in the template. Use the "Add another Path, Port, Variable, Label or Device" feature to add additiononal variables. Please refer to this for an extensive list of variables and possible values.
  4. Optional: Pass through reverse proxy: If you use a reverse proxy setup (e.g. swag), you can use Nightscout with it. There is no preconfiguered Nightscout sample in swag, but I had good success adapting the Nextcloud sample code simply by changing the names in the file. You also need to set the INSECURE_USE_HTTP variable in the Nightscout container to true. This is fine as it affects only traffic on the Docker network inside your server. Edit: While this is still a valid approach, the better one would be to set the X-Forwarded-Proto header inside your nightscout proxy-conf, so Nightscout knows it runs on https behind a secure proxy:
    location / {
        ...
        proxy_set_header X-Forwarded-Proto $scheme;
    }
     
    • Note that Nightscout itself has no real authentification scheme for the main page by default, although it can be made to ask for the API secret before showing the page. This might brake some features though, so exposing it on the internet might be unwanted (although it might be necessary for e.g. proper remote monitoring).

 

For further documentation of Nightscout refer to this: https://github.com/nightscout/cgm-remote-monitor

 

Have fun and feel free to post suggestions or reach out for help in this thread,

opal_06

 

 

Edited by Opal_06
  • Thanks 1
  • 2 weeks later...
Posted

A couple of questions though...

 

What would be the preferred Host or Bridge?

URL, what should it be set to?  I have the IP address of my unRaid server.  Should it include the port or not?  I have it showing correctly when I open it via a web browser, but am having troubles with the uploader finding it.

 

Thanks again and sorry for the qustions!

Posted (edited)
4 hours ago, StevieMac said:

A couple of questions though...

 

What would be the preferred Host or Bridge?

URL, what should it be set to?  I have the IP address of my unRaid server.  Should it include the port or not?  I have it showing correctly when I open it via a web browser, but am having troubles with the uploader finding it.

 

Thanks again and sorry for the qustions!

Generally speeking, bridge is preferable. If you want to use reverse proxy, bridge or a custom docker network is necessary (at least to my understanding).

 

As for URL, the documentation says the following: "Used for building links to your site's API, i.e. Pushover callbacks, usually the URL of your Nightscout site." So it seems you need a globally routable URL. The easiest way to achieve this should be through a reverse proxy like Let's encrypt (which comes with the added bonus of proper SSL certification). Or you can use a custom docker network configured to expose the Nightscout container as its own device on your local network and therefore giving you the possibilty to create a dynamic DNS record and port forwarding to that specific container. Reverse proxy is strongly advised though. 

As for the URL format itself, the port is omitted, e.g.: https://nightscout.your-dromain.com

 

No need to apologise for the questions, that's what this thread is for. ;)

Edited by Opal_06
  • 1 year later...
  • 9 months later...
Posted
On 7/15/2020 at 2:12 AM, Opal_06 said:

Setting the container up:

  1. Install dependencies: The Nightscout container relies on a MongoDB instance for its database. You can install MongoDB from the CA plugin.
  2. Set up database: Please refer to the official MongoDB documentation on how to set up a database and user. The user neads ReadWrite access to the database. Your db needs the following collections: activity, auth_subjects, devicestatus, entries, food, profile, settings, treatments.
    • You can also import an existing MongoDB database from another deployment by using mongodump and mongorestore. To get the dump of the remote database, enter the console of your local MongoDB container. Use this to get a local dump of the database (you can get the URI from Nightscout's configuration variable):
      mongodump --uri="<yourmongodb-uri>" -o <output-dir>

      Then use this to import the data from the dump:

      mongorestore --db <new_database_name> <path_to_dump>

      You still need to create a user that has RW permission on the new database.

  3. Install Nightscout: Download and install the template. Fill in the MongoDB URI according to the given pattern and link it to the IP address and port of the MongoDB container. Note that Nightscouts behaviour is entirely controlled by variables that can be passed through by Docker. As there are many options, only the most relevant are predefined and exposed in the template. Use the "Add another Path, Port, Variable, Label or Device" feature to add additiononal variables. Please refer to this for an extensive list of variables and possible values.
  4. Optional: Pass through reverse proxy: If you use a reverse proxy setup (e.g. Letsencrypt), you can use Nightscout with it. There is no preconfiguered Nightscout sample in Letsencrypt, but I had good success adapting the Nextcloud sample code simply by changing the names in the file. You also need to set the INSECURE_USE_HTTP variable in the Nightscout container to true. This is fine as it affects only trafic on the Docker network inside your server.
    • Note that Nightscout itself has no real authentification scheme for the main page by default, although it can be made to ask for the API secret before showing the page. This might brake some features though, so exposing it on the internet might be unwanted (although it might be necessary for e.g. proper remote monitoring).

 

 

 

 

G'day - just wanted to see if you would be able to help me get setup. Recently/today, Heroku announced they are shuttering their free tier, so ALOT of users will probably be looking for free and/or self-hosted alternatives in the near future. Being an unraid user, this seemed like the best option for me (and maybe others).
I have had a crack at setting things up myself, but am not having any luck connecting the mongoDB to nightscout. I am 100% sure it's (my) user error of course, but after pouring over the info/setup up pages for both dockers, I am still no closer to getting it functioning.

I was hoping - re: the potential influx - that you might consider roughing out a (fool proof) setup guide to getting up-and-running for all us less savvy users. Nothing too major (i.e. leave out things like transferring DBs, reverse proxies, etc.), just getting a working local nightscout. From there people can looking into importing data, reverse proxies etc. if they want. Thanks very much in advance for any time/effort, much appreciated.

  • 4 weeks later...
Posted

Hi

I know this is an old topic, but I hope someone can help.

I managed to install the containers and NS is up and running.

I have a large (32 TB) storage capacity, however NS is showing only a capacity of 496MiB. Is there a way to make the container read the whole storage capacity of the unraid server or is it just an error in reporting?

Thanks

 

2022-09-17.png

  • 2 months later...
Posted (edited)
On 9/17/2022 at 7:29 AM, zavanilli said:

Hi

I know this is an old topic, but I hope someone can help.

I managed to install the containers and NS is up and running.

I have a large (32 TB) storage capacity, however NS is showing only a capacity of 496MiB. Is there a way to make the container read the whole storage capacity of the unraid server or is it just an error in reporting?

Thanks

 

2022-09-17.png

 

I am pretty sure that is showing the database space left. Not the space on your array.

What mongo database are you pointing to? Something free in Atlas mongo? Or, did you install mongo locally and pointing to that?

The free tier in Atlas (cloud.mongodb.com) has a cap of 512mb of storage. I've been running nightscout for years and my data in Atlas is only 232mb. I think NightScout has a setting to shirk the database and/or set how long data is kept. Look in the admin tools for Nightscout, it should be there I think.

Edited by cobalt027
  • 1 month later...
Posted (edited)

I am very sorry for not having caught these new posts earlier, I didn't get any alerts unfortunately.

 

On 9/17/2022 at 1:29 PM, zavanilli said:

Hi

I know this is an old topic, but I hope someone can help.

I managed to install the containers and NS is up and running.

I have a large (32 TB) storage capacity, however NS is showing only a capacity of 496MiB. Is there a way to make the container read the whole storage capacity of the unraid server or is it just an error in reporting?

Thanks

 

2022-09-17.png

So, the size is simply a number set by Nightscout by default. This is, as @cobalt027 said, because the free MongoDB databases that are/were commonly used with Nightscout limited database size to 512MB. Now if you host your own MongoDB instance on Unraid (or any other server where these limits don't apply) it really doesn't matter, nor will it prevent the database from growing beyond the limit, as far as I understand (as long as there is storage space left). Anyway, you can change the size by adding the following variable in the template:

Key: DBSIZE_MAX

Value: <size in MB>

 

Additionally, you can change the view to just show you database size instead of percentage, which is maybe more interesting:

Key: DBSIZE_IN_MB

Value: true

 

------------------------------------

Edit: I also updated the template to use the more up-to-date images as suggested by @robschwieb

Edited by Opal_06

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...