Finished setting up chart

This commit is contained in:
2023-03-19 10:07:25 +00:00
parent da2afcd24b
commit e8095a7674
8 changed files with 287 additions and 118 deletions

View File

@@ -2,5 +2,5 @@ apiVersion: v2
name: cloudypress
description: A helm chart for deploying Wordpress on Cloudyne Hosting
type: application
version: 0.1.0
version: 0.1.5
appVersion: "6.1.1"

View File

@@ -10,5 +10,13 @@ spec:
kind: ClusterIssuer
secretName: {{ include "..fullname" . }}-cert-secret
commonName: {{ .Values.site.url }}
dnsNames: {{ range .Values.site.ingressNames }}
- {{ . }}{{end}}
dnsNames:
- {{ .Values.site.url | replace "www." "" }}
- www.{{ .Values.site.url | replace "www." "" }}
- {{ .Values.site.url | replace "www." "" | replace "." "-" }}.eu.cust.azurecd.net
- www.{{ .Values.site.url | replace "www." "" | replace "." "-" }}.eu.cust.azurecd.net
{{- if .Values.site.additionalIngressNames }}
{{- range .Values.site.additionalIngressNames }}
- {{ . }}
{{- end }}
{{- end }}

View File

@@ -13,18 +13,18 @@ data:
WP_HOME: {{ .Values.site.url }}
WP_SITEURL: {{ .Values.site.url }}/wp
{{- if and .values.Site.init .Values.site.init.composerPackage }}
{{- if and .Values.site.init .Values.site.init.composerPackage }}
RUN_COMPOSER: "true"
INSTALL_SITE: {{ .Values.site.init.composerPackage }}
SET_THEME: {{ .Values.site.init.themeName | default "" }}
{{- end }}
{{- if and .values.Site.init .Values.site.init.content .Values.site.init.content.import }}
{{- if and .Values.site.init .Values.site.init.content .Values.site.init.content.import }}
RUN_IMPORTS: "true"
IMPORT_CONTENT: {{ .Values.site.init.content.url }}
{{- end }}
{{- if and .values.Site.init .Values.site.init.database .Values.site.init.database.import }}
{{- if and .Values.site.init .Values.site.init.database .Values.site.init.database.import }}
RUN_DATABASEIMPORTS: "true"
IMPORT_DATABASE: {{ .Values.site.init.database.url }}
FORCE_IMPORT_DB: {{ .Values.site.init.database.force | default "false" }}
@@ -34,7 +34,7 @@ data:
kind: ConfigMap
apiVersion: v1
metadata:
name: {{ include "..fullname" . }}-configfiles
name: {{ include "..fullname" . }}-cfg
labels:
{{- include "..labels" . | nindent 8 }}
data:

View File

@@ -1,63 +1,111 @@
apiVersion: apps/v1
kind: Certificate
kind: Deployment
metadata:
name: {{ include "..fullname" . }}-cert
labels:
{{- include "..labels" . | nindent 8 }}
cloudyne.systems/component: site
name: {{ include "..fullname" . }}-cert
labels:
{{- include "..labels" . | nindent 4 }}
cloudyne.systems/component: site
spec:
{{- if and .Values.customer .Values.customer.package }}
replicas: {{ .Values.customer.package.replicas | default 1 }}
{{- end }}
selector:
matchLabels:
cloudyne.systems/customer: {{ .Values.customer.name }}
cloudyne.systems/site: {{ .Values.site.url }}
template:
metadata:
labels:
cloudyne.systems/customer: {{ .Values.customer.name }}
cloudyne.systems/site: {{ .Values.site.url }}
spec:
securityContext:
fsGroup: 65534
volumes:
- name: cloud
persistentVolumeClaim:
claimName: pvc-{{ include "..fullname" . }}
- name: local
emptyDir: {}
initContainers:
- name: deploy
securityContext:
allowPrivilegeEscalation: false
runAsUser: 0
{{- if .Values.global }}
image: {{ .Values.global.initImage }}:{{ .Values.global.imagetag }}
{{- else }}
image: ghcr.io/cloudynes/php-init:latest
{{- end }}
imagePullPolicy: Always
command: [ "bash", "/init-py/init.sh" ]
volumeMounts:
- name: site
mountPath: /app
{{- if and .Values.site .Values.site.storage .Values.site.storage.cloud .Values.site.storage.cloud.folders }}
{{- range $v := .Values.site.storage.cloud.folders }}
- name: cloud
mountPath: {{ $v.localPath }}
subPath: {{ $v.cloudPath }}
{{- end }}
{{- end }}
envFrom:
- configMapRef:
name: {{ include "..fullname" . }}-env
- secretRef:
name: {{ include "..fullname" . }}-db-auth
containers:
- name: wordpress
securityContext:
runAsUser: 65534
{{- if and .Values.customer .Values.customer.package }}
replicas: {{ .Values.customer.package.replicas | default 1 }}
{{- else }}
replicas: 1
{{- end }}
selector:
matchLabels:
cloudyne.systems/customer: {{ .Values.customer.name }}
cloudyne.systems/site: {{ .Values.site.url }}
template:
metadata:
labels:
cloudyne.systems/customer: {{ .Values.customer.name }}
cloudyne.systems/site: {{ .Values.site.url }}
spec:
securityContext:
fsGroup: 65534
volumes:
- name: cloud
persistentVolumeClaim:
claimName: pvc-{{ include "..fullname" . }}
- name: local
emptyDir: {}
- name: serverconfig
configMap:
name: {{ include "..fullname" . }}-cfg
initContainers:
- name: deploy
securityContext:
allowPrivilegeEscalation: false
runAsUser: 0
{{- if .Values.global }}
image: {{ .Values.global.initImage | default "ghcr.io/cloudynes/php-init" }}:{{ .Values.global.imagetag | default "latest" }}
{{- else }}
image: ghcr.io/cloudynes/php-init:latest
{{- end }}
imagePullPolicy: Always
volumeMounts:
- name: site
mountPath: /app
{{- if and .Values.site .Values.site.storage .Values.site.storage.cloud .Values.site.storage.cloud.folders }}
{{- range $v := .Values.site.storage.cloud.folders }}
- name: cloud
mountPath: {{ $v.localPath }}
subPath: {{ $v.cloudPath }}
{{- end }}
{{- end }}
envFrom:
- configMapRef:
name: {{ include "..fullname" . }}-env
- secretRef:
name: {{ include "..fullname" . }}-db-auth
containers:
- name: wordpress
securityContext:
runAsUser: 65534
{{- if .Values.global }}
image: {{ .Values.global.initImage | default "ghcr.io/cloudynes/php-nginx" }}:{{ .Values.global.imagetag | default "latest" }}
{{- else }}
image: ghcr.io/cloudynes/php-nginx:latest
{{- end }}
imagePullPolicy: Always
volumeMounts:
- name: site
mountPath: /app
- name: serverconfig
mountPath: /etx/nginx/nginx.conf
subPath: nginx.conf
- name: serverconfig
mountPath: /usr/local/etc/php-fpm.d/www.conf
{{- if and .Values.site .Values.site.storage .Values.site.storage.cloud .Values.site.storage.cloud.folders }}
{{- range $v := .Values.site.storage.cloud.folders }}
- name: cloud
mountPath: {{ $v.localPath }}
subPath: {{ $v.cloudPath }}
{{- end }}
{{- end }}
envFrom:
- configMapRef:
name: {{ include "..fullname" . }}-env
- secretRef:
name: {{ include "..fullname" . }}-db-auth
resources:
{{- if and .Values.customer .Values.customer.package .Values.customer.package.cpu }}
requests:
cpu: {{ .Values.customer.package.cpu.avg | default "1000m" }}
memory: {{ .Values.customer.package.mem.avg | default "1Gi" }}
limits:
cpu: {{ .Values.customer.package.cpu.peak | default "1000m" }}
memory: {{ .Values.customer.package.mem.peak | default "1Gi" }}
{{- else }}
requests:
cpu: 1000m
memory: 1Gi
limits:
cpu: 1000m
memory: 1Gi
{{- end }}
ports:
- containerPort: 8080
name: http
protocol: TCP

View File

@@ -0,0 +1,76 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "..fullname" . }}
labels:
{{- include "..labels" . | nindent 4 }}
spec:
ingressClassName: nginx
tls:
- secretName: {{ include "..fullname" . }}-cert-secret
hosts:
- {{ .Values.site.url | replace "www." "" }}
- www.{{ .Values.site.url | replace "www." "" }}
- {{ .Values.site.url | replace "www." "" | replace "." "-" }}.eu.cust.azurecd.net
- www.{{ .Values.site.url | replace "www." "" | replace "." "-" }}.eu.cust.azurecd.net
{{- if .Values.site.additionalIngressNames }}
{{- range .Values.site.additionalIngressNames }}
- {{ . }}
{{- end }}
{{- end }}
rules:
- host: {{ .Values.site.url | replace "www." "" }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "..fullname" . }}
port:
number: 80
- host: www.{{ .Values.site.url | replace "www." "" }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "..fullname" . }}
port:
number: 80
- host: {{ .Values.site.url | replace "www." "" | replace "." "-" }}.eu.cust.azurecd.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "..fullname" . }}
port:
number: 80
- host: www.{{ .Values.site.url | replace "www." "" | replace "." "-" }}.eu.cust.azurecd.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "..fullname" . }}
port:
number: 80
{{- if .Values.site.additionalIngressNames }}
{{- range .Values.site.additionalIngressNames }}
- host: {{ . }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "..fullname" . }}
port:
number: 80
{{- end }}
{{- end }}

View File

@@ -6,7 +6,19 @@ metadata:
{{- include "..labels" . | nindent 4 }}
spec:
hard:
requests.cpu: {{ .Values.customer.package.cpu.avg }}
limits.cpu: {{ .Values.customer.package.cpu.peak }}
requests.memory: {{ .Values.customer.package.mem.avg }}
limits.memory: {{ .Values.customer.package.mem.peak }}
{{- if and .Values.customer .Values.customer.package }}
{{- if .Values.customer.package.cpu }}
requests.cpu: {{ .Values.customer.package.cpu.avg | default "1000m" }}
limits.cpu: {{ .Values.customer.package.cpu.peak | default "1500m"}}
{{- else }}
requests.cpu: 1000m
limits.cpu: 1500m
{{- end }}
{{- if .Values.customer.package.mem }}
requests.memory: {{ .Values.customer.package.mem.avg | default "512Mi" }}
limits.memory: {{ .Values.customer.package.mem.peak | default "1Gi" }}
{{- else }}
requests.memory: 512Mi
limits.memory: 1Gi
{{- end }}
{{- end }}

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "..fullname" . }}-cert
labels:
{{- include "..labels" . | nindent 8 }}
cloudyne.systems/component: site
spec:
ports:
- name: http
port: 80
targetPort: 8080
selector:
cloudyne.systems/customer: {{ .Values.customer.name }}
cloudyne.systems/site: {{ .Values.site.url }}
type: ClusterIP

View File

@@ -2,80 +2,89 @@
customer:
# Customer Name/identifier
name: gunnarnilssonmaskin
name: mycustomer
# Timezone for customer
timezone: "Europe/Stockholm"
# Package/Resource Settings
package:
size: small
replicas: 1
cpu:
avg: 500m
peak: 1000m
mem:
avg: 512Mi
peak: 1Gi
disk: 5Gi
package: {}
# Defaults:
# package:
# size: small
# replicas: 1
# cpu:
# avg: 500m
# peak: 1000m
# mem:
# avg: 512Mi
# peak: 1Gi
# disk: 5Gi
# Website Configuration
site:
# The main URL for the website
url: "www.gunnarnilssonmaskin.se"
# Settings for the webroot (used by Nginx)
webroot:
path: "/app/web"
indexes: "index.php index.html index.htm"
url: "www.mycustomer.com"
# Whether to keep plugins and Wordpress updated
autoUpdate: true
# Storage settings
storage: {}
# Defaults:
# storage:
# cloud:
# class: "premium01"
# type: "Premium_LRS"
# container: "www-mycustomer-com"
# folders:
# - cloudPath: "uploads"
# localPath: "/app/web/app/uploads"
# - cloudyPath: "gallery"
# localPath: "/app/web/app/uploads"
# Initialization Settings
init:
# The composer package that contains the site
composerPackage: "buildahome/gunnarnilssonmaskin-se"
composerPackage: "somens/mycustomer-app"
# The name of the theme which the composer package refers to
themeName: "gunnarnilssonmaskin-se-theme"
themeName: "mycustomer-app-theme"
# Import content to wp-content directory from zip file
content:
import: true
url: "https://www.gunnarnilssonmaskin.se/gunnar.zip"
# Optional: Import content to wp-content directory from zip file
content: {}
# content:
# import: true
# url: "https://mycustomer.com/wp-content-data.zip"
# Optional: Import database from URL
database: {}
# # Import database from URL
# database:
# import: true
# force: false
# url: "https://www.gunnarnilssonmaskin.se/gunnar.sql"
# url: "https://www.mycustomer.com/mysqldump.sql"
# The allowed names for ingress to this site
ingressNames:
- "gunnarnilssonmaskin.se"
- "www.gunnarnilssonmaskin.se"
- "gunnarnilssonmaskin-se.eu.cust.azurecd.net"
- "www-gunnarnilssonmaskin-se.eu.cust.azurecd.net"
# Settings for the webroot (used by Nginx)
webroot: {}
# Storage settings
storage:
# Defaults:
# webroot:
# path: "/app/web"
# indexes: "index.php index.html index.htm"
# Settings for cloud storage
cloud:
# Storage class to use for the cloud storage
class: "premium01"
type: "Premium_LRS"
# Additional ingress names for the site
# Default ingress names are (customer domain: testsite.com, domain = testsite, tld = com):
# - <domain>.<tld>
# - www.<domain>.<tld>
# - <domain>-<tld>.eu.cust.azurecd.net
# - www-<domain>-<tld>.eu.cust.azurecd.net
additionalIngressNames: []
# The container in Azure storage
container: "gunnarnilssonmaskin-se"
# Folders to map up to the Azure storage
folders:
- cloudPath: "uploads"
localPath: "/app/web/app/uploads"
- cloudyPath: "gallery"
localPath: "/app/web/app/uploads"
# Global configuration
global: