This repository was archived by the owner on Oct 1, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +43
-14
lines changed Expand file tree Collapse file tree 5 files changed +43
-14
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,7 @@ if [[ $(isMinikubeRunning) -eq 0 ]]; then
227
227
status " Starting minikube"
228
228
# echo "$(python -c 'import os,sys;print(os.path.realpath("."));')/ -alldirs -mapall="$(id -u)":"$(id -g)" $(minikube ip)" | sudo tee -a /etc/exports && sudo nfsd restart
229
229
minikube start --cpus=2 --memory=4096
230
+ # minikube start --cache-images --cpus=2 --memory=4096
230
231
# hanged in some cases todo
231
232
# minikube start --cpus=2 --memory=4096 2> >(logError) | {
232
233
# while IFS= read -r line
@@ -239,15 +240,16 @@ if [[ $(isMinikubeRunning) -eq 0 ]]; then
239
240
fi
240
241
status " Configuring kubernetes cluster on the minikube"
241
242
# TODO: Optimize. Helm tiller must be initialized and started before environment configuration can begin
242
- helm init && sleep 10
243
+ helm init
244
+ waitForKubernetesPodToRun ' tiller-deploy'
245
+
243
246
# TODO: change k-rebuild-environment to comply with formatting requirements
244
247
if [[ " ${disable_nfs} " == 1 ]]; then
245
248
bash " ${vagrant_dir} /scripts/host/k_rebuild_environment.sh" -d
246
249
else
247
250
bash " ${vagrant_dir} /scripts/host/k_rebuild_environment.sh"
248
251
fi
249
252
250
-
251
253
minikube_ip=" $( minikube service magento2-monolith --url | grep -oE ' [0-9][^:]+' | head -1) "
252
254
status " Saving minikube IP to etc/config.yaml (${minikube_ip} )"
253
255
sed -i.back " s|ip_address: \" .*\" |ip_address: \" ${minikube_ip} \" |g" " ${config_path} "
Original file line number Diff line number Diff line change @@ -7,10 +7,11 @@ cd "$(dirname "${BASH_SOURCE[0]}")" && vagrant_dir=$PWD
7
7
source " ${vagrant_dir} /scripts/functions.sh"
8
8
resetNestingLevel
9
9
10
- if [[ $( isMinikubeRunning) -eq 1 ]]; then
10
+ if [[ $( isMinikubeRunning) -eq 1 || $( isMinikubeSaved ) -eq 1 ]]; then
11
11
minikube stop 2> >( logError)
12
12
fi
13
13
14
14
minikube start --cpus=2 --memory=4096 2> >( logError)
15
+ # minikube start --cache-images --cpus=2 --memory=4096 2> >(logError)
15
16
16
17
info " $( regular) See details in $( bold) ${vagrant_dir} /log/${current_script_name} .log$( regular) . For debug output set $( bold) debug:vagrant_project$( regular) to $( bold) 1$( regular) in $( bold) etc/config.yaml$( regular) "
Original file line number Diff line number Diff line change @@ -227,10 +227,41 @@ function isMinikubeStopped() {
227
227
fi
228
228
}
229
229
230
+ function isMinikubeSaved() {
231
+ minikube_status=" $( minikube status | grep minikube: 2> >( log) ) "
232
+ if [[ ${minikube_status} == " minikube: Saved" ]]; then
233
+ echo 1
234
+ fi
235
+ }
236
+
230
237
# TODO: Add suspended
231
238
232
239
function isMinikubeInitialized() {
233
- if [[ $( isMinikubeRunning) -eq 1 || $( isMinikubeStopped) -eq 1 ]]; then
240
+ if [[ $( isMinikubeRunning) -eq 1 || $( isMinikubeStopped) -eq 1 || $( isMinikubeSaved ) -eq 1 ]]; then
234
241
echo 1
235
242
fi
236
243
}
244
+
245
+ function waitForKubernetesPodToRun()
246
+ {
247
+ set +e
248
+
249
+ if [[ -n " ${1} " ]]; then
250
+ pod_id=" ${1} "
251
+ else
252
+ error " Argument missing for 'waitForKubernetesPodToRun'"
253
+ set -e
254
+ exit 1
255
+ fi
256
+
257
+ COUNTER=0
258
+ pod_status=$( kubectl get pods --all-namespaces | grep -hE " ${pod_id} -[a-z0-9\-]+" | grep -o ' Running' )
259
+
260
+ while [[ $pod_status != ' Running' && $COUNTER -lt 240 ]] ; do
261
+ sleep 3
262
+ let COUNTER+=3
263
+ status " Waiting for pod (${pod_id} ) to run"
264
+ pod_status=$( kubectl get pods --all-namespaces | grep -hE " ${pod_id} -[a-z0-9\-]+" | grep -o ' Running' )
265
+ done
266
+ set -e
267
+ }
Original file line number Diff line number Diff line change @@ -134,9 +134,8 @@ if [[ ${magento_home_page_content} =~ ${pattern} ]]; then
134
134
135
135
bash " ${VAGRANT_ROOT} /scripts/guest/warm_up_cache"
136
136
137
- status " Generating XSD references for PHP Storm"
138
- php " ${MAGENTO_ROOT} /bin/magento" dev:urn-catalog:generate " ${vagrant_dir} /.idea/misc.xml"
139
- sed -i " s|${MAGENTO_ROOT} |${MAGENTO_ROOT_HOST} |g" " ${vagrant_dir} /.idea/misc.xml"
137
+ status " Generating XSD references for PHP Storm in the background"
138
+ php " ${MAGENTO_ROOT} /bin/magento" dev:urn-catalog:generate " ${vagrant_dir} /.idea/misc.xml" && sed -i " s|${MAGENTO_ROOT} |${MAGENTO_ROOT_HOST} |g" " ${vagrant_dir} /.idea/misc.xml" &
140
139
141
140
decrementNestingLevel
142
141
success " Magento reinstalled successfully"
Original file line number Diff line number Diff line change @@ -35,12 +35,8 @@ cd "${vagrant_dir}/etc/helm" && helm install \
35
35
--set global.checkout.volumeHostPath=" ${vagrant_dir} " .
36
36
37
37
# TODO: Waiting for containers to initialize before proceeding
38
- sleep 7
39
-
40
-
41
- # # Bypass Helm
42
- # cd "${vagrant_dir}" && python local_deploy.py --all --ingress \
43
- # && kubectl patch deployment magento2-monolith -p \
44
- # "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}"
38
+ waitForKubernetesPodToRun ' magento2-monolith'
39
+ waitForKubernetesPodToRun ' magento2-mysql'
40
+ waitForKubernetesPodToRun ' magento2-redis-master'
45
41
46
42
exit 0
You can’t perform that action at this time.
0 commit comments