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

Commit af85f44

Browse files
author
Julien Neuhart
authored
better Xdebug support + services versions update (#46)
1 parent 47d15f5 commit af85f44

12 files changed

+67
-51
lines changed

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<h3 align="center">kickoff-docker-php</h3>
55
<p align="center">A complete stack for your PHP project powered by Docker</p>
66
<p align="center">
7-
<a href="https://github.com/thecodingmachine/kickoff-docker-php/tree/v2.1.1"><img src="https://img.shields.io/badge/stable-v2.1.1-green.svg" alt="Stable release: v2.1.1"></a>
7+
<a href="https://github.com/thecodingmachine/kickoff-docker-php/tree/v2.2.0"><img src="https://img.shields.io/badge/stable-v2.2.0-green.svg" alt="Stable release: v2.2.0"></a>
88
<a href="https://github.com/thecodingmachine/kickoff-docker-php/tree/master"><img src="https://img.shields.io/badge/unstable-master-orange.svg" alt="Unstable release: master"></a>
99
<a href="https://travis-ci.org/thecodingmachine/kickoff-docker-php"><img src="https://img.shields.io/travis/thecodingmachine/kickoff-docker-php.svg?label=Travis+CI" alt="Travis CI"></a>
1010
</p>
@@ -36,7 +36,7 @@ following goals in mind:
3636
## Features
3737

3838
* **Cross-platform:** Windows, Mac, Linux
39-
* **A complete stack:** NGINX, PHP-FPM 7.1, MySQL 5.7, phpMyAdmin, Redis, RabbitMQ and more to come!
39+
* **A complete stack:** NGINX, PHP-FPM 7.1, MySQL 5.7, phpMyAdmin, Redis, RabbitMQ
4040
* **Centralized logging** with Graylog
4141
* Automatic **HTTPS** on your local environment
4242
* A powerful **reverse-proxy** ([Traefik](https://traefik.io/)) which can handle automatic HTTPS (via [Let's Encrypt](https://letsencrypt.org/))
@@ -244,6 +244,8 @@ NGINX is the web server of your PHP application.
244244
The NGINX configuration located at `modules/nginx/conf.d/php-fpm.conf` provides good security defaults. Still, you might
245245
have to update it according to the PHP framework you wish to use.
246246

247+
Example for a Symfony application: https://gist.github.com/gulien/64d8c94c5d0e294ac121ea810794757e.
248+
247249
### PHP-FPM
248250

249251
The PHP-FPM container has many roles. First, it handles requests from the NGINX container to execute your PHP files.
@@ -259,6 +261,12 @@ zip and more!
259261

260262
You are able to find all installed PHP extensions by running `php -m` inside your workspace.
261263

264+
#### Xdebug
265+
266+
Xdebug is a tool for easily debugging your PHP code. We provided simple variables in your `.env` file as described below.
267+
268+
Example with PhpStorm: https://gist.github.com/gulien/d0933d8f90587a95cec5fd750da41b87.
269+
262270
#### Available tools
263271

264272
*Composer* - https://getcomposer.org/
@@ -284,10 +292,12 @@ as defined in the PSR-1 and PSR-2 documents and many more.
284292

285293
#### Configuration
286294

287-
| Variable | Location | Description |
288-
|----------------------|---------------|------------------------------------------------------------|
289-
| PHP_MEMORY_LIMIT | `config/.env` | Defines the PHP memory limit of the PHP-FPM container. |
290-
| PHP_FPM_MEMORY_LIMIT | `config/.env` | Defines the PHP-FPM memory limit of the PHP-FPM container. |
295+
| Variable | Location | Description |
296+
|----------------------|---------------|---------------------------------------------------------------------|
297+
| PHP_MEMORY_LIMIT | `config/.env` | Defines the PHP memory limit of the PHP-FPM container. |
298+
| PHP_FPM_MEMORY_LIMIT | `config/.env` | Defines the PHP-FPM memory limit of the PHP-FPM container. |
299+
| XDEBUG_ENABLED | `config/.env` | If true, enables Xdebug. |
300+
| XDEBUG_REMOTE_HOST | `config/.env` | If Xdebug is enabled, set this variable with your local IP address. |
291301

292302
### MySQL
293303

@@ -323,7 +333,7 @@ This should be used only in others environments.
323333

324334
### Redis
325335

326-
Redis is the database cache of this stack and it has been configured as the default session handler for PHP.
336+
Redis is the cache store of this stack.
327337

328338
The hostname of Redis in your PHP-FPM container is `redis`. To configure Redis to be the cache handler of
329339
your PHP application, you should refer to the documentation provided by your PHP framework.

config/.app.env.blueprint

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
# | You can add here variables which are useful to configure your PHP
66
# | application. For example: credentials to access to a remote
77
# | API.
8+
# |
9+
# | Of course, you should update the Orbit file located at
10+
# | 'config/orbit/orbit-build.yml' to add a command which uses those values.
811
# |

config/.env.blueprint

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,29 @@ PHP_MEMORY_LIMIT=-1
117117

118118
PHP_FPM_MEMORY_LIMIT=128m
119119

120+
# |--------------------------------------------------------------------------
121+
# | Xdebug enabled
122+
# |--------------------------------------------------------------------------
123+
# |
124+
# | If true, enables Xdebug.
125+
# |
126+
127+
XDEBUG_ENABLED=false
128+
129+
# |--------------------------------------------------------------------------
130+
# | Xdebug remote host
131+
# |--------------------------------------------------------------------------
132+
# |
133+
# | If Xdebug is enabled, set this variable with your local IP address.
134+
# |
135+
# | On MacOS, you should set it with "docker.for.mac.localhost".
136+
# | On Windows, run "ipconfig" and look for the IP4 address in "DockerNAT"
137+
# | entry.
138+
# |
139+
# |
140+
141+
XDEBUG_REMOTE_HOST=172.18.0.1
142+
120143
# |--------------------------------------------------------------------------
121144
# | MySQL password
122145
# |--------------------------------------------------------------------------

config/app.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@
44
# |
55
# | You can add here variables which are useful to configure your PHP
66
# | application.
7+
# |
8+
# | Of course, you should update the Orbit file located at
9+
# | 'config/orbit/orbit-build.yml' to add a command which uses those values.
710
# |

config/orbit/orbit-build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ commands:
8686
- orbit generate -t modules/php-fpm/conf.d/memory-limit.blueprint.ini -o modules/php-fpm/conf.d/memory-limit.ini -e Config,config/.env {{ if debug }}-d{{ end }}
8787
- orbit generate -t modules/php-fpm/php-fpm.d/memory-limit.blueprint.conf -o modules/php-fpm/php-fpm.d/memory-limit.conf -e Config,config/.env {{ if debug }}-d{{ end }}
8888
- orbit generate -t modules/php-fpm/php-fpm.d/security.blueprint.conf -o modules/php-fpm/php-fpm.d/security.conf -e Config,config/.env {{ if debug }}-d{{ end }}
89-
- orbit generate -t modules/php-fpm/Dockerfile.blueprint -o modules/php-fpm/Dockerfile -v Modules,config/modules.yml -e Config,config/.env {{ if debug }}-d{{ end }}
9089
- docker-compose -p {{ .EnvFiles.Config.ENV }}{{ .Values.Project.name }} -f modules/php-fpm/docker-compose.yml build
9190

9291
# |--------------------------------------------------------------------------

modules/graylog/docker-compose.blueprint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ services:
3333

3434

3535
graylog-server:
36-
image: graylog2/server:2.3.1-1
36+
image: graylog2/server:2.3.2-2
3737
container_name: {{ .EnvFiles.Config.ENV }}-{{ .Values.Project.name }}-graylog
3838
restart: "no"
3939
networks:

modules/mysql/docker-compose.blueprint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66

77

88
mysql:
9-
image: mysql:5.7
9+
image: mysql:5.7.20
1010
container_name: {{ .EnvFiles.Config.ENV }}-{{ .Values.Project.name }}-mysql
1111
restart: {{ if and (ne "local" .EnvFiles.Config.ENV) (eq false .Values.Modules.graylog.enable) }}unless-stopped{{ else }}"no"{{ end }}
1212
networks:
@@ -36,7 +36,7 @@ services:
3636
{{ end }}
3737
{{ if eq "local" .EnvFiles.Config.ENV }}
3838
phpmyadmin:
39-
image: phpmyadmin/phpmyadmin:4.7
39+
image: phpmyadmin/phpmyadmin:4.7.4-1
4040
container_name: {{ .EnvFiles.Config.ENV }}-{{ .Values.Project.name }}-phpmyadmin
4141
restart: "no"
4242
networks:

modules/nginx/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM nginx:1.12-alpine
1+
FROM nginx:1.12.1-alpine
22

33
# |--------------------------------------------------------------------------
44
# | Permissions issues workaround

modules/php-fpm/Dockerfile.blueprint

Lines changed: 0 additions & 37 deletions
This file was deleted.

modules/php-fpm/docker-compose.blueprint.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ services:
55

66

77
php-fpm:
8-
build: .
8+
image: gulnap/kickoff-docker-php-images:php-fpm-7.1.10-v2.2.0
99
container_name: {{ .EnvFiles.Config.ENV }}-{{ .Values.Project.name }}-php-fpm
1010
restart: {{ if and (ne "local" .EnvFiles.Config.ENV) (eq false .Values.Modules.graylog.enable) }}unless-stopped{{ else }}"no"{{ end }}
1111
entrypoint: /usr/local/bin/docker-entrypoint.sh
1212
networks:
1313
- backend
1414
environment:
1515
- UID={{ if ne "windows" os }}${UID}{{ else }}82{{ end }}
16+
- XDEBUG_ENABLED={{ .EnvFiles.Config.XDEBUG_ENABLED }}
17+
{{- if eq "true" .EnvFiles.Config.XDEBUG_ENABLED }}
18+
- XDEBUG_REMOTE_HOST={{ .EnvFiles.Config.XDEBUG_REMOTE_HOST }}
19+
{{- end }}
1620
labels:
1721
- traefik.enable=false
1822
volumes:

0 commit comments

Comments
 (0)