Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elegantthemes/helm-charts
Browse files Browse the repository at this point in the history
  • Loading branch information
bitfade committed Jul 3, 2024
2 parents 0fef04b + 7e755ab commit dcd6611
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 13 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.1
version: 1.1.9
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 }}
67 changes: 58 additions & 9 deletions charts/hub-server/templates/hub-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ metadata:
labels:
app: {{ .Release.Name }}
spec:
replicas: {{ .Values.REPLICAS }}
replicas: 3
strategy:
rollingUpdate:
maxSurge: 0
Expand Down Expand Up @@ -67,15 +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 @@ -85,14 +123,14 @@ spec:
- name: PHP_OPCACHE_VALIDATE_TIMESTAMPS
value: "1"

image: {{ .Values.ET_IMAGE | squote }}
image: {{ .Values.HUB_SERVER_IMAGE | squote }}
livenessProbe:
exec:
command:
- '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 @@ -108,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 @@ -121,17 +159,25 @@ 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
- name: config
mountPath: /config
readOnly: true

{{ 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 All @@ -144,3 +190,6 @@ spec:
hostPath:
path: /srv
type: DirectoryOrCreate
- name: config
secret:
secretName: secrets
6 changes: 4 additions & 2 deletions charts/hub-server/templates/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ stringData:
GITHUB_TOKEN: {{ .Values.GITHUB_TOKEN | squote }}
.env: |
APP_ENV={{ .Values.HUB_SERVER_ENV | squote }}
APP_URL={{ .Values.VIRTUAL_HOST | squote }}
APP_URL='https://{{ .Values.VIRTUAL_HOST }}'
DIVI_HUB_ENDPOINT={{ .Values.DIVI_HUB_ENDPOINT | squote }}
DIVI_HUB_WEBSITES_QUEUE_SIZE={{ .Values.DIVI_HUB_WEBSITES_QUEUE_SIZE | squote }}
DIVI_HUB_IP_ADDRESS={{ .Values.DIVI_HUB_IP_ADDRESS | squote }}
DIVI_HUB_PRIVATE_KEY_64={{ .Values.DIVI_HUB_PRIVATE_KEY_64 | b64enc | squote }}
HUB_SERVER_PATH={{ .Values.INSTALL_PATH | squote }}
HUB_SERVER_PATH={{ .Values.HUB_SERVER_PATH | squote }}
HUB_SERVER_REPO_URL={{ .Values.HUB_SERVER_REPO_URL | squote }}
IMAGE_VERSION={{ .Values.HUB_SERVER_VERSION | squote }}
REDIS_HOST={{ .Values.REDIS_HOSTNAME | squote }}
REDIS_SENTINEL_HOST={{ .Values.REDIS_HOSTNAME | squote }}
REDIS_SENTINEL_SERVICE={{ .Values.REDIS_SENTINEL_SERVICE | squote }}
VIRTUAL_HOST={{ .Values.VIRTUAL_HOST | squote }}
6 changes: 5 additions & 1 deletion charts/hub-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ DIVI_HUB_PRIVATE_KEY_64:
DIVI_HUB_WEBSITES_QUEUE_SIZE:
GITHUB_TOKEN:
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:
VIRTUAL_HOST:

0 comments on commit dcd6611

Please sign in to comment.