Skip to content

Commit

Permalink
Merge pull request #7 from nightscout/dev
Browse files Browse the repository at this point in the history
Dev update
  • Loading branch information
unsoluble committed Jul 17, 2017
2 parents fa2a7be + 25b9bce commit 3391d8d
Show file tree
Hide file tree
Showing 37 changed files with 4,320 additions and 350 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -20,3 +20,4 @@ static/bower_components/
coverage/

npm-debug.log
*.heapsnapshot
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
8.1.4
23 changes: 2 additions & 21 deletions .travis.yml
@@ -1,33 +1,14 @@
language: node_js
sudo: required
node_js:
- 0.10
- 0.12
- 4
- 5
- 6
matrix:
fast_finish: true
allow_failures:
- node_js: 4
- node_js: 5
services:
- mongodb
- docker
script: make travis
after_success:
- nvm version
- if [[ ! -z "$DOCKER_USER" ]] && [[ "$(nvm version)" = "v0.12."* ]]; then docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} && git checkout -- . && git clean -fd . && make docker_release; fi
- 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:
global:
- CXX=g++-4.8
- secure: "QW33rAsCulSORXkSQK9fQotS5GuXwsr3P0KX+R0CE88N0rNE1gZuKZL5cIfYvHTdd4BiReMWja6Cox+QJJC/lu3UKZTPdArT5yUMvJ1AP8nbzzEYR1gKMy7DmcQ7OaZ8lD8LGG27P1+uRTiQ+94FmR31izg8jVXjD6ogEAayDMy5in3HoklnG+07RLdqo/8N5N7LoPcajHG051m/DRxvREdLg2L9K4yMqGKi1fpNFFti8L8jm5jAlylDlL9NGWdUj/4G1NeNIjkFrYZFodvd6R8oBDf8C6V6Tj0yvdyUQBLivTD9B8gKUWpyqE9fuy1Hz7UrZ9I9m7X6G5WPneVBRFRJpoRtg/VjiNrmbDUkBJXeXniGm2pi8dxcxV8lQ0m7D3S2UkJwNutEkGt9tp5y/RSEUo+7x8AnO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yua8epXRbHzEiEuq8xGV1fqXZ3Wvii/IA0qVV2RTaM="
- secure: "AKz1AcG+xxnAPlMf7twqho6TsCwjafSHFObiUVP7J47t74HLklbKzI3hH7mJpkpYLhRDYGbQSzgP1Is00Hy4EwJyChocKMnWIsY2+5mGg1fkV5I2L1sncLtxyLakFw2TBQFvju7f7FaYtpvv9L3mt9i5JZ4E7BmSO+YBDv53uTA="
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
10 changes: 2 additions & 8 deletions Dockerfile.example
@@ -1,15 +1,9 @@
FROM node:0.12
FROM node:8.1.4

MAINTAINER Nightscout Contributors

RUN apt-get update && \
apt-get -y dist-upgrade && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
git \
nodejs \
nodejs-legacy \
npm && \
apt-get -y clean
apt-get -y dist-upgrade

RUN mkdir -p /opt/app
ADD . /opt/app
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Expand Up @@ -50,10 +50,14 @@ travis:
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 -f Dockerfile.example -t $(DOCKER_IMAGE):$(DOCKER_TAG) .
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)
#
Expand All @@ -68,5 +72,6 @@ docker_release:
docker tag $(DOCKER_IMAGE):$(DOCKER_TAG) $(DOCKER_IMAGE):latest_dev && \
docker push $(DOCKER_IMAGE):latest_dev; \
fi
rm -f Dockerfile

.PHONY: all coverage docker_release report test travis
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -113,7 +113,7 @@ Clone this repo then install dependencies into the root of the project:
$ npm install
```

#Usage
# Usage

The data being uploaded from the server to the client is from a
MongoDB server such as [mongolab][mongodb].
Expand Down Expand Up @@ -493,7 +493,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
12 changes: 12 additions & 0 deletions app.js
Expand Up @@ -63,6 +63,18 @@ function create (env, ctx) {
res.sendFile(__dirname + '/swagger.yaml');
});

if (env.settings.isEnabled('dumps')) {
var heapdump = require('heapdump');
app.get('/api/v2/dumps/start', function (req, res) {
var path = new Date().toISOString() + '.heapsnapshot';
path = path.replace(/:/g, '-');
console.info('writing dump to', path);
heapdump.writeSnapshot(path);
res.send('wrote dump to ' + path);
});
}


//app.get('/package.json', software);

// define static server
Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "nightscout",
"version": "0.9.3-dev-20170318",
"version": "0.10.0-dev-20170716",
"dependencies": {
"colorbrewer": "~1.0.0",
"jQuery-Storage-API": "~1.7.2",
Expand Down
2 changes: 0 additions & 2 deletions lib/api/treatments/index.js
Expand Up @@ -37,7 +37,6 @@ function configure (app, wares, ctx) {
console.log('Error adding treatment', err);
res.sendJSONStatus(res, consts.HTTP_INTERNAL_ERROR, 'Mongo Error', err);
} else {
console.log('Treatment created');
res.json(created);
}
});
Expand Down Expand Up @@ -73,4 +72,3 @@ function configure (app, wares, ctx) {
}

module.exports = configure;

0 comments on commit 3391d8d

Please sign in to comment.