-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
103 changed files
with
1,559 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/.vagrant | ||
/.idea | ||
/.composer | ||
/log/*.log | ||
/scripts/.current_nesting_level | ||
/scripts/.current_log_path | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
/* | ||
!/.gitignore | ||
!/docker | ||
!/composer | ||
/composer/* | ||
!/composer/auth.json.dist | ||
!/config.yaml.dist | ||
!/magento2_virtual_host.conf.dist | ||
!/guest | ||
!/guest | ||
!/kubernetes | ||
!/helm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM magento2-monolith:dev | ||
|
||
RUN sed -i "s|;zend_extension=xdebug.so|zend_extension=xdebug.so|g" /usr/local/etc/php/conf.d/zz-xdebug-settings.ini | ||
RUN sed -i "s|listen = 0.0.0.0:9001|listen = 0.0.0.0:9002|g" /usr/local/etc/php-fpm.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM paliarush123/minikube-php-fpm:latest | ||
|
||
RUN sed -i "s|listen = 0.0.0.0:9000|listen = 0.0.0.0:9001|g" /usr/local/etc/php-fpm.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ | ||
charts/checkout/sources/* | ||
sources/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
appVersion: "1.0" | ||
description: A Helm chart for Kubernetes | ||
name: monolith | ||
version: 0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Magento Kubernetes components | ||
|
||
Install minikube. | ||
|
||
Start minikube. And use docker env. | ||
|
||
```bash | ||
minikube start | ||
eval $(minikube docker-env) | ||
``` | ||
|
||
Install helm (cluster should be run to set tiller). [Install guide](https://docs.helm.sh/using_helm/#installing-helm) | ||
|
||
|
||
## NFS server (optional) | ||
|
||
Configure your sources directory as export (/etc/exports) in the NFS server that runs on your host machine. This way containers can mount source code. This is a lot faster than a default VirtualBox shared folder mount. You only have to do this once, the NFS service will load /etc/exports at (re)boot. | ||
|
||
NOTE: The Minikube IP can be different after a minikube delete and minikube start command. Make sure that your NFS export contains the correct Minikube IP again. | ||
|
||
[More info](http://pietervogelaar.nl/minikube-nfs-mounts) | ||
|
||
### Mac OS X | ||
If you do not have python, install it using brew: | ||
```bash | ||
brew install python | ||
``` | ||
echo "$(python -c 'import os,sys;print(os.path.realpath(".")')/sources -alldirs -mapall="$(id -u)":"$(id -g))" $(minikube ip)" | sudo tee -a /etc/exports && sudo nfsd restart | ||
Check if the entry is active by executing on your host machine: | ||
|
||
```bash | ||
showmount -e 127.0.0.1 | ||
``` | ||
|
||
This should output something like: | ||
|
||
```bash | ||
Exports list on 127.0.0.1: | ||
/Absolute/path/to/magento 192.168.99.100 | ||
``` | ||
|
||
There is also variable in values.yml which should be enabled | ||
|
||
## Run deployments | ||
|
||
Configuration values located in values.yaml | ||
|
||
To run all charts execute next command: | ||
|
||
```bash | ||
helm install --values values.yaml . | ||
``` | ||
|
||
(temporary) Magento sources should be cloned to source path in current chart and in checkout subchart as well. | ||
|
||
DB password autogenerated in container, to check it list pods: | ||
```bash | ||
kubectl get pods | ||
``` | ||
|
||
choose one of mysql pods end run bash in it: | ||
|
||
```bash | ||
kubectl exec -it release-1-some-mysql-pod bash | ||
``` | ||
|
||
Observe env variables with prefix MYSQL_ | ||
|
||
## Clean | ||
|
||
To delete releases run: | ||
``` | ||
helm delete $(helm list -q) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
appVersion: "1.0" | ||
description: A Helm chart for Kubernetes | ||
name: checkout | ||
version: 0.1.0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
include mime.types; | ||
default_type application/octet-stream; | ||
sendfile on; | ||
keepalive_timeout 65; | ||
|
||
upstream fastcgi_backend { | ||
server 127.0.0.1:9000; | ||
} | ||
|
||
server { | ||
listen 80 default_server; | ||
listen [::]:80 default_server; | ||
|
||
server_name _; | ||
set $MAGE_ROOT {{.Values.global.checkout.volumeHostPath}}; | ||
include {{.Values.global.checkout.volumeHostPath}}/nginx.conf.sample; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dependencies: | ||
- name: mysql | ||
repository: https://kubernetes-charts.storage.googleapis.com/ | ||
version: 0.9.2 | ||
digest: sha256:5f1ec2d74a44651865b038da4fb76dc9d5ee04084a1db574c50657ba1b0d96fc | ||
generated: 2019-01-03T00:55:37.077265-08:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dependencies: | ||
- name: mysql | ||
version: "0.9.2" | ||
appVersion: 5.7.14 | ||
repository: "@stable" | ||
alias: checkout-mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "checkout.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "checkout.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "checkout.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} |
49 changes: 49 additions & 0 deletions
49
etc/helm/charts/checkout/templates/checkout-deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "checkout.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "checkout.name" . }} | ||
helm.sh/chart: {{ include "checkout.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ include "checkout.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: {{ include "checkout.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
spec: | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
- containerPort: 80 | ||
volumeMounts: | ||
- name: {{ .Chart.Name }}-code | ||
mountPath: {{.Values.global.checkout.volumeHostPath}} | ||
- name: {{ .Chart.Name }}-nginx | ||
image: nginx:1.9 | ||
volumeMounts: | ||
- name: {{ .Chart.Name }}-code | ||
mountPath: {{.Values.global.checkout.volumeHostPath}} | ||
- name: {{ template "checkout.fullname" . }}-nginx-config-volume | ||
mountPath: /etc/nginx/nginx.conf | ||
subPath: nginx.conf | ||
volumes: | ||
- name: {{ template "checkout.fullname" . }}-nginx-config-volume | ||
configMap: | ||
name: {{ template "checkout.fullname" . }}-nginx-config | ||
- name: {{ .Chart.Name }}-code | ||
{{- if .Values.persistence.nfs.enabled }} | ||
persistentVolumeClaim: | ||
claimName: {{ include "checkout.fullname" . }}-claim | ||
{{- else }} | ||
hostPath: | ||
path: {{.Values.global.checkout.volumeHostPath}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ template "checkout.fullname" . }}-nginx-config | ||
data: | ||
nginx.conf: {{.Files.Get "etc/nginx.conf" | printf "%s" | indent 4}} |
14 changes: 14 additions & 0 deletions
14
etc/helm/charts/checkout/templates/default-sources-volume-claim.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{{- if .Values.persistence.nfs.enabled }} | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ include "checkout.fullname" . }}-claim | ||
namespace: default | ||
spec: | ||
storageClassName: standard | ||
accessModes: | ||
- ReadWriteMany | ||
resources: | ||
requests: | ||
storage: 2Gi | ||
{{- end }} |
19 changes: 19 additions & 0 deletions
19
etc/helm/charts/checkout/templates/default-sources-volume.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{- if .Values.persistence.nfs.enabled }} | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: {{ include "checkout.fullname" . }}-volume | ||
spec: | ||
capacity: | ||
storage: 2Gi | ||
accessModes: | ||
- ReadWriteMany | ||
storageClassName: standard | ||
nfs: | ||
# The address 192.168.99.1 is the Minikube gateway to the host. This way | ||
# not the container IP will be visible by the NFS server on the host machine, | ||
# but the IP address of the `minikube ip` command. You will need to | ||
# grant access to the `minikube ip` IP address. | ||
server: 192.168.99.1 | ||
path: {{.Values.global.checkout.volumeHostPath}} | ||
{{- end }} |
Oops, something went wrong.