Browse Source

Mediawiki convertido a helm

main
Celestino Rey 2 years ago
parent
commit
e1a4664e9d
14 changed files with 426 additions and 4 deletions
  1. +4
    -4
      HTTPS/docker-compose.yml
  2. +17
    -0
      HTTPS/docker-compose.yml.copia
  3. +14
    -0
      HelmCharts/helmMediawiki.sh
  4. +23
    -0
      HelmCharts/mediawiki-chart/.helmignore
  5. +24
    -0
      HelmCharts/mediawiki-chart/Chart.yaml
  6. +85
    -0
      HelmCharts/mediawiki-chart/templates/mediawiki-deployment.yaml
  7. +9
    -0
      HelmCharts/mediawiki-chart/templates/mediawiki-secrets.yaml
  8. +73
    -0
      HelmCharts/mediawiki-chart/templates/mysql-deployment-mw.yaml
  9. +57
    -0
      HelmCharts/mediawiki-chart/templates/php-myadmin-mw-deployment.yaml
  10. +11
    -0
      HelmCharts/mediawiki-chart/templates/registry-secrets.yaml
  11. +82
    -0
      HelmCharts/mediawiki-chart/values.yaml
  12. +4
    -0
      HelmCharts/preparaMediawiki/mw-namespace.yaml
  13. +12
    -0
      HelmCharts/preparaMediawiki/pv-local-mediawiki.yaml
  14. +11
    -0
      HelmCharts/preparaMediawiki/pv-local-mysql-mw.yaml

+ 4
- 4
HTTPS/docker-compose.yml View File

@ -8,10 +8,10 @@ services:
- 443:443
restart: always
volumes:
- ./nginx/conf:/etc/nginx/conf.d/:ro
- ./certbot/www:/var/www/certbot/:ro
- /mnt/cluster/miweb/conf:/etc/nginx/conf.d/:ro
- /mnt/cluster/miweb/www:/var/www/certbot/:ro
certbot:
image: certbot/certbot:latest
volumes:
- ./certbot/www/:/var/www/certbot/:rw
- ./certbot/conf/:/etc/letsencrypt/:rw
- /mnt/cluster/miweb/certbot/www/:/var/www/certbot/:rw
- /mnt/cluster/miweb/certbot/conf/:/etc/letsencrypt/:rw

+ 17
- 0
HTTPS/docker-compose.yml.copia View File

@ -0,0 +1,17 @@
version: '3'
services:
webserver:
image: nginx:latest
ports:
- 80:80
- 443:443
restart: always
volumes:
- ./nginx/conf:/etc/nginx/conf.d/:ro
- ./certbot/www:/var/www/certbot/:ro
certbot:
image: certbot/certbot:latest
volumes:
- ./certbot/www/:/var/www/certbot/:rw
- ./certbot/conf/:/etc/letsencrypt/:rw

+ 14
- 0
HelmCharts/helmMediawiki.sh View File

@ -0,0 +1,14 @@
#!/bin/bash
if [ "$1" = "i" ]
then
kubectl apply -f ./preparaMediawiki/mw-namespace.yaml
kubectl apply -f ./preparaMediawiki/pv-local-mysql-mw.yaml
kubectl apply -f ./preparaMediawiki/pv-local-mediawiki.yaml
helm install mediawiki mediawiki-chart/
else
helm uninstall mediawiki
kubectl delete -f ./preparaMediawiki/mw-namespace.yaml
kubectl delete -f ./preparaMediawiki/pv-local-mysql-mw.yaml
kubectl delete -f ./preparaMediawiki/pv-local-mediawiki.yaml
fi

+ 23
- 0
HelmCharts/mediawiki-chart/.helmignore View File

@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

+ 24
- 0
HelmCharts/mediawiki-chart/Chart.yaml View File

@ -0,0 +1,24 @@
apiVersion: v2
name: mediawiki-chart
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

+ 85
- 0
HelmCharts/mediawiki-chart/templates/mediawiki-deployment.yaml View File

@ -0,0 +1,85 @@
apiVersion: v1
kind: Service
metadata:
name: mediawiki
namespace: mediawiki
labels:
app: mediawiki
spec:
type: NodePort
ports:
- port: 80
nodePort: 30098
targetPort: mediawiki
selector:
app: mediawiki
tier: frontend
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mw-pv-claim
namespace: mediawiki
labels:
app: mediawiki
spec:
accessModes:
- ReadWriteOnce
storageClassName: ""
resources:
requests:
storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mediawiki
namespace: mediawiki
labels:
app: mediawiki
spec:
selector:
matchLabels:
app: mediawiki
tier: frontend
strategy:
type: Recreate
template:
metadata:
labels:
app: mediawiki
tier: frontend
spec:
containers:
# - image: mediawiki
- image: docker-registry:32000/mediawiki:1.0
name: mediawiki
env:
- name: DB_TYPE
value: mysql
- name: DB_NAME
value: mediawiki
- name: DB_HOST
value: mediawiki-mysql
- name: DB_PASS
valueFrom:
secretKeyRef:
name: mysqlmw-pass
key: password
- name: DB_USER
valueFrom:
secretKeyRef:
name: mysqlmw-pass
key: db_user
ports:
- containerPort: 80
name: mediawiki
volumeMounts:
- name: mediawiki-persistent-storage
mountPath: /var/www/html
imagePullSecrets:
- name: reg-cred-secret
volumes:
- name: mediawiki-persistent-storage
persistentVolumeClaim:
claimName: mw-pv-claim

+ 9
- 0
HelmCharts/mediawiki-chart/templates/mediawiki-secrets.yaml View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: mysqlmw-pass
namespace: mediawiki
data:
password: RHNhLTAyMTM=
db_user: cm9vdA==
db_passwd: RHNhLTAyMTM=

+ 73
- 0
HelmCharts/mediawiki-chart/templates/mysql-deployment-mw.yaml View File

@ -0,0 +1,73 @@
apiVersion: v1
kind: Service
metadata:
name: mediawiki-mysql
namespace: mediawiki
labels:
app: mediawiki
spec:
type: NodePort
ports:
- name: mysql
port: 3306
nodePort: 30381
targetPort: mysql
selector:
app: mediawiki
tier: mysql
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-mw-pv-claim
namespace: mediawiki
labels:
app: mediawiki
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mediawiki-mysql
namespace: mediawiki
labels:
app: mediawiki
spec:
selector:
matchLabels:
app: mediawiki
tier: mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: mediawiki
tier: mysql
spec:
containers:
- image: docker-registry:32000/mariadb:1.0
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysqlmw-pass
key: password
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
imagePullSecrets:
- name: reg-cred-secret
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-mw-pv-claim

+ 57
- 0
HelmCharts/mediawiki-chart/templates/php-myadmin-mw-deployment.yaml View File

@ -0,0 +1,57 @@
apiVersion: v1
kind: Service
metadata:
name: phpmyadmin-mediawiki
namespace: mediawiki
labels:
app: mediawiki
spec:
selector:
app: mediawiki
tier: phpmyadmin
type: NodePort
ports:
- name: phpadmin
port: 80
nodePort: 30380
targetPort: phpmyadm
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: phpmyadmin-mediawiki
namespace: mediawiki
labels:
app: mediawiki
spec:
selector:
matchLabels:
app: mediawiki
tier: phpmyadmin
strategy:
type: Recreate
template:
metadata:
labels:
app: mediawiki
tier: phpmyadmin
spec:
containers:
- name: phpmyadmin
image: docker-registry:32000/phpmyadmin:1.0
ports:
- containerPort: 80
name: phpmyadm
env:
- name: PMA_HOST
value: mediawiki-mysql
- name: PMA_PORT
value: "3306"
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysqlmw-pass
key: password
imagePullSecrets:
- name: reg-cred-secret

+ 11
- 0
HelmCharts/mediawiki-chart/templates/registry-secrets.yaml View File

@ -0,0 +1,11 @@
apiVersion: v1
data:
.dockerconfigjson: eyJhdXRocyI6eyJkb2NrZXItcmVnaXN0cnk6MzIwMDAiOnsidXNlcm5hbWUiOiJjcmV5bG9wZXoiLCJwYXNzd29yZCI6IlJleS0xMTc2IiwiYXV0aCI6IlkzSmxlV3h2Y0dWNk9sSmxlUzB4TVRjMiJ9fX0=
kind: Secret
metadata:
creationTimestamp: "2023-01-29T10:54:14Z"
name: reg-cred-secret
namespace: mediawiki
resourceVersion: "19890385"
uid: 66b3b7c5-26c1-4e5a-af4e-dc973aaafe4b
type: kubernetes.io/dockerconfigjson

+ 82
- 0
HelmCharts/mediawiki-chart/values.yaml View File

@ -0,0 +1,82 @@
# Default values for mediawiki-chart.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: nginx
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
imagePullSecrets: [reg-cred-secret]
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: NodePort
port: 80
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}

+ 4
- 0
HelmCharts/preparaMediawiki/mw-namespace.yaml View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: mediawiki

+ 12
- 0
HelmCharts/preparaMediawiki/pv-local-mediawiki.yaml View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: mw-folder
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/cluster/mediawiki/mediawiki"

+ 11
- 0
HelmCharts/preparaMediawiki/pv-local-mysql-mw.yaml View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: mw-data
spec:
capacity:
storage: 20Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/cluster/mediawiki/mediawiki-db"

Loading…
Cancel
Save