2 Commits
php8.0 ... php5

Author SHA1 Message Date
9e857a9006 Utilise php-fpm 2016-09-27 17:42:22 +02:00
5701ed6f97 Réorganisation du dépôt 2016-09-27 16:15:55 +02:00
13 changed files with 1936 additions and 204 deletions

1
.gitignore vendored
View File

@@ -1 +0,0 @@
/data

View File

@@ -1,47 +0,0 @@
SHELL := bash
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX = >
.DEFAULT_GOAL := help
.PHONY: init upgrade up help clear-log
DC=docker-compose
SETFACL=sudo setfacl -R -m u:${USER}:rwX,d:u:${USER}:rwX
CHOWN=sudo chown -R
WWW=${HOME}/public
init: create-dir set-acl upgrade
create-dir:
> mkdir -p data/log/{mysql,nginx,php,xdebug}
> mkdir -p $(WWW)
> touch data/log/xdebug/xdebug.log
> touch data/log/nginx/{access.log,error.log}
> touch data/log/php/fpm.log
set-acl:
> $(SETFACL) data
> $(SETFACL) $(WWW)
> $(CHOWN) 82:82 data/log/{xdebug,php}
> $(CHOWN) 82:82 $(WWW)
> $(CHOWN) root:root data/log/nginx
> $(CHOWN) 999:999 data/log/mysql
> $(CHOWN) 999:999 data/mysql
clear-log:
> truncate -s 0 data/log/{php,nginx}/{access.log,error.log}
> truncate -s 0 data/log/xdebug/xdebug.log
> rm data/log/xdebug/cachegrind*
upgrade:
> $(DC) pull
> $(DC) build --pull
up:
> $(DC) up
help:
> @printf "Usage : make [init|upgrade|set-acl|clear-log|up]"

View File

@@ -1,50 +0,0 @@
Environnement de développement PHP
==================================
Usage
-----
```bash
# Initialiser l'environnement
make init
# Démarrer
make up
# Mettre à jour
make upgrade
# vider les logs
make clear-log
# remettre a plat les droits
make set-acl
```
Configuration de VSCodium pour utiliser xdebug
----------------------------------------------
Nécessite l'extension PHP debug.
```json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"hostname": "172.17.0.1",
"port": 9000,
"pathMappings": {
"/var/www/html": "/home/[user_name]/public"
},
"xdebugSettings": {
"max_data": 65535,
"show_hidden": 1,
"max_children": 100,
"max_depth": 5
}
}
]
}
```

View File

@@ -25,12 +25,8 @@ http {
fastcgi_pass php:9000; fastcgi_pass php:9000;
fastcgi_index index.php; fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
fastcgi_read_timeout 180;
include fastcgi_params; include fastcgi_params;
#fastcgi_read_timeout 180;
#client_max_body_size 30M;
} }
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log error;
} }
} }

View File

@@ -1,12 +0,0 @@
[www]
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/php/fpm.log
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 32M
php_flag[display_startup_errors] = on
catch_workers_output = yes
; for debugging 1h
request_terminate_timeout = 3600

1872
config/php.ini Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +0,0 @@
#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=postmaster
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=mailcatcher
# Where will the mail seem to come from?
#rewriteDomain=
# The full hostname
hostname=devphp
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

View File

@@ -1,17 +1,10 @@
[xdebug] [xdebug]
zend_extension = xdebug.so zend_extension = xdebug.so
xdebug.mode = debug xdebug.remote_enable=1
xdebug.client_host = 172.17.0.1 xdebug.remote_port=9042
xdebug.discover_client_host = yes xdebug.remote_host=172.17.0.1
xdebug.client_port = 9000 xdebug.remote_connect_back=1 # Not safe for production servers
xdebug.idekey = VSCODE xdebug.remote_handler=dbgp
xdebug.remote_handler = dbgp xdebug.remote_mode=req
xdebug.start_with_request = yes xdebug.remote_autostart=true
xdebug.force_display_errors = On xdebug.remote_log="/var/log/xdebug/xdebug.log"
xdebug.log = "/var/log/xdebug/xdebug.log"
# Activation du Profiler
xdebug.mode = profile
xdebug.output_dir = "/var/log/xdebug/"
xdebug.profiler_output_name = "cachegrind.%s.out"

View File

@@ -1,41 +1,33 @@
mariadb: mariadb:
image: mariadb:latest image: mariadb:latest
volumes: volumes:
- ./data/mysql:/var/lib/mysql - ~/.mysql:/var/lib/mysql
- ./data/log/mysql:/var/log/mysql - ~/log/mysql:/var/log/mysql
expose: expose:
- 3306 - 3306
environment: environment:
- MYSQL_ROOT_PASSWORD=MyPassWord48 - MYSQL_ROOT_PASSWORD=MyPassWord48
mailcatcher:
build: mailcatcher
expose:
- 25
ports:
- 1080:1080
php: php:
build: phpfpm-8.0 build: ./php-fpm
expose:
- 9000
ports:
- 9042:9042
volumes: volumes:
- ~/public:/var/www/html - ~/Public:/var/www/html
- ./data/log/xdebug:/var/log/xdebug - ~/log/php:/var/log/
- ./data/log/php:/var/log/php - ./config/php.ini:/usr/local/etc/php/php.ini
- ./config/php.conf:/usr/local/etc/php-fpm.d/zzz-settings.conf
- ./config/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini - ./config/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
- ./config/ssmtp.conf:/etc/ssmtp/ssmtp.conf
environment:
- XDEBUG_CONFIG=remote_enable=1 remote_autostart=1
links: links:
- mariadb - mariadb
- mailcatcher
nginx: nginx:
image: nginx:latest image: nginx:latest
volumes: volumes:
- ~/public:/var/www/html - ~/log/nginx:/var/log/nginx
- ./data/log/nginx:/var/log/nginx
- ./config/nginx.conf:/etc/nginx/nginx.conf - ./config/nginx.conf:/etc/nginx/nginx.conf
- ~/Public:/var/www/html
ports: ports:
- 80:80 - 80:80
environment: environment:
@@ -43,3 +35,13 @@ nginx:
- NGINX_PORT=80 - NGINX_PORT=80
links: links:
- php - php
# smtp:
# build: ./smtp
# volumes:
# - ./config/smtpd.conf:/etc/smtpd.conf
# - ./config/mailname:/etc/mailname
# expose:
# - 25

View File

@@ -1,5 +0,0 @@
FROM ruby:latest
RUN gem install mailcatcher
ENTRYPOINT ["mailcatcher", "-f", "--ip", "0.0.0.0", "--smtp-port", "25", "--no-quit"]

25
php-fpm/Dockerfile Normal file
View File

@@ -0,0 +1,25 @@
FROM php:5.6-fpm
RUN cd /tmp/ && \
curl -O https://xdebug.org/files/xdebug-2.4.1.tgz && \
tar zxf xdebug-2.4.1.tgz && \
mkdir -p /usr/src/php/ext/xdebug && \
mv xdebug-2.4.1/* /usr/src/php/ext/xdebug/
RUN apt-get update && apt-get install -y \
ssmtp \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
&& docker-php-ext-install -j$(nproc) iconv mcrypt gd zip \
&& docker-php-ext-install -j$(nproc) mysqli pdo pdo_mysql \
&& docker-php-ext-install -j$(nproc) xdebug\
&& apt-get purge -y --auto-remove $buildDeps \
&& cd /usr/src/php/ext/xdebug/ \
&& make clean \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install xdebug

View File

@@ -1,28 +0,0 @@
FROM php:8.0-fpm-alpine
RUN apk add --update --no-cache \
build-base \
autoconf \
jpeg-dev \
zlib-dev \
libpng-dev \
freetype-dev \
libzip-dev \
oniguruma-dev \
ssmtp \
fish
ENV LIBRARY_PATH=/lib:/usr/lib
RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
&& docker-php-ext-install -j$(nproc) \
iconv \
gd \
zip \
sockets \
mysqli \
pdo \
pdo_mysql \
mbstring \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug

8
smtp/Dockerfile Normal file
View File

@@ -0,0 +1,8 @@
FROM debian:jessie
RUN echo "deb http://debian.mirrors.ovh.net/debian/ jessie-backports main" >> /etc/apt/sources.list \
&& apt-get update && apt-get install -y \
opensmtpd/jessie-backports \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/usr/sbin/smtpd", "-d"]