NOISSUE - Add system run script (#350)

* NOISSUE - Add system run script

Signed-off-by: drasko <drasko.draskovic@gmail.com>

* Add MQTT

Signed-off-by: drasko <drasko.draskovic@gmail.com>

* Add MQTT module install to Makefile. Fix warnings.

Signed-off-by: drasko <drasko.draskovic@gmail.com>
This commit is contained in:
Drasko DRASKOVIC 2018-08-16 19:52:43 +02:00 committed by GitHub
parent 312d30fd69
commit 7e83b2d612
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 82 additions and 6 deletions

View File

@ -12,12 +12,13 @@ define make_docker
docker build --build-arg SVC_NAME=$(subst docker_,,$(1)) --tag=mainflux/$(subst docker_,,$(1)) -f docker/Dockerfile .
endef
all: $(SERVICES)
all: $(SERVICES) mqtt
.PHONY: all $(SERVICES) dockers latest release
.PHONY: all $(SERVICES) dockers latest release mqtt
clean:
rm -rf ${BUILD_DIR}
rm -rf mqtt/node_modules
install:
cp ${BUILD_DIR}/* $(GOBIN)
@ -35,6 +36,9 @@ dockers: $(DOCKERS)
docker build --tag=mainflux/dashflux -f dashflux/docker/Dockerfile dashflux
docker build --tag=mainflux/mqtt -f mqtt/Dockerfile .
mqtt:
cd mqtt && npm install
latest: dockers
for svc in $(SERVICES); do \
docker push mainflux/$$svc; \
@ -54,3 +58,6 @@ release:
docker push mainflux/dashflux:$(version)
docker tag mainflux/mqtt mainflux/mqtt:$(version)
docker push mainflux/mqtt:$(version)
run:
cd scripts && ./run.sh

View File

@ -13,13 +13,14 @@
"lint": "eslint mqtt.js"
},
"dependencies": {
"aedes": "^0.34.0",
"2": "^1.0.2",
"aedes": "^0.35.2",
"aedes-logging": "^1.0.1",
"aedes-persistence-redis": "^5.1.0",
"atob": "^2.0.3",
"bunyan": "^1.5.1",
"grpc": "^1.11.3",
"lodash": "~3.10.1",
"lodash": "^4.17.10",
"nats": "^0.6.8",
"protocol-buffers": "^4.0.4",
"request": "^2.81.0",
@ -32,7 +33,7 @@
"eslint-config-airbnb-base": "^12.0.1",
"eslint-plugin-import": "^2.7.0",
"jshint-stylish": "^2.0.1",
"mocha": "^2.3.3",
"supertest": "^1.1.0"
"mocha": "^5.2.0",
"supertest": "^3.1.0"
}
}

3
package-lock.json generated Normal file
View File

@ -0,0 +1,3 @@
{
"lockfileVersion": 1
}

65
scripts/run.sh Executable file
View File

@ -0,0 +1,65 @@
#!/bin/bash
#
# Copyright (c) 2018
# Mainflux
#
# SPDX-License-Identifier: Apache-2.0
#
###
# Runs all Mainflux microservices (must be previously built and installed).
#
# Expects that PostgreSQL and needed messaging DB are alredy running.
# Additionally, MQTT microservice demands that Redis is up and running.
#
###
BUILD_DIR=../build
# Kill all mainflux-* stuff
function cleanup {
pkill mainflux
pkill nats
}
###
# NATS
###
gnatsd &
###
# Users
###
$BUILD_DIR/mainflux-users &
###
# Things
###
MF_THINGS_HTTP_PORT=8182 MF_THINGS_GRPC_PORT=8183 $BUILD_DIR/mainflux-things &
###
# HTTP
###
MF_HTTP_ADAPTER_PORT=8185 MF_THINGS_URL=localhost:8183 $BUILD_DIR/mainflux-http &
###
# WS
###
MF_WS_ADAPTER_PORT=8186 MF_THINGS_URL=localhost:8183 $BUILD_DIR/mainflux-ws &
###
# MQTT
###
# Switch to top dir to find *.proto stuff when running MQTT broker
cd ..
MF_THINGS_URL=localhost:8183 node mqtt/mqtt.js &
cd -
###
# CoAP
###
# TODO: add coap
trap cleanup EXIT
while : ; do sleep 1 ; done