Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .bash_aliases

This file was deleted.

11 changes: 8 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
WEB_PORT=80
MAILDEV_PORT=1080
PHPMYADMIN_PORT=9090
DBADMIN_PORT=9090
WEB_PORT=80
PHP_VERSION=7.2
DB=mysql
WEB_SERVER=nginx
PROJECTS_PATH=./projects
MONGOEXPRESS_PORT=8081
MYSQL_ROOT_PASSWORD=root
CACHE_SERVER=redis
CACHE_PORT=6380
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ projects/*
!projects/index.php
conf/apache/vhosts/*
conf/nginx/vhosts/*
!conf/apache/vhosts/000-default.php
db/mysql/*
db/mongo/*
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changelog
All notable changes to this project will be documented in this file.

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

## [2.0] - 2017-12-20
### Added
- Add cache stack : redis or memcached

### Changed

- Refactoring docker-compose
- Change PHP stack based on Alpine container
- Set default PHP version to 7.2

### Removed

- Remove Apigen container
- Remove Deployer container
- Remove bash_aliases file
215 changes: 201 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,219 @@
# Requirements
## Environment composition

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

## Windows
### Core
- [PHP](http://php.net)

Windows 7 or higher with support for virtualization.
Available version :

### Git
- `5.6`
- `7.0`
- `7.1`
- `7.2`

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

```
$ git config core.autocrlf false
```
- Database

Two different database are available :

- [MySQL](https://www.mysql.com)
- [MongoDB](https://www.mongodb.com)

The database wished is configured in `.env` file. Default: `mysql`

- Web server

Two web server are available :

- [Nginx](https://nginx.org)
- [Apache](https://httpd.apache.org/)

All of them are in Alpine version.

- Cache server

Two cache server are available :

- [Redis](https://redis.io/)
- [Memcached](https://memcached.org/)

All of them are in Alpine version

### Tools

#### Database admin

- [MongoExpress](https://github.com/mongo-express/mongo-express) : Manage Mongo database instances
- [PHPMyAdmin](https://www.phpmyadmin.net/) : Manage Mongo database instances

#### Mail hub

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

#### Composer

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

# Installation
#### NodeJs

- [NodeJs](https://nodejs.org/en) : JavaScript runtime

### Optional tools

Optional tools are available to use in EnvDev. They are not included by default but can be added easily.

- [APIGen](https://github.com/ApiGen/ApiGen) : Documentation for your PHP project

Image container : [`vfac/apigen`](https://hub.docker.com/r/vfac/apigen/)

- [Deployer](https://deployer.org) : Deployment tool for PHP

Image container : [`vfac/deployer`](https://hub.docker.com/r/vfac/deployer/)

## Requirements

Two system dependencies are required :
- Docker
- Docker Compose

## Installation

```
$ git clone [email protected]:vfalies/EnvDev.git
```

# Usage
## Usage

To start the environment, type the following command:

```
$ docker-compose up
```

# Documentation
Several containers are created from `.env` configuration:

| Description | Container's name |
|-------------|------------------|
| Maildev hub mail | `maildev` |
| NodeJs | `nodejs` |
| Web server ( Apache or Nginx ) | `web` |
| PHP container | `php` |
| Cache server | `cache` |
| Database server | `db` |
| Database admin tool | `dbadmin` |

`composer` is available through `php` container:

```
docker exec php composer -v
```

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

```
docker run --rm node node -v
```

```
docker run --rm node npm -v
```

### Hosts

You can add your own hosts file for all your projects.

With NGinx

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

```
server {

listen 80;
server_name localhost;
root /var/www/html;
index index.php index.html index.htm;

location ~* \.PHP$ {
fastcgi_index index.php;
fastcgi_pass php:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

}
```

With Apache

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

```
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/html

<Directory /var/www/html>
Require all granted
</Directory>

<FilesMatch \.php$>
SetHandler "proxy:fcgi://php:9000"
</FilesMatch>
</VirtualHost>
```

## Configuration

You can modify `.env` file to manage applications and tools.
The following versions, paths and ports can be configured :

| Description | Variable name | Possible values | Default |
|:-------------|:---------------:|:-----------------:|:---------:|
| PHP Version | PHP_VERSION | `5.6`, `7.0`, `7.1`, `7.2` | `7.2` |
| Database type | DB | `mariadb`, `mysql`, `mongodb` | `mysql` |
| Cache server type | CACHE_SERVER | `redis`, `memcached` | `redis` |
| Projects Path | PROJECTS_PATH | any | `./projects` |
| HTTP web port | WEB_PORT | any | `80` |
| MailDev port | MAILDEV_PORT | any | `1080` |
| PHPMyAdmin port | PHPMYADMIN_PORT | any | `9090` |
| MongoExpress port | MONGOEXPRESS_PORT | any | `8081` |
| Cache server port | CACHE_PORT | any | `6380` |

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

### Nginx configuration

Nginx configuration file is available at `/conf/nginx/nginx.conf` to custom the web server configuration.

### Apache configuration

Apache configuration file is available at `/conf/apache/httpd.conf` to custom the web server configuration.

### PHP configuration

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

```
date.timezone = Europe/Paris
display_errors=1
error_reporting=E_ALL
log_errors = on
error_log = /var/log/php_errors.log
memory_limit = 256M
upload_max_filesize = 200M
post_max_size = 40M
```

### Projects configuration

To simplify projects source sharing between containers, you can install source projects in the path define in `.env` with variable `PROJECTS_PATH`.

Naturally, you can change the default path. In this case, the default summary will not be available.

## Open source

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