Integrate PostgreSQL

This commit is contained in:
cytopia 2016-11-15 19:52:39 +01:00
parent e3ea211423
commit f49f1a9b22
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
3 changed files with 120 additions and 38 deletions

View File

@ -75,11 +75,11 @@ No need to install and configure different versions locally. Simply choose your
| Webserver | MySQL | PostgreSQL | PHP | | 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) | PostgreSQL 9.2 | [![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.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) | PostgreSQL 9.3 | [![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-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) | PostgreSQL 9.4 | [![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-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) | PostgreSQL 9.5 | [![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-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) | PostgreSQL 9.6 | [![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.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-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-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) | | | | [![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) | |
@ -134,12 +134,15 @@ No need to install and configure different versions locally. Simply choose your
The devilbox comes with a pre-configured intranet on `http://localhost` The devilbox comes with a pre-configured intranet on `http://localhost`
* Virtua lHost overview * Virtual Host overview
* Database overview * MySQL Database overview
* PostgreSQL Database overview
* Email overview * Email overview
* PHP Info * PHP Info
* MySQL Info * MySQL Info
* PHPMyAdmin * PostgreSQL Info
* phpMyAdmin
* Adminer
* Opcache GUI * Opcache GUI

View File

@ -102,7 +102,8 @@ services:
# PHP-FPM # PHP-FPM
# ---------------------------------------- # ----------------------------------------
php: php:
image: cytopia/${PHP_SERVER}:0.8.1 # TODO: remove latest, once it is ready for the next release
image: cytopia/${PHP_SERVER}:latest
# Manually build via `docker-compose build` # Manually build via `docker-compose build`
#build: #build:
@ -124,6 +125,10 @@ services:
- PHP_XDEBUG_REMOTE_PORT=${PHP_XDEBUG_REMOTE_PORT} - PHP_XDEBUG_REMOTE_PORT=${PHP_XDEBUG_REMOTE_PORT}
- PHP_XDEBUG_REMOTE_HOST=${PHP_XDEBUG_REMOTE_HOST} - PHP_XDEBUG_REMOTE_HOST=${PHP_XDEBUG_REMOTE_HOST}
##
## Postfix on
##
- ENABLE_MAIL=1
## ##
## Map remote MySQL Port to 127.0.0.1 ## Map remote MySQL Port to 127.0.0.1
@ -139,13 +144,25 @@ services:
- MOUNT_MYSQL_SOCKET_TO_LOCALDISK=1 - MOUNT_MYSQL_SOCKET_TO_LOCALDISK=1
- MYSQL_SOCKET_PATH=/tmp/mysql/mysqld.sock - 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
## ##
## Additional variables needed by custom intranet ## Additional variables needed by custom intranet
## ##
- HOST_PATH_TO_WWW_DOCROOTS=${HOST_PATH_TO_WWW_DOCROOTS} - HOST_PATH_TO_WWW_DOCROOTS=${HOST_PATH_TO_WWW_DOCROOTS}
- HOST_PATH_TO_MYSQL_DATADIR=${HOST_PATH_TO_MYSQL_DATADIR} - 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} - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- ENABLE_MAIL=1 - POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
networks: networks:
app_net: app_net:
@ -181,14 +198,15 @@ services:
links: links:
# ---- Format: ---- # ---- Format: ----
# SERVICE [ : ALIAS] # SERVICE [ : ALIAS]
- "db:database" - "mysql:mariadb"
- "postgres:postgresql"
# ---------------------------------------- # ----------------------------------------
# DATABASE # DATABASE
# ---------------------------------------- # ----------------------------------------
db: mysql:
image: cytopia/${MYSQL_SERVER}:0.8 image: cytopia/${MYSQL_SERVER}:0.8
# Manually build via `docker-compose build` # Manually build via `docker-compose build`
@ -237,6 +255,44 @@ services:
- ${HOST_PATH_TO_MYSQL_DATADIR}:/var/lib/mysql - ${HOST_PATH_TO_MYSQL_DATADIR}:/var/lib/mysql
# ----------------------------------------
# POSTGRES
# ----------------------------------------
postgres:
image: postgres:${POSTGRES_SERVER}
# 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
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- PGDATA=/var/lib/postgresql/data/pgdata
ports:
# [local-machine:]local-port:docker-port
- "127.0.0.1:5432:5432"
networks:
app_net:
ipv4_address: 172.16.238.13
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount logs
- ./log/postgres-${POSTGRES_SERVER}:/var/log/postgresql
# Mount PostgreSQL Socket directory
- ./run/postgres:/var/run/postgresql
# Mount PostgreSQL Data directory
- ${HOST_PATH_TO_POSTGRES_DATADIR}:/var/lib/postgresql/data/pgdata
################################################################################ ################################################################################
# NETWORK # NETWORK

View File

@ -9,7 +9,6 @@
### No need to rebuild any dockers! ### No need to rebuild any dockers!
### ###
### ###
### Show all executed commands in each ### Show all executed commands in each
### docker image during docker-compose up? ### docker image during docker-compose up?
@ -27,7 +26,7 @@ DEBUG_COMPOSE_ENTRYPOINT=0
################################################################################ ################################################################################
### ###
### You can choose any combination of httpd, mysql or php. ### You can choose any combination of httpd, mysql, postgresql or php.
### Each of them are fully compatible between one another. ### Each of them are fully compatible between one another.
### ###
@ -35,66 +34,65 @@ DEBUG_COMPOSE_ENTRYPOINT=0
### ###
### 1.1 Choose HTTP Server Image ### 1.1 Choose HTTP Server Image
### ###
#HTTPD_SERVER=apache-2.2 #HTTPD_SERVER=apache-2.2
#HTTPD_SERVER=apache-2.4 #HTTPD_SERVER=apache-2.4
HTTPD_SERVER=nginx-stable HTTPD_SERVER=nginx-stable
#HTTPD_SERVER=nginx-mainline #HTTPD_SERVER=nginx-mainline
### ###
### 1.2 Choose MySQL Server Image ### 1.2 Choose MySQL Server Image
### ###
#MYSQL_SERVER=mysql-5.5
MYSQL_SERVER=mysql-5.5
#MYSQL_SERVER=mysql-5.6 #MYSQL_SERVER=mysql-5.6
#MYSQL_SERVER=mysql-5.7 MYSQL_SERVER=mysql-5.7
#MYSQL_SERVER=mariadb-5.5 #MYSQL_SERVER=mariadb-5.5
#MYSQL_SERVER=mariadb-10.0 #MYSQL_SERVER=mariadb-10.0
#MYSQL_SERVER=mariadb-10.1 #MYSQL_SERVER=mariadb-10.1
#MYSQL_SERVER=mariadb-10.2 #MYSQL_SERVER=mariadb-10.2
###
### 1.3 Choose PostgreSQL Server Image
###
#POSTGRES_SERVER=9.1
#POSTGRES_SERVER=9.2
#POSTGRES_SERVER=9.3
#POSTGRES_SERVER=9.4
#POSTGRES_SERVER=9.5
POSTGRES_SERVER=9.6
### ###
### 1.3 Choose PHP Server Image ### 1.4 Choose PHP Server Image
### ###
#PHP_SERVER=php-fpm-5.4 #PHP_SERVER=php-fpm-5.4
#PHP_SERVER=php-fpm-5.5 #PHP_SERVER=php-fpm-5.5
PHP_SERVER=php-fpm-5.6 PHP_SERVER=php-fpm-5.6
#PHP_SERVER=php-fpm-7.0 #PHP_SERVER=php-fpm-7.0
#PHP_SERVER=php-fpm-7.1 #PHP_SERVER=php-fpm-7.1
#PHP_SERVER=hhvm-3
### ###
### 1.4 Timezone for all dockers and service config files ### 1.5 Timezone for all dockers and service config files
### ###
TIMEZONE=Europe/Berlin TIMEZONE=Europe/Berlin
################################################################################ ################################################################################
### ###
### 2. Host Settings (Your computer) ### 2. Host Mounts (Your computer)
### ###
################################################################################ ################################################################################
## ##
## Local filesystem path to www projects. ## Local filesystem path to www projects.
## ##
## ##
HOST_PATH_TO_WWW_DOCROOTS=./data/www HOST_PATH_TO_WWW_DOCROOTS=~/Sites
## ##
## Local filesystem path to mysql datadir. ## Local filesystem path to mysql/mariadb datadir.
## ##
## This can be an existing mysql data directory or empty. ## This can be an existing mysql data directory or empty.
## If it already is a mysql data directory with content, ## If it already is a mysql data directory with content,
@ -103,8 +101,19 @@ HOST_PATH_TO_WWW_DOCROOTS=./data/www
## If this directory is empty, a new mysql database will be ## If this directory is empty, a new mysql database will be
## created. ## created.
## ##
HOST_PATH_TO_MYSQL_DATADIR=./data/mysql HOST_PATH_TO_MYSQL_DATADIR=~/data/mysql57
##
## Local filesystem path to postgresql datadir.
##
## This can be an existing postgresql data directory or empty.
## If it already is a postgresql data directory with content,
## it will be mounted into the docker and used.
##
## If this directory is empty, a new postgresql database will be
## created.
##
HOST_PATH_TO_POSTGRES_DATADIR=~/data/postgres96
@ -118,7 +127,6 @@ HOST_PATH_TO_MYSQL_DATADIR=./data/mysql
################################################################################ ################################################################################
### ###
### 4. MySQL Docker Settings ### 4. MySQL Docker Settings
@ -136,21 +144,36 @@ HOST_PATH_TO_MYSQL_DATADIR=./data/mysql
## ##
MYSQL_ROOT_PASSWORD= MYSQL_ROOT_PASSWORD=
### ###
### Custom MySQL Runtime Settings ### Custom MySQL Runtime Settings
### ###
MYSQL_GENERAL_LOG=1 MYSQL_GENERAL_LOG=1
################################################################################ ################################################################################
### ###
### 5. PHP-FPM Docker Settings ### 5. PostgreSQL Docker Settings
### ###
################################################################################ ################################################################################
##
## PostgreSQL 'root' user name (usually postgres)
##
POSTGRES_USER=postgres
##
## PostgreSQL 'root' user password
##
POSTGRES_PASSWORD=
################################################################################
###
### 6. PHP-FPM Docker Settings
###
################################################################################
### ###
### Xdebug ### Xdebug
@ -166,4 +189,4 @@ PHP_XDEBUG_REMOTE_PORT=9000
# Your local IP address (your computer host [not the docker]) # Your local IP address (your computer host [not the docker])
# where your ide/editor is listening for xdebug connections. # where your ide/editor is listening for xdebug connections.
PHP_XDEBUG_REMOTE_HOST=172.20.10.2 PHP_XDEBUG_REMOTE_HOST=172.20.10.2
## TODO: Check if it works by automatically sending it to the broadcast address