-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·51 lines (39 loc) · 1.88 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
set -e
set -a
DEFAULT_WEB_API_PORT=8080
DEFAULT_WORKER_API_PORT=16180
echo -e "Settings for the dispatcher:\n"
echo -e "Auth Secret Key is a key used to sign JWTs that serve the purpose of authenticating user sessions."
echo -e "Please write a secure key below that will be used for this instance of the Dispatcher."
read -s -p "Auth Secret Key: " AUTH_SECRET_KEY
echo -e "\n\nPort used to listen for incoming connections for the web server, accessible to users."
read -p "Web server port ($DEFAULT_WEB_API_PORT): " WEB_API_PORT
if [ "$WEB_API_PORT" = "" ]; then
WEB_API_PORT=$DEFAULT_WEB_API_PORT
fi
echo -e "\n\nPort used to listen for incoming connections for the worker API server, used by workers to communicate with the main server."
read -p "Worker API port ($DEFAULT_WORKER_API_PORT): " WORKER_API_PORT
if [ "$WORKER_API_PORT" = "" ]; then
WORKER_API_PORT=$DEFAULT_WORKER_API_PORT
fi
echo -e "\nStarting installation..."
echo -e " - Creating temporary dir /tmp/dispatcher-master"
mkdir -p /tmp/dispatcher-master
cd /tmp/dispatcher-master
echo -e " - Downloading docker-compose definition from the GitHub repository"
curl --fail -L https://raw.githubusercontent.com/comnetunb/dispatcher-master/master/docker-compose.prod.yml >docker-compose.yml
echo -e " - Starting containers..."
sudo \
DISPATCHER_MASTER_SECRET_KEY=$AUTH_SECRET_KEY \
DISPATCHER_MASTER_WEB_API_PORT=$WEB_API_PORT \
DISPATCHER_MASTER_WORKER_API_PORT=$WORKER_API_PORT \
docker-compose up -d
echo -e "\n\n"
echo -e "Dispatcher is installed and running on port $WEB_API_PORT of this machine!\n"
echo -e "The database is stored inside a docker volume called 'mongodb_data_container', how that works can be read here: https://docs.docker.com/storage/volumes/\n"
read -p "Do you want to tail the logs? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]; then
sudo docker logs dispatcher-master -f
fi