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

Commit d2f4fe6

Browse files
authored
Merge pull request #23 from magento/travis-test
Added basic functional CLI tests and integrated with Travis
2 parents 76535e1 + 50e4a37 commit d2f4fe6

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/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/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 "magento.fullname" . }}
5-
labels:
6-
app.kubernetes.io/name: {{ include "magento.name" . }}
7-
helm.sh/chart: {{ include "magento.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 "magento.name" . }}
14-
app.kubernetes.io/instance: {{ .Release.Name }}
15-
strategy:
16-
type: Recreate
17-
template:
18-
metadata:
19-
labels:
4+
name: {{ include "magento.fullname" . }}
5+
labels:
206
app.kubernetes.io/name: {{ include "magento.name" . }}
7+
helm.sh/chart: {{ include "magento.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 "magento.fullname" . }}-nginx-config
78-
- name: code
79-
{{- if .Values.global.persistence.nfs.enabled }}
80-
persistentVolumeClaim:
81-
claimName: {{ include "magento.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 "magento.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 "magento.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 "magento.fullname" . }}-nginx-config
84+
- name: code
85+
{{- if .Values.global.persistence.nfs.enabled }}
86+
persistentVolumeClaim:
87+
claimName: {{ include "magento.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
@@ -228,12 +228,11 @@ cd "${vagrant_dir}"
228228

229229
if [[ $(isMinikubeRunning) -eq 0 ]]; then
230230
status "Starting minikube"
231-
#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
232-
minikube start --cache-images --cpus=2 --memory=4096
231+
minikube start --cpus=2 --memory=4096
233232
minikube addons enable ingress
234233
minikube addons enable heapster
235234
# hanged in some cases todo
236-
# minikube start --cpus=2 --memory=4096 2> >(logError) | {
235+
# minikube start --cache-images --cpus=2 --memory=4096 2> >(logError) | {
237236
# while IFS= read -r line
238237
# do
239238
# 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)"

0 commit comments

Comments
 (0)