Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Commit 4ad8ca3

Browse files
Enable Xdebug in dev (#60)
* Enable Xdebug in dev * Prevent Nginx timeout * Add port * Divide traffic between app and app-debug * Add comment
1 parent 4a530a4 commit 4ad8ca3

File tree

4 files changed

+50
-1
lines changed

4 files changed

+50
-1
lines changed

.docker/nginx/browser.conf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
resolver 127.0.0.11; # Docker's embedded DNS server
2+
3+
map $cookie_XDEBUG_SESSION $fastcgi_pass {
4+
default app;
5+
~.+ app-debug;
6+
}
7+
18
server {
29
server_name localhost;
310
listen 80;
@@ -14,7 +21,8 @@ server {
1421
include fastcgi_params;
1522
internal;
1623

17-
fastcgi_pass app:9000;
24+
fastcgi_pass $fastcgi_pass:9000;
25+
fastcgi_read_timeout 1d; # For Xdebug
1826
fastcgi_split_path_info ^(.+\.php)(/.*)$;
1927

2028
fastcgi_param SCRIPT_FILENAME /app/public/$fastcgi_script_name;

.docker/php-debug.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
xdebug.remote_enable = 1
2+
xdebug.remote_host = host.docker.internal
3+
xdebug.remote_port = 9000

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,22 @@ COPY .docker/php-dev.ini ${PHP_INI_DIR}/conf.d/01-app.ini
110110

111111
RUN bin/console assets:install && \
112112
rm -rf var/*
113+
114+
115+
116+
#
117+
# Stage: Debug environment
118+
#
119+
FROM dev AS debug
120+
121+
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \
122+
pecl install \
123+
xdebug-2.7.0 \
124+
&& \
125+
docker-php-ext-enable \
126+
xdebug \
127+
&& \
128+
apk del .build-deps && \
129+
rm -rf /var/cache/apk/
130+
131+
COPY .docker/php-debug.ini ${PHP_INI_DIR}/conf.d/02-app.ini

docker-compose.override.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,22 @@ services:
88
- ./:/app
99
- /app/var
1010
- /app/vendor
11+
app-debug:
12+
build:
13+
context: .
14+
target: debug
15+
environment:
16+
API_URI: http://web:8080
17+
APP_SECRET:
18+
DEFAULT_LOCALE: ${DEFAULT_LOCALE:-en}
19+
volumes:
20+
- ./:/app
21+
- /app/var
22+
- /app/vendor
23+
depends_on:
24+
- api
25+
web:
26+
depends_on:
27+
- api
28+
- app
29+
- app-debug

0 commit comments

Comments
 (0)