Skip to content

Instantly share code, notes, and snippets.

@progcode
Created March 7, 2019 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save progcode/571e3d3b2f8fa426621a225cd6c2ccc2 to your computer and use it in GitHub Desktop.
Save progcode/571e3d3b2f8fa426621a225cd6c2ccc2 to your computer and use it in GitHub Desktop.
devilbox config
##
## -------------------------
## | D E V I L S T A C K |
## -------------------------
##
## Local LAMP/LEMP stack
##
##
## ${VARIABLE:-default} will evaluate to default if VARIABLE is unset or empty in the environment.
## ${VARIABLE-default} will evaluate to default only if VARIABLE is unset in the environment.
##
##
## -- DO NOT EDIT THIS FILE --
##
## Copy 'docker-compose.override.yml-example' to 'docker-compose.override.yml'
## and edit this file with your custom changes (override or even new services).
##
## Edit '.env' for configuration.
##
## If '.env' does not exist, copy 'env-example' to '.env'
## $ cp env-example .env
##
version: '2.1'
################################################################################
# SERVICES
################################################################################
services:
# ------------------------------------------------------------
# Bind (DNS Server)
# ------------------------------------------------------------
bind:
image: cytopia/bind:0.15
restart: always
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_BIND:-1053}:53/tcp"
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_BIND:-1053}:53/udp"
environment:
##
## Debug?
##
- DEBUG_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
##
## Bind wildcard/host settings
##
- WILDCARD_DNS=${TLD_SUFFIX:-loc}=127.0.0.1
- EXTRA_HOSTS=${EXTRA_HOSTS}
##
## Forwarding
##
- DNS_FORWARDER=${BIND_DNS_RESOLVER:-8.8.8.8,8.8.4.4}
##
## Security
##
- DNSSEC_VALIDATE=${BIND_DNSSEC_VALIDATE:-no}
##
## Time settings
##
- TTL_TIME=${BIND_TTL_TIME}
- REFRESH_TIME=${BIND_REFRESH_TIME}
- RETRY_TIME=${BIND_RETRY_TIME}
- EXPIRY_TIME=${BIND_EXPIRY_TIME}
- MAX_CACHE_TIME=${BIND_MAX_CACHE_TIME}
##
## Query log
##
- DOCKER_LOGS=${BIND_LOG_DNS_QUERIES}
dns:
- 127.0.0.1
# MacOS and Windows have this by default, this hack also allows it for Linux
extra_hosts:
docker.for.lin.host.internal: 172.16.238.1
docker.for.lin.localhost: 172.16.238.1
hostname: bind
networks:
app_net:
ipv4_address: 172.16.238.100
# ------------------------------------------------------------
# PHP / HHVM
# ------------------------------------------------------------
php:
image: devilbox/php-fpm:${PHP_SERVER:-7.0}-work-0.32
##
## All .env variables
##
## Source all variables defined in .env
## This also makes any custom variable available in each PHP/HHVM container
##
env_file:
- ./.env
environment:
##
## Debug/Logging
##
- DEBUG_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
- DEBUG_COMPOSE_ENTRYPOINT
- DOCKER_LOGS
##
## UserID and GroupID
##
- NEW_UID
- NEW_GID
##
## Adjust timezone
##
- TIMEZONE
##
## Enable/Disable PHP Modules
##
- ENABLE_MODULES=${PHP_MODULES_ENABLE}
- DISABLE_MODULES=${PHP_MODULES_DISABLE}
##
## Mail-catching
##
- ENABLE_MAIL=1
##
## Enable 127.0.0.1 Port-forwarding
- FORWARD_PORTS_TO_LOCALHOST=80:httpd:80,443:httpd:443,3306:mysql:3306,11211:memcd:11211
##
## MySQL Backups
##
- MYSQL_BACKUP_USER=root
- MYSQL_BACKUP_PASS=${MYSQL_ROOT_PASSWORD}
- MYSQL_BACKUP_HOST=mysql
dns:
- 172.16.238.100
# MacOS and Windows have this by default, this hack also allows it for Linux
extra_hosts:
docker.for.lin.host.internal: 172.16.238.1
docker.for.lin.localhost: 172.16.238.1
hostname: php
networks:
app_net:
ipv4_address: 172.16.238.10
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount custom intranet
- ${DEVILBOX_PATH}/.devilbox/www:/var/www/default:ro${MOUNT_OPTIONS}
# Mount custom mass virtual hosting
- ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd:rw${MOUNT_OPTIONS}
# Mount logs
- ${DEVILBOX_PATH}/log/php-fpm-${PHP_SERVER}:/var/log/php:rw${MOUNT_OPTIONS}
# Mount Mail directory
- ${DEVILBOX_PATH}/mail:/var/mail:rw${MOUNT_OPTIONS}
# Mount DB Backup directory
- ${DEVILBOX_PATH}/backups:/shared/backups:rw${MOUNT_OPTIONS}
# Mount devilbox user-defined *.ini files in order
# to overwrite the default PHP.ini configuration
- ${DEVILBOX_PATH}/cfg/php-ini-${PHP_SERVER}:/etc/php-custom.d:ro${MOUNT_OPTIONS}
# Mount devilbox user-defined PHP-FPM *.conf files in order
# to overwrite the default PHP-FPM configuration
- ${DEVILBOX_PATH}/cfg/php-fpm-${PHP_SERVER}:/etc/php-fpm-custom.d:ro${MOUNT_OPTIONS}
# Mount devilbox user-defined *.so files in order
# to load custom PHP modules
- ${DEVILBOX_PATH}/mod/php-fpm-${PHP_SERVER}:/usr/lib64/php/custom-modules:ro${MOUNT_OPTIONS}
# Mount devilbox user-defined bash config
- ${DEVILBOX_PATH}/bash:/etc/bashrc-devilbox.d:rw${MOUNT_OPTIONS}
# Certificate Authority public key
- ${DEVILBOX_PATH}/ca:/ca:rw${MOUNT_OPTIONS}
depends_on:
- bind
# ------------------------------------------------------------
# Web Server
# ------------------------------------------------------------
httpd:
image: devilbox/${HTTPD_SERVER:-nginx-stable}:0.22
environment:
##
## Debug/Logging
##
- DEBUG_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
- DEBUG_RUNTIME=${DEBUG_COMPOSE_ENTRYPOINT}
- DOCKER_LOGS
##
## Adjust timezone
##
- TIMEZONE
##
## UserID and GroupID
##
- NEW_UID
- NEW_GID
##
## Disable default vhost?
##
- MAIN_VHOST_ENABLE=${DEVILBOX_UI_ENABLE}
- MAIN_VHOST_STATUS_ENABLE=1
- MAIN_VHOST_STATUS_ALIAS=/devilbox-httpd-status
- MAIN_VHOST_SSL_TYPE=both
- MAIN_VHOST_SSL_GEN=1
- MAIN_VHOST_SSL_CN=${DEVILBOX_UI_SSL_CN:-localhost}
##
## Enable Mass Vhosts
##
- MASS_VHOST_ENABLE=1
- MASS_VHOST_TLD=.${TLD_SUFFIX}
- MASS_VHOST_DOCROOT=${HTTPD_DOCROOT_DIR}
- MASS_VHOST_TPL=${HTTPD_TEMPLATE_DIR}
- MASS_VHOST_SSL_TYPE=both
- MASS_VHOST_SSL_GEN=1
##
## PHP-FPM Remote Server
##
- COMPAT=${PHP_SERVER:-7.0}
- PHP_FPM_ENABLE=1
- PHP_FPM_SERVER_ADDR=php
- PHP_FPM_SERVER_PORT=9000
- PHP_FPM_TIMEOUT=${HTTPD_TIMEOUT_TO_PHP_FPM:-180}
ports:
# ---- Format: ----
# [HOST-ADDR : ] HOST-PORT : DOCKER-PORT
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_HTTPD}:80"
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_HTTPD_SSL}:443"
hostname: httpd
networks:
app_net:
ipv4_address: 172.16.238.11
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount custom intranet
- ${DEVILBOX_PATH}/.devilbox/www:/var/www/default:ro${MOUNT_OPTIONS}
# Mount custom mass virtual hosting
- ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd:rw${MOUNT_OPTIONS}
# Mount custom web server config directory
- ${DEVILBOX_PATH}/cfg/${HTTPD_SERVER}:/etc/httpd-custom.d:rw${MOUNT_OPTIONS}
# Mount custom vhost-templates
- ${DEVILBOX_PATH}/cfg/vhost-gen:/etc/vhost-gen.d:rw${MOUNT_OPTIONS}
# Mount logs
- ${DEVILBOX_PATH}/log/${HTTPD_SERVER}:/var/log/${HTTPD_SERVER}:rw${MOUNT_OPTIONS}
# Certificate Authority public key
- ${DEVILBOX_PATH}/ca:/ca:rw${MOUNT_OPTIONS}
depends_on:
- bind
- php
# ------------------------------------------------------------
# MySQL Database
# ------------------------------------------------------------
mysql:
image: cytopia/${MYSQL_SERVER:-mariadb-10.1}:latest
environment:
##
## Debug?
##
- DEBUG_COMPOSE_ENTRYPOINT
##
## Adjust timezone
##
- TIMEZONE
##
## Adjust Root password
##
- MYSQL_ROOT_PASSWORD
##
## Socket directory Path
##
- MYSQL_SOCKET_DIR=/tmp/mysql
##
## Runtime settings
##
- MYSQL_GENERAL_LOG=${MYSQL_GENERAL_LOG}
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_MYSQL}:3306"
hostname: mysql
networks:
app_net:
ipv4_address: 172.16.238.12
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount logs
- ${DEVILBOX_PATH}/log/${MYSQL_SERVER}:/var/log/mysql:rw${MOUNT_OPTIONS}
# Mount devilbox default overwrites
- ${DEVILBOX_PATH}/.devilbox/etc/${MYSQL_SERVER}:/etc/mysql/conf.d:ro${MOUNT_OPTIONS}
# Mount devilbox user-defined cnf files in order
# to overwrite the MySQL server configuration
- ${DEVILBOX_PATH}/cfg/${MYSQL_SERVER}:/etc/mysql/docker-default.d:ro${MOUNT_OPTIONS}
# Mount MySQL Data directory
- ${HOST_PATH_MYSQL_DATADIR}/${MYSQL_SERVER}:/var/lib/mysql:rw${MOUNT_OPTIONS}
depends_on:
- bind
- php
- httpd
# ------------------------------------------------------------
# Memcached
# ------------------------------------------------------------
memcd:
image: memcached:${MEMCD_SERVER:-latest}
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_MEMCD}:11211"
hostname: memcd
networks:
app_net:
ipv4_address: 172.16.238.15
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount logs
- ${DEVILBOX_PATH}/log/memcd-${MEMCD_SERVER}:/var/log/memcd:rw${MOUNT_OPTIONS}
depends_on:
- bind
- php
- httpd
################################################################################
# NETWORK
################################################################################
networks:
app_net:
driver: bridge
driver_opts:
com.docker.network.enable_ipv6: "false"
ipam:
driver: default
config:
- subnet: 172.16.238.0/24
gateway: 172.16.238.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment