- Remove DASH_HOME legacy…

-- Now more dynamic
- Added python venv check
- Removed necessity of activating the the venv
pull/56/head
Steve Clement 2018-04-02 01:59:08 +09:00
parent a3ef669e80
commit 9691536a21
5 changed files with 22 additions and 11 deletions

View File

@ -8,8 +8,6 @@ sudo apt-get install python3-virtualenv virtualenv screen redis-server unzip -y
if [ -z "$VIRTUAL_ENV" ]; then
virtualenv -p python3 DASHENV
echo export DASH_HOME=$(pwd) >> ./DASHENV/bin/activate
. ./DASHENV/bin/activate
fi

View File

@ -7,7 +7,16 @@ GREEN="\\033[1;32m"
DEFAULT="\\033[0;39m"
RED="\\033[1;31m"
[ -z "$DASH_HOME" ] && echo "Needs the env var DASHENV. (Did you: . ./DASHENV/bin/activate ) Please run the script from the virtual environment." && exit 1;
# Getting CWD where bash script resides
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "${DIR}/DASHENV/bin/python" ]; then
echo "dashboard virtualenv seems to exist, good"
ENV_PY=${DIR}/DASHENV/bin/python
else
echo "Please make sure you have a dashboard environment, au revoir"
exit 1
fi
redis_dir="${DASH_HOME}/../redis/src/"
if [ ! -e "${redis_dir}" ]; then
@ -15,7 +24,6 @@ if [ ! -e "${redis_dir}" ]; then
redis_dir=""
fi
check_redis_port=$(netstat -an |grep LISTEN |grep 6250 |grep -v tcp6)
# Configure accordingly, remember: 0.0.0.0 exposes to every active IP interface, play safe and bind it to something you trust and know
@ -32,16 +40,16 @@ screen -dmS "$screenName"
sleep 0.1
if [ -z "${check_redis_port}" ]; then
echo -e $GREEN"\t* Launching Redis servers"$DEFAULT
# screen -S "$screenName" -X screen -t "redis-server" bash -c $redis_dir'redis-server '$conf_dir'6250.conf && echo "Started Redis" ; read x'
screen -S "$screenName" -X screen -t "redis-server" bash -c $redis_dir'redis-server '$conf_dir'6250.conf && echo "Started Redis" ; read x'
else
echo -e $RED"\t* NOT starting Redis server, made a very unrealiable check on port 6250, and something seems to be there… please double check if this is good!"$DEFAULT
fi
echo -e $GREEN"\t* Launching zmq subscriber"$DEFAULT
screen -S "$screenName" -X screen -t "zmq-subscriber" bash -c 'echo "Starting zmq-subscriber" ; ./zmq_subscriber.py; read x'
screen -S "$screenName" -X screen -t "zmq-subscriber" bash -c 'echo "Starting zmq-subscriber" ; ${ENV_PY} ${DIR}/zmq_subscriber.py; read x'
echo -e $GREEN"\t* Launching zmq dispatcher"$DEFAULT
screen -S "$screenName" -X screen -t "zmq-dispatcher" bash -c 'echo "Starting zmq-dispatcher"; ./zmq_dispatcher.py; read x'
screen -S "$screenName" -X screen -t "zmq-dispatcher" bash -c 'echo "Starting zmq-dispatcher"; ${ENV_PY} ${DIR}/zmq_dispatcher.py; read x'
echo -e $GREEN"\t* Launching flask server"$DEFAULT
screen -S "$screenName" -X screen -t "flask" bash -c 'echo "Starting Flask Server"; flask run --host=${FLASK_HOST} --port=${FLASK_PORT}; read x'
screen -S "$screenName" -X screen -t "flask" bash -c 'echo "Starting Flask Server"; ${ENV_PY} ${DIR}/server.py; read x'

View File

@ -6,7 +6,8 @@ GREEN="\\033[1;32m"
DEFAULT="\\033[0;39m"
RED="\\033[1;31m"
[ -z "$DASH_HOME" ] && echo "Needs the env var DASHENV. Run the script from the virtual environment." && exit 1;
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DASH_HOME="${DIR}/.."
conf_dir="${DASH_HOME}/config/"
redis_dir="${DASH_HOME}/../redis/src/"

View File

@ -6,7 +6,9 @@ GREEN="\\033[1;32m"
DEFAULT="\\033[0;39m"
RED="\\033[1;31m"
[ -z "$DASH_HOME" ] && echo "Needs the env var DASHENV. Run the script from the virtual environment." && exit 1;
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DASH_HOME="${DIR}/..
conf_dir="${DASH_HOME}/config/"
redis_dir="${DASH_HOME}/../redis/src/"

View File

@ -1,6 +1,8 @@
#!/bin/bash
set -e
[ -z "$DASH_HOME" ] && echo "Needs the env var DASHENV. Run the script from the virtual environment." && exit 1;
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DASH_HOME="${DIR}/.."
./start_framework.sh
# Wait a bit that redis terminate