Adding more container

This commit is contained in:
cytopia 2016-10-10 10:16:09 +02:00
parent 1cbe68e75f
commit bf3d4953f1
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
11 changed files with 168 additions and 67 deletions

View File

@ -1,8 +1,8 @@
# Devilbox
The ultimate Docker LAMP/LEMP Stack for local development.
The ultimate Docker-based LAMP/LEMP Stack for your development host.
## Specials
## Overview
* All logs are available on your Host computer
* MySQL localhost socket is available in PHP container
@ -13,15 +13,30 @@ The ultimate Docker LAMP/LEMP Stack for local development.
You can choose any combination of the following docker images during run-time:
<sub>This is under active development. Only the linkable items work at the moment.</sub>
| Webserver | Database | PHP |
|-----------|----------|-----|
| Apache 2.2 | [MySQL 5.5](https://github.com/cytopia/docker-mysql-5.5) | [PHP 5.5](https://github.com/cytopia/docker-php-fpm-5.5) |
| [Apache 2.4](https://github.com/cytopia/docker-apache-2.4) | MySQL 5.6 | [PHP 5.6](https://github.com/cytopia/docker-php-fpm-5.6) |
| Nginx | MySQL 5.7 | [PHP 7.0](https://github.com/cytopia/docker-php-fpm-7.0) |
| | MariaDB 5 | [PHP 7.1](https://github.com/cytopia/docker-php-fpm-7.1) |
| | MariaDB 10 | |
| [Apache 2.2](https://github.com/cytopia/docker-apache-2.2) | [MySQL 5.5](https://github.com/cytopia/docker-mysql-5.5) | [PHP 5.4](https://github.com/cytopia/docker-php-fpm-5.4) |
| [Apache 2.4](https://github.com/cytopia/docker-apache-2.4) | MySQL 5.6 | [PHP 5.5](https://github.com/cytopia/docker-php-fpm-5.5) |
| Nginx | MySQL 5.7 | [PHP 5.6](https://github.com/cytopia/docker-php-fpm-5.6) |
| | MariaDB 5 | [PHP 7.0](https://github.com/cytopia/docker-php-fpm-7.0) |
| | MariaDB 10 | [PHP 7.1](https://github.com/cytopia/docker-php-fpm-7.1) |
<!--
| Webserver | Database | PHP | KeyVal NoSQL | KeyDoc NoSQL | Column NoSQL |
|-----------|----------|-----|--------------|--------------|--------------|
| Apache 2.2 | [MySQL 5.5](https://github.com/cytopia/docker-mysql-5.5) | [PHP 5.5](https://github.com/cytopia/docker-php-fpm-5.5) | Redis | MongoDB | Cassandra |
| [Apache 2.4](https://github.com/cytopia/docker-apache-2.4) | MySQL 5.6 | [PHP 5.6](https://github.com/cytopia/docker-php-fpm-5.6) | Memcached | Couchbase | |
| Nginx | MySQL 5.7 | [PHP 7.0](https://github.com/cytopia/docker-php-fpm-7.0) | | | |
| lighttpd | MariaDB 5 | [PHP 7.1](https://github.com/cytopia/docker-php-fpm-7.1) | | | |
| | MariaDB 10 | HHVM | | | |
| | PostgreSQL | | | | |
<sub>Not all docker categories need to be started.</sub>
-->
## Start
1. Copy `env-example` to `.env`

View File

@ -0,0 +1,3 @@
<?php
// Fix DocumentRoot for VirtualDocumentRoot Hosts
$_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['SCRIPT_FILENAME']);

30
bin/apache-2.2/splitlogs.php Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env php
<?php
// TODO: logpath could also be passed via CMD argument
// so this script could be more general
$path = '/var/log/apache-2.2';
$fh_timeout = 30; // 30 sek.
$fd = fopen('php://stdin', 'r');
while (!feof($fd)) {
$row = fgets($fd);
list($vhost, $h, $l, $u, $t, $r, $s, $b, $referrer, $ua) = explode(';', $row, 10);
if (!isset(${$vhost})) {
${$vhost} = fopen($path . '/' . $vhost . '_access.log', 'a+');
}
$lastwrite[$vhost] = time();
fputs(${$vhost}, "$h $l $u $t $r $s $b $referrer $ua");
foreach ($lastwrite as $vhost => $time) {
if ((time() - ($time + 30)) >= 0) {
fclose(${$vhost});
unset(${$vhost});
unset($lastwrite[$vhost]);
}
}
}

View File

@ -3,25 +3,25 @@
// TODO: logpath could also be passed via CMD argument
// so this script could be more general
$path = "/var/log/apache-2.4";
$path = '/var/log/apache-2.4';
$fh_timeout = 30; // 30 sek.
$fd = fopen("php://stdin", "r");
$fd = fopen('php://stdin', 'r');
while (!feof($fd)) {
$row = fgets($fd);
list($vhost, $h, $l, $u, $t, $r, $s, $b, $referrer, $ua) = explode(";", $row, 10);
list($vhost, $h, $l, $u, $t, $r, $s, $b, $referrer, $ua) = explode(';', $row, 10);
if (!isset(${$vhost})) {
${$vhost} = fopen($path . "/" . $vhost . "_access.log", "a+");
${$vhost} = fopen($path . '/' . $vhost . '_access.log', 'a+');
}
$lastwrite[$vhost] = time();
fputs (${$vhost}, "$h $l $u $t $r $s $b $referrer $ua");
fputs(${$vhost}, "$h $l $u $t $r $s $b $referrer $ua");
foreach ($lastwrite as $vhost => $time) {
if ((time() - ($time+30)) >=0) {
if ((time() - ($time + 30)) >= 0) {
fclose(${$vhost});
unset(${$vhost});
unset($lastwrite[$vhost]);

View File

@ -46,6 +46,11 @@ services:
# Adjust timezone
- TIMEZONE=${TIMEZONE}
# Enable PHP-FPM support
- PHP_FPM_ENABLE=1
- PHP_FPM_SERVER_ADDR=172.16.238.11
- PHP_FPM_SERVER_PORT=9000
# Tell the webserver to look into this directory
# for additional configuration files.
#

View File

@ -56,6 +56,7 @@ MYSQL_SERVER=mysql-5.5
### 1.3 Choose PHP Server Image
###
#PHP_SERVER=php-fpm-5.4
#PHP_SERVER=php-fpm-5.5
PHP_SERVER=php-fpm-5.6
#PHP_SERVER=php-fpm-7.0
@ -98,7 +99,7 @@ HOST_PATH_TO_WWW_DOCROOTS=~/Sites
## If this directory is empty, a new mysql database will be
## created.
##
HOST_PATH_TO_MYSQL_DATADIR=~/data/mysql
HOST_PATH_TO_MYSQL_DATADIR=~/data/mysql4
@ -159,7 +160,7 @@ MYSQL_SQL_MODE=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
###
# Enable/Disable Xdebug
PHP_XDEBUG_ENABLE=0
PHP_XDEBUG_ENABLE=1
# Your local port (your computer host [not the docker])
# where your ide/editor is listening for xdebug connections.
@ -168,7 +169,7 @@ PHP_XDEBUG_REMOTE_PORT=9000
# Your local IP address (your computer host [not the docker])
# where your ide/editor is listening for xdebug connections.
PHP_XDEBUG_REMOTE_HOST=172.20.10.2
## TODO: Check if it works by automatically sending it to the broadcast address

View File

@ -0,0 +1,23 @@
CustomLog "/var/log/apache-2.2/access_log" combined
ErrorLog "/var/log/apache-2.2/error_log"
LogLevel warn
AddDefaultCharset UTF-8
# No DNS
HostnameLookups Off
#
Timeout 60
KeepAlive On
KeepAliveTimeout 10
MaxKeepAliveRequests 100
#
#
EnableMMAP Off
EnableSendfile Off
#
#
#
#
XSendFile On
XSendFilePath /shared/httpd

View File

@ -0,0 +1,31 @@
##
## Default Host for http://localhost
##
NameVirtualHost *:80
<VirtualHost _default_:80>
ServerName localhost
ServerAdmin root@localhost
ErrorLog /var/log/apache-2.2/localhost-error.log
CustomLog /var/log/apache-2.2/localhost-access.log combined
DirectoryIndex index.php index.html
DocumentRoot "/var/www/default/htdocs"
<Directory "/var/www/default/htdocs">
DirectoryIndex index.php index.html
AllowOverride All
Options All
RewriteEngine on
RewriteBase /
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

View File

@ -0,0 +1,43 @@
##
## Default Mass Virtual Host
##
<VirtualHost *:80>
# Get the server name from the Host: header
UseCanonicalName Off
ServerName localhost
ServerAlias *.loc
ServerAdmin root@localhost
# splitlogs.php is a custom script, which will filter the domain
# and create separate logfiles per domain.
LogFormat "%V;%h;%l;%u;%t;\"%r\";%>s;%b;\"%{Referer}i\";\"%{User-agent}i\"" vcommon
CustomLog "|/opt/bin/splitlogs.php" vcommon
ErrorLog /var/log/apache-2.2/other-error.log
DirectoryIndex index.php index.html
# When using VirtualDocumentRoot the PHP Env var DOCUMENT_ROOT
# is not filled, so we need to do that manually with a custom script.
VirtualDocumentRoot /shared/httpd/%-2+/htdocs/
php_admin_value auto_prepend_file /opt/bin/fix-virtual-docroot.php
<Directory "/shared/httpd/*/htdocs/">
DirectoryIndex index.php index.html
AllowOverride All
Options All
RewriteEngine on
RewriteBase /
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

View File

@ -2,6 +2,7 @@
## Default Host for http://localhost
##
<VirtualHost _default_:80>
ServerName localhost
ServerAdmin root@localhost
@ -11,28 +12,6 @@
DirectoryIndex index.php index.html
#RewriteEngine On
#RewriteRule ^/(.*\.php(/.*)?)$ fcgi://172.16.238.11:9000/var/www/default/htdocs/$1 [P]
# enablereuse
# Defining a worker will improve performance
# And in this case, re-use the worker (dependent on support from the fcgi application)
# If you have enough idle workers, this would only improve the performance marginally
#
# enablereuse requires Apache 2.4.11 or later
#<Proxy "fcgi://172.16.238.11:9000/" enablereuse=on max=10></Proxy>
<FilesMatch "\.php$">
Require all granted
# Pick one of the following approaches
# Use the standard TCP socket
SetHandler "proxy:fcgi://172.16.238.11:9000"
# If your version of httpd is 2.4.9 or newer (or has the back-ported feature), you can use the unix domain socket
#SetHandler "proxy:unix:/path/to/app.sock|fcgi://localhost/:9000"
</FilesMatch>
DocumentRoot "/var/www/default/htdocs"
<Directory "/var/www/default/htdocs">
DirectoryIndex index.php index.html
@ -43,14 +22,10 @@
RewriteEngine on
RewriteBase /
Order allow,deny
Allow from all
# Apache 2.4
Require all granted
</Directory>
</VirtualHost>

View File

@ -25,30 +25,6 @@
VirtualDocumentRoot /shared/httpd/%-2+/htdocs/
php_admin_value auto_prepend_file /opt/bin/fix-virtual-docroot.php
#<FilesMatch "\.php$">
# Require all granted
# SetHandler proxy:fcgi://172.16.238.11:9000
#</FilesMatch>
# enablereuse
# Defining a worker will improve performance
# And in this case, re-use the worker (dependent on support from the fcgi application)
# If you have enough idle workers, this would only improve the performance marginally
#
# enablereuse requires Apache 2.4.11 or later
#<Proxy "fcgi://172.16.238.11:9000/" enablereuse=on max=10></Proxy>
<FilesMatch "\.php$">
Require all granted
# Pick one of the following approaches
# Use the standard TCP socket
SetHandler "proxy:fcgi://172.16.238.11:9000"
# If your version of httpd is 2.4.9 or newer (or has the back-ported feature), you can use the unix domain socket
#SetHandler "proxy:unix:/path/to/app.sock|fcgi://localhost/:9000"
</FilesMatch>
<Directory "/shared/httpd/*/htdocs/">
DirectoryIndex index.php index.html
@ -62,7 +38,6 @@
Allow from all
Require all granted
</Directory>
</VirtualHost>