Skip to content

Commit 4a84346

Browse files
author
Sowmiya Nagarajan
committed
Fixing stack-brew.py #39
1 parent 3473bbd commit 4a84346

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

brew/stack-brew.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
error_clients = []
1818
error_services = []
19-
installation_path = sys.argv[1]
19+
src_path = sys.argv[1]
2020
args = sys.argv[2:]
2121
args = list(dict.fromkeys(args))
2222

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

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

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

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

5353
if len(error_services) > 0:

brew/stackbox-brew.sh

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ printf "The services you've chosen are: "
104104
echo "${stack[*]}"
105105
printf "\n"
106106

107+
echo "######## SETTING YOUR CODE DIRECTORY #############"
108+
printf "\n"
109+
110+
srcPath=$(pwd)"/stackbox/"
111+
112+
mkdir $srcPath
113+
cp -r $installationPath/. $srcPath
114+
echo "Your code is in ./"$srcPath
115+
107116
echo "######## BUILDING YOUR STACK ###############"
108117

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

114123
if beginswith "Python 3" "$python_version" ;
115124
then
116-
var="$(pip --disable-pip-version-check install -r $installationPath/requirements.txt) > /dev/null "
117-
python $installationPath/brew/stack-brew.py $installationPath ${stack[*]}
125+
var="$(pip --disable-pip-version-check install -r $srcPath/requirements.txt) > /dev/null "
126+
python $srcPath/brew/stack-brew.py $srcPath ${stack[*]}
118127
elif beginswith "Python 3" "$python3_version";
119128
then
120-
var="$(pip3 --disable-pip-version-check install -r $installationPath/requirements.txt) > /dev/null"
121-
python3 $installationPath/brew/stack-brew.py $installationPath ${stack[*]}
129+
var="$(pip3 --disable-pip-version-check install -r $srcPath/requirements.txt) > /dev/null"
130+
python3 $srcPath/brew/stack-brew.py $srcPath ${stack[*]}
122131
else
123132
echo "Unable to find a python 3 installation"
124133
fi
125134

126-
docker-compose -f $installationPath/docker-compose.yml down 2> /dev/null > $installationPath/logs/docker-compose-down-log.txt
127-
docker-compose -f $installationPath/docker-compose.yml build > $installationPath/logs/docker-compose-build-log.txt
135+
docker-compose -f srcPath/docker-compose.yml down 2> /dev/null > srcPath/logs/docker-compose-down-log.txt
136+
docker-compose -f srcPath/docker-compose.yml build > srcPath/logs/docker-compose-build-log.txt
128137

129138
printf "\n"
130139
echo "######## DEPLOYING YOUR STACK ##############"
131140

132-
docker-compose -f $installationPath/docker-compose.yml up -d --remove-orphans
141+
docker-compose -f srcPath/docker-compose.yml up -d --remove-orphans
133142

134143
sleep 5
135144

@@ -164,12 +173,4 @@ do
164173
echo ${tmp#"stackbox_"} is up at http://localhost:${service_ports[i]}
165174
fi
166175
fi
167-
done
168-
169-
printf "\n"
170-
echo "######## SETTING YOUR CODE DIRECTORY #############"
171-
printf "\n"
172-
173-
mkdir stackbox
174-
cp -r $installationPath/. stackbox/
175-
echo "Your code is in ./stackbox"
176+
done

0 commit comments

Comments
 (0)