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

Commit 938f48c

Browse files
committed
Merge remote-tracking branch 'remotes/mainline/master' into checkout-improvements
# Conflicts: # etc/helm/charts/monolith/templates/magento2-deployment.yaml
2 parents a69910f + d2f4fe6 commit 938f48c

Some content is hidden

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

63 files changed

+8727
-103
lines changed

.travis.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
sudo: required
2+
# Dummy changes 123
3+
# We need the systemd for the kubeadm and it's default from 16.04+
4+
dist: xenial
5+
# This moves Kubernetes specific config files.
6+
env:
7+
- CHANGE_MINIKUBE_NONE_USER=true
8+
9+
before_script:
10+
# Make root mounted as rshared to fix kube-dns issues.
11+
- sudo mount --make-rshared /
12+
# Download kubectl, which is a requirement for using minikube. Had to install kubeadm on local VM https://kubernetes.io/docs/setup/independent/install-kubeadm/
13+
- 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/
14+
# Download Minikube.
15+
- curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.30.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
16+
# Download Helm
17+
- curl https://raw.githubusercontent.com/helm/helm/master/scripts/get > get_helm.sh && chmod +x get_helm.sh && sudo ./get_helm.sh
18+
# Socat is required fo proper Helm operation
19+
- sudo apt-get update && sudo apt-get install -y socat
20+
# TODO Install sudo apt install nfs-kernel-server
21+
- sudo apt install -y nfs-kernel-server
22+
- sudo ./scripts/host/configure_nfs_exports.sh
23+
- cp ./tests/include/configuration.sh.dist ./tests/include/configuration.sh
24+
- sed -i "s|git@github.com:|https://github.com/|g" ./etc/config.yaml.dist
25+
- sed -i "s|minikube start --cpus=2 --memory=4096|sudo minikube start --cpus=2 --memory=4096 --vm-driver=none --bootstrapper=kubeadm --kubernetes-version=v1.13.0|g" ./init_project.sh
26+
- sed -i "s|&& eval \$(minikube docker-env) ||g" ./scripts/host/k_rebuild_environment.sh
27+
- sed -i "s/set global.persistence.nfs.serverIp=\"192.168.99.1\"/set global.persistence.nfs.serverIp=\"$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')\"/g" ./scripts/host/k_rebuild_environment.sh
28+
- sed -i "s/enabled:\ true \# NFS Status/enabled:\ false \# NFS Status/g" ./etc/helm/values.yaml
29+
30+
script:
31+
# Run DevBox tests
32+
- cd ./tests && sudo bash ./testsuite.sh && cd ..

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ The software listed below should be available in [PATH](https://en.wikipedia.org
118118
```
119119
helm init-magento -e
120120
```
121-
If yiu have issues with nfs. To use filesystem mount instead of nfs use -d parameter to init_project.sh call.
121+
If you have issues with nfs. To use filesystem mount instead of nfs use -d parameter to init_project.sh call.
122122
```
123123
helm init-magento -d
124124
```

etc/docker/monolith-with-xdebug/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ FROM magento2-monolith:dev
22

33
RUN sed -i "s|;zend_extension=xdebug.so|zend_extension=xdebug.so|g" /usr/local/etc/php/conf.d/zz-xdebug-settings.ini
44
RUN sed -i "s|listen = 0.0.0.0:9001|listen = 0.0.0.0:9002|g" /usr/local/etc/php-fpm.conf
5+

etc/docker/monolith/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
FROM paliarush123/minikube-php-fpm:latest
22

33
RUN sed -i "s|listen = 0.0.0.0:9000|listen = 0.0.0.0:9001|g" /usr/local/etc/php-fpm.conf
4+
5+
# RUN apt-get update && apt-get install -y nfs-common && rm -rf /var/lib/apt/lists/*

etc/helm/charts/monolith/templates/default-sources-volume-claim.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ spec:
1010
resources:
1111
requests:
1212
storage: 2Gi
13-
{{- end }}
13+
{{- end }}

etc/helm/charts/monolith/templates/default-sources-volume.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ spec:
1111
storageClassName: standard
1212
persistentVolumeReclaimPolicy: Retain
1313
nfs:
14-
server: 192.168.99.1
14+
server: {{.Values.global.persistence.nfs.serverIp}}
1515
path: {{.Values.global.monolith.volumeHostPath}}
1616
{{- end }}
Lines changed: 86 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,91 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: {{ include "monoloth.fullname" . }}
5-
labels:
6-
app.kubernetes.io/name: {{ include "monoloth.name" . }}
7-
helm.sh/chart: {{ include "monoloth.chart" . }}
8-
app.kubernetes.io/instance: {{ .Release.Name }}
9-
app.kubernetes.io/managed-by: {{ .Release.Service }}
10-
spec:
11-
selector:
12-
matchLabels:
13-
app.kubernetes.io/name: {{ include "monoloth.name" . }}
14-
app.kubernetes.io/instance: {{ .Release.Name }}
15-
strategy:
16-
type: Recreate
17-
template:
18-
metadata:
19-
labels:
4+
name: {{ include "monoloth.fullname" . }}
5+
labels:
206
app.kubernetes.io/name: {{ include "monoloth.name" . }}
7+
helm.sh/chart: {{ include "monoloth.chart" . }}
218
app.kubernetes.io/instance: {{ .Release.Name }}
22-
spec:
23-
containers:
24-
- name: {{ .Chart.Name }}
25-
image: magento2-monolith:dev
26-
imagePullPolicy: Never
27-
ports:
28-
- containerPort: {{ .Values.global.monolith.service.port }}
29-
volumeMounts:
30-
- name: code
31-
mountPath: {{.Values.global.monolith.volumeHostPath}}
32-
env:
33-
- name: VAGRANT_ROOT
34-
value: {{.Values.global.monolith.volumeHostPath}}
35-
- name: COMPOSER_HOME
36-
value: {{.Values.global.monolith.volumeHostPath}}/.composer
37-
- name: MAGENTO_ROOT
38-
value: {{.Values.global.monolith.volumeHostPath}}/magento
39-
- name: MAGENTO_ROOT_HOST
40-
value: {{.Values.global.monolith.volumeHostPath}}/magento
41-
- name: VAGRANT_ROOT_HOST
42-
value: {{.Values.global.monolith.volumeHostPath}}
43-
- name: IS_WINDOWS_HOST
44-
value: "0"
45-
- name: {{ .Chart.Name }}-xdebug
46-
image: magento2-monolith:dev-xdebug
47-
imagePullPolicy: Never
48-
ports:
49-
- containerPort: {{ .Values.xdebugService.port }}
50-
volumeMounts:
51-
- name: code
52-
mountPath: {{.Values.global.monolith.volumeHostPath}}
53-
env:
54-
- name: VAGRANT_ROOT
55-
value: {{.Values.global.monolith.volumeHostPath}}
56-
- name: COMPOSER_HOME
57-
value: {{.Values.global.monolith.volumeHostPath}}/.composer
58-
- name: MAGENTO_ROOT
59-
value: {{.Values.global.monolith.volumeHostPath}}/magento
60-
- name: MAGENTO_ROOT_HOST
61-
value: {{.Values.global.monolith.volumeHostPath}}/magento
62-
- name: VAGRANT_ROOT_HOST
63-
value: {{.Values.global.monolith.volumeHostPath}}
64-
- name: IS_WINDOWS_HOST
65-
value: "0"
66-
- name: nginx
67-
image: nginx:1.9
68-
volumeMounts:
69-
- name: code
70-
mountPath: {{.Values.global.monolith.volumeHostPath}}
71-
- name: nginx-config-volume
72-
mountPath: /etc/nginx/nginx.conf
73-
subPath: nginx.conf
74-
volumes:
75-
- name: nginx-config-volume
76-
configMap:
77-
name: {{ template "monoloth.fullname" . }}-nginx-config
78-
- name: code
79-
{{- if .Values.global.persistence.nfs.enabled }}
80-
persistentVolumeClaim:
81-
claimName: {{ include "monoloth.fullname" . }}-claim
82-
{{- else }}
83-
hostPath:
84-
path: {{.Values.global.monolith.volumeHostPath}}
85-
{{- end -}}
9+
app.kubernetes.io/managed-by: {{ .Release.Service }}
10+
spec:
11+
selector:
12+
matchLabels:
13+
app.kubernetes.io/name: {{ include "monoloth.name" . }}
14+
app.kubernetes.io/instance: {{ .Release.Name }}
15+
strategy:
16+
type: Recreate
17+
template:
18+
metadata:
19+
labels:
20+
app.kubernetes.io/name: {{ include "monoloth.name" . }}
21+
app.kubernetes.io/instance: {{ .Release.Name }}
22+
spec:
23+
containers:
24+
- name: {{ .Chart.Name }}
25+
image: magento2-monolith:dev
26+
imagePullPolicy: Never
27+
securityContext:
28+
privileged: true
29+
ports:
30+
- containerPort: {{ .Values.global.monolith.service.port }}
31+
volumeMounts:
32+
- name: code
33+
mountPath: {{.Values.global.monolith.volumeHostPath}}
34+
env:
35+
- name: VAGRANT_ROOT
36+
value: {{.Values.global.monolith.volumeHostPath}}
37+
- name: COMPOSER_HOME
38+
value: {{.Values.global.monolith.volumeHostPath}}/.composer
39+
- name: MAGENTO_ROOT
40+
value: {{.Values.global.monolith.volumeHostPath}}/magento
41+
- name: MAGENTO_ROOT_HOST
42+
value: {{.Values.global.monolith.volumeHostPath}}/magento
43+
- name: VAGRANT_ROOT_HOST
44+
value: {{.Values.global.monolith.volumeHostPath}}
45+
- name: IS_WINDOWS_HOST
46+
value: "0"
47+
- name: {{ .Chart.Name }}-xdebug
48+
image: magento2-monolith:dev-xdebug
49+
imagePullPolicy: Never
50+
securityContext:
51+
privileged: true
52+
ports:
53+
- containerPort: {{ .Values.xdebugService.port }}
54+
volumeMounts:
55+
- name: code
56+
mountPath: {{.Values.global.monolith.volumeHostPath}}
57+
env:
58+
- name: VAGRANT_ROOT
59+
value: {{.Values.global.monolith.volumeHostPath}}
60+
- name: COMPOSER_HOME
61+
value: {{.Values.global.monolith.volumeHostPath}}/.composer
62+
- name: MAGENTO_ROOT
63+
value: {{.Values.global.monolith.volumeHostPath}}/magento
64+
- name: MAGENTO_ROOT_HOST
65+
value: {{.Values.global.monolith.volumeHostPath}}/magento
66+
- name: VAGRANT_ROOT_HOST
67+
value: {{.Values.global.monolith.volumeHostPath}}
68+
- name: IS_WINDOWS_HOST
69+
value: "0"
70+
- name: nginx
71+
image: nginx:1.9
72+
securityContext:
73+
privileged: true
74+
volumeMounts:
75+
- name: code
76+
mountPath: {{.Values.global.monolith.volumeHostPath}}
77+
- name: nginx-config-volume
78+
mountPath: /etc/nginx/nginx.conf
79+
subPath: nginx.conf
80+
volumes:
81+
- name: nginx-config-volume
82+
configMap:
83+
name: {{ template "monoloth.fullname" . }}-nginx-config
84+
- name: code
85+
{{- if .Values.global.persistence.nfs.enabled }}
86+
persistentVolumeClaim:
87+
claimName: {{ include "monoloth.fullname" . }}-claim
88+
{{- else }}
89+
hostPath:
90+
path: {{.Values.global.monolith.volumeHostPath}}
91+
{{- end }}

etc/helm/values.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ global:
4343
volumeHostPath: /Users/user/Projects/magento2-kubernetes-for-developers
4444
persistence:
4545
nfs:
46-
enabled: true
46+
enabled: true # NFS Status
47+
serverIp: 192.168.99.1
4748

4849
resources: {}
4950
# Uncomment the following
@@ -67,11 +68,17 @@ mysql:
6768
service:
6869
type: NodePort
6970
nodePort: 30306
71+
persistence:
72+
size: 4Gi
7073

7174
redis:
7275
usePassword: false
7376
master:
7477
disableCommands: []
78+
persistence:
79+
enabled: false
80+
cluster:
81+
enabled: false
7582

7683
rabbitmq:
7784
serviceType: NodePort

init_project.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,11 @@ cd "${vagrant_dir}"
238238

239239
if [[ $(isMinikubeRunning) -eq 0 ]]; then
240240
status "Starting minikube"
241-
#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
242-
minikube start --cache-images --cpus=2 --memory=4096
241+
minikube start --cpus=2 --memory=4096
243242
minikube addons enable ingress
244243
minikube addons enable heapster
245244
# hanged in some cases todo
246-
# minikube start --cpus=2 --memory=4096 2> >(logError) | {
245+
# minikube start --cache-images --cpus=2 --memory=4096 2> >(logError) | {
247246
# while IFS= read -r line
248247
# do
249248
# filterVagrantOutput "${line}"

k-restart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ if [[ $(isMinikubeRunning) -eq 1 || $(isMinikubeSaved) -eq 1 ]]; then
1111
minikube stop 2> >(logError)
1212
fi
1313

14-
minikube start --cache-images --cpus=2 --memory=4096 2> >(logError)
14+
# TODO: Avoid duplication with init_project.sh
15+
minikube start --cpus=2 --memory=4096 2> >(logError)
1516

1617
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)"

k-start

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ resetNestingLevel
99

1010
if [[ ! $(isMinikubeRunning) -eq 1 ]]; then
1111
// TDOO: Eliminate duplication with k-restart
12-
minikube start --cache-images --cpus=2 --memory=4096 2> >(logError)
12+
minikube start --cpus=2 --memory=4096 2> >(logError)
1313
fi
1414

1515

scripts/host/check_requirements.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ source "${vagrant_dir}/scripts/functions.sh"
77
status "Checking requirements"
88
incrementNestingLevel
99

10-
nfs_exports_record="\"${vagrant_dir}\" -alldirs -mapall=$(id -u):$(id -g) -mask 255.0.0.0 -network 192.0.0.0"
11-
if [[ -z "$(grep "${nfs_exports_record}" /etc/exports)" ]]; then
12-
warning "NFS exports configuration required on the host. Please execute 'bash ${vagrant_dir}/scripts/host/configure_nfs_exports.sh' first."
13-
exit 1
14-
fi
10+
# TODO: Fix NFS requirements check
11+
#nfs_exports_record="\"${vagrant_dir}\" -alldirs -mapall=$(id -u):$(id -g) -mask 255.0.0.0 -network 192.0.0.0"
12+
#if [[ -z "$(grep "${nfs_exports_record}" /etc/exports)" ]]; then
13+
# warning "NFS exports configuration required on the host. Please execute 'bash ${vagrant_dir}/scripts/host/configure_nfs_exports.sh' first."
14+
# exit 1
15+
#fi
1516

1617
decrementNestingLevel

scripts/host/configure_nfs_exports.sh

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,33 @@ if [[ ${debug_vagrant_project} -eq 1 ]]; then
1414
set -x
1515
fi
1616

17-
nfs_exports_record="\"${vagrant_dir}\" -alldirs -mapall=$(id -u):$(id -g) -mask 255.0.0.0 -network 192.0.0.0"
18-
if [[ -z "$(grep "${nfs_exports_record}" /etc/exports)" ]]; then
19-
status "Updating /etc/exports to enable codebase sharing with containers via NFS"
20-
echo "${nfs_exports_record}" | sudo tee -a "/etc/exports" 2> >(logError) > >(log)
21-
sudo nfsd restart
22-
# TODO: Implement NFS exports clean up on project removal to prevent NFS mounting errors
23-
else
24-
warning "NFS exports are properly configured and do not need to be updated"
17+
host_os="$(bash "${vagrant_dir}/scripts/host/get_host_os.sh")"
18+
19+
# TODO: Calculate network IP
20+
if [[ ${host_os} == "OSX" ]]; then
21+
# TODO: Detect network IP dynamically
22+
nfs_exports_record="\"${vagrant_dir}\" -alldirs -mapall=$(id -u):$(id -g) -mask 255.0.0.0 -network 192.0.0.0"
23+
if [[ -z "$(grep "${nfs_exports_record}" /etc/exports)" ]]; then
24+
status "Updating /etc/exports to enable codebase sharing with containers via NFS"
25+
echo "${nfs_exports_record}" | sudo tee -a "/etc/exports" 2> >(logError) > >(log)
26+
sudo nfsd restart
27+
# TODO: Implement NFS exports clean up on project removal to prevent NFS mounting errors
28+
else
29+
warning "NFS exports are properly configured and do not need to be updated"
30+
fi
31+
fi
32+
33+
if [[ ${host_os} == "Linux" ]]; then
34+
# TODO: Detect network IP dynamically
35+
nfs_exports_record="\"${vagrant_dir}\" 172.17.0.0/255.255.0.0(rw,no_subtree_check,all_squash,anonuid=$(id -u),anongid=$(id -g))"
36+
if [[ -z "$(grep "${nfs_exports_record}" /etc/exports)" ]]; then
37+
status "Updating /etc/exports to enable codebase sharing with containers via NFS"
38+
echo "${nfs_exports_record}" | sudo tee -a "/etc/exports" 2> >(logError) > >(log)
39+
sudo service nfs-kernel-server restart
40+
# TODO: Implement NFS exports clean up on project removal to prevent NFS mounting errors
41+
else
42+
warning "NFS exports are properly configured and do not need to be updated"
43+
fi
2544
fi
2645

2746
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)"

scripts/host/k_rebuild_environment.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cd "${vagrant_dir}/scripts" && eval $(minikube docker-env) && docker build -t ma
1515
# TODO: Delete does not work when no releases created yet
1616
cd "${vagrant_dir}/etc/helm"
1717
set +e
18-
helm list -q | xargs helm delete --purge
18+
helm list -q | xargs helm delete --purge 2>/dev/null
1919
set -e
2020

2121
# TODO: Need to make sure all resources have been successfully deleted before the attempt of recreating them
@@ -29,18 +29,25 @@ while getopts 'de' flag; do
2929
*) error "Unexpected option" && exit 1;;
3030
esac
3131
done
32+
33+
# TODO: Make it work on OSX hosts
34+
# --set global.persistence.nfs.serverIp="$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" \
3235
cd "${vagrant_dir}/etc/helm" && helm install \
3336
--name magento2 \
3437
--values values.yaml \
3538
--wait \
39+
--set global.persistence.nfs.serverIp="192.168.99.1" \
3640
--set global.monolith.volumeHostPath="${vagrant_dir}" \
3741
--set global.persistence.nfs.enabled="${enable_nfs}" \
3842
--set global.checkout.enabled="${enable_checkout}" \
3943
--set global.checkout.volumeHostPath="${vagrant_dir}" .
4044

4145
# TODO: Waiting for containers to initialize before proceeding
46+
#waitForKubernetesPodToRun 'tiller-deploy'
4247
#waitForKubernetesPodToRun 'magento2-monolith'
4348
#waitForKubernetesPodToRun 'magento2-mysql'
4449
#waitForKubernetesPodToRun 'magento2-redis-master'
4550

51+
#sleep 20
52+
4653
exit 0

tests/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.idea
2+
/include/configuration.sh
3+
/include/auth.json

0 commit comments

Comments
 (0)