DVL-001 Prepare HHVM support

This commit is contained in:
cytopia 2017-04-19 19:48:44 +02:00
parent 294123505b
commit d396c921d7
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
20 changed files with 1447 additions and 284 deletions

View File

@ -42,23 +42,51 @@ $MYSQL_HOST_ADDR = gethostbyname($MYSQL_HOST_NAME);
$POSTGRES_HOST_NAME = 'postgres';
$POSTGRES_HOST_ADDR = gethostbyname($POSTGRES_HOST_NAME);
//
// Lazy Loader
//
function loadClass($class) {
//
// Load files
//
require $LIB_DIR . DIRECTORY_SEPARATOR . 'Logger.php';
require $LIB_DIR . DIRECTORY_SEPARATOR . 'Docker.php';
require $LIB_DIR . DIRECTORY_SEPARATOR . 'Mysql.php';
require $LIB_DIR . DIRECTORY_SEPARATOR . 'Postgres.php';
global $LIB_DIR;
global $MYSQL_HOST_ADDR;
global $POSTGRES_HOST_ADDR;
static $_LOADED_LIBS;
//
// Instantiate Basics
//
$Logger = \devilbox\Logger::getInstance();
$Docker = \devilbox\Docker::getInstance();
$MySQL = \devilbox\Mysql::getInstance('root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), $MYSQL_HOST_ADDR);
$Postgres = \devilbox\Postgres::getInstance($Docker->getEnv('POSTGRES_USER'), $Docker->getEnv('POSTGRES_PASSWORD'), $POSTGRES_HOST_ADDR);
if (isset($_LOADED_LIBS[$class])) {
return $_LOADED_LIBS[$class];
} else {
switch($class) {
case 'Logger':
require $LIB_DIR . DIRECTORY_SEPARATOR . $class . '.php';
$_LOADED_LIBS[$class] = \devilbox\Logger::getInstance();
break;
case 'Docker':
require $LIB_DIR . DIRECTORY_SEPARATOR . $class . '.php';
$_LOADED_LIBS[$class] = \devilbox\Docker::getInstance();
break;
case 'Mysql':
require $LIB_DIR . DIRECTORY_SEPARATOR . $class . '.php';
$Docker = loadClass('Docker');
$_LOADED_LIBS[$class] = \devilbox\Mysql::getInstance('root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), $MYSQL_HOST_ADDR);
break;
case 'Postgres':
require $LIB_DIR . DIRECTORY_SEPARATOR . $class . '.php';
$Docker = loadClass('Docker');
$_LOADED_LIBS[$class] = \devilbox\Postgres::getInstance($Docker->getEnv('POSTGRES_USER'), $Docker->getEnv('POSTGRES_PASSWORD'), $POSTGRES_HOST_ADDR);
break;
default:
exit('Class does not exist: '.$class);
}
return $_LOADED_LIBS[$class];
}
}

View File

@ -4,16 +4,16 @@ require '../config.php';
if (isset($_GET['database'])) {
if (isset($_GET['type']) && $_GET['type'] == 'mysql') {
echo json_encode(array(
'size' => (string)$MySQL->getDBSize($_GET['database']),
'table' => (string)$MySQL->getTableCount($_GET['database'])
'size' => (string)loadClass('Mysql')->getDBSize($_GET['database']),
'table' => (string)loadClass('Mysql')->getTableCount($_GET['database'])
));
} else if (isset($_GET['type']) && $_GET['type'] == 'postgres') {
$schema = isset($_GET['schema']) ? $_GET['schema'] : '';
echo json_encode(array(
'size' => (string)$Postgres->getSchemaSize($_GET['database'], $schema),
'table' => (string)$Postgres->getTableCount($_GET['database'], $schema)
'size' => (string)loadClass('Postgres')->getSchemaSize($_GET['database'], $schema),
'table' => (string)loadClass('Postgres')->getTableCount($_GET['database'], $schema)
));
}
} else if (isset($_GET['vhost'])) {
echo $Docker->PHP_checkVirtualHost($_GET['vhost']);
echo loadClass('Docker')->PHP_checkVirtualHost($_GET['vhost']);
}

View File

@ -1,4 +1,5 @@
<?php require '../config.php'; ?>
<?php $MySQL = loadClass('Mysql'); ?>
<!DOCTYPE html>
<html lang="en">
<head>

View File

@ -1,4 +1,5 @@
<?php require '../config.php'; ?>
<?php $Postgres = loadClass('Postgres'); ?>
<!DOCTYPE html>
<html lang="en">
<head>

View File

@ -17,7 +17,7 @@
<div class="row">
<div class="col-md-12">
<?php $errors = $Logger->getAll(); ?>
<?php $errors = loadClass('Logger')->getAll(); ?>
<?php if ($errors === false): ?>
<p>Writing to logfile is not possible. Errors will be sent as mail instead. Check the mail section.</p>
<?php elseif (count($errors) === 0): ?>

View File

@ -1,4 +1,5 @@
<?php require '../config.php'; ?>
<?php $Docker = loadClass('Docker'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
@ -162,28 +163,28 @@
</td>
</tr>
<tr>
<?php $error; $valid = $Docker->PHP_has_valid_mysql_socket($error); ?>
<?php $err=null; $valid = $Docker->PHP_has_valid_mysql_socket($err); ?>
<th>MySQL socket</th>
<td class="<?php echo !$valid ? 'bg-danger' : '';?>">
<?php echo !$valid ? 'Error<br/><sub>'.$error.'</sub>' : $Docker->getEnv('MYSQL_SOCKET_PATH'); ?>
<?php echo !$valid ? 'Error<br/><sub>'.$err.'</sub>' : $Docker->getEnv('MYSQL_SOCKET_PATH'); ?>
</td>
</tr>
<tr>
<?php $err; $valid = \devilbox\Mysql::testConnection($err, 'root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), 'localhost'); ?>
<?php $err=null; $valid = \devilbox\Mysql::testConnection($err, 'root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), 'localhost'); ?>
<th>MySQL test</th>
<td class="<?php echo !$valid ? 'bg-danger' : '';?>">
<?php echo $valid ? '<span class="bg-success">OK</span> localhost:3306' : 'Failed: localhost:3306<br/><sub>'.$err.'</sub>'; ?>
</td>
</tr>
<tr>
<?php $err; $valid = \devilbox\Mysql::testConnection($err, 'root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), '127.0.0.1'); ?>
<?php $err=null; $valid = \devilbox\Mysql::testConnection($err, 'root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), '127.0.0.1'); ?>
<th>MySQL test</th>
<td class="<?php echo !$valid ? 'bg-danger' : '';?>">
<?php echo $valid ? '<span class="bg-success">OK</span> 127.0.0.1:3306' : 'Failed: 127.0.0.1:3306<br/><sub>'.$err.'</sub>'; ?>
</td>
</tr>
<tr>
<?php $err; $valid = \devilbox\Mysql::testConnection($err, 'root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), $MYSQL_HOST_ADDR); ?>
<?php $err=null; $valid = \devilbox\Mysql::testConnection($err, 'root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), $MYSQL_HOST_ADDR); ?>
<th>MySQL test</th>
<td class="<?php echo !$valid ? 'bg-danger' : '';?>">
<?php echo $valid ? '<span class="bg-success">OK</span> '.$MYSQL_HOST_ADDR.':3306' : 'Failed: '.$MYSQL_HOST_ADDR.':3306<br/><sub>'.$err.'</sub>'; ?>

View File

@ -1,4 +1,5 @@
<?php
require '../config.php';
//
// $_POST submit for sending a test email
@ -7,7 +8,9 @@ if (isset($_GET['email']) && isset($_GET['subject']) && isset($_GET['message']))
$mail = $_GET['email'];
$subj = $_GET['subject'];
$mess = $_GET['message'];
mail($mail, $subj, $mess);
if (! mail($mail, $subj, $mess)) {
loadClass('Logger')->error('Could not send mail to: '.$mail.' | subject: '.$subject);
}
header('Location: /mail.php');
exit();
}
@ -15,7 +18,6 @@ if (isset($_GET['email']) && isset($_GET['subject']) && isset($_GET['message']))
//
// Includes
//
require '../config.php';
require $VEN_DIR . DIRECTORY_SEPARATOR . 'Mail' . DIRECTORY_SEPARATOR .'Mbox.php';
require $VEN_DIR . DIRECTORY_SEPARATOR . 'Mail' . DIRECTORY_SEPARATOR .'mimeDecode.php';
require $LIB_DIR . DIRECTORY_SEPARATOR . 'Mail.php';

View File

@ -1,4 +1,5 @@
<?php require '../config.php'; ?>
<?php $Docker = loadClass('Docker'); ?>
<!DOCTYPE html>
<html lang="en">
<head>

View File

@ -12,6 +12,10 @@
<div class="row">
<div class="col-md-12">
<style>
/* prevent hhvm phpinfo() from shrinking the width */
body {width: 100% !important;}
</style>
<?php phpinfo(); ?>
</div>
</div>

View File

@ -1,4 +1,5 @@
<?php require '../config.php'; ?>
<?php $Docker = loadClass('Docker'); ?>
<!DOCTYPE html>
<html lang="en">
<head>

View File

@ -1,4 +1,5 @@
<?php require '../config.php'; ?>
<?php $Docker = loadClass('Docker'); ?>
<!DOCTYPE html>
<html lang="en">
<head>

View File

@ -107,8 +107,7 @@ class Docker
public function getEnv($variable)
{
if (!isset($this->_env[$variable])) {
$Logger = \devilbox\Logger::getInstance();
$Logger->error('Docker environment variable not found: '.$variable);
loadClass('Logger')->error('Docker environment variable not found: '.$variable);
return null;
}
return $this->_env[$variable];
@ -158,7 +157,12 @@ class Docker
*/
public function PHP_version()
{
return 'PHP ' . phpversion() .' (' . php_sapi_name().')';
if (defined('HHVM_VERSION')) {
return 'HHVM ' .HHVM_VERSION . '<br/>(PHP '.str_replace('-hhvm', '', phpversion()).')';
//return 'PHP ' . phpversion() . '('. HHVM_VERSION . ')';
} else {
return 'PHP ' . phpversion() .' (' . php_sapi_name().')';
}
}
/**
@ -338,7 +342,7 @@ class Docker
};
$sql = 'SHOW VARIABLES;';
$configs = \devilbox\Mysql::getInstance()->select($sql, $callback);
$configs = loadClass('Mysql')->select($sql, $callback);
return $configs ? $configs : array();
@ -351,7 +355,7 @@ class Docker
};
$sql = 'SHOW VARIABLES WHERE Variable_Name = "'.$key.'";';
$val = \devilbox\Mysql::getInstance()->select($sql, $callback);
$val = loadClass('Mysql')->select($sql, $callback);
if (is_array($val) && $val) {
return array_values($val)[0];
@ -379,7 +383,7 @@ class Docker
$data = $row['version'];
};
$version = \devilbox\Postgres::getInstance()->select('SELECT version();', $callback);
$version = loadClass('Postgres')->select('SELECT version();', $callback);
// Extract shorthand
preg_match('/\w+[[:space:]]*[.0-9]+/i', $version, $matches);
@ -412,7 +416,7 @@ class Docker
};
$sql = 'SELECT name, setting FROM pg_settings;';
$configs = \devilbox\Postgres::getInstance()->select($sql, $callback);
$configs = loadClass('Postgres')->select($sql, $callback);
return $configs ? $configs : array();
@ -423,7 +427,7 @@ class Docker
};
$sql = "SELECT name, setting FROM pg_settings WHERE name = '".$key."';";
$val = \devilbox\Postgres::getInstance()->select($sql, $callback);
$val = loadClass('Postgres')->select($sql, $callback);
return is_array($val) ? '' : $val;
}

View File

@ -34,7 +34,7 @@ class Mysql
}
// If current MySQL instance was unable to connect
if ((static::$instance->getConnectError())) {
\devilbox\Logger::getInstance()->error('Instance has errors:' . "\r\n" . var_export(static::$instance, true) . "\r\n");
loadClass('Logger')->error('Instance has errors:' . "\r\n" . var_export(static::$instance, true) . "\r\n");
//return null;
}
return static::$instance;
@ -130,7 +130,7 @@ class Mysql
if (mysqli_connect_errno()) {
$this->_connect_error = 'Failed to connect: ' .mysqli_connect_error();
$this->_connect_errno = mysqli_connect_errno();
\devilbox\Logger::getInstance()->error($this->_connect_error);
loadClass('Logger')->error($this->_connect_error);
} else {
$this->_link = $link;
}
@ -162,14 +162,14 @@ class Mysql
public function select($query, $callback = null)
{
if (!$this->_link) {
\devilbox\Logger::getInstance()->error('MySQL error, link is no resource in select()');
loadClass('Logger')->error('MySQL error, link is no resource in select()');
return false;
}
if (!($result = mysqli_query($this->_link, $query))) {
$this->_error = mysqli_error($this->_link);
$this->_errno = mysqli_errno($this->_link);
\devilbox\Logger::getInstance()->error($this->_error);
loadClass('Logger')->error($this->_error);
return false;
}

View File

@ -34,7 +34,7 @@ class Postgres
}
// If current Postgres instance was unable to connect
if ((static::$instance->getConnectError())) {
\devilbox\Logger::getInstance()->error('Instance has errors:' . "\r\n" . var_export(static::$instance, true) . "\r\n");
loadClass('Logger')->error('Instance has errors:' . "\r\n" . var_export(static::$instance, true) . "\r\n");
//return null;
}
return static::$instance;
@ -135,7 +135,7 @@ class Postgres
if (!$link || pg_connection_status($link) !== PGSQL_CONNECTION_OK) {
$this->_connect_error = 'Failed to connect to '.$user.'@'.$host;
$this->_connect_errno = 1;
\devilbox\Logger::getInstance()->error($this->_connect_error);
loadClass('Logger')->error($this->_connect_error);
} else {
$this->_link = $link;
}
@ -171,14 +171,14 @@ class Postgres
public function select($query, $callback = null)
{
if (!$this->_link) {
\devilbox\Logger::getInstance()->error('Postgres error, link is no resource in select()');
loadClass('Logger')->error('Postgres error, link is no resource in select()');
return false;
}
if (!($result = pg_query($this->_link, $query))) {
$this->_error = 'PostgreSQL - error on result: '.pg_result_error($result)."\n" . 'query:'."\n" . $query;
$this->_errno = 1;
\devilbox\Logger::getInstance()->error($this->_error);
loadClass('Logger')->error($this->_error);
return false;
}
@ -224,7 +224,7 @@ class Postgres
// Get schemas for each database
foreach ($databases as $name => &$database) {
$PSQL = new Postgres('postgres', \devilbox\Docker::getInstance()->getEnv('POSTGRES_PASSWORD'), $GLOBALS['POSTGRES_HOST_ADDR'], $name);
$PSQL = new Postgres('postgres', loadClass('Docker')->getEnv('POSTGRES_PASSWORD'), $GLOBALS['POSTGRES_HOST_ADDR'], $name);
$sql = "SELECT n.nspname AS schemas FROM pg_catalog.pg_namespace AS n WHERE n.nspname !~ '^pg_' AND n.nspname <> 'information_schema';";
$callback = function ($row, &$data) {
@ -247,7 +247,7 @@ class Postgres
*/
public function getSchemaSize($database, $schema)
{
$PSQL = new Postgres('postgres', \devilbox\Docker::getInstance()->getEnv('POSTGRES_PASSWORD'), $GLOBALS['POSTGRES_HOST_ADDR'], $database);
$PSQL = new Postgres('postgres', loadClass('Docker')->getEnv('POSTGRES_PASSWORD'), $GLOBALS['POSTGRES_HOST_ADDR'], $database);
$callback = function ($row, &$data) {
$data = $row['size'];
@ -276,7 +276,7 @@ class Postgres
*/
public function getTableCount($database, $schema)
{
$PSQL = new Postgres('postgres', \devilbox\Docker::getInstance()->getEnv('POSTGRES_PASSWORD'), $GLOBALS['POSTGRES_HOST_ADDR'], $database);
$PSQL = new Postgres('postgres', loadClass('Docker')->getEnv('POSTGRES_PASSWORD'), $GLOBALS['POSTGRES_HOST_ADDR'], $database);
$callback = function ($row, &$data) {
$data = $row['count'];
};

1112
.devilbox/www/include/vendor/Mail/PEAR.php vendored Normal file

File diff suppressed because it is too large Load Diff

1
.gitignore vendored
View File

@ -31,6 +31,7 @@ cfg/php-fpm-5.5/*.ini
cfg/php-fpm-5.6/*.ini
cfg/php-fpm-7.0/*.ini
cfg/php-fpm-7.1/*.ini
cfg/hhvm-latest/*.ini

View File

@ -40,6 +40,7 @@ env:
- SERVER=php VERSION=php-fpm-5.6
- SERVER=php VERSION=php-fpm-7.0
- SERVER=php VERSION=php-fpm-7.1
- SERVER=php VERSION=hhvm-latest
###
@ -54,6 +55,14 @@ before_install:
- uname -a
before_script:
# Disable services enabled by default
# http://docs.travis-ci.com/user/database-setup/#MySQL
- sudo /etc/init.d/mysql stop
- sudo /etc/init.d/postgresql stop
###
### Test
###

View File

@ -79,12 +79,12 @@ No need to install and configure different versions locally. Simply choose your
| Webserver | MySQL | PostgreSQL | PHP |
|-----------|-------|------------|-----|
| [![Build Status](https://travis-ci.org/cytopia/docker-apache-2.2.svg?branch=master)](https://travis-ci.org/cytopia/docker-apache-2.2) [Apache 2.2](https://github.com/cytopia/docker-apache-2.2) | [![Build Status](https://travis-ci.org/cytopia/docker-mysql-5.5.svg?branch=master)](https://travis-ci.org/cytopia/docker-mysql-5.5) [MySQL 5.5](https://github.com/cytopia/docker-mysql-5.5) | [![Build Status](https://travis-ci.org/docker-library/postgres.svg?branch=master)](https://travis-ci.org/docker-library/postgres/branches) [PostgreSQL 9.2](https://hub.docker.com/_/postgres/) | [![Build Status](https://travis-ci.org/cytopia/docker-php-fpm-5.4.svg?branch=master)](https://travis-ci.org/cytopia/docker-php-fpm-5.4) [PHP 5.4](https://github.com/cytopia/docker-php-fpm-5.4) |
| [![Build Status](https://travis-ci.org/cytopia/docker-apache-2.4.svg?branch=master)](https://travis-ci.org/cytopia/docker-apache-2.4) [Apache 2.4](https://github.com/cytopia/docker-apache-2.4) | [![Build Status](https://travis-ci.org/cytopia/docker-mysql-5.6.svg?branch=master)](https://travis-ci.org/cytopia/docker-mysql-5.6) [MySQL 5.6](https://github.com/cytopia/docker-mysql-5.6) | [![Build Status](https://travis-ci.org/docker-library/postgres.svg?branch=master)](https://travis-ci.org/docker-library/postgres/branches) [PostgreSQL 9.3](https://hub.docker.com/_/postgres/) | [![Build Status](https://travis-ci.org/cytopia/docker-php-fpm-5.5.svg?branch=master)](https://travis-ci.org/cytopia/docker-php-fpm-5.5) [PHP 5.5](https://github.com/cytopia/docker-php-fpm-5.5) |
| [![Build Status](https://travis-ci.org/cytopia/docker-nginx-stable.svg?branch=master)](https://travis-ci.org/cytopia/docker-nginx-stable) [Nginx stable](https://github.com/cytopia/docker-nginx-stable) | [![Build Status](https://travis-ci.org/cytopia/docker-mysql-5.7.svg?branch=master)](https://travis-ci.org/cytopia/docker-mysql-5.7) [MySQL 5.7](https://github.com/cytopia/docker-mysql-5.7) | [![Build Status](https://travis-ci.org/docker-library/postgres.svg?branch=master)](https://travis-ci.org/docker-library/postgres/branches) [PostgreSQL 9.4](https://hub.docker.com/_/postgres/) | [![Build Status](https://travis-ci.org/cytopia/docker-php-fpm-5.6.svg?branch=master)](https://travis-ci.org/cytopia/docker-php-fpm-5.6) [PHP 5.6](https://github.com/cytopia/docker-php-fpm-5.6) |
| [![Build Status](https://travis-ci.org/cytopia/docker-nginx-mainline.svg?branch=master)](https://travis-ci.org/cytopia/docker-nginx-mainline) [Nginx mainline](https://github.com/cytopia/docker-nginx-mainline) | [![Build Status](https://travis-ci.org/cytopia/docker-mariadb-5.5.svg?branch=master)](https://travis-ci.org/cytopia/docker-mariadb-5.5) [MariaDB 5.5](https://github.com/cytopia/docker-mariadb-5.5) | [![Build Status](https://travis-ci.org/docker-library/postgres.svg?branch=master)](https://travis-ci.org/docker-library/postgres/branches) [PostgreSQL 9.5](https://hub.docker.com/_/postgres/) | [![Build Status](https://travis-ci.org/cytopia/docker-php-fpm-7.0.svg?branch=master)](https://travis-ci.org/cytopia/docker-php-fpm-7.0) [PHP 7.0](https://github.com/cytopia/docker-php-fpm-7.0) |
| | [![Build Status](https://travis-ci.org/cytopia/docker-mariadb-10.0.svg?branch=master)](https://travis-ci.org/cytopia/docker-mariadb-10.0) [MariaDB 10.0](https://github.com/cytopia/docker-mariadb-10.0) | [![Build Status](https://travis-ci.org/docker-library/postgres.svg?branch=master)](https://travis-ci.org/docker-library/postgres/branches) [PostgreSQL 9.6](https://hub.docker.com/_/postgres/) | [![Build Status](https://travis-ci.org/cytopia/docker-php-fpm-7.1.svg?branch=master)](https://travis-ci.org/cytopia/docker-php-fpm-7.1) [PHP 7.1](https://github.com/cytopia/docker-php-fpm-7.1) |
| | [![Build Status](https://travis-ci.org/cytopia/docker-mariadb-10.1.svg?branch=master)](https://travis-ci.org/cytopia/docker-mariadb-10.1) [MariaDB 10.1](https://github.com/cytopia/docker-mariadb-10.1) | |
| [![Build Status](https://travis-ci.org/cytopia/docker-apache-2.2.svg?branch=master)](https://travis-ci.org/cytopia/docker-apache-2.2) [Apache 2.2](https://github.com/cytopia/docker-apache-2.2) | [![Build Status](https://travis-ci.org/cytopia/docker-mysql-5.5.svg?branch=master)](https://travis-ci.org/cytopia/docker-mysql-5.5) [MySQL 5.5](https://github.com/cytopia/docker-mysql-5.5) | [![Build Status](https://travis-ci.org/docker-library/postgres.svg?branch=master)](https://travis-ci.org/docker-library/postgres/branches) [PgSQL 9.2](https://hub.docker.com/_/postgres/) | [![Build Status](https://travis-ci.org/cytopia/docker-php-fpm-5.4.svg?branch=master)](https://travis-ci.org/cytopia/docker-php-fpm-5.4) [PHP 5.4](https://github.com/cytopia/docker-php-fpm-5.4) |
| [![Build Status](https://travis-ci.org/cytopia/docker-apache-2.4.svg?branch=master)](https://travis-ci.org/cytopia/docker-apache-2.4) [Apache 2.4](https://github.com/cytopia/docker-apache-2.4) | [![Build Status](https://travis-ci.org/cytopia/docker-mysql-5.6.svg?branch=master)](https://travis-ci.org/cytopia/docker-mysql-5.6) [MySQL 5.6](https://github.com/cytopia/docker-mysql-5.6) | [![Build Status](https://travis-ci.org/docker-library/postgres.svg?branch=master)](https://travis-ci.org/docker-library/postgres/branches) [PgSQL 9.3](https://hub.docker.com/_/postgres/) | [![Build Status](https://travis-ci.org/cytopia/docker-php-fpm-5.5.svg?branch=master)](https://travis-ci.org/cytopia/docker-php-fpm-5.5) [PHP 5.5](https://github.com/cytopia/docker-php-fpm-5.5) |
| [![Build Status](https://travis-ci.org/cytopia/docker-nginx-stable.svg?branch=master)](https://travis-ci.org/cytopia/docker-nginx-stable) [Nginx stable](https://github.com/cytopia/docker-nginx-stable) | [![Build Status](https://travis-ci.org/cytopia/docker-mysql-5.7.svg?branch=master)](https://travis-ci.org/cytopia/docker-mysql-5.7) [MySQL 5.7](https://github.com/cytopia/docker-mysql-5.7) | [![Build Status](https://travis-ci.org/docker-library/postgres.svg?branch=master)](https://travis-ci.org/docker-library/postgres/branches) [PgSQL 9.4](https://hub.docker.com/_/postgres/) | [![Build Status](https://travis-ci.org/cytopia/docker-php-fpm-5.6.svg?branch=master)](https://travis-ci.org/cytopia/docker-php-fpm-5.6) [PHP 5.6](https://github.com/cytopia/docker-php-fpm-5.6) |
| [![Build Status](https://travis-ci.org/cytopia/docker-nginx-mainline.svg?branch=master)](https://travis-ci.org/cytopia/docker-nginx-mainline) [Nginx mainline](https://github.com/cytopia/docker-nginx-mainline) | [![Build Status](https://travis-ci.org/cytopia/docker-mariadb-5.5.svg?branch=master)](https://travis-ci.org/cytopia/docker-mariadb-5.5) [MariaDB 5.5](https://github.com/cytopia/docker-mariadb-5.5) | [![Build Status](https://travis-ci.org/docker-library/postgres.svg?branch=master)](https://travis-ci.org/docker-library/postgres/branches) [PgSQL 9.5](https://hub.docker.com/_/postgres/) | [![Build Status](https://travis-ci.org/cytopia/docker-php-fpm-7.0.svg?branch=master)](https://travis-ci.org/cytopia/docker-php-fpm-7.0) [PHP 7.0](https://github.com/cytopia/docker-php-fpm-7.0) |
| | [![Build Status](https://travis-ci.org/cytopia/docker-mariadb-10.0.svg?branch=master)](https://travis-ci.org/cytopia/docker-mariadb-10.0) [MariaDB 10.0](https://github.com/cytopia/docker-mariadb-10.0) | [![Build Status](https://travis-ci.org/docker-library/postgres.svg?branch=master)](https://travis-ci.org/docker-library/postgres/branches) [PgSQL 9.6](https://hub.docker.com/_/postgres/) | [![Build Status](https://travis-ci.org/cytopia/docker-php-fpm-7.1.svg?branch=master)](https://travis-ci.org/cytopia/docker-php-fpm-7.1) [PHP 7.1](https://github.com/cytopia/docker-php-fpm-7.1) |
| | [![Build Status](https://travis-ci.org/cytopia/docker-mariadb-10.1.svg?branch=master)](https://travis-ci.org/cytopia/docker-mariadb-10.1) [MariaDB 10.1](https://github.com/cytopia/docker-mariadb-10.1) | | [![Build Status](https://travis-ci.org/cytopia/docker-hhvm-latest.svg?branch=master)](https://travis-ci.org/cytopia/docker-hhvm-latest) [HHVM latest](https://github.com/cytopia/docker-hhvm-latest)
| | [![Build Status](https://travis-ci.org/cytopia/docker-mariadb-10.2.svg?branch=master)](https://travis-ci.org/cytopia/docker-mariadb-10.2) [MariaDB 10.2](https://github.com/cytopia/docker-mariadb-10.2) | |

View File

@ -26,273 +26,271 @@ version: '2'
################################################################################
services:
# ----------------------------------------
# HTTP
# ----------------------------------------
httpd:
image: cytopia/${HTTPD_SERVER}:0.8
# Manually build via `docker-compose build`
#build:
#context: https://github.com/cytopia/docker-${HTTPD_SERVER}.git#1
# context: https://github.com/cytopia/docker-${HTTPD_SERVER}.git
environment:
# Show all executed commands during docker entrypoint?
- DEBUG_COMPOSE_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
# 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.
#
# @see volumes:: - ./etc/${HTTPD_SERVER}:/etc/${HTTPD_SERVER}
- CUSTOM_HTTPD_CONF_DIR=/etc/${HTTPD_SERVER}
ports:
# ---- Format: ----
# [HOST-ADDR : ] HOST-PORT : DOCKER-PORT
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_HTTPD}:80"
networks:
app_net:
ipv4_address: 172.16.238.10
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Custom scripts/binaries required for httpd server vhost
# configuration to work.
# (configured in /etc/${HTTPD_SERVER}/02-vhost-mass.conf)
- ${DEVILBOX_PATH}/.devilbox/bin/${HTTPD_SERVER}:/opt/bin:ro
# Mount user-defined httpd configuration files
# @see environment::CUSTOM_HTTPD_CONF_DIR for how this
# is added in httpd server
- ${DEVILBOX_PATH}/.devilbox/etc/${HTTPD_SERVER}:/etc/${HTTPD_SERVER}:ro
# Mount custom intranet
# (configured in /etc/${HTTPD_SERVER}/01-vhost-default.conf)
- ${DEVILBOX_PATH}/.devilbox/www:/var/www/default:ro
# Mount user-defined httpd log
# @see ./etc/${HTTPD_SERVER}/*.conf for log defines
- ${DEVILBOX_PATH}/log/${HTTPD_SERVER}:/var/log/${HTTPD_SERVER}
# Mount custom mass virtual hosting
# (configured in /etc/${HTTPD_SERVER}/02-vhost-mass.conf)
- ${HOST_PATH_TO_WWW_DOCROOTS}:/shared/httpd:ro
links:
# ---- Format: ----
# SERVICE [ : ALIAS]
- "php:php-fpm"
# ----------------------------------------
# PHP-FPM
# ----------------------------------------
php:
# TODO: remove latest, once it is ready for the next release
image: cytopia/${PHP_SERVER}:latest
# Manually build via `docker-compose build`
#build:
#context: https://github.com/cytopia/docker-${PHP_SERVER}.git#1
# context: https://github.com/cytopia/docker-${PHP_SERVER}.git
environment:
# Show all executed commands during docker entrypoint?
- DEBUG_COMPOSE_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
# Adjust timezone
- TIMEZONE=${TIMEZONE}
##
## PHP Xdebug
##
- PHP_XDEBUG_ENABLE=${PHP_XDEBUG_ENABLE}
- PHP_XDEBUG_REMOTE_PORT=${PHP_XDEBUG_REMOTE_PORT}
- PHP_XDEBUG_REMOTE_HOST=${PHP_XDEBUG_REMOTE_HOST}
# ----------------------------------------
# HTTP
# ----------------------------------------
httpd:
image: cytopia/${HTTPD_SERVER}:latest
# Manually build via `docker-compose build`
#build:
#context: https://github.com/cytopia/docker-${HTTPD_SERVER}.git#1
# context: https://github.com/cytopia/docker-${HTTPD_SERVER}.git
environment:
# Show all executed commands during docker entrypoint?
- DEBUG_COMPOSE_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
# 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.
#
# @see volumes:: - ./etc/${HTTPD_SERVER}:/etc/${HTTPD_SERVER}
- CUSTOM_HTTPD_CONF_DIR=/etc/${HTTPD_SERVER}
ports:
# ---- Format: ----
# [HOST-ADDR : ] HOST-PORT : DOCKER-PORT
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_HTTPD}:80"
networks:
app_net:
ipv4_address: 172.16.238.10
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Custom scripts/binaries required for httpd server vhost
# configuration to work.
# (configured in /etc/${HTTPD_SERVER}/02-vhost-mass.conf)
- ${DEVILBOX_PATH}/.devilbox/bin/${HTTPD_SERVER}:/opt/bin:ro
# Mount user-defined httpd configuration files
# @see environment::CUSTOM_HTTPD_CONF_DIR for how this
# is added in httpd server
- ${DEVILBOX_PATH}/.devilbox/etc/${HTTPD_SERVER}:/etc/${HTTPD_SERVER}:ro
# Mount custom intranet
# (configured in /etc/${HTTPD_SERVER}/01-vhost-default.conf)
- ${DEVILBOX_PATH}/.devilbox/www:/var/www/default:ro
# Mount user-defined httpd log
# @see ./etc/${HTTPD_SERVER}/*.conf for log defines
- ${DEVILBOX_PATH}/log/${HTTPD_SERVER}:/var/log/${HTTPD_SERVER}
# Mount custom mass virtual hosting
# (configured in /etc/${HTTPD_SERVER}/02-vhost-mass.conf)
- ${HOST_PATH_TO_WWW_DOCROOTS}:/shared/httpd:ro
links:
# ---- Format: ----
# SERVICE [ : ALIAS]
- "php:php-fpm"
# ----------------------------------------
# PHP-FPM
# ----------------------------------------
php:
# TODO: remove latest, once it is ready for the next release
image: cytopia/${PHP_SERVER}:latest
# Manually build via `docker-compose build`
#build:
#context: https://github.com/cytopia/docker-${PHP_SERVER}.git#1
# context: https://github.com/cytopia/docker-${PHP_SERVER}.git
environment:
# Show all executed commands during docker entrypoint?
- DEBUG_COMPOSE_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
# Adjust timezone
- TIMEZONE=${TIMEZONE}
##
## PHP Xdebug
##
- PHP_XDEBUG_ENABLE=${PHP_XDEBUG_ENABLE}
- PHP_XDEBUG_REMOTE_PORT=${PHP_XDEBUG_REMOTE_PORT}
- PHP_XDEBUG_REMOTE_HOST=${PHP_XDEBUG_REMOTE_HOST}
##
## Postfix on
##
- ENABLE_MAIL=1
##
## Map remote MySQL Port to 127.0.0.1
##
- FORWARD_MYSQL_PORT_TO_LOCALHOST=1
- MYSQL_REMOTE_ADDR=172.16.238.12
- MYSQL_REMOTE_PORT=3306
- MYSQL_LOCAL_PORT=3306
##
## Postfix on
##
- ENABLE_MAIL=1
##
## Mount remote MySQL socket file to local disk
##
- MOUNT_MYSQL_SOCKET_TO_LOCALDISK=1
- MYSQL_SOCKET_PATH=/tmp/mysql/mysqld.sock
##
## Map remote PostgreSQL Port to 127.0.0.1
##
# TODO
##
## Mount remote PostgreSQL socket file to local disk
##
# TODO
##
## Map remote MySQL Port to 127.0.0.1
##
- FORWARD_MYSQL_PORT_TO_LOCALHOST=1
- MYSQL_REMOTE_ADDR=172.16.238.12
- MYSQL_REMOTE_PORT=3306
- MYSQL_LOCAL_PORT=3306
##
## Additional variables needed by custom intranet
##
- HOST_PATH_TO_WWW_DOCROOTS=${HOST_PATH_TO_WWW_DOCROOTS}
- HOST_PORT_HTTPD=${HOST_PORT_HTTPD}
- HOST_PATH_TO_MYSQL_DATADIR=${HOST_PATH_TO_MYSQL_DATADIR}
- HOST_PATH_TO_POSTGRES_DATADIR=${HOST_PATH_TO_POSTGRES_DATADIR}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
##
## Mount remote MySQL socket file to local disk
##
- MOUNT_MYSQL_SOCKET_TO_LOCALDISK=1
- MYSQL_SOCKET_PATH=/tmp/mysql/mysqld.sock
networks:
app_net:
ipv4_address: 172.16.238.11
##
## Map remote PostgreSQL Port to 127.0.0.1
##
# TODO
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
##
## Mount remote PostgreSQL socket file to local disk
##
# TODO
# Mount custom intranet
# (configured in /etc/${HTTPD_SERVER}/01-vhost-default.conf)
- ${DEVILBOX_PATH}/.devilbox/www:/var/www/default:ro
##
## Additional variables needed by custom intranet
##
- HOST_PATH_TO_WWW_DOCROOTS=${HOST_PATH_TO_WWW_DOCROOTS}
- HOST_PORT_HTTPD=${HOST_PORT_HTTPD}
- HOST_PATH_TO_MYSQL_DATADIR=${HOST_PATH_TO_MYSQL_DATADIR}
- HOST_PATH_TO_POSTGRES_DATADIR=${HOST_PATH_TO_POSTGRES_DATADIR}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
# Mount logs
- ${DEVILBOX_PATH}/log/${PHP_SERVER}:/var/log/php-fpm
networks:
app_net:
ipv4_address: 172.16.238.11
# Mount MySQL Socket directory
- ${DEVILBOX_PATH}/run/mysql:/tmp/mysql
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount Mail directory
- ${DEVILBOX_PATH}/run/mail:/var/mail
# Mount custom intranet
# (configured in /etc/${HTTPD_SERVER}/01-vhost-default.conf)
- ${DEVILBOX_PATH}/.devilbox/www:/var/www/default:ro
# Mount devilbox user-defined *.ini files in order
# to overwrite the default PHP configuration
- ${DEVILBOX_PATH}/cfg/${PHP_SERVER}:/etc/php-custom.d:ro
# Mount logs
- ${DEVILBOX_PATH}/log/${PHP_SERVER}:/var/log/php-fpm
# Mount MySQL Socket directory
- ${DEVILBOX_PATH}/run/mysql:/tmp/mysql
# Mount custom mass virtual hosting
# (configured in /etc/${HTTPD_SERVER}/02-vhost-mass.conf)
- ${HOST_PATH_TO_WWW_DOCROOTS}:/shared/httpd
# Mount Mail directory
- ${DEVILBOX_PATH}/run/mail:/var/mail
# Mount devilbox user-defined *.ini files in order
# to overwrite the default PHP configuration
- ${DEVILBOX_PATH}/cfg/${PHP_SERVER}:/etc/php-custom.d:ro
links:
# ---- Format: ----
# SERVICE [ : ALIAS]
- "mysql:mariadb"
- "postgres:postgresql"
# Mount custom mass virtual hosting
# (configured in /etc/${HTTPD_SERVER}/02-vhost-mass.conf)
- ${HOST_PATH_TO_WWW_DOCROOTS}:/shared/httpd
# ----------------------------------------
# DATABASE
# ----------------------------------------
mysql:
image: cytopia/${MYSQL_SERVER}:latest
# Manually build via `docker-compose build`
#build:
#context: https://github.com/cytopia/docker-${MYSQL_SERVER}.git#1
# context: https://github.com/cytopia/docker-${MYSQL_SERVER}.git
links:
# ---- Format: ----
# SERVICE [ : ALIAS]
- "mysql:mariadb"
- "postgres:postgresql"
environment:
# Show all executed commands during docker entrypoint?
- DEBUG_COMPOSE_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
# Adjust timezone
- TIMEZONE=${TIMEZONE}
# ----------------------------------------
# DATABASE
# ----------------------------------------
mysql:
image: cytopia/${MYSQL_SERVER}:0.8
# Manually build via `docker-compose build`
#build:
#context: https://github.com/cytopia/docker-${MYSQL_SERVER}.git#1
# context: https://github.com/cytopia/docker-${MYSQL_SERVER}.git
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_SOCKET_DIR=/tmp/mysql
environment:
# Runtime settings
- MYSQL_GENERAL_LOG=${MYSQL_GENERAL_LOG}
# Show all executed commands during docker entrypoint?
- DEBUG_COMPOSE_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_MYSQL}:3306"
# Adjust timezone
- TIMEZONE=${TIMEZONE}
networks:
app_net:
ipv4_address: 172.16.238.12
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_SOCKET_DIR=/tmp/mysql
# Mount logs
- ${DEVILBOX_PATH}/log/${MYSQL_SERVER}:/var/log/mysql
# Runtime settings
- MYSQL_GENERAL_LOG=${MYSQL_GENERAL_LOG}
# Mount MySQL Socket directory
- ${DEVILBOX_PATH}/run/mysql:/tmp/mysql
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_MYSQL}:3306"
# Mount devilbox user-defined cnf files in order
# to overwrite the MySQL server configuration
- ${DEVILBOX_PATH}/cfg/${MYSQL_SERVER}:/etc/mysql/conf.d:ro
networks:
app_net:
ipv4_address: 172.16.238.12
# Mount MySQL Data directory
- ${HOST_PATH_TO_MYSQL_DATADIR}:/var/lib/mysql
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount logs
- ${DEVILBOX_PATH}/log/${MYSQL_SERVER}:/var/log/mysql
# ----------------------------------------
# POSTGRES
# ----------------------------------------
postgres:
image: postgres:${POSTGRES_SERVER}
# Mount MySQL Socket directory
- ${DEVILBOX_PATH}/run/mysql:/tmp/mysql
# Manually build via `docker-compose build`
#build:
#context: https://github.com/cytopia/docker-${MYSQL_SERVER}.git#1
# context: https://github.com/cytopia/docker-${MYSQL_SERVER}.git
# Mount devilbox user-defined cnf files in order
# to overwrite the MySQL server configuration
- ${DEVILBOX_PATH}/cfg/${MYSQL_SERVER}:/etc/mysql/conf.d:ro
environment:
# Mount MySQL Data directory
- ${HOST_PATH_TO_MYSQL_DATADIR}:/var/lib/mysql
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- PGDATA=/var/lib/postgresql/data/pgdata
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_POSTGRES}:5432"
# ----------------------------------------
# POSTGRES
# ----------------------------------------
postgres:
image: postgres:${POSTGRES_SERVER}
networks:
app_net:
ipv4_address: 172.16.238.13
# Manually build via `docker-compose build`
#build:
#context: https://github.com/cytopia/docker-${MYSQL_SERVER}.git#1
# context: https://github.com/cytopia/docker-${MYSQL_SERVER}.git
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
environment:
# Mount logs
- ${DEVILBOX_PATH}/log/postgres-${POSTGRES_SERVER}:/var/log/postgresql
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- PGDATA=/var/lib/postgresql/data/pgdata
# Mount PostgreSQL Socket directory
- ${DEVILBOX_PATH}/run/postgres:/var/run/postgresql
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_POSTGRES}:5432"
networks:
app_net:
ipv4_address: 172.16.238.13
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount logs
- ${DEVILBOX_PATH}/log/postgres-${POSTGRES_SERVER}:/var/log/postgresql
# Mount PostgreSQL Socket directory
- ${DEVILBOX_PATH}/run/postgres:/var/run/postgresql
# Mount PostgreSQL Data directory
- ${HOST_PATH_TO_POSTGRES_DATADIR}:/var/lib/postgresql/data/pgdata
# Mount PostgreSQL Data directory
- ${HOST_PATH_TO_POSTGRES_DATADIR}:/var/lib/postgresql/data/pgdata
################################################################################
@ -306,5 +304,5 @@ networks:
ipam:
driver: default
config:
- subnet: 172.16.238.0/24
gateway: 172.16.238.1
- subnet: 172.16.238.0/24
gateway: 172.16.238.1

View File

@ -15,7 +15,7 @@
###
### 1: Yes
### 0: No
DEBUG_COMPOSE_ENTRYPOINT=0
DEBUG_COMPOSE_ENTRYPOINT=1
@ -96,8 +96,7 @@ POSTGRES_SERVER=9.6
#PHP_SERVER=php-fpm-5.6
PHP_SERVER=php-fpm-7.0
#PHP_SERVER=php-fpm-7.1
#PHP_SERVER=hhvm-3
#PHP_SERVER=hhvm-latest
###