This repository was archived by the owner on Oct 1, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 10 files changed +53
-37
lines changed
monolith-with-xdebug-and-ssh Expand file tree Collapse file tree 10 files changed +53
-37
lines changed Original file line number Diff line number Diff line change 2
2
3
3
It is possible to run Magento tests using remote PHP interpreter from the kubernetes cluster.
4
4
5
- 1 . Configure remote PHP interpreter in PhpStorm with credentials ` root:123123q ` . Use the IP which you get by running ` minikube ip ` and port ` 30022 `
5
+ 1 . Configure remote PHP interpreter in PhpStorm with credentials ` root:123123q ` . Use the IP which you get by running ` minikube ip ` and port ` 30022 ` . It is important to update ` Configuration options ` field for XDebug to work.
6
6
![ ] ( configure-remote-php.png )
7
7
1 . Select configured remote PHP interpreter
8
8
![ ] ( select-remote-php.png )
Original file line number Diff line number Diff line change
1
+ FROM magento2-monolith:dev-xdebug
2
+
3
+ RUN apt-get update && apt-get install -y openssh-server
4
+ RUN mkdir /var/run/sshd
5
+ RUN echo 'root:123123q' | chpasswd
6
+ RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
7
+
8
+ # SSH login fix. Otherwise user is kicked off after login
9
+ RUN sed -i 's@session\s *required\s *pam_loginuid.so@session optional pam_loginuid.so@g' /etc/pam.d/sshd
10
+
11
+ ENV NOTVISIBLE "in users profile"
12
+ RUN echo "export VISIBLE=now" >> /etc/profile
13
+
14
+ EXPOSE 22
15
+ CMD ["/usr/sbin/sshd" , "-D" ]
Original file line number Diff line number Diff line change @@ -2,17 +2,6 @@ FROM magento2-monolith:dev
2
2
3
3
RUN sed -i "s|;zend_extension=xdebug.so|zend_extension=xdebug.so|g" /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
4
4
RUN sed -i "s|listen = 0.0.0.0:9001|listen = 0.0.0.0:9002|g" /usr/local/etc/php-fpm.conf
5
+ RUN sed -i "s|xdebug.remote_connect_back = 1|xdebug.remote_host=192.168.99.1|g" /usr/local/etc/php-fpm.conf
5
6
6
- RUN apt-get update && apt-get install -y openssh-server
7
- RUN mkdir /var/run/sshd
8
- RUN echo 'root:123123q' | chpasswd
9
- RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
10
-
11
- # SSH login fix. Otherwise user is kicked off after login
12
- RUN sed -i 's@session\s *required\s *pam_loginuid.so@session optional pam_loginuid.so@g' /etc/pam.d/sshd
13
-
14
- ENV NOTVISIBLE "in users profile"
15
- RUN echo "export VISIBLE=now" >> /etc/profile
16
-
17
- EXPOSE 22
18
- CMD ["sh" , "-c" , "/usr/sbin/sshd -D && php-fpm -R" ]
7
+ CMD ["php-fpm" , "-R" ]
Original file line number Diff line number Diff line change 27
27
{{/*value: {{.Values.global.monolith.volumeHostPath}}/.composer*/}}
28
28
{{/*- name: DEVBOX_ROOT_HOST*/}}
29
29
{{/*value: {{.Values.global.monolith.volumeHostPath}}*/}}
30
- {{/*- name: IS_WINDOWS_HOST*/}}
31
- {{/*value: "0"*/}}
32
30
{{/*volumes:*/}}
33
31
{{/*- name: code*/}}
34
32
{{/*{{- if .Values.global.persistence.nfs.enabled }}*/}}
68
66
{{/*value: {{.Values.global.monolith.volumeHostPath}}/.composer*/}}
69
67
{{/*- name: DEVBOX_ROOT_HOST*/}}
70
68
{{/*value: {{.Values.global.monolith.volumeHostPath}}*/}}
71
- {{/*- name: IS_WINDOWS_HOST*/}}
72
- {{/*value: "0"*/}}
73
69
{{/*volumes:*/}}
74
70
{{/*- name: code*/}}
75
71
{{/*{{- if .Values.global.persistence.nfs.enabled }}*/}}
110
106
{{/*value: {{.Values.global.monolith.volumeHostPath}}/.composer*/}}
111
107
{{/*- name: DEVBOX_ROOT_HOST*/}}
112
108
{{/*value: {{.Values.global.monolith.volumeHostPath}}*/}}
113
- {{/*- name: IS_WINDOWS_HOST*/}}
114
- {{/*value: "0"*/}}
115
109
{{/*volumes:*/}}
116
110
{{/*- name: code*/}}
117
111
{{/*{{- if .Values.global.persistence.nfs.enabled }}*/}}
Original file line number Diff line number Diff line change 31
31
securityContext :
32
32
privileged : true
33
33
ports :
34
- - containerPort : {{ .Values.global.monolith.service.port }}
34
+ - containerPort : {{ .Values.global.monolith.service.phpFpmPort }}
35
35
volumeMounts :
36
36
- name : code
37
37
mountPath : {{.Values.global.monolith.volumeHostPath}}
@@ -42,15 +42,30 @@ spec:
42
42
value : {{.Values.global.monolith.volumeHostPath}}/.composer
43
43
- name : DEVBOX_ROOT_HOST
44
44
value : {{.Values.global.monolith.volumeHostPath}}
45
- - name : IS_WINDOWS_HOST
46
- value : " 0"
47
45
- name : {{ .Chart.Name }}-xdebug
48
46
image : magento2-monolith:dev-xdebug
49
47
imagePullPolicy : Never
50
48
securityContext :
51
49
privileged : true
52
50
ports :
53
- - containerPort : {{ .Values.xdebugService.port }}
51
+ - containerPort : {{ .Values.global.monolith.service.phpFpmXdebugPort }}
52
+ {{/*- containerPort: 22*/}}
53
+ volumeMounts :
54
+ - name : code
55
+ mountPath : {{.Values.global.monolith.volumeHostPath}}
56
+ env :
57
+ - name : DEVBOX_ROOT
58
+ value : {{.Values.global.monolith.volumeHostPath}}
59
+ - name : COMPOSER_HOME
60
+ value : {{.Values.global.monolith.volumeHostPath}}/.composer
61
+ - name : DEVBOX_ROOT_HOST
62
+ value : {{.Values.global.monolith.volumeHostPath}}
63
+ - name : {{ .Chart.Name }}-xdebug-cli-over-ssh
64
+ image : magento2-monolith:dev-xdebug-and-ssh
65
+ imagePullPolicy : Never
66
+ securityContext :
67
+ privileged : true
68
+ ports :
54
69
- containerPort : 22
55
70
volumeMounts :
56
71
- name : code
62
77
value : {{.Values.global.monolith.volumeHostPath}}/.composer
63
78
- name : DEVBOX_ROOT_HOST
64
79
value : {{.Values.global.monolith.volumeHostPath}}
65
- - name : IS_WINDOWS_HOST
66
- value : " 0"
67
80
- name : nginx
68
81
image : nginx:1.9
69
82
securityContext :
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ source "${devbox_dir}/scripts/functions.sh"
7
7
get_config_value=" ${devbox_dir} /scripts/get_config_value.sh"
8
8
magento_host_name=" $( bash ${get_config_value} " magento_host_name" ) "
9
9
use_nfs=" $( bash " ${devbox_dir} /scripts/get_env_config_value.sh" " guest_use_nfs" ) "
10
- is_windows_host=${IS_WINDOWS_HOST}
11
10
generate_basic_data=" $( bash ${get_config_value} " magento_generate_basic_data" ) "
12
11
13
12
@@ -40,10 +39,6 @@ setupOptions[amqp_user]='admin'
40
39
setupOptions[amqp_password]=' 123123q'
41
40
setupOptions[amqp_virtualhost]=' /'
42
41
43
- # if [[ ${is_windows_host} == 1 ]] || [[ ${use_nfs} == 0 ]]; then
44
- # sudo chown -R devbox:devbox ${DEVBOX_ROOT}/$(getContext)
45
- # fi
46
- #
47
42
# status "Killing MQ processes"
48
43
# pkill -f queue
49
44
121
116
122
117
bash " ${devbox_dir} /scripts/guest/configure_varnish" -f
123
118
124
- # TODO: Remove
125
- # if [[ ${is_windows_host} == 1 ]] || [[ ${use_nfs} == 0 ]]; then
126
- # status "Changing ownership of "${DEVBOX_ROOT}/$(getContext)" to devbox:devbox"
127
- # sudo chown -R devbox:devbox ${DEVBOX_ROOT}/$(getContext)
128
- # fi
129
-
130
119
bash " ${DEVBOX_ROOT} /scripts/guest/configure_search_engine"
131
120
bash " ${DEVBOX_ROOT} /scripts/guest/change_magento_config_for_functional_tests"
132
121
bash " ${DEVBOX_ROOT} /scripts/guest/update_magento_config" ' admin/security/session_lifetime' ' 86400'
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ source "${devbox_dir}/scripts/functions.sh"
7
7
# # TODO: Add status messages
8
8
cd " ${devbox_dir} /scripts" && eval $( minikube docker-env) && docker build -t magento2-monolith:dev -f ../etc/docker/monolith/Dockerfile ../scripts
9
9
cd " ${devbox_dir} /scripts" && eval $( minikube docker-env) && docker build -t magento2-monolith:dev-xdebug -f ../etc/docker/monolith-with-xdebug/Dockerfile ../scripts
10
+ cd " ${devbox_dir} /scripts" && eval $( minikube docker-env) && docker build -t magento2-monolith:dev-xdebug-and-ssh -f ../etc/docker/monolith-with-xdebug-and-ssh/Dockerfile ../scripts
10
11
11
12
# TODO: Repeat for other deployments, not just Magento 2
12
13
# See https://github.com/kubernetes/kubernetes/issues/33664#issuecomment-386661882
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ source "${devbox_dir}/scripts/functions.sh"
7
7
# # TODO: Add status messages
8
8
cd " ${devbox_dir} /scripts" && eval $( minikube docker-env) && docker build -t magento2-monolith:dev -f ../etc/docker/monolith/Dockerfile ../scripts
9
9
cd " ${devbox_dir} /scripts" && eval $( minikube docker-env) && docker build -t magento2-monolith:dev-xdebug -f ../etc/docker/monolith-with-xdebug/Dockerfile ../scripts
10
+ cd " ${devbox_dir} /scripts" && eval $( minikube docker-env) && docker build -t magento2-monolith:dev-xdebug-and-ssh -f ../etc/docker/monolith-with-xdebug-and-ssh/Dockerfile ../scripts
10
11
11
12
# TODO: Repeat for other deployments, not just Magento 2
12
13
# See https://github.com/kubernetes/kubernetes/issues/33664#issuecomment-386661882
Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ function executeExtendedCommonAssertions()
39
39
assertElasticSearchEnabled
40
40
assertElasticSearchDisablingWorks
41
41
assertElasticSearchEnablingWorks
42
+
43
+ assertXdebugContainerWorks
42
44
}
43
45
44
46
# # Assertions
@@ -542,3 +544,15 @@ function assertRemotePhpWorks()
542
544
543
545
assertTrue " Remote PHP is not accessible ('php -i' failed to execute over ssh)." ' [[ ${remote_php_ini_contents} =~ "PHP License" ]]'
544
546
}
547
+
548
+ function assertXdebugContainerWorks()
549
+ {
550
+ echo " ${blue} ## assertXdebugContainerWorks${regular} "
551
+ echo " ## assertXdebugContainerWorks" >> ${current_log_file_path}
552
+
553
+ cd ${tests_dir}
554
+ magento_page_content=" $( curl -sL --cookie " XDEBUG_SESSION=PHPSTORM" " ${current_magento_base_url} /customer/account/create/" ) "
555
+ pattern=" Magento.* All rights reserved."
556
+ assertTrue " Account creation page is not accessible when queried with XDEBUG_SESSION cookie. URL: '${current_magento_base_url} /customer/account/create/'" ' [[ ${magento_page_content} =~ ${pattern} ]]'
557
+
558
+ }
You can’t perform that action at this time.
0 commit comments