From a6013a112d0c93556a6f45b63ef7df3d7fa2d429 Mon Sep 17 00:00:00 2001 From: vcarroy Date: Fri, 2 Aug 2024 10:33:27 +0200 Subject: [PATCH 1/2] Add opcache to symfony apps --- components/hydra-sql/files/03_base.ini | 22 +++++++++++++++++++ components/hydra-sql/kustomization.yaml | 3 +++ .../resources/hydra-sql-deployment.yaml | 10 +++++++++ resources/hydra-dispatcher/files/03_base.ini | 22 +++++++++++++++++++ resources/hydra-dispatcher/kustomization.yaml | 3 +++ .../hydra-dispatcher-deployment.yaml | 10 +++++++++ 6 files changed, 70 insertions(+) create mode 100644 components/hydra-sql/files/03_base.ini create mode 100644 resources/hydra-dispatcher/files/03_base.ini diff --git a/components/hydra-sql/files/03_base.ini b/components/hydra-sql/files/03_base.ini new file mode 100644 index 0000000..c416de0 --- /dev/null +++ b/components/hydra-sql/files/03_base.ini @@ -0,0 +1,22 @@ +[opcache] +; Determines if Zend OPCache is enabled +opcache.enable=1 + +; Determines if Zend OPCache is enabled for the CLI version of PHP +opcache.enable_cli=1 + +; The OPcache shared memory storage size. +opcache.memory_consumption=512 + +; The maximum number of keys (scripts) in the OPcache hash table. +; Only numbers between 200 and 1000000 are allowed. +opcache.max_accelerated_files=20000 + +; When disabled, you must reset the OPcache manually or restart the +; webserver for changes to the filesystem to take effect. +opcache.validate_timestamps=${OPCACHE_VALIDATE_TIMESTAMP} + +; How often (in seconds) to check file timestamps for changes to the shared +; memory storage allocation. ("1" means validate once per second, but only +; once per request. "0" means always validate) +opcache.revalidate_freq=${OPCACHE_REVALIDATE_FREQ} \ No newline at end of file diff --git a/components/hydra-sql/kustomization.yaml b/components/hydra-sql/kustomization.yaml index b0b66d5..ae964ce 100644 --- a/components/hydra-sql/kustomization.yaml +++ b/components/hydra-sql/kustomization.yaml @@ -26,3 +26,6 @@ configMapGenerator: - name: sql-login-config files: - ./files/sql_login.yaml +- name: hydra-sql-php-ini + files: + - ./files/03_base.ini diff --git a/components/hydra-sql/resources/hydra-sql-deployment.yaml b/components/hydra-sql/resources/hydra-sql-deployment.yaml index 6287734..204eb41 100644 --- a/components/hydra-sql/resources/hydra-sql-deployment.yaml +++ b/components/hydra-sql/resources/hydra-sql-deployment.yaml @@ -55,10 +55,17 @@ spec: value: 128m - name: PHP_FPM_LOG_LEVEL value: warning + - name: OPCACHE_VALIDATE_TIMESTAMP + value: "0" + - name: OPCACHE_REVALIDATE_FREQ + value: "0" volumeMounts: - name: sql-login-config mountPath: "/app/config/sql_login_configuration/sql_login.yaml" subPath: "sql_login.yaml" + - name: hydra-sql-php-ini + mountPath: /etc/php81/conf.d/03_base.ini + subPath: 03_base.ini - name: hydra-sql-caddy image: reg.cadoles.com/cadoles/hydra-sql-base:2024.6.6-develop.1343.769e7ed @@ -108,5 +115,8 @@ spec: - name: sql-login-config configMap: name: sql-login-config + - name: hydra-sql-php-ini + configMap: + name: hydra-sql-php-ini restartPolicy: Always diff --git a/resources/hydra-dispatcher/files/03_base.ini b/resources/hydra-dispatcher/files/03_base.ini new file mode 100644 index 0000000..c416de0 --- /dev/null +++ b/resources/hydra-dispatcher/files/03_base.ini @@ -0,0 +1,22 @@ +[opcache] +; Determines if Zend OPCache is enabled +opcache.enable=1 + +; Determines if Zend OPCache is enabled for the CLI version of PHP +opcache.enable_cli=1 + +; The OPcache shared memory storage size. +opcache.memory_consumption=512 + +; The maximum number of keys (scripts) in the OPcache hash table. +; Only numbers between 200 and 1000000 are allowed. +opcache.max_accelerated_files=20000 + +; When disabled, you must reset the OPcache manually or restart the +; webserver for changes to the filesystem to take effect. +opcache.validate_timestamps=${OPCACHE_VALIDATE_TIMESTAMP} + +; How often (in seconds) to check file timestamps for changes to the shared +; memory storage allocation. ("1" means validate once per second, but only +; once per request. "0" means always validate) +opcache.revalidate_freq=${OPCACHE_REVALIDATE_FREQ} \ No newline at end of file diff --git a/resources/hydra-dispatcher/kustomization.yaml b/resources/hydra-dispatcher/kustomization.yaml index b3441fe..7ab4a1d 100644 --- a/resources/hydra-dispatcher/kustomization.yaml +++ b/resources/hydra-dispatcher/kustomization.yaml @@ -29,3 +29,6 @@ configMapGenerator: - name: hydra-dispatcher-apps files: - apps.yaml=./files/hydra/default.yaml +- name: hydra-dispatcher-php-ini + files: + - ./files/03_base.ini \ No newline at end of file diff --git a/resources/hydra-dispatcher/resources/hydra-dispatcher-deployment.yaml b/resources/hydra-dispatcher/resources/hydra-dispatcher-deployment.yaml index 7745243..d4e66e7 100644 --- a/resources/hydra-dispatcher/resources/hydra-dispatcher-deployment.yaml +++ b/resources/hydra-dispatcher/resources/hydra-dispatcher-deployment.yaml @@ -41,12 +41,19 @@ spec: value: 128m - name: PHP_FPM_MEMORY_LIMIT value: 128m + - name: OPCACHE_VALIDATE_TIMESTAMP + value: "0" + - name: OPCACHE_REVALIDATE_FREQ + value: "0" envFrom: - configMapRef: name: hydra-dispatcher-env volumeMounts: - mountPath: /app/config/hydra name: hydra-dispatcher-apps + - name: hydra-dispatcher-php-ini + mountPath: /etc/php81/conf.d/03_base.ini + subPath: 03_base.ini resources: {} securityContext: runAsNonRoot: true @@ -105,3 +112,6 @@ spec: - name: hydra-dispatcher-apps configMap: name: hydra-dispatcher-apps + - name: hydra-dispatcher-php-ini + configMap: + name: hydra-dispatcher-php-ini \ No newline at end of file -- 2.17.1 From 02d75c5f546f4ab82a3d068b364cc2298b45f5f5 Mon Sep 17 00:00:00 2001 From: vcarroy Date: Fri, 2 Aug 2024 15:22:08 +0200 Subject: [PATCH 2/2] Update hydra sql and dispatcher image ref --- components/hydra-sql/resources/hydra-sql-deployment.yaml | 4 ++-- .../resources/hydra-dispatcher-deployment.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/hydra-sql/resources/hydra-sql-deployment.yaml b/components/hydra-sql/resources/hydra-sql-deployment.yaml index 204eb41..925fa49 100644 --- a/components/hydra-sql/resources/hydra-sql-deployment.yaml +++ b/components/hydra-sql/resources/hydra-sql-deployment.yaml @@ -21,7 +21,7 @@ spec: spec: containers: - name: hydra-sql-fpm - image: reg.cadoles.com/cadoles/hydra-sql-base:2024.6.6-develop.1343.769e7ed + image: reg.cadoles.com/cadoles/hydra-sql-base:2024.7.25-develop.1026.5bfd899 imagePullPolicy: Always args: ["/usr/sbin/php-fpm81", "-F", "-e"] readinessProbe: @@ -68,7 +68,7 @@ spec: subPath: 03_base.ini - name: hydra-sql-caddy - image: reg.cadoles.com/cadoles/hydra-sql-base:2024.6.6-develop.1343.769e7ed + image: reg.cadoles.com/cadoles/hydra-sql-base:2024.7.25-develop.1026.5bfd899 imagePullPolicy: Always args: ["/usr/sbin/caddy", "run", "--adapter", "caddyfile", "--config", "/etc/caddy/Caddyfile"] readinessProbe: diff --git a/resources/hydra-dispatcher/resources/hydra-dispatcher-deployment.yaml b/resources/hydra-dispatcher/resources/hydra-dispatcher-deployment.yaml index d4e66e7..93cbcad 100644 --- a/resources/hydra-dispatcher/resources/hydra-dispatcher-deployment.yaml +++ b/resources/hydra-dispatcher/resources/hydra-dispatcher-deployment.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: hydra-dispatcher-php-fpm - image: reg.cadoles.com/cadoles/hydra-dispatcher-base:2024.4.29-develop.1417.7f64598 + image: reg.cadoles.com/cadoles/hydra-dispatcher-base:2024.7.25-develop.1034.21d6822 args: ["/usr/sbin/php-fpm81", "-F", "-e"] readinessProbe: exec: @@ -60,7 +60,7 @@ spec: runAsGroup: 1000 runAsUser: 1000 - name: hydra-dispatcher-caddy - image: reg.cadoles.com/cadoles/hydra-dispatcher-base:2024.4.29-develop.1139.0f72845 + image: reg.cadoles.com/cadoles/hydra-dispatcher-base:2024.7.25-develop.1034.21d6822 imagePullPolicy: Always args: [ -- 2.17.1