diff --git a/charts/hub-server/Chart.yaml b/charts/hub-server/Chart.yaml index 4534898..9dc09a4 100644 --- a/charts/hub-server/Chart.yaml +++ b/charts/hub-server/Chart.yaml @@ -5,4 +5,4 @@ maintainers: - email: dustin@elegantthemes.com name: Elegant Themes name: hub-server -version: 1.1.1 +version: 1.1.9 diff --git a/charts/hub-server/templates/_helpers.tpl b/charts/hub-server/templates/_helpers.tpl new file mode 100644 index 0000000..9c8a8a1 --- /dev/null +++ b/charts/hub-server/templates/_helpers.tpl @@ -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 }} diff --git a/charts/hub-server/templates/hub-server.yml b/charts/hub-server/templates/hub-server.yml index f520cd0..71b689a 100644 --- a/charts/hub-server/templates/hub-server.yml +++ b/charts/hub-server/templates/hub-server.yml @@ -21,7 +21,7 @@ metadata: labels: app: {{ .Release.Name }} spec: - replicas: {{ .Values.REPLICAS }} + replicas: 3 strategy: rollingUpdate: maxSurge: 0 @@ -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 @@ -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' @@ -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' @@ -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 @@ -144,3 +190,6 @@ spec: hostPath: path: /srv type: DirectoryOrCreate + - name: config + secret: + secretName: secrets diff --git a/charts/hub-server/templates/secrets.yml b/charts/hub-server/templates/secrets.yml index 4e26dc6..cd3685f 100644 --- a/charts/hub-server/templates/secrets.yml +++ b/charts/hub-server/templates/secrets.yml @@ -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 }} diff --git a/charts/hub-server/values.yaml b/charts/hub-server/values.yaml index d0718b4..796bec7 100644 --- a/charts/hub-server/values.yaml +++ b/charts/hub-server/values.yaml @@ -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: