Skip to content

Commit

Permalink
Merge remote-tracking branch 'root/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.gitignore
#	docker-compose.yml
  • Loading branch information
automatix committed May 5, 2021
2 parents 9ee0493 + c864877 commit 942b972
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 17 deletions.
31 changes: 31 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
########################################################################
# MySQL
########################################################################
MYSQL_PORT=3306
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=symfony
MYSQL_USER=symfony
MYSQL_PASSWORD=symfony

########################################################################
# PHP
########################################################################
PHP_PORT=9000
PHP_XDEBUG_MODE=off
PHP_XDEBUG_CLIENT_PORT=5902
PHP_XDEBUG_CLIENT_HOST=host.docker.internal

########################################################################
# NGINX
########################################################################
NGINX_PORT=80

########################################################################
# Elasticsearch
########################################################################
ELASTICSEARCH_PORT=9200

########################################################################
# Kibana
########################################################################
KIBANA_PORT=81
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# volumes
/logs
/symfony
/db

/.env.*

# IDE setting
## PhpStorm
.idea
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ nginx nginx Up 443/tc
php-fpm php-fpm7 -F Up 0.0.0.0:9000->9001/tcp
```

# Environment Customizations

You can customize the exposed ports and other parameters changing the docker-compose .env file.

# Read logs

You can access Nginx and Symfony application logs in the following directories on your host machine:
Expand Down
22 changes: 12 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ services:
image: mysql:8.0.22
command: ["--default-authentication-plugin=mysql_native_password"]
ports:
- "3306:3306"
- "${MYSQL_PORT}:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: symfony
MYSQL_USER: symfony
MYSQL_PASSWORD: symfony
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- ./db:/var/lib/mysql

Expand All @@ -19,10 +19,12 @@ services:
build:
context: ./php-fpm
args:
ENABLE_PHP_XDEBUG: 1
PHP_XDEBUG_MODE: ${PHP_XDEBUG_MODE}
PHP_XDEBUG_CLIENT_PORT: ${PHP_XDEBUG_CLIENT_PORT}
PHP_XDEBUG_CLIENT_HOST: ${PHP_XDEBUG_CLIENT_HOST}
SYMFONY_CLI_VERSION: 4.23.2
ports:
- "9000:9001"
- "${PHP_PORT}:9001"
volumes:
- ./symfony:/var/www/symfony:cached
- ./logs/symfony:/var/www/symfony/var/log:cached
Expand All @@ -33,7 +35,7 @@ services:
container_name: nginx
build: ./nginx
ports:
- "80:80"
- "${NGINX_PORT}:80"
depends_on:
- php
volumes:
Expand All @@ -46,7 +48,7 @@ services:
environment:
discovery.type: "single-node"
ports:
- "9200:9200"
- "${ELASTICSEARCH_PORT}:9200"

logstash:
container_name: logstash
Expand All @@ -68,4 +70,4 @@ services:
SERVER_NAME: localhost
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
ports:
- "81:5601"
- "${KIBANA_PORT}:5601"
16 changes: 12 additions & 4 deletions php-fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ LABEL maintainer="Vincent Composieux <[email protected]>"

RUN apk add --no-cache \
coreutils \
gettext \
php8-fpm \
php8-ctype \
php8-curl \
Expand Down Expand Up @@ -33,11 +34,19 @@ RUN apk add --no-cache \
make \
curl

# Allow to enable php8-xdebug
ARG ENABLE_PHP_XDEBUG
RUN if [[ "$ENABLE_PHP_XDEBUG" == "1" ]]; then \
# Enable php8-xdebug if $PHP_XDEBUG_MODE is not empty
ARG PHP_XDEBUG_MODE=off
ARG PHP_XDEBUG_CLIENT_PORT=5902
ARG PHP_XDEBUG_CLIENT_HOST=host.docker.internal
COPY xdebug.ini /etc/php8/conf.d/xdebug.ini.template
RUN if [[ "$PHP_XDEBUG_MODE" != "" ]]; then \
apk add --no-cache php8-pecl-xdebug; \
export PHP_XDEBUG_MODE=$PHP_XDEBUG_MODE; \
export PHP_XDEBUG_CLIENT_PORT=$PHP_XDEBUG_CLIENT_PORT; \
export PHP_XDEBUG_CLIENT_HOST=$PHP_XDEBUG_CLIENT_HOST; \
envsubst < /etc/php8/conf.d/xdebug.ini.template > /etc/php8/conf.d/xdebug.ini; \
fi
RUN rm -f /etc/php8/conf.d/xdebug.ini.template

RUN curl -sS https://getcomposer.org/installer | tee composer-setup.php \
&& php8 composer-setup.php && rm composer-setup.php* \
Expand All @@ -56,7 +65,6 @@ RUN apk add --update nodejs npm \

COPY symfony.ini /etc/php8/conf.d/
COPY symfony.ini /etc/php8/cli/conf.d/
COPY xdebug.ini /etc/php8/conf.d/

COPY symfony.pool.conf /etc/php8/php-fpm.d/

Expand Down
6 changes: 3 additions & 3 deletions php-fpm/xdebug.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
zend_extension=xdebug.so

[Xdebug]
xdebug.mode=debug
xdebug.client_port=5902
xdebug.client_host=host.docker.internal
xdebug.mode=${PHP_XDEBUG_MODE}
xdebug.client_port=${PHP_XDEBUG_CLIENT_PORT}
xdebug.client_host=${PHP_XDEBUG_CLIENT_HOST}

0 comments on commit 942b972

Please sign in to comment.