Skip to content

Commit

Permalink
feat: update divi-hub chart
Browse files Browse the repository at this point in the history
  • Loading branch information
lots0logs committed Jun 19, 2024
1 parent e1d3f62 commit 07f7569
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 9 deletions.
2 changes: 1 addition & 1 deletion charts/hub-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ maintainers:
- email: dustin@elegantthemes.com
name: Elegant Themes
name: hub-server
version: 1.1.3
version: 1.1.4
36 changes: 36 additions & 0 deletions charts/hub-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{ define "hub.container.worker" }}
- name: worker-{{ .index }}
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: HUB_SERVER_PATH
value: {{ .Values.HUB_SERVER_PATH | squote }}
- name: VIRTUAL_HOST
value: {{ .Values.VIRTUAL_HOST | squote }}
- name: HUB_SERVER_REPO_URL
value: {{ .Values.HUB_SERVER_REPO_URL | squote }}
- name: IMAGE_VERSION
value: {{ .Values.HUB_SERVER_VERSION | squote }}
- name: HUB_SERVER_WORKER
value: '1'
- name: PHP_OPCACHE_FILE_CACHE
value: {{ ternary "/var/cache/php" "" (eq "production" .Values.HUB_SERVER_ENV) | squote }}
- name: PHP_OPCACHE_VALIDATE_TIMESTAMPS
value: {{ ternary "false" "true" (eq "production" .Values.HUB_SERVER_ENV) | squote }}
image: {{ .Values.HUB_SERVER_IMAGE | squote }}
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: '4'
memory: 4G
volumeMounts:
- name: wordpress
mountPath: /srv
- name: config
mountPath: /config
readOnly: true
{{ end }}
56 changes: 49 additions & 7 deletions charts/hub-server/templates/hub-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,53 @@ spec:
namespaces:
- dc-screenshot
topologyKey: kubernetes.io/hostname
initContainers:
- name: init
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: HUB_SERVER_PATH
value: {{ .Values.HUB_SERVER_PATH | squote }}
- name: VIRTUAL_HOST
value: {{ .Values.VIRTUAL_HOST | squote }}
- name: HUB_SERVER_REPO_URL
value: {{ .Values.HUB_SERVER_REPO_URL | squote }}
- name: IMAGE_VERSION
value: {{ .Values.HUB_SERVER_VERSION | squote }}
- name: HUB_SERVER_INIT
value: '1'
- name: PHP_OPCACHE_FILE_CACHE
value: {{ ternary "/var/cache/php" "" (eq "production" .Values.WP_ENV) | squote }}
- name: PHP_OPCACHE_VALIDATE_TIMESTAMPS
value: {{ ternary "false" "true" (eq "production" .Values.WP_ENV) | squote }}
image: {{ .Values.HUB_SERVER_IMAGE | squote }}
command: [ '/etc/cont-init.d/init' ]
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: '4'
memory: 2G
volumeMounts:
- name: wordpress
mountPath: /srv
- name: config
mountPath: /config
readOnly: true

containers:
- name: {{ .Release.Name }}
- name: app
image: {{ .Values.HUB_SERVER_IMAGE | squote }}
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: INSTALL_PATH
value: {{ .Values.INSTALL_PATH | squote }}
- name: HUB_SERVER_PATH
value: {{ .Values.HUB_SERVER_PATH | squote }}
- name: VIRTUAL_HOST
value: {{ .Values.VIRTUAL_HOST | squote }}
- name: PHP_MEMORY_LIMIT
Expand All @@ -93,7 +130,7 @@ spec:
- 'bash'
- '-c'
- 'SCRIPT_NAME=/healthz'
- 'SCRIPT_FILENAME={{ .Values.INSTALL_PATH }}/public/healthz.php'
- 'SCRIPT_FILENAME={{ .Values.HUB_SERVER_PATH }}/public/healthz.php'
- 'REQUEST_METHOD=GET'
- 'cgi-fcgi'
- '-bind'
Expand All @@ -109,7 +146,7 @@ spec:
- 'bash'
- '-c'
- 'SCRIPT_NAME=/healthz'
- 'SCRIPT_FILENAME={{ .Values.INSTALL_PATH }}/public/healthz.php'
- 'SCRIPT_FILENAME={{ .Values.HUB_SERVER_PATH }}/public/healthz.php'
- 'REQUEST_METHOD=GET'
- 'cgi-fcgi'
- '-bind'
Expand All @@ -122,17 +159,22 @@ spec:
memory: 100Mi
limits:
cpu: 5000m
memory: 3G
memory: 2G
startupProbe:
exec:
command:
- cat
- {{ .Values.INSTALL_PATH }}/public/healthz.php
- {{ .Values.HUB_SERVER_PATH }}/public/healthz.php
failureThreshold: 30
periodSeconds: 10
volumeMounts:
- name: wordpress
mountPath: /srv

{{ range $_, $index := untilStep 1 (int .Values.HUB_SERVER_WORKERS) 1 }}
{{ include "hub.container.worker" (dict "Values" $.Values "index" $index) }}
{{ end }}

tolerations:
- key: node.kubernetes.io/disk-pressure
operator: Exists
Expand Down
4 changes: 3 additions & 1 deletion charts/hub-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ HUB_SERVER_ENV:
HUB_SERVER_IMAGE:
HUB_SERVER_REPO_URL:
HUB_SERVER_VERSION:
INSTALL_PATH:
HUB_SERVER_WORKERS:
HUB_SERVER_PATH:
PHP_MEMORY_LIMIT:
PUBLIC_KEY:
REDIS_HOSTNAME:
REDIS_SENTINEL_SERVICE:
Expand Down

0 comments on commit 07f7569

Please sign in to comment.