Skip to content

PhpFpmDebug #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions config/dockergento/nginx/conf/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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";
Expand All @@ -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;
Expand Down Expand Up @@ -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";
Expand Down
31 changes: 31 additions & 0 deletions config/dockergento/usr/local/etc/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
7 changes: 7 additions & 0 deletions config/dockergento/usr/local/etc/php/conf.d/xdebug.ini
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions docker-compose/docker-compose.dev.mac.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ services:
- ./composer.lock:/var/www/html/composer.lock:delegated
# {FILES_IN_GIT}

phpfpmdebug:
volumes:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we could re-use volumes from phpfpm service. Can't we?

- 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is missing # {FILES_IN_GIT} - it will be replaced during setup

- ./config/dockergento/usr/local/etc/php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini:delegated

nginx:
volumes: *appvolumes-mac

Expand All @@ -28,6 +39,7 @@ services:
- SYNC_MAX_INOTIFY_WATCHES=60000
depends_on:
- phpfpm
- phpfpmdebug
privileged: true

volumes:
Expand Down
15 changes: 11 additions & 4 deletions docker-compose/docker-compose.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,30 @@ services:
phpfpm:
image: modestcoders/php:7.1-fpm
volumes: &appvolumes
- sockdata:/sock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now sockdata volume is never used, probably could be removed

- ../.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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image should be the same as in phpfpm: modestcoders/php:7.1-fpm
otherwise we'll have different php versions with and w/o xdebug

volumes: *appvolumes
environment: *phpfpmenv
depends_on: *phpfpmdependencies

nginx:
image: modestcoders/nginx:1.13
ports:
- 80:8000
volumes: *appvolumes
depends_on:
- phpfpm
- phpfpmdebug

db:
image: mysql:5.7
Expand Down