commit
f88a913333
|
@ -3,7 +3,8 @@
|
|||
###
|
||||
# Set the base image to Node, onbuild variant: https://registry.hub.docker.com/_/node/
|
||||
|
||||
FROM node:0.10.38
|
||||
FROM node:4.2.3
|
||||
MAINTAINER Mainflux
|
||||
|
||||
RUN apt-get update -qq && apt-get install -y build-essential
|
||||
|
||||
|
|
|
@ -5,13 +5,20 @@ var config = require('../config/config');
|
|||
*/
|
||||
var mongojs = require('mongojs');
|
||||
|
||||
/** Docker MongoDB url */
|
||||
var docker_mongo_url = process.env.MAINFLUX_MONGODB_1_PORT_27017_TCP_ADDR
|
||||
|
||||
/** Connect to DB */
|
||||
console.log("Connecting to DB");
|
||||
var collections = ['devices'];
|
||||
var db = mongojs(docker_mongo_url || config.db.path + ':' + config.db.port + '/' + config.db.name);
|
||||
|
||||
/** Check if we run with Docker compose */
|
||||
var dockerMongo = process.env.MONGODB_NAME;
|
||||
var dbUrl = '';
|
||||
if (dockerMongo && dockerMongo == '/mainflux-api-docker/mongodb') {
|
||||
dbUrl = 'mongodb://' + process.env.MONGODB_PORT_27017_TCP_ADDR + ':' + process.env.MONGODB_PORT_27017_TCP_PORT + '/' + config.db.name;
|
||||
} else {
|
||||
dbUrl = 'mongodb://' + config.db.addr + ':' + config.db.port + '/' + config.db.name;
|
||||
}
|
||||
|
||||
var db = mongojs(dbUrl);
|
||||
|
||||
|
||||
/**
|
||||
* EXPORTS
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"message" : "We are in development",
|
||||
"db" : {
|
||||
"path" : "mongodb://localhost",
|
||||
"addr" : "localhost",
|
||||
"port" : "27017",
|
||||
"name" : "test"
|
||||
},
|
||||
|
|
|
@ -7,8 +7,10 @@ api:
|
|||
# set up links so that api knows about db, redis, etc...
|
||||
links:
|
||||
- mongodb
|
||||
container_name: mainflux-api-docker
|
||||
|
||||
mongodb:
|
||||
image: mongo
|
||||
ports:
|
||||
- "27017:27017"
|
||||
container_name: mainflux-mongo-docker
|
||||
|
|
Loading…
Reference in New Issue