mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-11-03 19:58:14 +00:00 
			
		
		
		
	In between commit Magento implementation
This commit is contained in:
		
							
								
								
									
										35
									
								
								roles/web-app-magento/tasks/02_runtime_conf.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								roles/web-app-magento/tasks/02_runtime_conf.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Assert required vars (no defaults anywhere)
 | 
			
		||||
  assert:
 | 
			
		||||
    that:
 | 
			
		||||
      - MAGENTO_DOMAIN is defined and MAGENTO_DOMAIN | length > 0
 | 
			
		||||
      - MAGENTO_NGINX_PORT is defined
 | 
			
		||||
      - MAGENTO_PHP_HOST is defined and MAGENTO_PHP_HOST | length > 0
 | 
			
		||||
      - MAGENTO_PHP_PORT is defined
 | 
			
		||||
      - docker_compose.directories.config is defined and docker_compose.directories.config | length > 0
 | 
			
		||||
    fail_msg: "Missing one of: MAGENTO_DOMAIN, MAGENTO_NGINX_PORT, MAGENTO_PHP_HOST, MAGENTO_PHP_PORT, docker_compose.directories.config"
 | 
			
		||||
 | 
			
		||||
- name: Ensure subdirs exist (config root exists already)
 | 
			
		||||
  file:
 | 
			
		||||
    path: "{{ item }}"
 | 
			
		||||
    state: directory
 | 
			
		||||
    mode: '0755'
 | 
			
		||||
  loop:
 | 
			
		||||
    - "{{ MAGENTO_NGINX_DIR }}"
 | 
			
		||||
    - "{{ MAGENTO_PHP_DIR }}"
 | 
			
		||||
 | 
			
		||||
- name: Render nginx main config (no TLS; single source of truth)
 | 
			
		||||
  template:
 | 
			
		||||
    src: "nginx.conf.j2"
 | 
			
		||||
    dest: "{{ MAGENTO_NGINX_CONF_PATH }}"
 | 
			
		||||
    mode: '0644'
 | 
			
		||||
    force: true
 | 
			
		||||
  notify: docker compose up
 | 
			
		||||
 | 
			
		||||
- name: Render php-fpm pool override (TCP listen; clear_env=no)
 | 
			
		||||
  template:
 | 
			
		||||
    src: "php-fpm-zz-docker.conf.j2"
 | 
			
		||||
    dest: "{{ MAGENTO_PHP_ZZ_CONF_PATH }}"
 | 
			
		||||
    mode: '0644'
 | 
			
		||||
    force: true
 | 
			
		||||
  notify: docker compose up
 | 
			
		||||
							
								
								
									
										47
									
								
								roles/web-app-magento/templates/nginx.conf.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								roles/web-app-magento/templates/nginx.conf.j2
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
worker_processes auto;
 | 
			
		||||
 | 
			
		||||
events { worker_connections 1024; }
 | 
			
		||||
 | 
			
		||||
http {
 | 
			
		||||
  include       /etc/nginx/mime.types;
 | 
			
		||||
  default_type  application/octet-stream;
 | 
			
		||||
 | 
			
		||||
  sendfile on;
 | 
			
		||||
  keepalive_timeout 65;
 | 
			
		||||
 | 
			
		||||
  access_log /dev/stdout;
 | 
			
		||||
  error_log  /dev/stderr;
 | 
			
		||||
 | 
			
		||||
  upstream fastcgi_backend {
 | 
			
		||||
    server {{ MAGENTO_PHP_HOST }}:{{ MAGENTO_PHP_PORT }};
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  server {
 | 
			
		||||
    listen {{ MAGENTO_NGINX_PORT }};
 | 
			
		||||
    server_name {{ MAGENTO_DOMAIN }};
 | 
			
		||||
 | 
			
		||||
    set $MAGE_ROOT /var/www/html;
 | 
			
		||||
    root $MAGE_ROOT/pub;
 | 
			
		||||
    index index.php;
 | 
			
		||||
 | 
			
		||||
    location / {
 | 
			
		||||
      try_files $uri $uri/ /index.php?$args;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    location ~ \.php$ {
 | 
			
		||||
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
 | 
			
		||||
      include fastcgi_params;
 | 
			
		||||
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 | 
			
		||||
      fastcgi_param PATH_INFO       $fastcgi_path_info;
 | 
			
		||||
      fastcgi_index index.php;
 | 
			
		||||
      fastcgi_pass  fastcgi_backend;
 | 
			
		||||
      fastcgi_read_timeout 300;
 | 
			
		||||
      fastcgi_connect_timeout 5s;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    location ~* ^/(app|var|lib|dev|update|vendor|node_modules|\.git|\.svn)/ { deny all; }
 | 
			
		||||
    location ~ /\. { deny all; }
 | 
			
		||||
 | 
			
		||||
    error_page 404 403 = /errors/404.php;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										15
									
								
								roles/web-app-magento/templates/php-fpm-zz-docker.conf.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								roles/web-app-magento/templates/php-fpm-zz-docker.conf.j2
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
[global]
 | 
			
		||||
error_log = /proc/self/fd/2
 | 
			
		||||
 | 
			
		||||
[www]
 | 
			
		||||
listen = 0.0.0.0:{{ MAGENTO_PHP_PORT }}
 | 
			
		||||
clear_env = no
 | 
			
		||||
 | 
			
		||||
pm = dynamic
 | 
			
		||||
pm.max_children = 10
 | 
			
		||||
pm.start_servers = 2
 | 
			
		||||
pm.min_spare_servers = 1
 | 
			
		||||
pm.max_spare_servers = 5
 | 
			
		||||
 | 
			
		||||
access.log = /proc/self/fd/2
 | 
			
		||||
catch_workers_output = yes
 | 
			
		||||
		Reference in New Issue
	
	Block a user