2018-08-17 01:52:43 +08:00
|
|
|
#!/bin/bash
|
2019-09-12 22:55:24 +08:00
|
|
|
# Copyright (c) Mainflux
|
2018-08-17 01:52:43 +08:00
|
|
|
# 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 &
|
2019-10-01 20:12:52 +08:00
|
|
|
counter=1
|
2020-04-07 18:02:17 +08:00
|
|
|
until nc -zv localhost 4222 1>/dev/null 2>&1;
|
2019-10-01 20:12:52 +08:00
|
|
|
do
|
|
|
|
sleep 0.5
|
|
|
|
((counter++))
|
|
|
|
if [ ${counter} -gt 10 ]
|
|
|
|
then
|
|
|
|
echo -ne "gnatsd failed to start in 5 sec, exiting"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo -ne "Waiting for gnatsd"
|
|
|
|
done
|
2018-08-17 01:52:43 +08:00
|
|
|
|
|
|
|
###
|
|
|
|
# Users
|
|
|
|
###
|
2019-11-11 19:13:48 +08:00
|
|
|
MF_USERS_LOG_LEVEL=info MF_EMAIL_TEMPLATE=../docker/users/emailer/templates/email.tmpl $BUILD_DIR/mainflux-users &
|
2018-08-17 01:52:43 +08:00
|
|
|
|
|
|
|
###
|
|
|
|
# Things
|
|
|
|
###
|
2019-07-12 05:19:08 +08:00
|
|
|
MF_THINGS_LOG_LEVEL=info MF_THINGS_HTTP_PORT=8182 MF_THINGS_AUTH_GRPC_PORT=8183 MF_THINGS_AUTH_HTTP_PORT=8989 $BUILD_DIR/mainflux-things &
|
2018-08-17 01:52:43 +08:00
|
|
|
|
|
|
|
###
|
|
|
|
# HTTP
|
|
|
|
###
|
2020-04-07 18:02:17 +08:00
|
|
|
MF_HTTP_ADAPTER_LOG_LEVEL=info MF_HTTP_ADAPTER_PORT=8185 MF_THINGS_AUTH_GRPC_URL=localhost:8183 $BUILD_DIR/mainflux-http &
|
2018-08-17 01:52:43 +08:00
|
|
|
|
|
|
|
###
|
2020-03-05 20:34:07 +08:00
|
|
|
# MQTT
|
2018-08-17 01:52:43 +08:00
|
|
|
###
|
2020-04-07 18:02:17 +08:00
|
|
|
MF_MQTT_ADAPTER_LOG_LEVEL=info MF_THINGS_AUTH_GRPC_URL=localhost:8183 $BUILD_DIR/mainflux-mqtt &
|
2018-08-17 01:52:43 +08:00
|
|
|
|
|
|
|
###
|
|
|
|
# CoAP
|
|
|
|
###
|
2020-04-07 18:02:17 +08:00
|
|
|
MF_COAP_ADAPTER_LOG_LEVEL=info MF_COAP_ADAPTER_PORT=5683 MF_THINGS_AUTH_GRPC_URL=localhost:8183 $BUILD_DIR/mainflux-coap &
|
2018-08-17 01:52:43 +08:00
|
|
|
|
2020-03-30 21:22:18 +08:00
|
|
|
###
|
|
|
|
# AUTHN
|
|
|
|
###
|
|
|
|
MF_AUTHN_LOG_LEVEL=debug MF_AUTHN_HTTP_PORT=8189 MF_AUTHN_GRPC_PORT=8181 MF_AUTHN_DB_PORT=5432 MF_AUTHN_DB_USER=mainflux MF_AUTHN_DB_PASS=mainflux MF_AUTHN_DB=authn MF_AUTHN_SECRET=secret $BUILD_DIR/mainflux-authn &
|
|
|
|
|
2018-08-17 01:52:43 +08:00
|
|
|
trap cleanup EXIT
|
|
|
|
|
|
|
|
while : ; do sleep 1 ; done
|