Skip to content

steve8x8/deploy-ns-local-raspi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brief:

Use this script to setup a complete local running Nightscout instance. This script can either install:

  • a local MongoDB instance or
  • work without MongoDB and use static OpenAPS report files (recommended for tiny rigs)

Tested with:

  • Raspberry Pi Zero (rpi0): Working with Raspian Jessie Lite (Release date: 2016-09-23)
  • Raspberry Pi 1 Model B (rpi1): Working with Raspian Jessie Lite with PIXEL (Release date: 2016-09-23)
  • Raspberry Pi 3 (rpi3): Everything works nicely with or without PIXEL (Release date: 2016-09-23 and 2016-11-25)

Prerequisites

  1. Install Raspberry Pi SD kart with Rasbian. Download Raspbian at https://www.raspberrypi.org/downloads/raspbian/ You can you choose to use:

    • Rasbian Jessie with PIXEL: This has a graphical user interface, called PIXEL desktop
    • Raspbian Jessie Lite: A minimal image based on Debian Jessie. No desktop included.
  2. Make sure your Raspberry kernel is up to date $ sudo apt-get install rpi-update && sudo rpi-update and reboot.

  3. Configure your Rasberry Pi $ sudo raspi-config

1. Expand Filesystem   ==> Make use of the whole SD-CARD
2. Change User Password     	
3. Bootoptions ==> Choose what you want
4. Wait for Network at Boot ==> Set to No
5.  Internationalisation Options => Change Locale, Timezone, Keyboard Layout, Wi-Fi country to your needs
7. Advanced Options
A2. Hostname ==> Set your hostname. This will be used for the URL of your Nightscout 
A4. SSH ==> Enable SSH for remote access
  1. Tweak your Raspberry Pi. See for example: https://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/rpi.html for information on setting up your Raspberry Pi:
  • Configure WiFi Settings
  • Wifi reliability tweaks [optional]
  • Watchdog [optional]
  • Disable HDMI to conserve power [optional]
  • Configure Bluetooth Low Energy tethering [optional]

Usage:

  1. open console on your raspi eg ssh pi@192.168.10.4 default-password raspberry and run ns-local-install script for an interactive install:

    curl -s https://raw.githubusercontent.com/SandraK82/deploy-ns-local-raspi/master/ns-local-install.sh | bash -
    

    relax and drink some ☕ - script runtime over 1.5 hour on clean and fresh raspi 1 or 2, and about 30 minutes on a raspi 3.

    You can also use a non-interactive install:

    mkdir src 
    cd src
    git clone https://github.com/SandraK82/deploy-ns-local-raspi.git
    cd deploy-ns-local-raspi
    

    You can then use

    bash ns-local-install.sh [--mongo=[yes|no]] [--units=[mmol|mg]] [--storage=[openaps|mongodb]] [--oref0=[yes|no]] [--units=[mmol|mg]]
    

    For example:

    bash ns-local-install.sh --mongo=yes --units=mmol --storage=mongo --oref0=yes
    
  2. after running the script you will have a running nightscout local installation. Now open editor with your config for nightscout. nano /home/pi/cgm-remote-monitor/start-nightscout.sh You need to configure at least the lines at the top of the file: CUSTOM_TITLE=mysitename_without_spaces `API_SECRET=my_12_characters_or_more_password``

    Put your personal password (at least 12 characters long) and the name of your site (just for display) there!

  3. once finished, restart nightscout with: sudo /etc/init.d/nightscout stop && sudo /etc/init.d/nightscout start

  4. navigate to http://192.168.10.4:1337/ complete nightscout profile settings

  5. Have fun 😃

Troubleshooting:

  • nodejs manual start: pi@raspberrypi:~/cgm-remote-monitor $ start-nightscout.sh (must be in cgm-remote-monitor directory)
  • nodejs / nightscout log: check cat /var/log/openaps/nightscout.log
  • mongodb check cat /var/log/mongodb/mongodb.log should contain: [initandlisten] waiting for connections on port 27017

Changelog:

2016-11-13:

2016-10-14:

  • change to nightscout 0.9.0 stable ()Grilled Cheese)
  • add start_nightscout.sh instead of my.env

2016-09: I forked the current dev-branch of nightscout/cgm-remote-monitor and changed the mongodb compatibility problems. Now it runs smoothly with mongodb 2.x on a raspi! Maybe the pull request gets accepted soon. As soon as I´m notified, I will change the script again to use the current dev-branch again. The patches for mongo2.x compatibility are now merged back into the official dev branch.

With help from:

Whishlist/To Do:

  • seperate username/password for Mongo
  • Nginx to use for https / letsencrypt certificate
  • Script to create wifi hotspot on the raspberry pi
  • Always install latest Node (now 6.8.0 instead of 6.7.0 what is being installed)
  • ...

About

Deploy a complete nightscout site with mongodb on local RaspberryPi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%