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

Commit 45e5a91

Browse files
authored
Merge pull request #75 from magento/multi-instance
Support multiple Magento instances simultaneously #52
2 parents 8b18bbe + 5202f21 commit 45e5a91

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1020
-766
lines changed

.travis.yml

+22-17
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ jobs:
1212
- stage: "Basic Tests"
1313
script:
1414
- cd tests && sudo bash ./NoCustomConfigBasicTest.sh
15-
- stage: "Extended Tests"
16-
script: cd tests && sudo bash ./Ce23WithSampleDataMysqlSearchNoNfsTest.sh
15+
- script: cd tests && sudo bash ./Ce23WithSampleDataMysqlSearchNoNfsTest.sh
1716
- script: cd tests && sudo bash ./CeFromComposerNoNfsTest.sh
1817
- script: cd tests && sudo bash ./EeLinkingTest.sh
1918

@@ -24,36 +23,42 @@ install:
2423
# Make root mounted as rshared to fix kube-dns issues.
2524
- sudo mount --make-rshared /
2625
# Download kubectl, which is a requirement for using minikube. Had to install kubeadm on local VM https://kubernetes.io/docs/setup/independent/install-kubeadm/
27-
- curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
26+
- curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.14.2/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
2827
# Download Minikube.
29-
- curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.0.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
28+
- curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.1.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
3029
# Download Helm
31-
- curl https://raw.githubusercontent.com/helm/helm/master/scripts/get > get_helm.sh && chmod +x get_helm.sh && sudo ./get_helm.sh
30+
- curl https://raw.githubusercontent.com/helm/helm/master/scripts/get > get_helm.sh && chmod +x get_helm.sh && sudo ${TRAVIS_BUILD_DIR}/get_helm.sh
3231
# Socat is required fo proper Helm operation
3332
- sudo apt-get update && sudo apt-get install -y socat
3433
# TODO Install sudo apt install nfs-kernel-server
3534
# - sudo apt install -y nfs-kernel-server
36-
- cat ./etc/helm/values.yaml
35+
- cat ${TRAVIS_BUILD_DIR}/etc/helm/values.yaml
3736

3837
before_script:
39-
- sudo bash ./scripts/host/configure_ubuntu_travis.sh
40-
- cat ./tests/include/configuration.sh
41-
- cat ./scripts/host/k_rebuild_environment.sh
42-
- cat ./init_project.sh
43-
- cat ./etc/config.yaml.dist
44-
# - cat ./tests/_files/* # TODO: Cannot cat because of directory, move configs to a separate directory
45-
- cat ./scripts/host/get_path_to_php.sh
38+
- sudo bash ${TRAVIS_BUILD_DIR}/scripts/host/configure_ubuntu_travis.sh
39+
- cat ${TRAVIS_BUILD_DIR}/tests/include/configuration.sh
40+
- cat ${TRAVIS_BUILD_DIR}/scripts/host/k_upgrade_environment.sh
41+
- cat ${TRAVIS_BUILD_DIR}/scripts/host/k_install_environment.sh
42+
- cat ${TRAVIS_BUILD_DIR}/init_project.sh
43+
- cat ${TRAVIS_BUILD_DIR}/etc/instance/config.yaml.dist
44+
- cat ${TRAVIS_BUILD_DIR}/etc/env/config.yaml.dist
45+
# - cat ${TRAVIS_BUILD_DIR}/tests/_files/* # TODO: Cannot cat because of directory, move configs to a separate directory
46+
- cat ${TRAVIS_BUILD_DIR}/scripts/host/get_path_to_php.sh
4647
- while sleep 540; do echo "=====[ $SECONDS seconds still running ]====="; done &
4748

48-
after_script:
49+
after_failure:
4950
- sudo kubectl describe pods
5051
- sudo kubectl describe deployments
5152
- sudo kubectl get pv,pvc
5253
- sudo kubectl logs -l app=magento -c monolith-xdebug
5354
- sudo kubectl logs -l app=magento -c monolith
5455
- sudo kubectl logs -l app=magento -c nginx
55-
- sudo cat ./logs/*
56-
- sudo cat ./tests/tmp/test/current-test.log
57-
- sudo cat ./tests/tmp/test/magento2-devbox/log/*
56+
- sudo cat ${TRAVIS_BUILD_DIR}/tests/logs/*
57+
- sudo cat ${TRAVIS_BUILD_DIR}/tests/tmp/test/current-test.log
5858
- sudo cat /etc/exports
59+
- sudo cat /etc/hosts
60+
# TODO: Travis is cutting long logs due to race condition (bug in travis)
61+
#- sudo cat ${TRAVIS_BUILD_DIR}/tests/tmp/test/magento2-devbox/log/*
62+
63+
after_script:
5964
- kill %1

README.md

+40-33
Large diffs are not rendered by default.

etc/.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
config.yaml
2-
composer/auth.json
1+
context.txt

etc/composer/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
auth.json

etc/env/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/*.yaml

etc/env/config.yaml.dist

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
guest:
2+
# [To apply changes: init_project.sh -f] NFS will be used for folder synchronization on *nix and OSX hosts by default.
3+
use_nfs: 1
4+
# [To apply changes: init_project.sh -f] The placeholder IP will be replaced with auto-detected value, unless modified manually before execution of "init_project.sh" script.
5+
nfs_server_ip: "0.0.0.0"
6+
# [To apply changes: devbox reload] Default is 2Gb, around 3Gb is necessary to run functional tests.
7+
memory: 2048
8+
# Recommended number of CPUs is 2
9+
cpus: 1
10+
ip_address: "192.168.10.2"
11+
forwarded_ssh_port: 3000
12+
13+
environment:
14+
# [To apply changes: devbox reload] Valid versions: 5.6, 7.0, 7.1, 7.2
15+
php_version: "7.0"
16+
composer_prefer_source: 0
17+
# [To apply changes: m-reinstall OR m-varnish enable/disable]
18+
use_varnish: 1
19+
# [To apply changes: m-reinstall] Possible values: mysql, elasticsearch
20+
search_engine: "elasticsearch"
21+
22+
debug:
23+
# [Changes applied immediately] Enable detailed output from all scripts provided by current devbox project
24+
devbox_project: 0

etc/helm/templates/_helpers.tpl

+179
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,182 @@ Create chart name and version as used by the chart label.
3030
{{- define "magento.chart" -}}
3131
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
3232
{{- end -}}
33+
34+
{{- define "common.nginx.config" -}}
35+
root $MAGE_ROOT/pub;
36+
37+
index index.php;
38+
autoindex off;
39+
charset UTF-8;
40+
error_page 404 403 = /errors/404.php;
41+
#add_header "X-UA-Compatible" "IE=Edge";
42+
43+
# PHP entry point for setup application
44+
location ~* ^/setup($|/) {
45+
root $MAGE_ROOT;
46+
location ~ ^/setup/index.php {
47+
fastcgi_pass fastcgi_backend;
48+
49+
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
50+
fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=600";
51+
fastcgi_read_timeout 600s;
52+
fastcgi_connect_timeout 600s;
53+
54+
fastcgi_index index.php;
55+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
56+
include fastcgi_params;
57+
}
58+
59+
location ~ ^/setup/(?!pub/). {
60+
deny all;
61+
}
62+
63+
location ~ ^/setup/pub/ {
64+
add_header X-Frame-Options "SAMEORIGIN";
65+
}
66+
}
67+
68+
# PHP entry point for update application
69+
location ~* ^/update($|/) {
70+
root $MAGE_ROOT;
71+
72+
location ~ ^/update/index.php {
73+
fastcgi_split_path_info ^(/update/index.php)(/.+)$;
74+
fastcgi_pass fastcgi_backend;
75+
fastcgi_index index.php;
76+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
77+
fastcgi_param PATH_INFO $fastcgi_path_info;
78+
include fastcgi_params;
79+
}
80+
81+
# Deny everything but index.php
82+
location ~ ^/update/(?!pub/). {
83+
deny all;
84+
}
85+
86+
location ~ ^/update/pub/ {
87+
add_header X-Frame-Options "SAMEORIGIN";
88+
}
89+
}
90+
91+
location / {
92+
try_files $uri $uri/ /index.php$is_args$args;
93+
}
94+
95+
location /pub/ {
96+
location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
97+
deny all;
98+
}
99+
alias $MAGE_ROOT/pub/;
100+
add_header X-Frame-Options "SAMEORIGIN";
101+
}
102+
103+
location /static/ {
104+
# Uncomment the following line in production mode
105+
# expires max;
106+
107+
# Remove signature of the static files that is used to overcome the browser cache
108+
location ~ ^/static/version {
109+
rewrite ^/static/(version[^/]+/)?(.*)$ /static/$2 last;
110+
}
111+
112+
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|json)$ {
113+
add_header Cache-Control "public";
114+
add_header X-Frame-Options "SAMEORIGIN";
115+
expires +1y;
116+
117+
if (!-f $request_filename) {
118+
rewrite ^/static/?(.*)$ /static.php?resource=$1 last;
119+
}
120+
}
121+
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
122+
add_header Cache-Control "no-store";
123+
add_header X-Frame-Options "SAMEORIGIN";
124+
expires off;
125+
126+
if (!-f $request_filename) {
127+
rewrite ^/static/?(.*)$ /static.php?resource=$1 last;
128+
}
129+
}
130+
if (!-f $request_filename) {
131+
rewrite ^/static/?(.*)$ /static.php?resource=$1 last;
132+
}
133+
add_header X-Frame-Options "SAMEORIGIN";
134+
}
135+
136+
location /media/ {
137+
try_files $uri $uri/ /get.php$is_args$args;
138+
139+
location ~ ^/media/theme_customization/.*\.xml {
140+
deny all;
141+
}
142+
143+
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
144+
add_header Cache-Control "public";
145+
add_header X-Frame-Options "SAMEORIGIN";
146+
expires +1y;
147+
try_files $uri $uri/ /get.php$is_args$args;
148+
}
149+
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
150+
add_header Cache-Control "no-store";
151+
add_header X-Frame-Options "SAMEORIGIN";
152+
expires off;
153+
try_files $uri $uri/ /get.php$is_args$args;
154+
}
155+
add_header X-Frame-Options "SAMEORIGIN";
156+
}
157+
158+
location /media/customer/ {
159+
deny all;
160+
}
161+
162+
location /media/downloadable/ {
163+
deny all;
164+
}
165+
166+
location /media/import/ {
167+
deny all;
168+
}
169+
170+
# PHP entry point for main application
171+
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
172+
try_files $uri =404;
173+
fastcgi_pass $fastcgi_backend_name;
174+
fastcgi_buffers 1024 4k;
175+
176+
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
177+
fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
178+
fastcgi_read_timeout 600s;
179+
fastcgi_connect_timeout 600s;
180+
181+
fastcgi_index index.php;
182+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
183+
include fastcgi_params;
184+
}
185+
186+
gzip on;
187+
gzip_disable "msie6";
188+
189+
gzip_comp_level 6;
190+
gzip_min_length 1100;
191+
gzip_buffers 16 8k;
192+
gzip_proxied any;
193+
gzip_types
194+
text/plain
195+
text/css
196+
text/js
197+
text/xml
198+
text/javascript
199+
application/javascript
200+
application/x-javascript
201+
application/json
202+
application/xml
203+
application/xml+rss
204+
image/svg+xml;
205+
gzip_vary on;
206+
207+
# Banned locations (only reached if the earlier PHP entry point regexes don't match)
208+
location ~* (\.php$|\.htaccess$|\.git) {
209+
deny all;
210+
}
211+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{- define "common.nginx.servers.config" -}}
2+
server {
3+
listen "{{ .Values.global.monolith.service.nginxPort }}";
4+
server_name magento.default;
5+
set $MAGE_ROOT {{.Values.global.monolith.volumeHostPath}}/default;
6+
{{- include "common.nginx.config" . | nindent 2 }}
7+
}
8+
{{- end -}}

0 commit comments

Comments
 (0)