mirror of
https://github.com/funkypenguin/geek-cookbook/
synced 2025-12-12 17:26:19 +00:00
Add NightScout, CGM "in the cloud"!
* [recipe] nightscout Fixes #179 * Tweakes * Tweak cookie consent * Updates * Formatting fixes * Update mkdocs.yml
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
[linx]: /recipes/linx/
|
||||
[mealie]: /recipes/mealie/
|
||||
[mylar]: /recipes/autopirate/mylar/
|
||||
[nightscout]: /recipes/nightscout/
|
||||
[nzbget]: /recipes/autopirate/nzbget/
|
||||
[nzbhydra]: /recipes/autopirate/nzbhydra/
|
||||
[ombi]: /recipes/autopirate/ombi/
|
||||
|
||||
@@ -8,13 +8,12 @@ hide:
|
||||
|
||||
Recipe | Description | Date
|
||||
-------------------------|------------------------------------------------------------------------------------------------------------------|--------------
|
||||
[NightScout][nightscout] | Share your CGM :drop_of_blood: data, setup advanced alarms and charts, for improved diabetes treatment :syringe: and quality-of-life :runner: | _9 Aug 2021_
|
||||
[Mealie][mealie] | Delicious, API-driven recipe manager, able to scrape-and-import recipes from a URL :cook: | _4 Feb 2021_
|
||||
[Funkwhale][funkwhale] | Enjoy, share, and federate your music in your own funky "pod". Think "Mastodon for Music" :whale: :musical_note: | _28 Jan 2021_
|
||||
[CyberChef][cyberchef] | A web-based collection of useful tools for INFOSEC work, by the [GCHQ](https://en.wikipedia.org/wiki/GCHQ) | _19 Jan 2021_
|
||||
[Linx][linx] | Quickly and securely share media/files with optional password-protection and expiry | _13 Jan 2021_
|
||||
[Komga][komga] | Beautiful interface to manage and enjoy your comics / graphic novels | _5 Jan 2021_
|
||||
[Photoprism][photoprism] | Self-hosted photo-management app incorporating automated tagging using Tensorflow | _6 Aug 2020_
|
||||
|
||||
|
||||
## Recent updates
|
||||
|
||||
|
||||
BIN
manuscript/images/nightscout.png
Normal file
BIN
manuscript/images/nightscout.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
BIN
manuscript/images/nightscout_screenshot_600.png
Normal file
BIN
manuscript/images/nightscout_screenshot_600.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
166
manuscript/recipes/nightscout.md
Normal file
166
manuscript/recipes/nightscout.md
Normal file
@@ -0,0 +1,166 @@
|
||||
# Nightscout
|
||||
|
||||
Nightscout is "*...an open source, DIY project that allows real time access to a CGM data via personal website, smartwatch viewers, or apps and widgets available for smartphones*"
|
||||
|
||||
!!! question "Yeah, but what's a CGM?"
|
||||
A CGM is a "continuos glucose monitor" :drop_of_blood: - If you have a blood-sugar-related disease (*i.e. diabetes*), you might wear a CGM in order to retrieve blood-glucose level readings, to inform your treatment.
|
||||
|
||||
NightScout frees you from the CGM's supplier's limited and proprietary app, and unlocks advanced charting, alarming, and sharing features :muscle:
|
||||
|
||||
|
||||

|
||||
|
||||
[Nightscout](https://nightscout.github.io/) is _the_ standard for open-source CGM data collection, used by diabetics and those who love them, to store, share, and retrieve blood-glocuse data, in order to live healthier and happier lives. It's used as the data sharing/syncing backend for all the popular smartphone apps, including [xDrip+](https://github.com/NightscoutFoundation/xDrip) (*Android*) and [Spike App](https://spike-app.com/) (*iOS*).
|
||||
|
||||
Most NightScout users will deploy to Heroko, using MongoDB Atlas, which is a [well-documented solution](https://nightscout.github.io/nightscout/new_user/). If you wanted to run NightScout on your own Docker stack though, then this recipe is for you!
|
||||
|
||||
--8<-- "recipe-standard-ingredients.md"
|
||||
|
||||
## Preparation
|
||||
|
||||
### Setup data locations
|
||||
|
||||
First we create a directory to hold Nightscout's database, as well as database backups:
|
||||
```
|
||||
mkdir -p /var/data/runtime/nightscout/database # excluded from automated backups
|
||||
mkdir -p /var/data/nightscout/database # included in automated backups
|
||||
```
|
||||
|
||||
### Create env file
|
||||
|
||||
NightScout is configured entirely using environment variables, so create something like this as `/var/data/config/nightscout/nightscout.env`:
|
||||
|
||||
!!! warning
|
||||
Your variables may vary significantly from what's illustrated below, and it's best to read up and understand exactly what each option does.
|
||||
|
||||
```yaml
|
||||
# Customize these per https://github.com/nightscout/cgm-remote-monitor/blob/master/README.md#environment
|
||||
|
||||
# Required
|
||||
MONGODB_URI=mongodb://db
|
||||
API_SECRET=myverysecritsecrit
|
||||
DISPLAY_UNITS=mmol # set to "mg/dl" if you're using US-style measurements
|
||||
BASE_URL=https://nightscout.example.com
|
||||
|
||||
# We rely on traefik to handle SSL, so don't bother using in in nightscout
|
||||
INSECURE_USE_HTTP=true
|
||||
|
||||
# Listen on all interfaces
|
||||
HOSTNAME=::
|
||||
|
||||
# # Features
|
||||
ENABLE=careportal basal dbsize rawbg iob maker bridge cob bwp cage iage sage boluscalc pushover treatmentnotify mmconnect loop pump profile food openaps bage alexa override cors
|
||||
# DISABLE=
|
||||
AUTH_DEFAULT_ROLES=denied
|
||||
THEME=colors
|
||||
|
||||
# IMPORT_CONFIG=
|
||||
# TREATMENTS_AUTH=
|
||||
|
||||
# # Alarms
|
||||
# ALARM_TYPES=
|
||||
# BG_HIGH
|
||||
# BG_TARGET_TOP
|
||||
# BG_TARGET_BOTTOM
|
||||
# BG_LOW
|
||||
# ALARM_URGENT_HIGH
|
||||
# ALARM_URGENT_HIGH_MINS
|
||||
# ALARM_HIGH
|
||||
# ALARM_HIGH_MINS
|
||||
# ALARM_LOW
|
||||
# ALARM_LOW_MINS
|
||||
# ALARM_URGENT_LOW
|
||||
# ALARM_URGENT_LOW_MINS
|
||||
# ALARM_URGENT_MINS
|
||||
# ALARM_WARN_MINS
|
||||
|
||||
# # Core
|
||||
# MONGO_TREATMENTS_COLLECTION=treatments
|
||||
|
||||
# Mongodb specific database dump details
|
||||
BACKUP_NUM_KEEP=7
|
||||
BACKUP_FREQUENCY=1d
|
||||
|
||||
```
|
||||
|
||||
### Setup Docker Swarm
|
||||
|
||||
Create a docker swarm config file in docker-compose syntax (v3), something like this:
|
||||
|
||||
--8<-- "premix-cta.md"
|
||||
|
||||
!!! tip
|
||||
I'm keen to share any and all resources I have with diabetics or loved-ones of diabetics (*of which I am one*). [Contact me](https://www.funkypenguin.co.nz/contact/) directly for details!
|
||||
|
||||
```yaml
|
||||
version: '3.2'
|
||||
|
||||
services:
|
||||
|
||||
app:
|
||||
image: nightscout/cgm-remote-monitor
|
||||
networks:
|
||||
- internal
|
||||
- traefik_public
|
||||
env_file: /var/data/config/nightscout/nightscout.env
|
||||
deploy:
|
||||
labels:
|
||||
# traefik
|
||||
- traefik.enable=true
|
||||
- traefik.docker.network=traefik_public
|
||||
|
||||
# traefikv1
|
||||
- traefik.frontend.rule=Host:nightscout.example.com
|
||||
- traefik.port=1337
|
||||
|
||||
# traefikv2
|
||||
- "traefik.http.routers.nightscout.rule=Host(`nightscout.example.com`)"
|
||||
- "traefik.http.routers.nightscout.entrypoints=https"
|
||||
- "traefik.http.services.nightscout.loadbalancer.server.port=1337"
|
||||
|
||||
db:
|
||||
image: mongo:latest
|
||||
networks:
|
||||
- internal
|
||||
volumes:
|
||||
- /var/data/runtime/nightscout/database:/data/db
|
||||
|
||||
db-backup:
|
||||
image: mongo:latest
|
||||
env_file: /var/data/config/nightscout/nightscout.env
|
||||
volumes:
|
||||
- /var/data/nightscout/database-dump:/dump
|
||||
entrypoint: |
|
||||
bash -c 'bash -s <<EOF
|
||||
trap "break;exit" SIGHUP SIGINT SIGTERM
|
||||
sleep 2m
|
||||
while /bin/true; do
|
||||
mongodump -h db --gzip --archive=/dump/dump_\`date +%d-%m-%Y"_"%H_%M_%S\`.mongo.gz
|
||||
ls -tr /dump/dump_*.mongo.gz | head -n -"$$BACKUP_NUM_KEEP" | xargs -r rm
|
||||
sleep $$BACKUP_FREQUENCY
|
||||
done
|
||||
EOF'
|
||||
networks:
|
||||
- internal
|
||||
|
||||
networks:
|
||||
traefik_public:
|
||||
external: true
|
||||
internal:
|
||||
driver: overlay
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.16.4.0/24
|
||||
|
||||
```
|
||||
|
||||
## Serving
|
||||
|
||||
### Launch nightscout!
|
||||
|
||||
Launch the nightscout stack by running ```docker stack deploy nightscout -c <path -to-docker-compose.yml>```
|
||||
|
||||
|
||||
[^1]: Most of the time, you'll need an app which syncs to Nightscout, and these apps won't support OIDC auth, so this recipe doesn't take into account any sort of authentication using [Traefik Forward Auth](/ha-docker-swarm/traefik-forward-auth/). Instead, NightScout is secured entirely with your `API_SECRET` above (*although it is possible to add more users once you're an admin*)
|
||||
|
||||
--8<-- "recipe-footer.md"
|
||||
@@ -9,6 +9,7 @@ In order to avoid IP addressing conflicts as we bring swarm networks up/down, we
|
||||
| [Mail Server](https://geek-cookbook.funkypenguin.co.nz/recipes/mail/) | 172.16.1.0/24 |
|
||||
| [Gitlab](https://geek-cookbook.funkypenguin.co.nz/recipes/gitlab/) | 172.16.2.0/24 |
|
||||
| [Wekan](https://geek-cookbook.funkypenguin.co.nz/recipes/wekan/) | 172.16.3.0/24 |
|
||||
| [NightScout](https://geek-cookbook.funkypenguin.co.nz/recipes/nightscout/) | 172.16.4.0/24 |
|
||||
| [Tiny Tiny RSS](https://geek-cookbook.funkypenguin.co.nz/recipes/tiny-tiny-rss/) | 172.16.5.0/24 |
|
||||
| [Huginn](https://geek-cookbook.funkypenguin.co.nz/recipes/huginn/) | 172.16.6.0/24 |
|
||||
| [Kanboard](https://geek-cookbook.funkypenguin.co.nz/recipes/kanboard/) | 172.16.8.0/24 |
|
||||
|
||||
17
mkdocs.yml
17
mkdocs.yml
@@ -19,6 +19,7 @@ copyright: 'Copyright © 2016 - 2021 David Young, Funky Penguin Limited'
|
||||
|
||||
# Plugins
|
||||
plugins:
|
||||
- social
|
||||
- search
|
||||
- minify:
|
||||
minify_html: true
|
||||
@@ -113,6 +114,7 @@ nav:
|
||||
- Linx: recipes/linx.md
|
||||
- Mealie: recipes/mealie.md
|
||||
- Minio: recipes/minio.md
|
||||
- NightScout: recipes/nightscout.md
|
||||
- OpenLDAP: recipes/openldap.md
|
||||
- OwnTracks: recipes/owntracks.md
|
||||
- Photoprism: recipes/photoprism.md
|
||||
@@ -233,11 +235,18 @@ extra:
|
||||
- icon: 'material/mailbox'
|
||||
link: 'mailto:davidy@funkypenguin.co.nz?Subject=Hello%2C%20from%20a%20geek-cookbook%20reader%20%3B%29'
|
||||
generator: false
|
||||
consent:
|
||||
title: '🍪 Cookie consent'
|
||||
description: >
|
||||
|
||||
I know. cookies suck (except the choc-chip ones!), and so does invasive tracking. Thing is, without cookies,
|
||||
analytics can't record your visit, and I can't work out where/how to invest time to make the cookbook better.
|
||||
So, with your consent, I'd like to record what you look at and where you're from, so that I can make the
|
||||
cookbook even better! I promise I won't do anything nefarious! - David
|
||||
analytics:
|
||||
provider: google
|
||||
property: 'UA-139253-18'
|
||||
|
||||
# Google Analytics
|
||||
google_analytics:
|
||||
- 'UA-139253-18'
|
||||
- 'auto'
|
||||
|
||||
# extra_css:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user