Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions brew/stack-brew.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

error_clients = []
error_services = []
installation_path = sys.argv[1]
src_path = sys.argv[1]
args = sys.argv[2:]
args = list(dict.fromkeys(args))

services = [x for x in args if x not in CLIENTS]
clients = [x for x in args if x in CLIENTS]

# Loads the master yaml containing docker service definitions
with open(installation_path+'/master.yaml') as master_service_file:
with open(src_path+'/master.yaml') as master_service_file:
master_services = yaml.load(master_service_file, Loader=yaml.FullLoader)

# Populates clients in docker-compose
Expand All @@ -47,7 +47,7 @@
if service == 'kafka':
COMPOSITION['services'][service]['environment']['KAFKA_ADVERTISED_HOST_NAME'] = ip

with open(installation_path+'/docker-compose.yml', 'w') as outfile:
with open(src_path+'/docker-compose.yml', 'w') as outfile:
yaml.dump(COMPOSITION, outfile, default_flow_style=False, indent=2)

if len(error_services) > 0:
Expand Down
33 changes: 17 additions & 16 deletions brew/stackbox-brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ printf "The services you've chosen are: "
echo "${stack[*]}"
printf "\n"

echo "######## SETTING YOUR CODE DIRECTORY #############"
printf "\n"

srcPath=$(pwd)"/stackbox/"

mkdir $srcPath
cp -r $installationPath/. $srcPath
echo "Your code is in ./"$srcPath

echo "######## BUILDING YOUR STACK ###############"

beginswith() { case $2 in "$1"*) true;; *) false;; esac; }
Expand All @@ -113,23 +122,23 @@ python3_version=$(python3 --version)

if beginswith "Python 3" "$python_version" ;
then
var="$(pip --disable-pip-version-check install -r $installationPath/requirements.txt) > /dev/null "
python $installationPath/brew/stack-brew.py $installationPath ${stack[*]}
var="$(pip --disable-pip-version-check install -r $srcPath/requirements.txt) > /dev/null "
python $srcPath/brew/stack-brew.py $srcPath ${stack[*]}
elif beginswith "Python 3" "$python3_version";
then
var="$(pip3 --disable-pip-version-check install -r $installationPath/requirements.txt) > /dev/null"
python3 $installationPath/brew/stack-brew.py $installationPath ${stack[*]}
var="$(pip3 --disable-pip-version-check install -r $srcPath/requirements.txt) > /dev/null"
python3 $srcPath/brew/stack-brew.py $srcPath ${stack[*]}
else
echo "Unable to find a python 3 installation"
fi

docker-compose -f $installationPath/docker-compose.yml down 2> /dev/null > $installationPath/logs/docker-compose-down-log.txt
docker-compose -f $installationPath/docker-compose.yml build > $installationPath/logs/docker-compose-build-log.txt
docker-compose -f srcPath/docker-compose.yml down 2> /dev/null > srcPath/logs/docker-compose-down-log.txt
docker-compose -f srcPath/docker-compose.yml build > srcPath/logs/docker-compose-build-log.txt

printf "\n"
echo "######## DEPLOYING YOUR STACK ##############"

docker-compose -f $installationPath/docker-compose.yml up -d --remove-orphans
docker-compose -f srcPath/docker-compose.yml up -d --remove-orphans

sleep 5

Expand Down Expand Up @@ -164,12 +173,4 @@ do
echo ${tmp#"stackbox_"} is up at http://localhost:${service_ports[i]}
fi
fi
done

printf "\n"
echo "######## SETTING YOUR CODE DIRECTORY #############"
printf "\n"

mkdir stackbox
cp -r $installationPath/. stackbox/
echo "Your code is in ./stackbox"
done