Skip to content

Commit fd8ea02

Browse files
authored
Merge pull request #3 from vfalies/dev
Dev
2 parents 9b496c5 + 4e06886 commit fd8ea02

File tree

31 files changed

+925
-399
lines changed

31 files changed

+925
-399
lines changed

.bash_aliases

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

.env

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
WEB_PORT=80
21
MAILDEV_PORT=1080
3-
PHPMYADMIN_PORT=9090
2+
DBADMIN_PORT=9090
3+
WEB_PORT=80
4+
PHP_VERSION=7.2
5+
DB=mysql
6+
WEB_SERVER=nginx
47
PROJECTS_PATH=./projects
5-
MONGOEXPRESS_PORT=8081
8+
MYSQL_ROOT_PASSWORD=root
9+
CACHE_SERVER=redis
10+
CACHE_PORT=6380

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ projects/*
33
!projects/index.php
44
conf/apache/vhosts/*
55
conf/nginx/vhosts/*
6-
!conf/apache/vhosts/000-default.php
7-
db/mysql/*
8-
db/mongo/*

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6+
7+
## [2.0] - 2017-12-20
8+
### Added
9+
- Add cache stack : redis or memcached
10+
11+
### Changed
12+
13+
- Refactoring docker-compose
14+
- Change PHP stack based on Alpine container
15+
- Set default PHP version to 7.2
16+
17+
### Removed
18+
19+
- Remove Apigen container
20+
- Remove Deployer container
21+
- Remove bash_aliases file

README.md

Lines changed: 201 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,219 @@
1-
# Requirements
1+
## Environment composition
22

3-
- [docker](https://www.docker.com/products/overview)
4-
- [docker-compose](https://docs.docker.com/compose/install/)
3+
This environment provies the following tools to develop in PHP :
54

6-
## Windows
5+
### Core
6+
- [PHP](http://php.net)
77

8-
Windows 7 or higher with support for virtualization.
8+
Available version :
99

10-
### Git
10+
- `5.6`
11+
- `7.0`
12+
- `7.1`
13+
- `7.2`
1114

12-
The following configuration is necessary :
15+
The version is configured in `.env` file. Default: `7.2`
16+
PHP Stack run on Alpine version to keep a small size image.
1317

14-
```
15-
$ git config core.autocrlf false
16-
```
18+
- Database
19+
20+
Two different database are available :
21+
22+
- [MySQL](https://www.mysql.com)
23+
- [MongoDB](https://www.mongodb.com)
24+
25+
The database wished is configured in `.env` file. Default: `mysql`
26+
27+
- Web server
28+
29+
Two web server are available :
30+
31+
- [Nginx](https://nginx.org)
32+
- [Apache](https://httpd.apache.org/)
33+
34+
All of them are in Alpine version.
35+
36+
- Cache server
37+
38+
Two cache server are available :
39+
40+
- [Redis](https://redis.io/)
41+
- [Memcached](https://memcached.org/)
42+
43+
All of them are in Alpine version
44+
45+
### Tools
46+
47+
#### Database admin
48+
49+
- [MongoExpress](https://github.com/mongo-express/mongo-express) : Manage Mongo database instances
50+
- [PHPMyAdmin](https://www.phpmyadmin.net/) : Manage Mongo database instances
51+
52+
#### Mail hub
53+
54+
- [MailDev](http://danfarrelly.nyc/MailDev) : SMTP Server + Web Interface for viewing and testing emails during development
55+
56+
#### Composer
57+
58+
- [Composer](https://getcomposer.org) : Dependency Manager for PHP
1759

18-
# Installation
60+
#### NodeJs
61+
62+
- [NodeJs](https://nodejs.org/en) : JavaScript runtime
63+
64+
### Optional tools
65+
66+
Optional tools are available to use in EnvDev. They are not included by default but can be added easily.
67+
68+
- [APIGen](https://github.com/ApiGen/ApiGen) : Documentation for your PHP project
69+
70+
Image container : [`vfac/apigen`](https://hub.docker.com/r/vfac/apigen/)
71+
72+
- [Deployer](https://deployer.org) : Deployment tool for PHP
73+
74+
Image container : [`vfac/deployer`](https://hub.docker.com/r/vfac/deployer/)
75+
76+
## Requirements
77+
78+
Two system dependencies are required :
79+
- Docker
80+
- Docker Compose
81+
82+
## Installation
1983

2084
```
2185
$ git clone [email protected]:vfalies/EnvDev.git
2286
```
2387

24-
# Usage
88+
## Usage
89+
90+
To start the environment, type the following command:
2591

2692
```
2793
$ docker-compose up
2894
```
2995

30-
# Documentation
96+
Several containers are created from `.env` configuration:
97+
98+
| Description | Container's name |
99+
|-------------|------------------|
100+
| Maildev hub mail | `maildev` |
101+
| NodeJs | `nodejs` |
102+
| Web server ( Apache or Nginx ) | `web` |
103+
| PHP container | `php` |
104+
| Cache server | `cache` |
105+
| Database server | `db` |
106+
| Database admin tool | `dbadmin` |
107+
108+
`composer` is available through `php` container:
109+
110+
```
111+
docker exec php composer -v
112+
```
113+
114+
`node`, `npm` are available through `node` container:
115+
116+
```
117+
docker run --rm node node -v
118+
```
119+
120+
```
121+
docker run --rm node npm -v
122+
```
123+
124+
### Hosts
125+
126+
You can add your own hosts file for all your projects.
127+
128+
With NGinx
129+
130+
In `conf/nginx/vhosts` directory, all your `yourhost.conf` file. A default host file is available for example : `/conf/nginx/vhosts/default.conf`.
131+
132+
```
133+
server {
134+
135+
listen 80;
136+
server_name localhost;
137+
root /var/www/html;
138+
index index.php index.html index.htm;
139+
140+
location ~* \.PHP$ {
141+
fastcgi_index index.php;
142+
fastcgi_pass php:9000;
143+
include fastcgi_params;
144+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
145+
}
146+
147+
}
148+
```
149+
150+
With Apache
151+
152+
In `conf/apache/vhosts` directory, all your `yourhost.conf` file. A default host file is available for example : `/conf/apache/vhosts/default.conf`.
153+
154+
```
155+
<VirtualHost *:80>
156+
ServerName localhost
157+
DocumentRoot /var/www/html
158+
159+
<Directory /var/www/html>
160+
Require all granted
161+
</Directory>
162+
163+
<FilesMatch \.php$>
164+
SetHandler "proxy:fcgi://php:9000"
165+
</FilesMatch>
166+
</VirtualHost>
167+
```
168+
169+
## Configuration
170+
171+
You can modify `.env` file to manage applications and tools.
172+
The following versions, paths and ports can be configured :
173+
174+
| Description | Variable name | Possible values | Default |
175+
|:-------------|:---------------:|:-----------------:|:---------:|
176+
| PHP Version | PHP_VERSION | `5.6`, `7.0`, `7.1`, `7.2` | `7.2` |
177+
| Database type | DB | `mariadb`, `mysql`, `mongodb` | `mysql` |
178+
| Cache server type | CACHE_SERVER | `redis`, `memcached` | `redis` |
179+
| Projects Path | PROJECTS_PATH | any | `./projects` |
180+
| HTTP web port | WEB_PORT | any | `80` |
181+
| MailDev port | MAILDEV_PORT | any | `1080` |
182+
| PHPMyAdmin port | PHPMYADMIN_PORT | any | `9090` |
183+
| MongoExpress port | MONGOEXPRESS_PORT | any | `8081` |
184+
| Cache server port | CACHE_PORT | any | `6380` |
185+
186+
If you access to the url `http://localhost` a page summarizes all projets and propose access link to PHPMyAdmin, MailDev and PHPInfo.
187+
188+
### Nginx configuration
189+
190+
Nginx configuration file is available at `/conf/nginx/nginx.conf` to custom the web server configuration.
191+
192+
### Apache configuration
193+
194+
Apache configuration file is available at `/conf/apache/httpd.conf` to custom the web server configuration.
195+
196+
### PHP configuration
197+
198+
A custom php.ini file is available at `/conf/php/php.ini`. The default PHP configuration is with these options:
199+
200+
```
201+
date.timezone = Europe/Paris
202+
display_errors=1
203+
error_reporting=E_ALL
204+
log_errors = on
205+
error_log = /var/log/php_errors.log
206+
memory_limit = 256M
207+
upload_max_filesize = 200M
208+
post_max_size = 40M
209+
```
210+
211+
### Projects configuration
212+
213+
To simplify projects source sharing between containers, you can install source projects in the path define in `.env` with variable `PROJECTS_PATH`.
214+
215+
Naturally, you can change the default path. In this case, the default summary will not be available.
216+
217+
## Open source
31218

32-
The complete documentation is avaiable on https://vfac.fr/envdev
219+
EnvDev is licensed under the MIT License and published through [GitHub](https://github.com/vfalies/envdev/blob/master/LICENSE)

0 commit comments

Comments
 (0)