Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
00c7bb9358 | |||
1355684687 | |||
1de6aaad7f | |||
dcf5e72f8b | |||
956f51612d | |||
70d87fe5d1 | |||
9a655f9531 | |||
691f5d4e31 | |||
3ed355a515 | |||
a936052dd0 | |||
8c330bfcd0 | |||
d747734ad8 | |||
52bf0e678a | |||
907b831d73 | |||
3a7a9b6e3b | |||
5a7697e15d | |||
9e7616d052 | |||
ebf7d095c9 | |||
90512a3be6 | |||
fb7a36e4ce | |||
8a22bc22e0 | |||
200cd26a06 | |||
4b23424ff4 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/data
|
47
Makefile
Normal file
47
Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
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]"
|
50
README.md
Normal file
50
README.md
Normal file
@@ -0,0 +1,50 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
@@ -25,8 +25,12 @@ http {
|
||||
fastcgi_pass php:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
|
||||
fastcgi_read_timeout 180;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
12
config/php.conf
Normal file
12
config/php.conf
Normal file
@@ -0,0 +1,12 @@
|
||||
[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
1872
config/php.ini
File diff suppressed because it is too large
Load Diff
21
config/ssmtp.conf
Normal file
21
config/ssmtp.conf
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# 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
|
@@ -1,10 +1,17 @@
|
||||
[xdebug]
|
||||
zend_extension = xdebug.so
|
||||
xdebug.remote_enable = 1
|
||||
xdebug.remote_port=9042
|
||||
xdebug.remote_host = 172.17.0.1
|
||||
xdebug.remote_connect_back = 1 # Not safe for production servers
|
||||
xdebug.remote_port = 9000
|
||||
xdebug.idekey = VSCODE
|
||||
xdebug.remote_handler = dbgp
|
||||
xdebug.remote_mode = req
|
||||
xdebug.remote_autostart = true
|
||||
xdebug.remote_log = "/var/log/xdebug/xdebug.log"
|
||||
xdebug.force_display_errors = On
|
||||
|
||||
# Activation du Profiler
|
||||
xdebug.profiler_enable = 1
|
||||
xdebug.profiler_output_dir = "/var/log/xdebug/"
|
||||
xdebug.profiler_output_name = "cachegrind.%s.out"
|
||||
|
@@ -1,33 +1,41 @@
|
||||
mariadb:
|
||||
image: mariadb:latest
|
||||
volumes:
|
||||
- ~/.mysql:/var/lib/mysql
|
||||
- ~/log/mysql:/var/log/mysql
|
||||
- ./data/mysql:/var/lib/mysql
|
||||
- ./data/log/mysql:/var/log/mysql
|
||||
expose:
|
||||
- 3306
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=MyPassWord48
|
||||
|
||||
php:
|
||||
build: ./php-fpm
|
||||
mailcatcher:
|
||||
build: mailcatcher
|
||||
expose:
|
||||
- 9000
|
||||
- 25
|
||||
ports:
|
||||
- 9042:9042
|
||||
- 1080:1080
|
||||
|
||||
php:
|
||||
build: phpfpm
|
||||
volumes:
|
||||
- ~/Public:/var/www/html
|
||||
- ~/log/php:/var/log/
|
||||
- ./config/php.ini:/usr/local/etc/php/php.ini
|
||||
- ~/public:/var/www/html
|
||||
- ./data/log/xdebug:/var/log/xdebug
|
||||
- ./data/log/php:/var/log/php
|
||||
- ./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/ssmtp.conf:/etc/ssmtp/ssmtp.conf
|
||||
environment:
|
||||
- XDEBUG_CONFIG=remote_enable=1 remote_autostart=1
|
||||
links:
|
||||
- mariadb
|
||||
- mailcatcher
|
||||
|
||||
nginx:
|
||||
image: nginx:latest
|
||||
volumes:
|
||||
- ~/log/nginx:/var/log/nginx
|
||||
- ~/public:/var/www/html
|
||||
- ./data/log/nginx:/var/log/nginx
|
||||
- ./config/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ~/Public:/var/www/html
|
||||
ports:
|
||||
- 80:80
|
||||
environment:
|
||||
@@ -35,13 +43,3 @@ nginx:
|
||||
- NGINX_PORT=80
|
||||
links:
|
||||
- php
|
||||
|
||||
|
||||
|
||||
# smtp:
|
||||
# build: ./smtp
|
||||
# volumes:
|
||||
# - ./config/smtpd.conf:/etc/smtpd.conf
|
||||
# - ./config/mailname:/etc/mailname
|
||||
# expose:
|
||||
# - 25
|
||||
|
5
mailcatcher/Dockerfile
Normal file
5
mailcatcher/Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
||||
FROM ruby:latest
|
||||
|
||||
RUN gem install mailcatcher
|
||||
|
||||
ENTRYPOINT ["mailcatcher", "-f", "--ip", "0.0.0.0", "--smtp-port", "25", "--no-quit"]
|
@@ -1,25 +0,0 @@
|
||||
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
|
27
phpfpm/Dockerfile
Normal file
27
phpfpm/Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
FROM php:7.4-fpm-alpine
|
||||
|
||||
RUN apk add --update --no-cache \
|
||||
build-base \
|
||||
autoconf \
|
||||
jpeg-dev \
|
||||
zlib-dev \
|
||||
libpng-dev \
|
||||
freetype-dev \
|
||||
libzip-dev \
|
||||
oniguruma-dev \
|
||||
ssmtp
|
||||
|
||||
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
|
@@ -1,8 +0,0 @@
|
||||
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"]
|
Reference in New Issue
Block a user