Skip to content

Commit ebbe67a

Browse files
committed
Automatically find xdebug remote host
1 parent b86f91a commit ebbe67a

File tree

11 files changed

+32
-19
lines changed

11 files changed

+32
-19
lines changed

php5.6-fpm/docker-entrypoint.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
#!/bin/bash
22
set -e
33

4-
## Run templates with configuration.
5-
/usr/local/bin/confd --onetime --backend env --confdir /etc/confd
6-
74
# Add docker host domain to hosts file
85
if [ ! -z "${DOCKER_HOST_DOMAIN}" ]; then
96
echo $(getent hosts host.docker.internal | cut -d" " -f1) ${DOCKER_HOST_DOMAIN} >> /etc/hosts
107
fi
118

9+
# Set xdebug remote host to docker host ip.
10+
if [ ! -z "${PHP_XDEBUG}" ]; then
11+
export PHP_XDEBUG_REMOTE_HOST=$(getent hosts host.docker.internal | cut -d" " -f1)
12+
fi
13+
14+
## Run templates with configuration.
15+
/usr/local/bin/confd --onetime --backend env --confdir /etc/confd
16+
1217
## Start the php FPM process.
1318
echo "Starting PHP 5.6 FPM"
1419
php-fpm5.6 -F --pid /var/run/php/php-fpm5.6.pid -y /etc/php/5.6/fpm/php-fpm.conf

php7.0-fpm/docker-entrypoint.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
#!/bin/bash
22
set -e
33

4-
## Run templates with configuration.
5-
/usr/local/bin/confd --onetime --backend env --confdir /etc/confd
6-
74
# Add docker host domain to hosts file
85
if [ ! -z "${DOCKER_HOST_DOMAIN}" ]; then
96
echo $(getent hosts host.docker.internal | cut -d" " -f1) ${DOCKER_HOST_DOMAIN} >> /etc/hosts
107
fi
118

9+
# Set xdebug remote host to docker host ip.
10+
if [ ! -z "${PHP_XDEBUG}" ]; then
11+
export PHP_XDEBUG_REMOTE_HOST=$(getent hosts host.docker.internal | cut -d" " -f1)
12+
fi
13+
14+
## Run templates with configuration.
15+
/usr/local/bin/confd --onetime --backend env --confdir /etc/confd
16+
1217
## Start the php FPM process.
1318
echo "Starting PHP 7.0 FPM"
1419
php-fpm7.0 -F --pid /var/run/php/php-fpm7.0.pid -y /etc/php/7.0/fpm/php-fpm.conf

php7.2-fpm/docker-entrypoint.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
#!/bin/bash
22
set -e
33

4-
## Run templates with configuration.
5-
/usr/local/bin/confd --onetime --backend env --confdir /etc/confd
6-
74
# Add docker host domain to hosts file
85
if [ ! -z "${DOCKER_HOST_DOMAIN}" ]; then
96
echo $(getent hosts host.docker.internal | cut -d" " -f1) ${DOCKER_HOST_DOMAIN} >> /etc/hosts
107
fi
118

9+
# Set xdebug remote host to docker host ip.
10+
if [ ! -z "${PHP_XDEBUG}" ]; then
11+
export PHP_XDEBUG_REMOTE_HOST=$(getent hosts host.docker.internal | cut -d" " -f1)
12+
fi
13+
14+
## Run templates with configuration.
15+
/usr/local/bin/confd --onetime --backend env --confdir /etc/confd
16+
1217
## Start the php FPM process.
1318
echo "Starting PHP 7.2 FPM"
1419
php-fpm7.2 -F --pid /var/run/php/php-fpm7.2.pid -y /etc/php/7.2/fpm/php-fpm.conf

php7.3-fpm/docker-entrypoint.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
#!/bin/bash
22
set -e
33

4-
## Run templates with configuration.
5-
/usr/local/bin/confd --onetime --backend env --confdir /etc/confd
6-
74
# Add docker host domain to hosts file
85
if [ ! -z "${DOCKER_HOST_DOMAIN}" ]; then
96
echo $(getent hosts host.docker.internal | cut -d" " -f1) ${DOCKER_HOST_DOMAIN} >> /etc/hosts
107
fi
118

9+
# Set xdebug remote host to docker host ip.
10+
if [ ! -z "${PHP_XDEBUG}" ]; then
11+
export PHP_XDEBUG_REMOTE_HOST=$(getent hosts host.docker.internal | cut -d" " -f1)
12+
fi
13+
14+
## Run templates with configuration.
15+
/usr/local/bin/confd --onetime --backend env --confdir /etc/confd
16+
1217
## Start the php FPM process.
1318
echo "Starting PHP 7.3 FPM"
1419
php-fpm7.3 -F --pid /var/run/php/php-fpm7.3.pid -y /etc/php/7.3/fpm/php-fpm.conf

scripts/itkdev-docker-compose

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ EOF
394394
xdebug)
395395
PHP_XDEBUG=1 \
396396
PHP_XDEBUG_REMOTE_AUTOSTART=1 \
397-
PHP_XDEBUG_REMOTE_HOST=$(ipconfig getifaddr en0) \
398397
PHP_XDEBUG_REMOTE_PORT=9000 \
399398
PHP_XDEBUG_REMOTE_CONNECT_BACK=0 \
400399
docker_compose up -d

templates/ddbcms/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ services:
2727
environment:
2828
- PHP_XDEBUG=${PHP_XDEBUG:-0}
2929
- PHP_XDEBUG_REMOTE_AUTOSTART=${PHP_XDEBUG_REMOTE_AUTOSTART:-0}
30-
- PHP_XDEBUG_REMOTE_HOST=${PHP_XDEBUG_REMOTE_HOST:-0.0.0.0}
3130
- PHP_XDEBUG_REMOTE_CONNECT_BACK=${PHP_XDEBUG_REMOTE_CONNECT_BACK:-0}
3231
- PHP_MAX_EXECUTION_TIME=300
3332
- PHP_MEMORY_LIMIT=512M

templates/drupal-7/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ services:
2828
environment:
2929
- PHP_XDEBUG=${PHP_XDEBUG:-0}
3030
- PHP_XDEBUG_REMOTE_AUTOSTART=${PHP_XDEBUG_REMOTE_AUTOSTART:-0}
31-
- PHP_XDEBUG_REMOTE_HOST=${PHP_XDEBUG_REMOTE_HOST:-0.0.0.0}
3231
- PHP_XDEBUG_REMOTE_CONNECT_BACK=${PHP_XDEBUG_REMOTE_CONNECT_BACK:-0}
3332
- PHP_MAX_EXECUTION_TIME=30
3433
- PHP_MEMORY_LIMIT=256M

templates/drupal-8/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ services:
2828
environment:
2929
- PHP_XDEBUG=${PHP_XDEBUG:-0}
3030
- PHP_XDEBUG_REMOTE_AUTOSTART=${PHP_XDEBUG_REMOTE_AUTOSTART:-0}
31-
- PHP_XDEBUG_REMOTE_HOST=${PHP_XDEBUG_REMOTE_HOST:-0.0.0.0}
3231
- PHP_XDEBUG_REMOTE_CONNECT_BACK=${PHP_XDEBUG_REMOTE_CONNECT_BACK:-0}
3332
- PHP_MAX_EXECUTION_TIME=30
3433
- PHP_MEMORY_LIMIT=256M

templates/ereolen/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ services:
2828
environment:
2929
- PHP_XDEBUG=${PHP_XDEBUG:-0}
3030
- PHP_XDEBUG_REMOTE_AUTOSTART=${PHP_XDEBUG_REMOTE_AUTOSTART:-0}
31-
- PHP_XDEBUG_REMOTE_HOST=${PHP_XDEBUG_REMOTE_HOST:-0.0.0.0}
3231
- PHP_XDEBUG_REMOTE_CONNECT_BACK=${PHP_XDEBUG_REMOTE_CONNECT_BACK:-0}
3332
- PHP_MAIL=1
3433
- PHP_MAX_EXECUTION_TIME=60

templates/symfony-3/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ services:
2828
environment:
2929
- PHP_XDEBUG=${PHP_XDEBUG:-0}
3030
- PHP_XDEBUG_REMOTE_AUTOSTART=${PHP_XDEBUG_REMOTE_AUTOSTART:-0}
31-
- PHP_XDEBUG_REMOTE_HOST=${PHP_XDEBUG_REMOTE_HOST:-0.0.0.0}
3231
- PHP_XDEBUG_REMOTE_CONNECT_BACK=${PHP_XDEBUG_REMOTE_CONNECT_BACK:-0}
3332
- PHP_MAX_EXECUTION_TIME=30
3433
- PHP_MEMORY_LIMIT=256M

0 commit comments

Comments
 (0)