From f7484692e6b7d8aee4db5e08f6df6ab3ab6e38ec Mon Sep 17 00:00:00 2001 From: Jay Sharma Date: Tue, 27 Feb 2024 17:20:01 +0000 Subject: [PATCH] Merged in feature/404multidev (pull request #28) Feature/404multidev * Fix socket location * Fix socket location * Fix socket location * Fix socket location * To fix sock file issue * fix issues with clear_env = no * Ondemand fpm and deploy update * Merged develop into feature/404multidev * Merged develop into feature/404multidev * Add config map for www pool and supd Approved-by: Rachit Bhargava --- Dockerfile | 4 +- build/dev/deployment.tpl | 17 +++- build/dev/fpm-pool-www-conf-cm.yaml | 124 ++++++++++++++++++++++++++++ build/dev/supervisord-cm.yaml | 61 ++++++++++++++ build/dev/web-default-conf-cm.yaml | 6 +- 5 files changed, 205 insertions(+), 7 deletions(-) create mode 100644 build/dev/fpm-pool-www-conf-cm.yaml create mode 100644 build/dev/supervisord-cm.yaml diff --git a/Dockerfile b/Dockerfile index 25cc5fe7..05cf7fee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ FROM wyveo/nginx-php-fpm:php74 -RUN mkdir -p /var/lib/nginx/cache /usr/share/nginx/subdomain; cd /usr/share/nginx/subdomain ; mkdir www +RUN mkdir -p /var/lib/nginx/cache /usr/share/nginx/subdomain;cd /usr/share/nginx/subdomain;mkdir www COPY wp/ /usr/share/nginx/subdomain/www COPY ngx_http_cache_purge_module.so /usr/lib/nginx/modules/ RUN sed -i 's/;pm.status_path/pm.status_path/g' /etc/php/7.4/fpm/pool.d/www.conf RUN sed -i -e '1iload_module modules/ngx_http_cache_purge_module.so;\' /etc/nginx/nginx.conf -RUN rm /etc/php/7.4/fpm/php.ini +RUN rm /etc/php/7.4/fpm/php.ini RUN rm /etc/php/7.4/cli/php.ini COPY php.ini /etc/php/7.4/cli/php.ini COPY php.ini /etc/php/7.4/fpm/php.ini diff --git a/build/dev/deployment.tpl b/build/dev/deployment.tpl index fc0ba963..13c76616 100755 --- a/build/dev/deployment.tpl +++ b/build/dev/deployment.tpl @@ -58,7 +58,7 @@ spec: command: - /root/redinessprobe-wp.sh initialDelaySeconds: 90 - periodSeconds: 10 + periodSeconds: 30 timeoutSeconds: 10 failureThreshold: 5 successThreshold: 1 @@ -84,7 +84,7 @@ spec: resources: limits: cpu: 1000m - memory: 2048Mi + memory: 5120Mi requests: cpu: 500m memory: 1024Mi @@ -117,6 +117,11 @@ spec: name: empty-dir - mountPath: /usr/share/nginx/subdomain/dev05/wp-content/wflogs name: empty-dir + - mountPath: /etc/supervisord.conf + subPath: supervisord.conf + name: supervisord-conf + - mountPath: /etc/php/7.4/fpm/pool.d/ + name: fpm-pool-www-conf dnsPolicy: ClusterFirst imagePullSecrets: - name: regcred @@ -150,3 +155,11 @@ spec: name: medicalalert-web-default-conf-cm - emptyDir: {} name: empty-dir + - name: supervisord-conf + configMap: + defaultMode: 420 + name: supervisord-cm + - name: fpm-pool-www-conf + configMap: + defaultMode: 420 + name: fpm-pool-www-conf-cm diff --git a/build/dev/fpm-pool-www-conf-cm.yaml b/build/dev/fpm-pool-www-conf-cm.yaml new file mode 100644 index 00000000..3ba21c69 --- /dev/null +++ b/build/dev/fpm-pool-www-conf-cm.yaml @@ -0,0 +1,124 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: fpm-pool-www-conf-cm + namespace: medicalalert-web + labels: + app: medicalalert-web +data: + www.conf: | + [www] + user = nginx + group = nginx + listen = /run/php/php7.4-fpm-www.sock + listen.owner = nginx + listen.group = nginx + pm = ondemand + pm.max_children = 100 + pm.process_idle_timeout = 12s + pm.max_requests = 300 + pm.status_path = /status + catch_workers_output = yes + clear_env = no + access.log = /var/log/fpm-php.access.log + access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + slowlog = /var/log/fpm-php.log.slow + request_slowlog_timeout = 12s + request_terminate_timeout_track_finished = yes + + [dev01] + user = nginx + group = nginx + listen = /run/php/php7.4-fpm-dev01.sock + listen.owner = nginx + listen.group = nginx + pm = ondemand + pm.max_children = 100 + pm.process_idle_timeout = 12s + pm.max_requests = 300 + pm.status_path = /status + catch_workers_output = yes + clear_env = no + access.log = /var/log/fpm-php.access.log + access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + slowlog = /var/log/fpm-php.log.slow + request_slowlog_timeout = 12s + request_terminate_timeout_track_finished = yes + + [dev02] + user = nginx + group = nginx + listen = /run/php/php7.4-fpm-dev02.sock + listen.owner = nginx + listen.group = nginx + pm = ondemand + pm.max_children = 100 + pm.process_idle_timeout = 12s + pm.max_requests = 300 + pm.status_path = /status + catch_workers_output = yes + clear_env = no + access.log = /var/log/fpm-php.access.log + access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + slowlog = /var/log/fpm-php.log.slow + request_slowlog_timeout = 12s + request_terminate_timeout_track_finished = yes + + [dev03] + user = nginx + group = nginx + listen = /run/php/php7.4-fpm-dev03.sock + listen.owner = nginx + listen.group = nginx + pm = ondemand + pm.max_children = 100 + pm.process_idle_timeout = 12s + pm.max_requests = 300 + pm.status_path = /status + catch_workers_output = yes + clear_env = no + access.log = /var/log/fpm-php.access.log + access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + slowlog = /var/log/fpm-php.log.slow + request_slowlog_timeout = 12s + request_terminate_timeout_track_finished = yes + + [dev04] + user = nginx + group = nginx + listen = /run/php/php7.4-fpm-dev04.sock + listen.owner = nginx + listen.group = nginx + pm = ondemand + pm.max_children = 100 + pm.process_idle_timeout = 12s + pm.max_requests = 300 + pm.status_path = /status + catch_workers_output = yes + clear_env = no + access.log = /var/log/fpm-php.access.log + access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + slowlog = /var/log/fpm-php.log.slow + request_slowlog_timeout = 12s + request_terminate_timeout_track_finished = yes + + [dev05] + user = nginx + group = nginx + listen = /run/php/php7.4-fpm-dev05.sock + listen.owner = nginx + listen.group = nginx + pm = ondemand + pm.max_children = 100 + pm.process_idle_timeout = 12s + pm.max_requests = 300 + pm.status_path = /status + catch_workers_output = yes + clear_env = no + access.log = /var/log/fpm-php.access.log + access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + slowlog = /var/log/fpm-php.log.slow + request_slowlog_timeout = 12s + request_terminate_timeout_track_finished = yes + + \ No newline at end of file diff --git a/build/dev/supervisord-cm.yaml b/build/dev/supervisord-cm.yaml new file mode 100644 index 00000000..b1e0566b --- /dev/null +++ b/build/dev/supervisord-cm.yaml @@ -0,0 +1,61 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: supervisord-cm + namespace: medicalalert-web + labels: + app: medicalalert-web +data: + supervisord.conf: | + [unix_http_server] + file=/tmp/supervisor.sock ; (the path to the socket file) + username=nobody + password=nobody + + [supervisord] + logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log) + logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) + logfile_backups=10 ; (num of main logfile rotation backups;default 10) + loglevel=trace ; (log level;default info; others: debug,warn,trace) + pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) + nodaemon=false ; (start in foreground if true;default false) + minfds=1024 ; (min. avail startup file descriptors;default 1024) + minprocs=200 ; (min. avail process descriptors;default 200) + user=root ; (default is current user, required if root) + + ; the below section must remain in the config file for RPC + ; (supervisorctl/web interface) to work, additional interfaces may be + ; added by defining them in separate rpcinterface: sections + [rpcinterface:supervisor] + supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + + [supervisorctl] + serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket + + [program:php-fpm7] + command=/usr/sbin/php-fpm7.4 --nodaemonize --fpm-config=/etc/php/7.4/fpm/pool.d/www.conf + autostart=true + autorestart=true + priority=5 + stdout_logfile=/dev/stdout + stdout_logfile_maxbytes=0 + stderr_logfile=/dev/stderr + stderr_logfile_maxbytes=0 + + [program:nginx] + command=/usr/sbin/nginx -g "daemon off;" + autostart=true + autorestart=true + priority=10 + stdout_events_enabled=true + stderr_events_enabled=true + stdout_logfile=/dev/stdout + stdout_logfile_maxbytes=0 + stderr_logfile=/dev/stderr + stderr_logfile_maxbytes=0 + + [eventlistener:stdout] + command = supervisor_stdout + buffer_size = 100 + events = PROCESS_LOG + result_handler = supervisor_stdout:event_handler \ No newline at end of file diff --git a/build/dev/web-default-conf-cm.yaml b/build/dev/web-default-conf-cm.yaml index 26c43976..07498d5c 100644 --- a/build/dev/web-default-conf-cm.yaml +++ b/build/dev/web-default-conf-cm.yaml @@ -162,7 +162,7 @@ data: } fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/run/php/php7.4-fpm.sock; + fastcgi_pass unix:/run/php/php7.4-fpm-$subdomain.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SUBDOMAIN $subdomain; # $_SERVER["SUBDOMAIN"] @@ -284,7 +284,7 @@ data: } fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/run/php/php7.4-fpm.sock; + fastcgi_pass unix:/run/php/php7.4-fpm-www.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; @@ -321,7 +321,7 @@ data: deny all; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; - fastcgi_pass unix:/run/php/php7.4-fpm.sock; + fastcgi_pass unix:/run/php/php7.4-fpm-www.sock; } }