Skip to content

Commit

Permalink
Integrating docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko committed Jun 22, 2015
1 parent f4ad21a commit 1399b9f
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3 deletions.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:0.10.38-slim

MAINTAINER Nightscout

# Netcat is required to poll the database, so Nightscout starts when MongoDB is up and running
RUN apt-get update && apt-get -y install netcat
RUN npm install .

EXPOSE 1337
CMD ["sh", "docker/docker-start.sh"]
2 changes: 0 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ function create (env, ctx) {
var bundle = require('./bundle')();
app.use(bundle);

// Handle errors with express's errorhandler, to display more readable error messages.

// Handle errors with express's errorhandler, to display more readable error messages.
var errorhandler = require('errorhandler');
//if (process.env.NODE_ENV === 'development') {
Expand Down
8 changes: 8 additions & 0 deletions docker/docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

cd ../

docker-compose -p nightscout_build -f docker/docker-compose.yml stop
docker-compose -p nightscout_build -f docker/docker-compose.yml rm --force -v
docker-compose -p nightscout_build -f docker/docker-compose.yml build
docker-compose -p nightscout_build -f docker/docker-compose.yml up
20 changes: 20 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
nightscout:
build: ../
links:
- database
- broker
ports:
- "1337:1337"
environment:
- MONGO_CONNECTION=mongodb://database/nightscout
- API_SECRET=mylittlesecret
- MQTT_MONITOR=mqtt://broker
- PORT=1337
database:
image: mongo:3.0.3
ports:
- "27017"
broker:
image: prologic/mosquitto
ports:
- "1883"
1 change: 0 additions & 1 deletion env.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ var consts = require('./lib/constants');
var fs = require('fs');
// Module to constrain all config and environment parsing to one spot.
function config ( ) {

/*
* First inspect a bunch of environment variables:
* * PORT - serve http on this port
Expand Down
2 changes: 2 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh

sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make git
sudo add-apt-repository ppa:chris-lea/node.js
Expand Down

0 comments on commit 1399b9f

Please sign in to comment.