Skip to content

Commit 76ad1d8

Browse files
authored
Merge pull request #4 from vfalies/dev
Dev
2 parents c21c086 + 5075e35 commit 76ad1d8

36 files changed

+2714
-164
lines changed

.env renamed to .env.dist

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
MAILDEV_PORT=1080
22
DBADMIN_PORT=9090
33
WEB_PORT=80
4-
PHP_VERSION=7.2
4+
PHP_VERSION=7.2-fpm-alpine
55
DB=mysql
66
WEB_SERVER=nginx
7-
PROJECTS_PATH=./projects
7+
PROJECTS_PATH=/your/projects/directory/path
88
MYSQL_ROOT_PASSWORD=root
99
CACHE_SERVER=redis
1010
CACHE_PORT=6380

.gitignore

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
projects/*
2-
!projects/phpinfo.php
3-
!projects/index.php
41
conf/apache/vhosts/*
2+
!conf/apache/vhosts/default.conf
3+
!conf/apache/vhosts/envdev_home.conf
54
conf/nginx/vhosts/*
5+
!conf/nginx/vhosts/default.conf
6+
!conf/nginx/vhosts/envdev_home.conf
7+
projects/*
8+
!projects/index.php
9+
!projects/phpinfo.php
10+
.env

CHANGELOG.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,39 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

45
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
56
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
67

8+
## [2.1] - 2018-04-05
9+
10+
### Added
11+
12+
- Share git config & ssh keys
13+
- Add `envdev` vhost configuration for Apache & Nginx
14+
- Rename `projects` directory to `home`
15+
- Add ``.env.dist` configuration example
16+
- Add Makefile
17+
- Use current UID & GID in container
18+
- Add Make action "stop" to stop all containers
19+
- Add Make action "homepage" to open envdev.localhost in default browser
20+
21+
### Changed
22+
23+
- Rename conf/apache/vhost directory to conf/apache/vhosts
24+
- Update working directory for PHP container
25+
- Change PHP image
26+
- Refactoring Home page
27+
- Set docker-compose make action with detached mode
28+
29+
### Deleted
30+
31+
- Remove NodeJs container (already include in PHP image)
32+
733
## [2.0] - 2017-12-20
34+
835
### Added
36+
937
- Add cache stack : redis or memcached
1038

1139
### Changed
@@ -18,4 +46,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1846

1947
- Remove Apigen container
2048
- Remove Deployer container
21-
- Remove bash_aliases file
49+
- Remove bash_aliases file

Makefile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export USER_ID=$(shell id -u)
2+
export GROUP_ID=$(shell id -g)
3+
4+
include .env
5+
6+
servers:
7+
docker-compose up -d --build --remove-orphans
8+
9+
stop:
10+
docker-compose down
11+
12+
install:
13+
docker-compose build --force-rm --no-cache && docker run --rm -v $(shell pwd):/var/www/html -u "$(USER_ID):$(GROUP_ID)" vfac/envdevphpbase:$(PHP_VERSION) sh -c "cd /var/www/html/home/envdev; composer update --lock"
14+
15+
homepage:
16+
x-www-browser envdev.localhost

README.md

+41-20
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
# EnvDev
2+
13
## Environment composition
24

35
This environment provies the following tools to develop in PHP :
46

57
### Core
8+
69
- [PHP](http://php.net)
710

811
Available version :
@@ -17,7 +20,7 @@ PHP Stack run on Alpine version to keep a small size image.
1720

1821
- Database
1922

20-
Two different database are available :
23+
Two different database are available :
2124

2225
- [MySQL](https://www.mysql.com)
2326
- [MongoDB](https://www.mongodb.com)
@@ -53,7 +56,7 @@ All of them are in Alpine version
5356

5457
- [MailDev](http://danfarrelly.nyc/MailDev) : SMTP Server + Web Interface for viewing and testing emails during development
5558

56-
#### Composer
59+
#### Composer
5760

5861
- [Composer](https://getcomposer.org) : Dependency Manager for PHP
5962

@@ -76,21 +79,31 @@ Image container : [`vfac/deployer`](https://hub.docker.com/r/vfac/deployer/)
7679
## Requirements
7780

7881
Two system dependencies are required :
82+
7983
- Docker
8084
- Docker Compose
8185

8286
## Installation
8387

88+
```shell
89+
git clone git@github.com:vfalies/EnvDev.git
8490
```
85-
$ git clone git@github.com:vfalies/EnvDev.git
91+
92+
Create a `.env` file to define your configuration.
93+
An example is available with `.env.dist` file.
94+
95+
To install environment
96+
97+
```shell
98+
make install
8699
```
87100

88101
## Usage
89102

90103
To start the environment, type the following command:
91104

92-
```
93-
$ docker-compose up
105+
```shell
106+
make servers
94107
```
95108

96109
Several containers are created from `.env` configuration:
@@ -107,29 +120,35 @@ Several containers are created from `.env` configuration:
107120

108121
`composer` is available through `php` container:
109122

110-
```
123+
```shell
111124
docker exec php composer -v
112125
```
113126

114127
`node`, `npm` are available through `node` container:
115128

116-
```
129+
```shell
117130
docker run --rm node node -v
118131
```
119132

120-
```
133+
```shell
121134
docker run --rm node npm -v
122135
```
123136

137+
To open default home page in browser
138+
139+
```shell
140+
make home
141+
```
142+
124143
### Hosts
125144

126-
You can add your own hosts file for all your projects.
145+
You can add your own hosts file for all your projects.
127146

128-
With NGinx
147+
With NGinx
129148

130149
In `conf/nginx/vhosts` directory, all your `yourhost.conf` file. A default host file is available for example : `/conf/nginx/vhosts/default.conf`.
131150

132-
```
151+
```conf
133152
server {
134153
135154
listen 80;
@@ -151,39 +170,41 @@ With Apache
151170

152171
In `conf/apache/vhosts` directory, all your `yourhost.conf` file. A default host file is available for example : `/conf/apache/vhosts/default.conf`.
153172

154-
```
173+
```conf
155174
<VirtualHost *:80>
156175
ServerName localhost
157-
DocumentRoot /var/www/html
176+
DocumentRoot /var/www/html/projects
158177
159-
<Directory /var/www/html>
178+
<Directory /var/www/html/projects>
160179
Require all granted
161180
</Directory>
162181
163182
<FilesMatch \.php$>
164-
SetHandler "proxy:fcgi://php:9000"
183+
SetHandler "proxy:fcgi://php:9000"
165184
</FilesMatch>
166185
</VirtualHost>
167186
```
168187

169188
## Configuration
170189

171-
You can modify `.env` file to manage applications and tools.
190+
You can create `.env` file to manage applications and tools.
191+
An example is available with `.env.dist` file.
192+
172193
The following versions, paths and ports can be configured :
173194

174195
| Description | Variable name | Possible values | Default |
175196
|:-------------|:---------------:|:-----------------:|:---------:|
176197
| PHP Version | PHP_VERSION | `5.6`, `7.0`, `7.1`, `7.2` | `7.2` |
177198
| Database type | DB | `mariadb`, `mysql`, `mongodb` | `mysql` |
178199
| Cache server type | CACHE_SERVER | `redis`, `memcached` | `redis` |
179-
| Projects Path | PROJECTS_PATH | any | `./projects` |
200+
| Projects Path | PROJECTS_PATH | any | `/your/projects/directory/path` |
180201
| HTTP web port | WEB_PORT | any | `80` |
181202
| MailDev port | MAILDEV_PORT | any | `1080` |
182203
| PHPMyAdmin port | PHPMYADMIN_PORT | any | `9090` |
183204
| MongoExpress port | MONGOEXPRESS_PORT | any | `8081` |
184205
| Cache server port | CACHE_PORT | any | `6380` |
185206

186-
If you access to the url `http://localhost` a page summarizes all projets and propose access link to PHPMyAdmin, MailDev and PHPInfo.
207+
If you access to the url `http://envdev.localhost` a page summarizes all projets and propose access link to PHPMyAdmin, MailDev and PHPInfo.
187208

188209
### Nginx configuration
189210

@@ -195,9 +216,9 @@ Apache configuration file is available at `/conf/apache/httpd.conf` to custom th
195216

196217
### PHP configuration
197218

198-
A custom php.ini file is available at `/conf/php/php.ini`. The default PHP configuration is with these options:
219+
A custom php.ini file is available at `/conf/php/php.ini`. The default PHP configuration is with these options:
199220

200-
```
221+
```conf
201222
date.timezone = Europe/Paris
202223
display_errors=1
203224
error_reporting=E_ALL
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<VirtualHost *:80>
22
ServerName localhost
3-
DocumentRoot /var/www/html
3+
DocumentRoot /var/www/html/projects
44

5-
<Directory /var/www/html>
5+
<Directory /var/www/html/projects>
66
Require all granted
77
</Directory>
88

99
<FilesMatch \.php$>
1010
SetHandler "proxy:fcgi://php:9000"
1111
</FilesMatch>
12-
</VirtualHost>
12+
</VirtualHost>

conf/apache/vhosts/envdev_home.conf

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<VirtualHost *:80>
2+
ServerName envdev.localhost
3+
ServerAlias envdev
4+
5+
DocumentRoot /var/www/html/envdev_home/envdev/public
6+
7+
<Directory "/var/www/html/envdev_home/envdev/public">
8+
Options FollowSymLinks
9+
AllowOverride All
10+
11+
Require all granted
12+
</Directory>
13+
14+
<FilesMatch \.php$>
15+
SetHandler "proxy:fcgi://php:9000"
16+
</FilesMatch>
17+
</VirtualHost>

conf/nginx/vhosts/default.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ server {
22

33
listen 80;
44
server_name localhost;
5-
root /var/www/html;
5+
root /var/www/html/projects;
66
index index.php index.html index.htm;
77

88
location ~* \.PHP$ {

conf/nginx/vhosts/envdev_home.conf

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
server {
2+
3+
listen 80;
4+
server_name envdev.localhost envdev;
5+
root /var/www/html/envdev_home/envdev/public;
6+
index index.php index.html index.htm;
7+
8+
location / {
9+
try_files $uri /index.php$is_args$args;
10+
}
11+
12+
location ~* \.PHP$ {
13+
fastcgi_index index.php;
14+
fastcgi_pass php:9000;
15+
include fastcgi_params;
16+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
17+
}
18+
19+
}

0 commit comments

Comments
 (0)