2017-08-24 16:02:28 +02:00
#!/bin/bash
set -e
2018-01-06 20:51:23 +01:00
set -x
2017-08-24 16:02:28 +02:00
GREEN = "\\033[1;32m"
DEFAULT = "\\033[0;39m"
RED = "\\033[1;31m"
2018-01-06 12:07:14 +01:00
[ -z " $DASH_HOME " ] && echo "Needs the env var DASHENV. (Did you: . ./DASHENV/bin/activate ) Please run the script from the virtual environment." && exit 1;
2017-08-24 16:02:28 +02:00
redis_dir = " ${ DASH_HOME } /../redis/src/ "
2018-01-06 20:30:58 +01:00
if [ ! -e " ${ redis_dir } " ] ; then
2018-01-06 20:51:23 +01:00
[ ! -f "`which redis-server`" ] && echo " Either ${ DASH_HOME } /../redis/src/ does not exist or 'redis-server' is not installed/not on PATH. Please fix and run again. " && exit 1
2018-01-06 12:07:14 +01:00
redis_dir = ""
fi
2018-01-06 20:51:23 +01:00
# Configure accordingly, remember: 0.0.0.0 exposes to every active IP interface, play safe and bind it to something you trust and know
export FLASK_APP = server.py
export FLASK_DEBUG = 0
export FLASK_PORT = 8001
export FLASK_HOST = 127.0.0.1
2018-01-06 12:07:14 +01:00
conf_dir = " ${ DASH_HOME } /config/ "
2017-08-24 16:02:28 +02:00
screenName = "Misp-Dashboard"
screen -dmS " $screenName "
sleep 0.1
echo -e $GREEN "\t* Launching Redis servers" $DEFAULT
2018-01-06 20:51:23 +01:00
screen -S " $screenName " -X screen -t "redis-server" bash -c $redis_dir 'redis-server ' $conf_dir '6250.conf && echo "Started Redis" ; read x'
2017-08-24 16:02:28 +02:00
echo -e $GREEN "\t* Launching zmq subscriber" $DEFAULT
2018-01-06 20:51:23 +01:00
screen -S " $screenName " -X screen -t "zmq-subscriber" bash -c 'echo "Starting zmq-subscriber" ; ./zmq_subscriber.py; read x'
2017-08-24 16:02:28 +02:00
2017-12-04 14:36:30 +01:00
echo -e $GREEN "\t* Launching zmq dispatcher" $DEFAULT
2018-01-06 20:51:23 +01:00
screen -S " $screenName " -X screen -t "zmq-dispatcher" bash -c 'echo "Starting zmq-dispatcher"; ./zmq_dispatcher.py; read x'
2017-12-04 14:36:30 +01:00
2017-08-24 16:02:28 +02:00
echo -e $GREEN "\t* Launching flask server" $DEFAULT
2018-01-06 20:51:23 +01:00
screen -S " $screenName " -X screen -t "flask" bash -c 'echo "Starting Flask Server"; flask run --host=${FLASK_HOST} --port=${FLASK_PORT}; read x'