-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d2cd1f
commit 22e886d
Showing
3 changed files
with
52 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,51 @@ | ||
#!/bin/bash | ||
set -e -u -o pipefail | ||
#!/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 | ||
|
||
curl -L https://raw.githubusercontent.com/comnetunb/dispatcher-master/master/docker-compose.prod.yml -o docker-compose.yml | ||
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 "Auth Secret Key is used for user authentication, please use a secure value." | ||
read -s -p "Auth Secret Key:" AUTH_SECRET_KEY | ||
echo -e "Dispatcher is installed and running on port $WEB_API_PORT of this machine!\n" | ||
|
||
export DISPATCHER_MASTER_PORT=8080 | ||
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" | ||
|
||
sudo docker-compose up -d | ||
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 |