Skip to content

Commit 21bdf2e

Browse files
committed
Docker
0 parents  commit 21bdf2e

33 files changed

Lines changed: 1533 additions & 0 deletions

.examples/apache/compose.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
services:
3+
db:
4+
image: mariadb:lts
5+
command: --max-allowed-packet=64MB
6+
restart: always
7+
volumes:
8+
- db:/var/lib/mysql:Z
9+
environment:
10+
- MARIADB_AUTO_UPGRADE=1
11+
- MARIADB_DATABASE=matomo
12+
- MARIADB_DISABLE_UPGRADE_BACKUP=1
13+
- MARIADB_INITDB_SKIP_TZINFO=1
14+
- MARIADB_PASSWORD=${MARIADB_PASSWORD}
15+
- MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}
16+
- MARIADB_USER=matomo
17+
18+
app:
19+
image: matomo
20+
restart: always
21+
volumes:
22+
# - ./config:/var/www/html/config:z
23+
# - ./logs:/var/www/html/logs:z
24+
- matomo:/var/www/html:z
25+
depends_on:
26+
- db
27+
environment:
28+
- MATOMO_DATABASE_ADAPTER=mysql
29+
- MATOMO_DATABASE_DBNAME=matomo
30+
- MATOMO_DATABASE_HOST=db
31+
- MATOMO_DATABASE_PASSWORD=${MARIADB_PASSWORD}
32+
- MATOMO_DATABASE_TABLES_PREFIX=matomo_
33+
- MATOMO_DATABASE_USERNAME=matomo
34+
ports:
35+
- 8080:80
36+
37+
volumes:
38+
db:
39+
matomo:

.examples/helm/.helmignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

.examples/helm/Chart.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
appVersion: "1.0"
3+
description: A Helm chart for Kubernetes
4+
name: matomo
5+
version: 0.1.0

.examples/helm/templates/NOTES.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range .Values.ingress.hosts }}
4+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
5+
{{- end }}
6+
{{- else if contains "NodePort" .Values.service.type }}
7+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "matomo.fullname" . }})
8+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
9+
echo http://$NODE_IP:$NODE_PORT
10+
{{- else if contains "LoadBalancer" .Values.service.type }}
11+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
12+
You can watch the status of by running 'kubectl get svc -w {{ template "matomo.fullname" . }}'
13+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "matomo.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
14+
echo http://$SERVICE_IP:{{ .Values.service.port }}
15+
{{- else if contains "ClusterIP" .Values.service.type }}
16+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "matomo.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
17+
echo "Visit http://127.0.0.1:8080 to use your application"
18+
kubectl port-forward $POD_NAME 8080:80
19+
{{- end }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "matomo.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "matomo.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "matomo.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ template "matomo.fullname" . }}
5+
labels:
6+
app: {{ template "matomo.name" . }}
7+
chart: {{ template "matomo.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
data:
11+
nginx.conf: |
12+
# nginx.conf for php
13+
events {
14+
worker_connections 768;
15+
}
16+
17+
http {
18+
upstream backend {
19+
server localhost:9000;
20+
}
21+
22+
include /etc/nginx/mime.types;
23+
default_type application/octet-stream;
24+
gzip on;
25+
gzip_disable "msie6";
26+
27+
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
28+
# scheme used to connect to this server
29+
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
30+
default $http_x_forwarded_proto;
31+
'' $scheme;
32+
}
33+
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
34+
# server port the client connected to
35+
map $http_x_forwarded_port $proxy_x_forwarded_port {
36+
default $http_x_forwarded_port;
37+
'' $server_port;
38+
}
39+
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
40+
# Connection header that may have been passed to this server
41+
map $http_upgrade $proxy_connection {
42+
default upgrade;
43+
'' close;
44+
}
45+
# Set appropriate X-Forwarded-Ssl header
46+
map $scheme $proxy_x_forwarded_ssl {
47+
default off;
48+
https on;
49+
}
50+
# HTTP 1.1 support
51+
proxy_http_version 1.1;
52+
proxy_buffering off;
53+
proxy_set_header Host $http_host;
54+
proxy_set_header Upgrade $http_upgrade;
55+
proxy_set_header Connection $proxy_connection;
56+
proxy_set_header X-Real-IP $remote_addr;
57+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
58+
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
59+
proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl;
60+
proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;
61+
proxy_set_header Proxy "";
62+
63+
server {
64+
listen 80;
65+
66+
root /var/www/html/;
67+
index index.php index.html index.htm;
68+
69+
location / {
70+
try_files $uri $uri/ =404;
71+
}
72+
73+
error_page 404 /404.html;
74+
error_page 500 502 503 504 /50x.html;
75+
location = /50x.html {
76+
root /usr/share/nginx/html;
77+
}
78+
79+
location = /favicon.ico {
80+
log_not_found off;
81+
access_log off;
82+
}
83+
84+
location ~ \.php$ {
85+
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
86+
fastcgi_param SERVER_SOFTWARE nginx;
87+
fastcgi_param QUERY_STRING $query_string;
88+
fastcgi_param REQUEST_METHOD $request_method;
89+
fastcgi_param CONTENT_TYPE $content_type;
90+
fastcgi_param CONTENT_LENGTH $content_length;
91+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
92+
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
93+
fastcgi_param REQUEST_URI $request_uri;
94+
fastcgi_param DOCUMENT_URI $document_uri;
95+
fastcgi_param DOCUMENT_ROOT $document_root;
96+
fastcgi_param SERVER_PROTOCOL $server_protocol;
97+
fastcgi_param REMOTE_ADDR $remote_addr;
98+
fastcgi_param REMOTE_PORT $remote_port;
99+
fastcgi_param SERVER_ADDR $server_addr;
100+
fastcgi_param SERVER_PORT $server_port;
101+
fastcgi_param SERVER_NAME $server_name;
102+
fastcgi_intercept_errors on;
103+
fastcgi_pass backend;
104+
}
105+
}
106+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
apiVersion: apps/v1beta2
2+
kind: Deployment
3+
metadata:
4+
name: {{ template "matomo.fullname" . }}
5+
labels:
6+
app: {{ template "matomo.name" . }}
7+
chart: {{ template "matomo.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
spec:
11+
replicas: {{ .Values.replicaCount }}
12+
selector:
13+
matchLabels:
14+
app: {{ template "matomo.name" . }}
15+
release: {{ .Release.Name }}
16+
template:
17+
metadata:
18+
labels:
19+
app: {{ template "matomo.name" . }}
20+
release: {{ .Release.Name }}
21+
spec:
22+
containers:
23+
- name: {{ .Chart.Name }}-nginx
24+
image: "{{ .Values.matomoNginx.image.repository }}:{{ .Values.matomoNginx.image.tag }}"
25+
imagePullPolicy: {{ .Values.matomoNginx.image.pullPolicy }}
26+
command: ["nginx", "-g", "daemon off;", "-c", "/config/nginx.conf"]
27+
ports:
28+
- name: http
29+
containerPort: 80
30+
protocol: TCP
31+
# livenessProbe:
32+
# httpGet:
33+
# path: /
34+
# port: http
35+
# readinessProbe:
36+
# httpGet:
37+
# path: /
38+
# port: http
39+
volumeMounts:
40+
- mountPath: /config
41+
name: config
42+
- mountPath: /var/www/html
43+
name: html-files
44+
- name: {{ .Chart.Name }}
45+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
46+
imagePullPolicy: {{ .Values.image.pullPolicy }}
47+
ports:
48+
- name: http
49+
containerPort: 9000
50+
protocol: TCP
51+
volumeMounts:
52+
- mountPath: /var/www/html
53+
name: html-files
54+
resources:
55+
{{ toYaml .Values.resources | indent 12 }}
56+
{{- with .Values.nodeSelector }}
57+
nodeSelector:
58+
{{ toYaml . | indent 8 }}
59+
{{- end }}
60+
{{- with .Values.affinity }}
61+
affinity:
62+
{{ toYaml . | indent 8 }}
63+
{{- end }}
64+
{{- with .Values.tolerations }}
65+
tolerations:
66+
{{ toYaml . | indent 8 }}
67+
{{- end }}
68+
volumes:
69+
- name: config
70+
configMap:
71+
name: {{ template "matomo.fullname" . }}
72+
- name: html-files
73+
emptyDir: {}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "matomo.fullname" . -}}
3+
{{- $ingressPath := .Values.ingress.path -}}
4+
apiVersion: extensions/v1beta1
5+
kind: Ingress
6+
metadata:
7+
name: {{ $fullName }}
8+
labels:
9+
app: {{ template "matomo.name" . }}
10+
chart: {{ template "matomo.chart" . }}
11+
release: {{ .Release.Name }}
12+
heritage: {{ .Release.Service }}
13+
{{- with .Values.ingress.annotations }}
14+
annotations:
15+
{{ toYaml . | indent 4 }}
16+
{{- end }}
17+
spec:
18+
{{- if .Values.ingress.tls }}
19+
tls:
20+
{{- range .Values.ingress.tls }}
21+
- hosts:
22+
{{- range .hosts }}
23+
- {{ . }}
24+
{{- end }}
25+
secretName: {{ .secretName }}
26+
{{- end }}
27+
{{- end }}
28+
rules:
29+
{{- range .Values.ingress.hosts }}
30+
- host: {{ . }}
31+
http:
32+
paths:
33+
- path: {{ $ingressPath }}
34+
backend:
35+
serviceName: {{ $fullName }}
36+
servicePort: http
37+
{{- end }}
38+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ template "matomo.fullname" . }}
5+
labels:
6+
app: {{ template "matomo.name" . }}
7+
chart: {{ template "matomo.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
spec:
11+
type: {{ .Values.service.type }}
12+
ports:
13+
- port: {{ .Values.service.port }}
14+
targetPort: http
15+
protocol: TCP
16+
name: http
17+
selector:
18+
app: {{ template "matomo.name" . }}
19+
release: {{ .Release.Name }}

0 commit comments

Comments
 (0)