Code Monkey home page Code Monkey logo

deploy-ns-local-raspi-1's Introduction

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]
  1. Install git & insserv.
    sudo apt-get install git
    sudo apt-get install insserv
    

Usage:

  1. open console on your raspi eg ssh [email protected] default-password raspberry and run ns-local-install script for an interactive install:

    curl -s https://raw.githubusercontent.com/tillhen/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/tillhen/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 --units=mmol
    
  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)
  • ...

deploy-ns-local-raspi-1's People

Contributors

jcorbett80 avatar tillhen avatar pietergit avatar desserthunter avatar sandrak82 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.