DVL-013 Fix #49 Duplication of env variables passed to docker-compose

This commit is contained in:
cytopia 2017-04-29 16:36:22 +02:00
parent 4c0ec7de3d
commit 629dbb0e50
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
2 changed files with 259 additions and 194 deletions

View File

@ -27,7 +27,104 @@ version: '2'
services:
# ----------------------------------------
# HTTP
# 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:
##
## Debug?
##
- DEBUG_COMPOSE_ENTRYPOINT
##
## UserID and GroupID
##
- NEW_UID
- NEW_GID
##
## Adjust timezone
##
- TIMEZONE
##
## PHP Xdebug
##
- PHP_XDEBUG_ENABLE
- PHP_XDEBUG_REMOTE_PORT
- PHP_XDEBUG_REMOTE_HOST
##
## Mail-catching
##
- ENABLE_MAIL=1
##
## Enable 127.0.0.1 Port-forwarding
##
- FORWARD_PORTS_TO_LOCALHOST=3306:mysql:3306,5432:pgsql:5432,6379:redis:6379
##
## Additional variables to announce to intranet/php-container
##
# Ports
- HOST_PORT_HTTPD
# Paths
- HOST_PATH_HTTPD_DATADIR
- HOST_PATH_MYSQL_DATADIR
- HOST_PATH_PGSQL_DATADIR
# Database credentials
- PGSQL_ROOT_USER
- PGSQL_ROOT_PASSWORD
- MYSQL_ROOT_PASSWORD
# Selected Server versions
- PHP_SERVER
- HTTPD_SERVER
- PGSQL_SERVER
- MYSQL_SERVER
- REDIS_SERVER
networks:
app_net:
ipv4_address: 172.16.238.11
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount custom intranet
# (configured in /etc/${HTTPD_SERVER}/01-vhost-default.conf)
- ${DEVILBOX_PATH}/.devilbox/www:/var/www/default:ro
# Mount logs
- ${DEVILBOX_PATH}/log/${PHP_SERVER}:/var/log/php
# Mount MySQL Socket directory
- mysql_socket_volume:/tmp/mysql
# 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
# Mount custom mass virtual hosting
# (configured in /etc/${HTTPD_SERVER}/02-vhost-mass.conf)
- ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd
# ----------------------------------------
# HTTPD
# ----------------------------------------
httpd:
# TODO: remove latest, once it is ready for the next release
@ -40,21 +137,27 @@ services:
environment:
# Show all executed commands during docker entrypoint?
- DEBUG_COMPOSE_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
##
## Debug?
##
- DEBUG_COMPOSE_ENTRYPOINT
# Adjust timezone
- TIMEZONE=${TIMEZONE}
##
## Adjust timezone
##
- TIMEZONE
# Enable PHP-FPM support
##
## PHP-FPM Remote Server
##
- PHP_FPM_ENABLE=1
- PHP_FPM_SERVER_ADDR=172.16.238.11
- PHP_FPM_SERVER_ADDR=php
- 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}
## 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:
@ -90,119 +193,12 @@ services:
# Mount custom mass virtual hosting
# (configured in /etc/${HTTPD_SERVER}/02-vhost-mass.conf)
- ${HOST_PATH_TO_WWW_DOCROOTS}:/shared/httpd:ro
- ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd:ro
depends_on:
- php
# ----------------------------------------
# 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
##
## 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
##
## 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}
# Server versions
- PHP_SERVER=${PHP_SERVER}
- HTTPD_SERVER=${HTTPD_SERVER}
- POSTGRES_SERVER=${POSTGRES_SERVER}
- MYSQL_SERVER=${MYSQL_SERVER}
networks:
app_net:
ipv4_address: 172.16.238.11
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount custom intranet
# (configured in /etc/${HTTPD_SERVER}/01-vhost-default.conf)
- ${DEVILBOX_PATH}/.devilbox/www:/var/www/default:ro
# Mount logs
- ${DEVILBOX_PATH}/log/${PHP_SERVER}:/var/log/php-fpm
# Mount MySQL Socket directory
- mysql_socket_volume:/tmp/mysql
# 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
# Mount custom mass virtual hosting
# (configured in /etc/${HTTPD_SERVER}/02-vhost-mass.conf)
- ${HOST_PATH_TO_WWW_DOCROOTS}:/shared/httpd
depends_on:
- mysql
- postgres
# ----------------------------------------
# DATABASE
# ----------------------------------------
@ -217,17 +213,29 @@ services:
environment:
# Show all executed commands during docker entrypoint?
- DEBUG_COMPOSE_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
##
## Debug?
##
- DEBUG_COMPOSE_ENTRYPOINT
# Adjust timezone
- TIMEZONE=${TIMEZONE}
##
## Adjust timezone
##
- TIMEZONE
##
## Adjust Root password
##
- MYSQL_ROOT_PASSWORD
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
##
## Socket directory Path
##
- MYSQL_SOCKET_DIR=/tmp/mysql
# Runtime settings
##
## Runtime settings
##
- MYSQL_GENERAL_LOG=${MYSQL_GENERAL_LOG}
ports:
@ -256,14 +264,17 @@ services:
- ${DEVILBOX_PATH}/cfg/${MYSQL_SERVER}:/etc/mysql/conf.d:ro
# Mount MySQL Data directory
- ${HOST_PATH_TO_MYSQL_DATADIR}/${MYSQL_SERVER}:/var/lib/mysql
- ${HOST_PATH_MYSQL_DATADIR}/${MYSQL_SERVER}:/var/lib/mysql
depends_on:
- php
- httpd
# ----------------------------------------
# POSTGRES
# POSTGRESQL
# ----------------------------------------
postgres:
image: postgres:${POSTGRES_SERVER}
pgsql:
image: postgres:${PGSQL_SERVER}
# Manually build via `docker-compose build`
#build:
@ -272,13 +283,13 @@ services:
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=${PGSQL_ROOT_USER}
- POSTGRES_PASSWORD=${PGSQL_ROOT_PASSWORD}
- PGDATA=/var/lib/postgresql/data/pgdata
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_POSTGRES}:5432"
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_PGSQL}:5432"
networks:
app_net:
@ -289,13 +300,41 @@ services:
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount logs
- ${DEVILBOX_PATH}/log/postgres-${POSTGRES_SERVER}:/var/log/postgresql
- ${DEVILBOX_PATH}/log/postgres-${PGSQL_SERVER}:/var/log/postgresql
# Mount PostgreSQL Socket directory
- pgsql_socket_volume:/var/run/postgresql
# Mount PostgreSQL Data directory
- ${HOST_PATH_TO_POSTGRES_DATADIR}/${POSTGRES_SERVER}:/var/lib/postgresql/data/pgdata
- ${HOST_PATH_PGSQL_DATADIR}/${PGSQL_SERVER}:/var/lib/postgresql/data/pgdata
depends_on:
- php
- httpd
# ----------------------------------------
# Redis
# ----------------------------------------
redis:
image: redis:${REDIS_SERVER}
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_REDIS}:6379"
networks:
app_net:
ipv4_address: 172.16.238.14
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount logs
- ${DEVILBOX_PATH}/log/redis-${REDIS_SERVER}:/var/log/redis
depends_on:
- php
- httpd
################################################################################

View File

@ -9,6 +9,7 @@
### No need to rebuild any dockers!
###
###
### Show all executed commands in each
### docker image during docker-compose up?
@ -18,7 +19,6 @@
DEBUG_COMPOSE_ENTRYPOINT=1
###
### Relative or absolute path to the devilbox repository.
### (Used as a prefix for all mount paths)
@ -47,6 +47,7 @@ DEVILBOX_PATH=.
LOCAL_LISTEN_ADDR=127.0.0.1:
################################################################################
###
### 1. Choose Images (Version)
@ -60,15 +61,27 @@ LOCAL_LISTEN_ADDR=127.0.0.1:
###
### 1.1 Choose HTTP Server Image
### 1.1 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
#PHP_SERVER=php-fpm-7.1
#PHP_SERVER=hhvm-latest
###
### 1.2 Choose HTTPD Server Image
###
#HTTPD_SERVER=apache-2.2
#HTTPD_SERVER=apache-2.4
HTTPD_SERVER=nginx-stable
#HTTPD_SERVER=nginx-mainline
###
### 1.2 Choose MySQL Server Image
### 1.3 Choose MySQL Server Image
###
#MYSQL_SERVER=mysql-5.5
#MYSQL_SERVER=mysql-5.6
@ -76,29 +89,20 @@ HTTPD_SERVER=nginx-stable
#MYSQL_SERVER=mysql-8.0
#MYSQL_SERVER=mariadb-5.5
#MYSQL_SERVER=mariadb-10.0
MYSQL_SERVER=mariadb-10.1
#MYSQL_SERVER=mariadb-10.1
#MYSQL_SERVER=mariadb-10.2
#MYSQL_SERVER=mariadb-10.3
MYSQL_SERVER=mariadb-10.3
###
### 1.3 Choose PostgreSQL Server Image
### 1.4 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.4 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
#PHP_SERVER=php-fpm-7.1
#PHP_SERVER=hhvm-latest
#PGSQL_SERVER=9.1
#PGSQL_SERVER=9.2
#PGSQL_SERVER=9.3
#PGSQL_SERVER=9.4
#PGSQL_SERVER=9.5
PGSQL_SERVER=9.6
###
@ -111,12 +115,6 @@ PHP_SERVER=php-fpm-7.0
REDIS_SERVER=3.2
###
### 1.6 Timezone for all dockers and service config files
###
TIMEZONE=Europe/Berlin
################################################################################
###
@ -127,7 +125,7 @@ TIMEZONE=Europe/Berlin
###
### Local filesystem path to www projects.
###
HOST_PATH_TO_WWW_DOCROOTS=./data/www
HOST_PATH_HTTPD_DATADIR=./data/www
###
### Local filesystem path to mysql/mariadb datadir.
@ -144,7 +142,8 @@ HOST_PATH_TO_WWW_DOCROOTS=./data/www
### This is to protect databases from being altered by
### newer or older mysql|mariadb server versions.
###
HOST_PATH_TO_MYSQL_DATADIR=./data/mysql
HOST_PATH_MYSQL_DATADIR=./data/mysql
###
### Local filesystem path to postgresql datadir.
@ -160,13 +159,62 @@ HOST_PATH_TO_MYSQL_DATADIR=./data/mysql
### version will be created where the actual data resides.
### This is to protect databases from being altered by
### newer or older postgres server versions.
HOST_PATH_TO_POSTGRES_DATADIR=./data/pgsql
HOST_PATH_PGSQL_DATADIR=./data/pgsql
################################################################################
###
### 3. HTTP Docker Settings
### 3. GENERAL DOCKER CONTAINER SETTINGS
###
################################################################################
###
### Set your user id and group id
###
### This should be changed to the value of your local
### users uid and gid
###
### Type `id` on the terminal to find out your values
###
NEW_UID=1001
NEW_GID=1001
###
### Timezone for all dockers and service config files
###
TIMEZONE=Europe/Berlin
################################################################################
###
### 3. PHP Docker Settings
###
################################################################################
###
### Xdebug
###
# Enable/Disable Xdebug
PHP_XDEBUG_ENABLE=1
# Your local port (your computer host [not the docker])
# where your ide/editor is listening for xdebug connections.
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=192.168.0.215
## TODO: Check if it works by automatically sending it to the broadcast address
################################################################################
###
### 4. HTTPD Docker Settings
###
################################################################################
@ -176,9 +224,10 @@ HOST_PATH_TO_POSTGRES_DATADIR=./data/pgsql
HOST_PORT_HTTPD=80
################################################################################
###
### 4. MySQL Docker Settings
### 5. MySQL Docker Settings
###
################################################################################
@ -207,47 +256,24 @@ HOST_PORT_MYSQL=3306
################################################################################
###
### 5. PostgreSQL Docker Settings
### 6. PostgreSQL Docker Settings
###
################################################################################
###
### PostgreSQL 'root' user name (usually postgres)
###
POSTGRES_USER=postgres
PGSQL_ROOT_USER=postgres
###
### PostgreSQL 'root' user password
###
POSTGRES_PASSWORD=
PGSQL_ROOT_PASSWORD=
###
### Expose PostgreSQL Port to Host
###
HOST_PORT_POSTGRES=5432
################################################################################
###
### 6. PHP-FPM Docker Settings
###
################################################################################
###
### Xdebug
###
# Enable/Disable Xdebug
PHP_XDEBUG_ENABLE=1
# Your local port (your computer host [not the docker])
# where your ide/editor is listening for xdebug connections.
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
HOST_PORT_PGSQL=5432