init commit

This commit is contained in:
Danyliuk 2022-10-29 22:46:44 +03:00
commit 43fd54cd9b
12 changed files with 357 additions and 0 deletions

109
.gitignore vendored Normal file
View File

@ -0,0 +1,109 @@
php_errors.log
*.tmp
*.pyc
.DS_Store
/.idea/
/bootstrap.php
/build
/composer.phar
/config/config*
/config/*.pem
/crossdomain.xml
/documentation
/docs/
/favicon.ico
/js/yui*
/misc/*.dat
/misc/*.dat.gz
/misc/*.tar.gz
/misc/*.mmdb
/misc/user/logo-header.png
/misc/user/logo.png
/misc/user/logo.svg
/misc/user/favicon.png
/piwik-min.js
/plugins/*.zip
/plugins/ImageGraph/fonts/unifont.ttf
/plugins/ImageGraph/fonts/unifont.ttf.zip
/plugins/*/tests/System/processed
/plugins/*/Test/System/processed
/plugins/*/tests/UI/processed-ui-screenshots
/plugins/*/Test/UI/processed-ui-screenshots
/plugins/*/tests/UI/screenshot-diffs
/plugins/*/Test/UI/screenshot-diffs
/robots.txt
/tmp/*
!/tmp/.gitkeep
!/tmp/CACHEDIR.TAG
/vendor/
/.cache
/.externalToolBuilders
/.idea/*
/.metadata
/.project
/.settings
/*.buildpath
/tests/javascript/unittest.dbf
/tests/javascript/unittest2.dbf
/tests/lib/geoip-files/*.dat*
/tests/lib/xhprof*
/tests/PHPUnit/System/processed/
/tests/PHPUnit/phpunit.xml
/tests/results/
/.htaccess
/config/.htaccess
/core/.htaccess
/js/.htaccess
/lang/.htaccess
/libs/.htaccess
/misc/.htaccess
/misc/user/.htaccess
/misc/cron/.htaccess
/plugins/.htaccess
/tests/resources/overlay-test-site-real/
/tests/PHPUnit/.phpunit.result.cache
/tests/PHPUnit/proxy/libs
/tests/PHPUnit/proxy/piwik.js
/tests/PHPUnit/proxy/matomo.js
/tests/PHPUnit/proxy/plugins
/tests/PHPUnit/proxy/tests
/tests/PHPUnit/proxy/misc
/tests/resources/piwik.test.js
/tests/resources/matomo.test.js
/config/*.config.ini.php
/Vagrantfile
/misc/vagrant
/.vagrant
/plugins/.gitignore
/js/container*.js
/.docker
docker-compose.yml
/node_modules/*
!/node_modules/angular
!/node_modules/angular-animate
!/node_modules/angular-cookies
!/node_modules/angular-mocks
!/node_modules/angular-sanitize
!/node_modules/chroma-js
!/node_modules/iframe-resizer
!/node_modules/jquery
!/node_modules/jquery-mousewheel
!/node_modules/jquery-ui-dist
!/node_modules/jquery.browser
!/node_modules/jquery.dotdotdot
!/node_modules/jquery.scrollto
!/node_modules/materialize-css
!/node_modules/mousetrap
!/node_modules/ng-dialog
!/node_modules/qrcodejs2
!/node_modules/sprintf-js
!/node_modules/visibilityjs
/node_modules/vue/*
!/node_modules/vue
!/node_modules/vue/dist
/plugins/*/vue/dist/demo.html
/plugins/*/vue/dist/*.common.js
/plugins/*/vue/dist/*.map
/plugins/*/vue/dist/*.development.*
/plugins/CoreVue/polyfills/dist/MatomoPolyfills.min.js.map
/@types

10
antora.yml Normal file
View File

@ -0,0 +1,10 @@
name: matomo-documentation
title: Matomo documentation
version: 1.0.1
start_page: general.adoc
asciidoc:
attributes:
source-language: asciidoc@
table-caption: false
nav:
- modules/ROOT/nav.adoc

11
k8s/backend-matomo.yaml Normal file
View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: matomo-playground
spec:
type: ClusterIP
selector:
app: matomo-playground
ports:
- protocol: TCP
port: 8081

11
k8s/backend-mysql.yaml Normal file
View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: mysql-playground
spec:
type: ClusterIP
selector:
app: matomo-playground
ports:
- protocol: TCP
port: 3306

View File

@ -0,0 +1,19 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: matomo-playground
spec:
replicas: 1
selector:
matchLabels:
app: matomo
template:
metadata:
labels:
app: matomo
spec:
containers:
- name: matomo
image: matomo:4.12.0-apache
ports:
- containerPort: 8081

38
k8s/deployment-mysql.yaml Normal file
View File

@ -0,0 +1,38 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql-playground
labels:
app: matomo-playground
spec:
selector:
matchLabels:
app: matomo-playground
tier: mysql-playground
strategy:
type: Recreate
template:
metadata:
labels:
app: matomo-playground
tier: mysql-playground
spec:
containers:
- image: mysql:8.0.31
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-pass
key: password
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: oleksii-mysql-pv-claim

25
k8s/ingress-matomo.yaml Normal file
View File

@ -0,0 +1,25 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: oleksii-matomo
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.middlewares: traefik-sso@kubernetescrd
traefik.ingress.kubernetes.io/router.tls: "true"
external-dns.alpha.kubernetes.io/target: traefik.k-space.ee
spec:
rules:
- host: oleksii-matomo.k-space.ee
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: matomo-playground
port:
number: 8081
tls:
- hosts:
- "*.k-space.ee"

25
k8s/ingress-mysql.yaml Normal file
View File

@ -0,0 +1,25 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: oleksii-mysql
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.middlewares: traefik-sso@kubernetescrd
traefik.ingress.kubernetes.io/router.tls: "true"
external-dns.alpha.kubernetes.io/target: traefik.k-space.ee
spec:
rules:
- host: oleksii-mysql.k-space.ee
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: matomo-playground
port:
number: 3306
tls:
- hosts:
- "*.k-space.ee"

4
k8s/kustomization.yaml Normal file
View File

@ -0,0 +1,4 @@
secretGenerator:
- name: mysql-pass
literals:
- password=helloworld

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: oleksii-mysql-pv-claim
labels:
app: matomo-playground
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi

1
modules/ROOT/nav.adoc Normal file
View File

@ -0,0 +1 @@
* xref:general.adoc[]

View File

@ -0,0 +1,92 @@
:toc: right
= Matomo
https://hub.docker.com/_/matomo/[Official docker image].
Steps:
. create Ingress object
== Ingress
[source, yaml]
----
include::../.././../k8s/ingress-matomo.yaml[]
----
kubectl describe ingress ingress-matomo -n playground
kubectl describe ingress -n playground
kubectl describe ingress ingress-resource-backend -n playground
=== Error
docker run --name=some-mysql -e MYSQL_ROOT_PASSWORD=admin123 -d mysql
docker run --name myadmin -d --link testsql:db -p 8080:80 phpmyadmin/phpmyadmin
docker run --name myadmin -d --link dockermysqlrabbitmq_mysql:db -p 8080:80 phpmyadmin/phpmyadmin
docker run -d --link dockermysqlrabbitmq_mysql_1:db -v matomo:/var/www/html -p 8080:80 matomo
docker exec -ti dockermysqlrabbitmq_mysql_1 bash
docker-compose up --build
== Backend or Service
[source,yaml]
----
include::../.././../k8s/backend-matomo.yaml[]
----
https://kubernetes.io/docs/concepts/services-networking/ingress/#resource-backend[Resource backends documentation]
== Deployment
[source,yaml]
----
include::../.././../k8s/deployment-matomo.yaml[]
----
Logging UI https://playground.k-space.ee[address]
== Useful commands
kubectl delete ingress matomo-ingress
kubectl get ep -n playground
kubectl config use-context default
kubectl config get-contexts
journalctl -u kubelet
journalctl -f
ip route list
kubectl apply -f k8s/ -n playground
alias k="kubectl -n sb-4m3khtc9b8"
== Secret
[source,bash]
----
cat <<EOF >./kustomization.yaml
secretGenerator:
- name: mysql-pass
literals:
- password=helloworld
EOF
----