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

better Xdebug support + services versions update #46

Merged
merged 3 commits into from
Oct 23, 2017
Merged
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
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<h3 align="center">kickoff-docker-php</h3>
<p align="center">A complete stack for your PHP project powered by Docker</p>
<p align="center">
<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>
<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>
<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>
<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>
</p>
Expand Down Expand Up @@ -36,7 +36,7 @@ following goals in mind:
## Features

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

Example for a Symfony application: https://gist.github.com/gulien/64d8c94c5d0e294ac121ea810794757e.

### PHP-FPM

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

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

#### Xdebug

Xdebug is a tool for easily debugging your PHP code. We provided simple variables in your `.env` file as described below.

Example with PhpStorm: https://gist.github.com/gulien/d0933d8f90587a95cec5fd750da41b87.

#### Available tools

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

#### Configuration

| Variable | Location | Description |
|----------------------|---------------|------------------------------------------------------------|
| PHP_MEMORY_LIMIT | `config/.env` | Defines the PHP memory limit of the PHP-FPM container. |
| PHP_FPM_MEMORY_LIMIT | `config/.env` | Defines the PHP-FPM memory limit of the PHP-FPM container. |
| Variable | Location | Description |
|----------------------|---------------|---------------------------------------------------------------------|
| PHP_MEMORY_LIMIT | `config/.env` | Defines the PHP memory limit of the PHP-FPM container. |
| PHP_FPM_MEMORY_LIMIT | `config/.env` | Defines the PHP-FPM memory limit of the PHP-FPM container. |
| XDEBUG_ENABLED | `config/.env` | If true, enables Xdebug. |
| XDEBUG_REMOTE_HOST | `config/.env` | If Xdebug is enabled, set this variable with your local IP address. |

### MySQL

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

### Redis

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

The hostname of Redis in your PHP-FPM container is `redis`. To configure Redis to be the cache handler of
your PHP application, you should refer to the documentation provided by your PHP framework.
Expand Down
3 changes: 3 additions & 0 deletions config/.app.env.blueprint
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
# | You can add here variables which are useful to configure your PHP
# | application. For example: credentials to access to a remote
# | API.
# |
# | Of course, you should update the Orbit file located at
# | 'config/orbit/orbit-build.yml' to add a command which uses those values.
# |
23 changes: 23 additions & 0 deletions config/.env.blueprint
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,29 @@ PHP_MEMORY_LIMIT=-1

PHP_FPM_MEMORY_LIMIT=128m

# |--------------------------------------------------------------------------
# | Xdebug enabled
# |--------------------------------------------------------------------------
# |
# | If true, enables Xdebug.
# |

XDEBUG_ENABLED=false

# |--------------------------------------------------------------------------
# | Xdebug remote host
# |--------------------------------------------------------------------------
# |
# | If Xdebug is enabled, set this variable with your local IP address.
# |
# | On MacOS, you should set it with "docker.for.mac.localhost".
# | On Windows, run "ipconfig" and look for the IP4 address in "DockerNAT"
# | entry.
# |
# |

XDEBUG_REMOTE_HOST=172.18.0.1

# |--------------------------------------------------------------------------
# | MySQL password
# |--------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions config/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
# |
# | You can add here variables which are useful to configure your PHP
# | application.
# |
# | Of course, you should update the Orbit file located at
# | 'config/orbit/orbit-build.yml' to add a command which uses those values.
# |
1 change: 0 additions & 1 deletion config/orbit/orbit-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ commands:
- 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 }}
- 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 }}
- 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 }}
- 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 }}
- docker-compose -p {{ .EnvFiles.Config.ENV }}{{ .Values.Project.name }} -f modules/php-fpm/docker-compose.yml build

# |--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion modules/graylog/docker-compose.blueprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ services:


graylog-server:
image: graylog2/server:2.3.1-1
image: graylog2/server:2.3.2-2
container_name: {{ .EnvFiles.Config.ENV }}-{{ .Values.Project.name }}-graylog
restart: "no"
networks:
Expand Down
4 changes: 2 additions & 2 deletions modules/mysql/docker-compose.blueprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:


mysql:
image: mysql:5.7
image: mysql:5.7.20
container_name: {{ .EnvFiles.Config.ENV }}-{{ .Values.Project.name }}-mysql
restart: {{ if and (ne "local" .EnvFiles.Config.ENV) (eq false .Values.Modules.graylog.enable) }}unless-stopped{{ else }}"no"{{ end }}
networks:
Expand Down Expand Up @@ -36,7 +36,7 @@ services:
{{ end }}
{{ if eq "local" .EnvFiles.Config.ENV }}
phpmyadmin:
image: phpmyadmin/phpmyadmin:4.7
image: phpmyadmin/phpmyadmin:4.7.4-1
container_name: {{ .EnvFiles.Config.ENV }}-{{ .Values.Project.name }}-phpmyadmin
restart: "no"
networks:
Expand Down
2 changes: 1 addition & 1 deletion modules/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nginx:1.12-alpine
FROM nginx:1.12.1-alpine

# |--------------------------------------------------------------------------
# | Permissions issues workaround
Expand Down
37 changes: 0 additions & 37 deletions modules/php-fpm/Dockerfile.blueprint

This file was deleted.

6 changes: 5 additions & 1 deletion modules/php-fpm/docker-compose.blueprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ services:


php-fpm:
build: .
image: gulnap/kickoff-docker-php-images:php-fpm-7.1.10-v2.2.0
container_name: {{ .EnvFiles.Config.ENV }}-{{ .Values.Project.name }}-php-fpm
restart: {{ if and (ne "local" .EnvFiles.Config.ENV) (eq false .Values.Modules.graylog.enable) }}unless-stopped{{ else }}"no"{{ end }}
entrypoint: /usr/local/bin/docker-entrypoint.sh
networks:
- backend
environment:
- UID={{ if ne "windows" os }}${UID}{{ else }}82{{ end }}
- XDEBUG_ENABLED={{ .EnvFiles.Config.XDEBUG_ENABLED }}
{{- if eq "true" .EnvFiles.Config.XDEBUG_ENABLED }}
- XDEBUG_REMOTE_HOST={{ .EnvFiles.Config.XDEBUG_REMOTE_HOST }}
{{- end }}
labels:
- traefik.enable=false
volumes:
Expand Down
11 changes: 11 additions & 0 deletions modules/php-fpm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
#!/bin/sh

sedi()
{
sed --version >/dev/null 2>&1 && sed -i -- "$@" || sed -i "" "$@";
}

usermod -u $UID www-data;
chown -R www-data:www-data /var/www/html;

if [ "$XDEBUG_ENABLED" == "false" ]; then
sedi "s/\zend_extension/;zend_extension/g" /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini;
else
export XDEBUG_CONFIG="remote_host=$XDEBUG_REMOTE_HOST";
fi;

exec php-fpm;
2 changes: 1 addition & 1 deletion modules/traefik/docker-compose.blueprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:


proxy:
image: traefik:1.3.8-alpine
image: traefik:1.4.0-alpine
container_name: kickoff-proxy
restart: {{ if and (ne "local" .EnvFiles.Config.ENV) (eq false .Values.Modules.graylog.enable) }}unless-stopped{{ else }}"no"{{ end }}
command: --docker --logLevel={{ .EnvFiles.Config.TRAEFIK_LOG_LEVEL }}
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy