Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit 4c221b9

Browse files
committed
install m2 on checkout container
1 parent d26ca47 commit 4c221b9

File tree

8 files changed

+116
-49
lines changed

8 files changed

+116
-49
lines changed

etc/helm/charts/checkout/templates/configmap.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,18 @@ data:
1919
fastcgi_read_timeout 30000s;
2020
2121
upstream fastcgi_backend {
22-
server 127.0.0.1:9001;
23-
}
24-
25-
upstream fastcgi_backend_xdebug {
26-
server 127.0.0.1:9002;
22+
server 127.0.0.1:9000;
2723
}
2824
2925
map $cookie_XDEBUG_SESSION $fastcgi_backend_name {
3026
"" "fastcgi_backend";
31-
default "fastcgi_backend_xdebug";
27+
default "fastcgi_backend";
3228
}
3329
3430
server {
3531
listen 8001;
32+
listen 30102;
33+
listen 80;
3634
3735
server_name _;
3836
set $MAGE_ROOT {{.Values.global.checkout.volumeHostPath}}/checkout;

etc/helm/templates/configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ data:
3232
3333
server {
3434
listen 8001;
35+
listen 30301;
3536
3637
server_name _;
3738
set $MAGE_ROOT {{.Values.global.monolith.volumeHostPath}}/magento;

etc/helm/templates/proxy-deployment.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ metadata:
77
kubernetes.io/ingress.allow-http: "true"
88
nginx.ingress.kubernetes.io/ssl-redirect: "false"
99
nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
10-
nginx.ingress.kubernetes.io/rewrite-target: /$1/$2
10+
nginx.ingress.kubernetes.io/rewrite-target: /
1111
ingress.appscode.com/hsts: "false"
1212
spec:
1313
rules:
1414
- http:
1515
paths:
16-
{{- if .Values.global.checkout.enabled }}
17-
- path: /(magento)/(.*)
18-
backend:
19-
serviceName: {{ include "magento.fullname" . }}
20-
servicePort: {{ .Values.global.monolith.service.port }}
21-
- path: /(checkout)/(.*)
22-
backend:
23-
serviceName: {{ include "checkout.fullname" . }}
24-
servicePort: {{ .Values.global.checkout.service.port }}
25-
{{- else }}
26-
- path: /
27-
backend:
28-
serviceName: {{ include "magento.fullname" . }}
29-
servicePort: {{ .Values.global.monolith.service.port }}
30-
{{- end -}}
16+
# Monolith installation
17+
- path: /
18+
backend:
19+
serviceName: {{ include "magento.fullname" . }}
20+
servicePort: {{ .Values.global.monolith.service.port }}
21+
22+
## Multi-service installation
23+
# - path: /magento
24+
# backend:
25+
# serviceName: magento2
26+
# servicePort: 80
27+
# - path: /checkout
28+
# backend:
29+
# serviceName: magento2-checkout
30+
# servicePort: 80

init_project.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ minikube_ip="$(minikube service magento2-monolith --url | grep -oE '[0-9][^:]+'
267267
status "Saving minikube IP to etc/config.yaml (${minikube_ip})"
268268
sed -i.back "s|ip_address: \".*\"|ip_address: \"${minikube_ip}\"|g" "${config_path}"
269269
if [[ "${enable_checkout}" == 1 ]]; then
270-
sed -i.back "s|host_name: \".*\"|host_name: \"${minikube_ip}/magento\"|g" "${config_path}"
270+
sed -i.back "s|host_name: \".*\"|host_name: \"${minikube_ip}\"|g" "${config_path}"
271271
else
272272
sed -i.back "s|host_name: \".*\"|host_name: \"${minikube_ip}\"|g" "${config_path}"
273273
fi
@@ -295,6 +295,9 @@ else
295295
else
296296
bash "${vagrant_dir}/scripts/host/m_switch_to_ce.sh" -f 2> >(logError)
297297
fi
298+
if [[ "${enable_checkout}" == 1 ]]; then
299+
bash "${vagrant_dir}/scripts/host/m_switch_to_ce.sh" -p=checkout -f 2> >(logError)
300+
fi
298301
fi
299302

300303
success "Project initialization succesfully completed (make sure there are no errors in the log above)"

scripts/guest/m-reinstall

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,28 @@ vagrant_dir="${VAGRANT_ROOT}"
44

55
source "${vagrant_dir}/scripts/functions.sh"
66

7+
PORT=80
8+
for i in "$@"
9+
do
10+
case $i in
11+
-p=*|--path=*)
12+
PORT="${i#*=}"
13+
shift # past argument=value
14+
;;
15+
*)
16+
# unknown option
17+
;;
18+
esac
19+
done
720
get_config_value="${vagrant_dir}/scripts/get_config_value.sh"
821
magento_host_name="$(bash ${get_config_value} "magento_host_name")"
22+
magento_db_name="magento"
23+
if [[ ${PORT} != 80 ]]; then
24+
magento_host_name="${magento_host_name}:${PORT}"
25+
magento_db_name="checkout"
26+
fi
27+
28+
status ${magento_host_name}
929
use_nfs="$(bash "${vagrant_dir}/scripts/get_config_value.sh" "guest_use_nfs")"
1030
is_windows_host=${IS_WINDOWS_HOST}
1131
generate_basic_data="$(bash ${get_config_value} "magento_generate_basic_data")"
@@ -18,7 +38,7 @@ setupOptions[currency]="$(bash ${get_config_value} "magento_currency")"
1838
setupOptions[admin_user]="$(bash ${get_config_value} "magento_admin_user")"
1939
setupOptions[admin_password]="$(bash ${get_config_value} "magento_admin_password")"
2040
setupOptions[db_host]='magento2-mysql'
21-
setupOptions[db_name]='magento'
41+
setupOptions[db_name]="${magento_db_name}"
2242
setupOptions[db_user]='root'
2343
setupOptions[db_password]='123123q'
2444
setupOptions[base_url]="http://${magento_host_name}/"

scripts/host/m_checkout_reinstall.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
cd "$(dirname "${BASH_SOURCE[0]}")/../.." && vagrant_dir=$PWD
4+
5+
source "${vagrant_dir}/scripts/functions.sh"
6+
7+
magento_app_code_dir="${vagrant_dir}/checkout/app/code/Magento"
8+
9+
cd "${magento_app_code_dir}"
10+
11+
status "Deleting TestModule directories"
12+
ls | grep "TestModule" | xargs rm -rf
13+
14+
cd "${vagrant_dir}"
15+
16+
# TODO: parameterize container
17+
18+
executeInMagento2CheckoutContainer "${vagrant_dir}/scripts/guest/m-reinstall" -p=30102 2> >(logError)
19+
# Explicit exit is necessary to bypass incorrect output from vagrant in case of errors
20+
exit 0

scripts/host/m_switch_to_ce.sh

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,37 @@ cd "$(dirname "${BASH_SOURCE[0]}")/../.." && vagrant_dir=$PWD
66

77
source "${vagrant_dir}/scripts/functions.sh"
88

9-
status "Switching to Magento CE"
9+
force_switch=0
10+
upgrade_only=0
11+
CODEPATH="magento"
12+
for i in "$@"
13+
do
14+
case $i in
15+
-p=*|--path=*)
16+
CODEPATH="${i#*=}"
17+
shift # past argument=value
18+
;;
19+
-f) force_switch=1
20+
shift
21+
;;
22+
-u) upgrade_only=1
23+
shift
24+
;;
25+
*)
26+
# unknown option
27+
;;
28+
esac
29+
done
30+
31+
status "Switching ${CODEPATH} to Magento CE"
1032
incrementNestingLevel
1133

12-
magento_ce_dir="${vagrant_dir}/magento"
34+
magento_ce_dir="${vagrant_dir}/${CODEPATH}"
1335
magento_ee_dir="${magento_ce_dir}/magento2ee"
1436
host_os="$(bash "${vagrant_dir}/scripts/host/get_host_os.sh")"
1537
php_executable="$(bash "${vagrant_dir}/scripts/host/get_path_to_php.sh")"
1638
checkout_source_from="$(bash "${vagrant_dir}/scripts/get_config_value.sh" "checkout_source_from")"
1739

18-
force_switch=0
19-
upgrade_only=0
20-
while getopts 'fu' flag; do
21-
case "${flag}" in
22-
f) force_switch=1 ;;
23-
u) upgrade_only=1 ;;
24-
*) error "Unexpected option" && decrementNestingLevel && exit 1;;
25-
esac
26-
done
27-
2840
if [[ "${checkout_source_from}" == "git" ]]; then
2941
# Current installation is Git-based
3042
if [[ ! -f ${magento_ee_dir}/LICENSE_EE.txt ]]; then
@@ -81,7 +93,11 @@ if [[ ${upgrade_only} -eq 1 ]]; then
8193
bash "${vagrant_dir}/m-bin-magento" "indexer:reindex" 2> >(logError)
8294
bash "${vagrant_dir}/m-clear-cache" 2> >(logError)
8395
else
84-
bash "${vagrant_dir}/scripts/host/m_reinstall.sh" 2> >(logError)
96+
if [[ ${CODEPATH} == "magento" ]]; then
97+
bash "${vagrant_dir}/scripts/host/m_reinstall.sh" 2> >(logError)
98+
else
99+
bash "${vagrant_dir}/scripts/host/m_checkout_reinstall.sh" 2> >(logError)
100+
fi
85101
fi
86102

87103
decrementNestingLevel

scripts/host/m_switch_to_ee.sh

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,34 @@
33
cd "$(dirname "${BASH_SOURCE[0]}")/../.." && vagrant_dir=$PWD
44

55
source "${vagrant_dir}/scripts/functions.sh"
6-
7-
status "Switching to Magento EE"
6+
CODEPATH="magento"
7+
for i in "$@"
8+
do
9+
case $i in
10+
-p=*|--path=*)
11+
CODEPATH="${i#*=}"
12+
shift # past argument=value
13+
;;
14+
-f) force_switch=1
15+
shift
16+
;;
17+
-u) upgrade_only=1
18+
shift
19+
;;
20+
*)
21+
# unknown option
22+
;;
23+
esac
24+
done
25+
status "Switching ${CODEPATH} to Magento EE"
826
incrementNestingLevel
927

10-
magento_ce_dir="${vagrant_dir}/magento"
28+
magento_ce_dir="${vagrant_dir}/${CODEPATH}"
1129
magento_ee_dir="${magento_ce_dir}/magento2ee"
1230
host_os="$(bash "${vagrant_dir}/scripts/host/get_host_os.sh")"
1331
php_executable="$(bash "${vagrant_dir}/scripts/host/get_path_to_php.sh")"
1432
checkout_source_from="$(bash "${vagrant_dir}/scripts/get_config_value.sh" "checkout_source_from")"
1533

16-
force_switch=0
17-
upgrade_only=0
18-
while getopts 'fu' flag; do
19-
case "${flag}" in
20-
f) force_switch=1 ;;
21-
u) upgrade_only=1 ;;
22-
*) error "Unexpected option" && decrementNestingLevel && exit 1;;
23-
esac
24-
done
2534

2635
if [[ "${checkout_source_from}" == "git" ]]; then
2736
# Current installation is Git-based

0 commit comments

Comments
 (0)