Skip to content

Commit

Permalink
Merge pull request #5 from nightscout/master
Browse files Browse the repository at this point in the history
pr
  • Loading branch information
miiko-github authored Nov 28, 2017
2 parents 9a92420 + 9f7de63 commit 9ef5b6d
Show file tree
Hide file tree
Showing 149 changed files with 17,076 additions and 1,330 deletions.
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Don't include the .git history in the Docker image:
.git

# Items from .gitignore
bower_components/
node_modules/
bundle/bundle.out.js
.idea/
*.iml
my.env
*.env
static/bower_components/
.*.sw?
.DS_Store
.vagrant
/iisnode
coverage/
npm-debug.log
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ static/bower_components/
coverage/

npm-debug.log
*.heapsnapshot

/tmp
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.1.4
25 changes: 8 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
language: node_js
sudo: false
sudo: required
node_js:
- 0.10
- 0.12
- 4
- 5
- "8.5.0"
matrix:
fast_finish: true
allow_failures:
- node_js: 4
- node_js: 5
services: mongodb
services:
- mongodb
- docker
script: make travis
after_success:
- nvm version
- if [[ ! -z "$DOCKER_USER" ]]; then docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} && git checkout -- . && git clean -fd . && make docker_release; fi
after_script: make report
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
6 changes: 5 additions & 1 deletion COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
Copyright (C) 2015 The Nightscout Foundation, http://www.nightscoutfoundation.org

We track contributions on a per-patch basis using git.
Please see our published git log:
* https://github.com/nightscout/cgm-remote-monitor/commits/master

18 changes: 18 additions & 0 deletions Dockerfile.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:8.5.0

MAINTAINER Nightscout Contributors

RUN apt-get update && \
apt-get -y dist-upgrade

RUN mkdir -p /opt/app
ADD . /opt/app
WORKDIR /opt/app

RUN npm install && \
npm run postinstall && \
npm run env

EXPOSE 1337

CMD ["node", "server.js"]
37 changes: 33 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ ISTANBUL=./node_modules/.bin/istanbul
ANALYZED=./coverage/lcov.info
export CODACY_REPO_TOKEN=e29ae5cf671f4f918912d9864316207c

DOCKER_IMAGE=nightscout/cgm-remote-monitor-travis

all: test

coverage:
NODE_ENV=test ${MONGO_SETTINGS} \
${ISTANBUL} cover ${MOCHA} -- -R tap ${TESTS}
${ISTANBUL} cover ${MOCHA} -- --timeout 30000 -R tap ${TESTS}

report:
test -f ${ANALYZED} && \
Expand All @@ -39,10 +41,37 @@ report:
YOURPACKAGE_COVERAGE=1 ./node_modules/codacy-coverage/bin/codacy-coverage.js) || echo "NO COVERAGE"

test:
${MONGO_SETTINGS} ${MOCHA} -R tap ${TESTS}
${MONGO_SETTINGS} ${MOCHA} --timeout 30000 -R tap ${TESTS}

travis:
NODE_ENV=test ${MONGO_SETTINGS} \
${ISTANBUL} cover ${MOCHA} --report lcovonly -- -R tap ${TESTS}
${ISTANBUL} cover ${MOCHA} --report lcovonly -- --timeout 50000 -R tap ${TESTS}

docker_release:
# Get the version from the package.json file
$(eval DOCKER_TAG=$(shell cat package.json | jq '.version' | tr -d '"'))
$(eval NODE_VERSION=$(shell cat .nvmrc))
#
# Create a Dockerfile that contains the correct NodeJS version
cat Dockerfile.example | sed -e "s/^FROM node:.*/FROM node:${NODE_VERSION}/" > Dockerfile
#
# Rebuild the image. We do this with no-cache so that we have all security upgrades,
# since that's more important than fewer layers in the Docker image.
docker build --no-cache=true -t $(DOCKER_IMAGE):$(DOCKER_TAG) .
# Push an image to Docker Hub with the version from package.json:
docker push $(DOCKER_IMAGE):$(DOCKER_TAG)
#
# Push the master branch to Docker hub as 'latest'
if [ "$(TRAVIS_BRANCH)" = "master" ]; then \
docker tag $(DOCKER_IMAGE):$(DOCKER_TAG) $(DOCKER_IMAGE):latest && \
docker push $(DOCKER_IMAGE):latest; \
fi
#
# Push the dev branch to Docker Hub as 'latest_dev'
if [ "$(TRAVIS_BRANCH)" = "dev" ]; then \
docker tag $(DOCKER_IMAGE):$(DOCKER_TAG) $(DOCKER_IMAGE):latest_dev && \
docker push $(DOCKER_IMAGE):latest_dev; \
fi
rm -f Dockerfile

.PHONY: all coverage report test travis
.PHONY: all coverage docker_release report test travis
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ Clone this repo then install dependencies into the root of the project:
$ npm install
```

#Usage
If deploying the software to Microsoft Azure, you must set *WEBSITE_NODE_DEFAULT_VERSION* in the app settings to *8.5.0* or the site deployment will fail. Other hosting environments do not require this setting.

# Usage

The data being uploaded from the server to the client is from a
MongoDB server such as [mongolab][mongodb].
Expand Down Expand Up @@ -218,6 +220,7 @@ To learn more about the Nightscout API, visit https://YOUR-SITE.com/api-docs.htm
* `SSL_CERT` - Path to your ssl cert file, so that ssl(https) can be enabled directly in node.js
* `SSL_CA` - Path to your ssl ca file, so that ssl(https) can be enabled directly in node.js
* `HEARTBEAT` (`60`) - Number of seconds to wait in between database checks
* `DEBUG_MINIFY` (`true`) - Debug option, setting to `false` will disable bundle minification to help tracking down error and speed up development


### Predefined values for your browser settings (optional)
Expand Down Expand Up @@ -374,6 +377,7 @@ To learn more about the Nightscout API, visit https://YOUR-SITE.com/api-docs.htm
Generic Pump Monitoring for OpenAPS, MiniMed Connect, RileyLink, t:slim, with more on the way
* Requires `DEVICESTATUS_ADVANCED="true"` to be set
* `PUMP_ENABLE_ALERTS` (`false`) - Set to `true` to enable notifications for Pump battery and reservoir.
* `PUMP_WARNONSUSPEND` (`false`) - Set to `true` to get an alarm when the pump is suspended.
* `PUMP_FIELDS` (`reservoir battery`) - The fields to display by default. Any of the following fields: `reservoir`, `battery`, `clock`, `status`, and `device`
* `PUMP_RETRO_FIELDS` (`reservoir battery clock`) - The fields to display in retro mode. Any of the above fields.
* `PUMP_WARN_CLOCK` (`30`) - The number of minutes ago that needs to be exceed before an alert is triggered.
Expand Down Expand Up @@ -492,7 +496,7 @@ Easy to emulate on the commandline:

From now on you can run using
```bash
$ env $(cat my.env) PORT=1337 node server.js
$ (eval $(cat my.env | sed 's/^/export /') && PORT=1337 node server.js)
```

Your hosting provider probably has a way to set these through their GUI.
Expand Down Expand Up @@ -532,7 +536,9 @@ License
[agpl-3]: http://www.gnu.org/licenses/agpl-3.0.txt

cgm-remote-monitor - web app to broadcast cgm readings
Copyright (C) 2015 The Nightscout Foundation, http://www.nightscoutfoundation.org.
Copyright (C) 2017 Nightscout contributors. See the COPYRIGHT file
at the root directory of this distribution and at
https://github.com/nightscout/cgm-remote-monitor/blob/master/COPYRIGHT

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
Expand Down
Loading

0 comments on commit 9ef5b6d

Please sign in to comment.