diff --git a/config/dockergento/nginx/conf/default.conf b/config/dockergento/nginx/conf/default.conf index ec0edc0..3bae7f5 100644 --- a/config/dockergento/nginx/conf/default.conf +++ b/config/dockergento/nginx/conf/default.conf @@ -8,8 +8,15 @@ map $http_host $MAGE_RUN_CODE { # dominio-de.lo de; } -upstream fastcgi_backend { - server unix:/sock/docker.sock; +# default Docker DNS server +resolver 127.0.0.11; + +map $cookie_XDEBUG_SESSION $my_fastcgi_pass { + default phpfpm; + XDEBUG_ECLIPSE phpfpmdebug; + PHPSTORM phpfpmdebug; + netbeans-xdebug phpfpmdebug; + macgdbp phpfpmdebug; } server { @@ -41,7 +48,7 @@ server { root $MAGE_ROOT; location ~ ^/setup/index.php { fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass fastcgi_backend; + fastcgi_pass $my_fastcgi_pass:9000; fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off"; fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=600"; @@ -68,7 +75,7 @@ server { location ~ ^/update/index.php { fastcgi_split_path_info ^(/update/index.php)(/.+)$; - fastcgi_pass fastcgi_backend; + fastcgi_pass $my_fastcgi_pass:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; @@ -174,7 +181,7 @@ server { # PHP entry point for main application location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ { try_files $uri =404; - fastcgi_pass fastcgi_backend; + fastcgi_pass $my_fastcgi_pass:9000; fastcgi_buffers 1024 4k; fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off"; diff --git a/config/dockergento/usr/local/etc/php-fpm.conf b/config/dockergento/usr/local/etc/php-fpm.conf new file mode 100644 index 0000000..19e8a8d --- /dev/null +++ b/config/dockergento/usr/local/etc/php-fpm.conf @@ -0,0 +1,31 @@ +; This file was initially adapated from the output of: (on PHP 5.6) +; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default + +[global] + +error_log = /proc/self/fd/2 +daemonize = no + +[www] + +; if we send this to /proc/self/fd/1, it never appears +access.log = /proc/self/fd/2 + +;user = app +;group = app + +listen = 9000 +listen.owner = app +listen.group = app +listen.mode = 0660 + +pm = dynamic +pm.max_children = 10 +pm.start_servers = 4 +pm.min_spare_servers = 2 +pm.max_spare_servers = 6 + +clear_env = no + +; Ensure worker stdout and stderr are sent to the main error log. +catch_workers_output = yes \ No newline at end of file diff --git a/config/dockergento/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini b/config/dockergento/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini new file mode 100644 index 0000000..523b629 --- /dev/null +++ b/config/dockergento/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini @@ -0,0 +1 @@ +zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so \ No newline at end of file diff --git a/config/dockergento/usr/local/etc/php/conf.d/xdebug.ini b/config/dockergento/usr/local/etc/php/conf.d/xdebug.ini new file mode 100644 index 0000000..31e1e1b --- /dev/null +++ b/config/dockergento/usr/local/etc/php/conf.d/xdebug.ini @@ -0,0 +1,7 @@ +xdebug.idekey=PHPSTORM +xdebug.remote_autostart=0 +xdebug.remote_connect_back=0 +xdebug.remote_enable=1 +xdebug.remote_host=host.docker.internal +xdebug.remote_port=9000 +xdebug.max_nesting_level=500 \ No newline at end of file diff --git a/docker-compose/docker-compose.dev.mac.sample.yml b/docker-compose/docker-compose.dev.mac.sample.yml index c37d634..b0c0893 100644 --- a/docker-compose/docker-compose.dev.mac.sample.yml +++ b/docker-compose/docker-compose.dev.mac.sample.yml @@ -11,6 +11,17 @@ services: - ./composer.lock:/var/www/html/composer.lock:delegated # {FILES_IN_GIT} + phpfpmdebug: + volumes: + - workspace:/var/www/html + - ./app:/var/www/html/app:delegated + - ./.git:/var/www/html/.git:delegated + - ./config:/var/www/html/config:delegated + - ./composer.json:/var/www/html/composer.json:delegated + - ./composer.lock:/var/www/html/composer.lock:delegated + - ./config/dockergento/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini:delegated + - ./config/dockergento/usr/local/etc/php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini:delegated + nginx: volumes: *appvolumes-mac @@ -28,6 +39,7 @@ services: - SYNC_MAX_INOTIFY_WATCHES=60000 depends_on: - phpfpm + - phpfpmdebug privileged: true volumes: diff --git a/docker-compose/docker-compose.sample.yml b/docker-compose/docker-compose.sample.yml index dee9a3c..8245fc0 100644 --- a/docker-compose/docker-compose.sample.yml +++ b/docker-compose/docker-compose.sample.yml @@ -4,16 +4,22 @@ services: phpfpm: image: modestcoders/php:7.1-fpm volumes: &appvolumes - - sockdata:/sock - ../.composer:/var/www/.composer:delegated - ../.composer:/var/www/html/var/composer_home:delegated - - ./config/dockergento/nginx/conf/default.conf:/var/www/conf/nginx/default.conf:delegated - environment: + - ./config/dockergento/nginx/conf/default.conf:/etc/nginx/conf.d/default.conf:delegated + - ./config/dockergento/usr/local/etc/php-fpm.conf:/usr/local/etc/php-fpm.conf:delegated + environment: &phpfpmenv PHP_IDE_CONFIG: serverName=localhost - depends_on: + depends_on: &phpfpmdependencies - db - elasticsearch + phpfpmdebug: + image: modestcoders/php:7.2-fpm + volumes: *appvolumes + environment: *phpfpmenv + depends_on: *phpfpmdependencies + nginx: image: modestcoders/nginx:1.13 ports: @@ -21,6 +27,7 @@ services: volumes: *appvolumes depends_on: - phpfpm + - phpfpmdebug db: image: mysql:5.7