From 2fdc6fef2667b479d7475cbec9927ee55b015cf3 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Mon, 29 Jun 2015 21:46:50 +0200 Subject: [PATCH 01/66] Added Ubuntu 15.04 --- docker/main/ubuntu-15.04/Dockerfile | 24 ++++ docker/main/ubuntu-15.04/bin/customization.sh | 10 ++ docker/main/ubuntu-15.04/bin/dnsmasq.sh | 63 +++++++++++ docker/main/ubuntu-15.04/bin/init-mysql.sh | 29 +++++ docker/main/ubuntu-15.04/bin/init-php.sh | 52 +++++++++ docker/main/ubuntu-15.04/bin/init-ssmtp.sh | 8 ++ docker/main/ubuntu-15.04/bin/init-system.sh | 5 + docker/main/ubuntu-15.04/bin/install.sh | 107 ++++++++++++++++++ docker/main/ubuntu-15.04/bin/logwatch.sh | 8 ++ docker/main/ubuntu-15.04/conf/locale.conf | 11 ++ docker/main/ubuntu-15.04/conf/php.ini | 29 +++++ .../main/ubuntu-15.04/conf/supervisord.conf | 47 ++++++++ docker/main/ubuntu-15.04/entrypoint.sh | 63 +++++++++++ docker/main/ubuntu-15.04/htdocs/.gitkeep | 0 14 files changed, 456 insertions(+) create mode 100644 docker/main/ubuntu-15.04/Dockerfile create mode 100644 docker/main/ubuntu-15.04/bin/customization.sh create mode 100644 docker/main/ubuntu-15.04/bin/dnsmasq.sh create mode 100644 docker/main/ubuntu-15.04/bin/init-mysql.sh create mode 100644 docker/main/ubuntu-15.04/bin/init-php.sh create mode 100644 docker/main/ubuntu-15.04/bin/init-ssmtp.sh create mode 100644 docker/main/ubuntu-15.04/bin/init-system.sh create mode 100644 docker/main/ubuntu-15.04/bin/install.sh create mode 100644 docker/main/ubuntu-15.04/bin/logwatch.sh create mode 100644 docker/main/ubuntu-15.04/conf/locale.conf create mode 100644 docker/main/ubuntu-15.04/conf/php.ini create mode 100644 docker/main/ubuntu-15.04/conf/supervisord.conf create mode 100755 docker/main/ubuntu-15.04/entrypoint.sh create mode 100644 docker/main/ubuntu-15.04/htdocs/.gitkeep diff --git a/docker/main/ubuntu-15.04/Dockerfile b/docker/main/ubuntu-15.04/Dockerfile new file mode 100644 index 0000000..db024c7 --- /dev/null +++ b/docker/main/ubuntu-15.04/Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:15.04 + +# Ensure UTF-8 +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY conf/locale.conf /opt/docker/locale.conf +COPY bin/* /opt/docker/ +ADD entrypoint.sh /entrypoint.sh + +RUN bash /opt/docker/install.sh +RUN bash /opt/docker/customization.sh + +COPY conf/php.ini /etc/php5/mods-available/docker-boilerplate.ini + +EXPOSE 9000 + +VOLUME /docker/ +WORKDIR /docker/code/ + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["supervisord"] diff --git a/docker/main/ubuntu-15.04/bin/customization.sh b/docker/main/ubuntu-15.04/bin/customization.sh new file mode 100644 index 0000000..861b916 --- /dev/null +++ b/docker/main/ubuntu-15.04/bin/customization.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export DEBIAN_FRONTEND="noninteractive" + +## add your custom stuff here diff --git a/docker/main/ubuntu-15.04/bin/dnsmasq.sh b/docker/main/ubuntu-15.04/bin/dnsmasq.sh new file mode 100644 index 0000000..8da4dfa --- /dev/null +++ b/docker/main/ubuntu-15.04/bin/dnsmasq.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +sleep 5 + +## backup original resolv.conf +if [ ! -f "/opt/docker/.resolv.conf" ]; then + ## backup original file + cp /etc/resolv.conf /opt/docker/.resolv.conf + + ## Copy resolv.conf for dnsmasq (default resolver) + cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf +fi + +## Restore original resolvconf +function restore_resolvconf() { + ## restore original resolv.conf + cp /opt/docker/.resolv.conf /etc/resolv.conf +} + +## Start and configure dnsmasq +function dnsmasq_start() { + echo "[dnsmasq] Found Webserver IP: $1" + + restore_resolvconf + + ## clear dns file + echo > /etc/dnsmasq.d/development + + ## add IP for each domain (wildcard!) + for DOMAIN in $DNS_DOMAIN; do + echo "address=/${DOMAIN}/${1}" >> /etc/dnsmasq.d/development + done + + ## set forward servers + cat /var/run/dnsmasq/resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward + + ## (re)start dnsmasq as DNS server + service dnsmasq restart + + ## set dnsmasq to main nameserver + echo "nameserver 127.0.0.1" > /etc/resolv.conf + + ## wait for 10 hours + sleep 10h +} + +## Fetch IP from services +if [ -f "/data/dns/web.ip" ]; then + ## Found WEB + dnsmasq_start "$(cat /data/dns/web.ip)" +elif [ -f "/data/dns/httpd.ip" ]; then + ## Found HTTPD (fallback) + dnsmasq_start "$(cat /data/dns/httpd.ip)" +elif [ -f "/data/dns/nginx.ip" ]; then + ## Found NGINX (fallback) + dnsmasq_start "$(cat /data/dns/nginx.ip)" +else + ## Found nothing, restore original resolvconf + restore_resolvconf + sleep 15 +fi + +exit 0 diff --git a/docker/main/ubuntu-15.04/bin/init-mysql.sh b/docker/main/ubuntu-15.04/bin/init-mysql.sh new file mode 100644 index 0000000..821754d --- /dev/null +++ b/docker/main/ubuntu-15.04/bin/init-mysql.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +############################# +## Init MySQL +############################# + +echo "[client] +host=mysql +user=\"root\" +password=\"$MYSQL_ROOT_PASSWORD\" + +[mysql] +host=mysql +user=\"root\" +password=\"$MYSQL_ROOT_PASSWORD\" +database=\"$MYSQL_DATABASE\" +default-character-set=utf8 +local-infile=1 +show-warnings +auto-rehash +sigint-ignore +reconnect + +[mysqldump] +host=mysql +user=\"root\" +password=\"$MYSQL_ROOT_PASSWORD\" + +" | tee /root/.my.cnf > /home/.my.cnf diff --git a/docker/main/ubuntu-15.04/bin/init-php.sh b/docker/main/ubuntu-15.04/bin/init-php.sh new file mode 100644 index 0000000..2f28aa6 --- /dev/null +++ b/docker/main/ubuntu-15.04/bin/init-php.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +############################# +## Init PHP +############################# +echo " +date.timezone = ${PHP_TIMEZONE} +" >> /etc/php5/mods-available/docker-boilerplate.ini + +############################# +## Init PHP-FPM +############################# + +# Backup original +if [ ! -f "/opt/docker/.fpm-www.conf" ]; then + cp /etc/php5/fpm/pool.d/www.conf /opt/docker/.fpm-www.conf +fi + +## Remove old logs +rm -f -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log +touch -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log +chmod 666 /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log + +# Restore original +cp /opt/docker/.fpm-www.conf /etc/php5/fpm/pool.d/www.conf +sed -i "s@listen = /var/run/php5-fpm.sock@listen = 9000@" /etc/php5/fpm/pool.d/www.conf + +# Manipulate php-fpm configuration +echo " +; Server resource settings + +listen = 0.0.0.0:9000 + +pm.max_children = 10 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 + +catch_workers_output = yes + +access.format = \"%R - %u %t \\\"%m %r%Q%q\\\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d\" +access.log = /tmp/php.access.log +slowlog = /tmp/php.slow.log +request_slowlog_timeout = 30s + +php_admin_value[error_log] = /tmp/php.error.log +php_admin_flag[log_errors] = on + +env[TYPO3_CONTEXT] = ${TYPO3_CONTEXT} +env[FLOW_CONTEXT] = ${FLOW_CONTEXT} +env[FLOW_REWRITEURLS] = ${FLOW_REWRITEURLS} +" >> /etc/php5/fpm/pool.d/www.conf diff --git a/docker/main/ubuntu-15.04/bin/init-ssmtp.sh b/docker/main/ubuntu-15.04/bin/init-ssmtp.sh new file mode 100644 index 0000000..4bf8972 --- /dev/null +++ b/docker/main/ubuntu-15.04/bin/init-ssmtp.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +############################# +## Init SSMTP +############################# + +sed -i "s/mailhub=.*/mailhub=${MAIL_GATEWAY}/" /etc/ssmtp/ssmtp.conf +sed -i "s/#FromLineOverride=.*/FromLineOverride=YES/" /etc/ssmtp/ssmtp.conf diff --git a/docker/main/ubuntu-15.04/bin/init-system.sh b/docker/main/ubuntu-15.04/bin/init-system.sh new file mode 100644 index 0000000..fb98e9c --- /dev/null +++ b/docker/main/ubuntu-15.04/bin/init-system.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +## Set uid/gid for www-data user +usermod --uid "${EFFECTIVE_UID}" --shell /bin/bash --home /home www-data > /dev/null +groupmod --gid "${EFFECTIVE_GID}" www-data > /dev/null diff --git a/docker/main/ubuntu-15.04/bin/install.sh b/docker/main/ubuntu-15.04/bin/install.sh new file mode 100644 index 0000000..8c446a1 --- /dev/null +++ b/docker/main/ubuntu-15.04/bin/install.sh @@ -0,0 +1,107 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export DEBIAN_FRONTEND="noninteractive" + +############################# +# Modify user +############################# + +usermod --shell /bin/bash --home /home www-data +chown www-data:www-data /home + +## Fix terminal +echo 'export TERM="xterm-color"' >> /root/.bashrc +echo 'export TERM="xterm-color"' >> /home/.bashrc + +############################# +# Common tasks +############################# + +mkdir -p /opt/docker/ \ + /var/log/supervisor + +############################# +# Install packages +############################# + +apt-get update + +apt-get install -y \ + sudo \ + supervisor \ + dnsmasq \ + ssmtp \ + php5-cli \ + php5-fpm \ + php5-json \ + php5-intl \ + php5-curl \ + php5-mysqlnd \ + php5-xdebug \ + php5-memcached \ + php5-mcrypt \ + php5-gd \ + php5-sqlite \ + php5-xmlrpc \ + php5-xsl \ + php5-geoip \ + php5-ldap \ + php5-memcache \ + php5-memcached + +apt-get install -y \ + graphicsmagick \ + zip \ + unzip \ + wget \ + curl \ + mysql-client \ + moreutils \ + dnsutils + +############################# +# Generate locales +############################# + +cat /opt/docker/locale.conf >> /var/lib/locales/supported.d/local +locale-gen + +############################# +# Enable php modules +############################# +## custom config +touch /etc/php5/mods-available/docker-boilerplate.ini +php5enmod docker-boilerplate + +# enable ext mcrypt +php5enmod mcrypt + +############################# +# Composer +############################# + +curl -sS https://getcomposer.org/installer | php +mv composer.phar /usr/local/bin/composer + + +############################# +# Dnsmasq +############################# + +## Fix dnsmasqd +echo " +user=root +conf-dir=/etc/dnsmasq.d +" >> /etc/dnsmasq.conf + +############################# +# Cleanup +############################# + +apt-get clean -y +apt-get autoclean -y diff --git a/docker/main/ubuntu-15.04/bin/logwatch.sh b/docker/main/ubuntu-15.04/bin/logwatch.sh new file mode 100644 index 0000000..729e0ca --- /dev/null +++ b/docker/main/ubuntu-15.04/bin/logwatch.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +tail -F --quiet $2 | sed --unbuffered -e "s/^/\[$1\] /" diff --git a/docker/main/ubuntu-15.04/conf/locale.conf b/docker/main/ubuntu-15.04/conf/locale.conf new file mode 100644 index 0000000..7410061 --- /dev/null +++ b/docker/main/ubuntu-15.04/conf/locale.conf @@ -0,0 +1,11 @@ +en_GB.UTF-8 UTF-8 +en_GB ISO-8859-1 +en_GB.ISO-8859-15 ISO-8859-15 + +en_US.UTF-8 UTF-8 +en_US ISO-8859-1 +en_US.ISO-8859-15 ISO-8859-15 + +de_DE.UTF-8 UTF-8 +de_DE ISO-8859-1 +de_DE@euro ISO-8859-15 \ No newline at end of file diff --git a/docker/main/ubuntu-15.04/conf/php.ini b/docker/main/ubuntu-15.04/conf/php.ini new file mode 100644 index 0000000..b3b39c5 --- /dev/null +++ b/docker/main/ubuntu-15.04/conf/php.ini @@ -0,0 +1,29 @@ +; this file will overwrite default php.ini settings + +short_open_tag = On +variables_order = 'GPCS' +request_order = 'GP' + +allow_url_fopen = On +allow_url_include = Off + +memory_limit = 512M +max_execution_time = 900 +max_input_time = 300 +post_max_size = 50M +upload_max_filesize = 50M + +; timezone will be overwritten in startup, use docker-env.yml +date.timezone = Europe/Berlin + +mysql.default_host = mysql +mysqli.default_host = mysql + +xdebug.remote_enable = 1 +xdebug.remote_connect_back = on +xdebug.idekey = "docker" +xdebug.cli_color = 1 +xdebug.max_nesting_level = 1000 +xdebug.profiler_enable_trigger = 1 +xdebug.profiler_output_dir = '/tmp/debug/' +xhprof.output_dir = '/tmp/debug/' diff --git a/docker/main/ubuntu-15.04/conf/supervisord.conf b/docker/main/ubuntu-15.04/conf/supervisord.conf new file mode 100644 index 0000000..d9802c9 --- /dev/null +++ b/docker/main/ubuntu-15.04/conf/supervisord.conf @@ -0,0 +1,47 @@ +[supervisord] +nodaemon=true + +[program:php-fpm] +command = /usr/sbin/php5-fpm --nodaemonize +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:dnsmasq] +command = bash /opt/docker/dnsmasq.sh +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-access] +command = bash /opt/docker/logwatch.sh php:access /tmp/php.access.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-slow] +command = bash /opt/docker/logwatch.sh php:slow /tmp/php.slow.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-error] +command = bash /opt/docker/logwatch.sh php:error /tmp/php.error.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/docker/main/ubuntu-15.04/entrypoint.sh b/docker/main/ubuntu-15.04/entrypoint.sh new file mode 100755 index 0000000..838c922 --- /dev/null +++ b/docker/main/ubuntu-15.04/entrypoint.sh @@ -0,0 +1,63 @@ +#!/bin/bash +set -e + +## Init system +source /opt/docker/init-system.sh + +## Init MySQL (client) +source /opt/docker/init-mysql.sh + +## Init SSMTP +source /opt/docker/init-ssmtp.sh + +## Init PHP and PHP-FPM +source /opt/docker/init-php.sh + +############################# +## COMMAND +############################# + +case "$1" in + + ## Supervisord (start daemons) + supervisord) + ## Register IP + ETH0_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') + mkdir -p /data/dns/ + chmod 777 /data/dns/ + echo "${ETH0_IP}" > /data/dns/main.ip + echo "${ETH0_IP} main main_1" > /data/dns/main.hosts + + ## Start services + exec supervisord + ;; + + ## Root shell + root) + if [ "$#" -eq 1 ]; then + ## No command, fall back to shell + exec bash + else + ## Exec root command + shift + exec "$@" + fi + ;; + + ## Defined cli script + cli) + if [ -n "${CLI_SCRIPT}" ]; then + shift + exec sudo -H -E -u "${CLI_USER}" ${CLI_SCRIPT} "$@" + else + echo "[ERROR] No CLI_SCRIPT in docker-env.yml defined" + exit 1 + fi + ;; + + ## All other commands + *) + ## Execute cmd + exec sudo -H -E -u "${CLI_USER}" "$@" + ;; +esac diff --git a/docker/main/ubuntu-15.04/htdocs/.gitkeep b/docker/main/ubuntu-15.04/htdocs/.gitkeep new file mode 100644 index 0000000..e69de29 From 7399b016ebd53939a210a72ec8ab15947386a203 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Mon, 29 Jun 2015 21:47:00 +0200 Subject: [PATCH 02/66] Moved Ubuntu 14.04 --- docker/main/{ => ubuntu-14.04}/Dockerfile | 0 docker/main/{ => ubuntu-14.04}/bin/customization.sh | 0 docker/main/{ => ubuntu-14.04}/bin/dnsmasq.sh | 0 docker/main/{ => ubuntu-14.04}/bin/init-mysql.sh | 0 docker/main/{ => ubuntu-14.04}/bin/init-php.sh | 2 ++ docker/main/{ => ubuntu-14.04}/bin/init-ssmtp.sh | 0 docker/main/{ => ubuntu-14.04}/bin/init-system.sh | 0 docker/main/{ => ubuntu-14.04}/bin/install.sh | 1 + docker/main/{ => ubuntu-14.04}/bin/logwatch.sh | 0 docker/main/{ => ubuntu-14.04}/conf/locale.conf | 0 docker/main/{ => ubuntu-14.04}/conf/php.ini | 0 docker/main/{ => ubuntu-14.04}/conf/supervisord.conf | 0 docker/main/{ => ubuntu-14.04}/entrypoint.sh | 0 docker/main/{ => ubuntu-14.04}/htdocs/.gitkeep | 0 14 files changed, 3 insertions(+) rename docker/main/{ => ubuntu-14.04}/Dockerfile (100%) rename docker/main/{ => ubuntu-14.04}/bin/customization.sh (100%) rename docker/main/{ => ubuntu-14.04}/bin/dnsmasq.sh (100%) rename docker/main/{ => ubuntu-14.04}/bin/init-mysql.sh (100%) rename docker/main/{ => ubuntu-14.04}/bin/init-php.sh (98%) rename docker/main/{ => ubuntu-14.04}/bin/init-ssmtp.sh (100%) rename docker/main/{ => ubuntu-14.04}/bin/init-system.sh (100%) rename docker/main/{ => ubuntu-14.04}/bin/install.sh (99%) rename docker/main/{ => ubuntu-14.04}/bin/logwatch.sh (100%) rename docker/main/{ => ubuntu-14.04}/conf/locale.conf (100%) rename docker/main/{ => ubuntu-14.04}/conf/php.ini (100%) rename docker/main/{ => ubuntu-14.04}/conf/supervisord.conf (100%) rename docker/main/{ => ubuntu-14.04}/entrypoint.sh (100%) rename docker/main/{ => ubuntu-14.04}/htdocs/.gitkeep (100%) diff --git a/docker/main/Dockerfile b/docker/main/ubuntu-14.04/Dockerfile similarity index 100% rename from docker/main/Dockerfile rename to docker/main/ubuntu-14.04/Dockerfile diff --git a/docker/main/bin/customization.sh b/docker/main/ubuntu-14.04/bin/customization.sh similarity index 100% rename from docker/main/bin/customization.sh rename to docker/main/ubuntu-14.04/bin/customization.sh diff --git a/docker/main/bin/dnsmasq.sh b/docker/main/ubuntu-14.04/bin/dnsmasq.sh similarity index 100% rename from docker/main/bin/dnsmasq.sh rename to docker/main/ubuntu-14.04/bin/dnsmasq.sh diff --git a/docker/main/bin/init-mysql.sh b/docker/main/ubuntu-14.04/bin/init-mysql.sh similarity index 100% rename from docker/main/bin/init-mysql.sh rename to docker/main/ubuntu-14.04/bin/init-mysql.sh diff --git a/docker/main/bin/init-php.sh b/docker/main/ubuntu-14.04/bin/init-php.sh similarity index 98% rename from docker/main/bin/init-php.sh rename to docker/main/ubuntu-14.04/bin/init-php.sh index de8f251..2f28aa6 100644 --- a/docker/main/bin/init-php.sh +++ b/docker/main/ubuntu-14.04/bin/init-php.sh @@ -29,6 +29,8 @@ sed -i "s@listen = /var/run/php5-fpm.sock@listen = 9000@" /etc/php5/fpm/pool.d/w echo " ; Server resource settings +listen = 0.0.0.0:9000 + pm.max_children = 10 pm.start_servers = 2 pm.min_spare_servers = 1 diff --git a/docker/main/bin/init-ssmtp.sh b/docker/main/ubuntu-14.04/bin/init-ssmtp.sh similarity index 100% rename from docker/main/bin/init-ssmtp.sh rename to docker/main/ubuntu-14.04/bin/init-ssmtp.sh diff --git a/docker/main/bin/init-system.sh b/docker/main/ubuntu-14.04/bin/init-system.sh similarity index 100% rename from docker/main/bin/init-system.sh rename to docker/main/ubuntu-14.04/bin/init-system.sh diff --git a/docker/main/bin/install.sh b/docker/main/ubuntu-14.04/bin/install.sh similarity index 99% rename from docker/main/bin/install.sh rename to docker/main/ubuntu-14.04/bin/install.sh index afa5da7..8c446a1 100644 --- a/docker/main/bin/install.sh +++ b/docker/main/ubuntu-14.04/bin/install.sh @@ -32,6 +32,7 @@ mkdir -p /opt/docker/ \ apt-get update apt-get install -y \ + sudo \ supervisor \ dnsmasq \ ssmtp \ diff --git a/docker/main/bin/logwatch.sh b/docker/main/ubuntu-14.04/bin/logwatch.sh similarity index 100% rename from docker/main/bin/logwatch.sh rename to docker/main/ubuntu-14.04/bin/logwatch.sh diff --git a/docker/main/conf/locale.conf b/docker/main/ubuntu-14.04/conf/locale.conf similarity index 100% rename from docker/main/conf/locale.conf rename to docker/main/ubuntu-14.04/conf/locale.conf diff --git a/docker/main/conf/php.ini b/docker/main/ubuntu-14.04/conf/php.ini similarity index 100% rename from docker/main/conf/php.ini rename to docker/main/ubuntu-14.04/conf/php.ini diff --git a/docker/main/conf/supervisord.conf b/docker/main/ubuntu-14.04/conf/supervisord.conf similarity index 100% rename from docker/main/conf/supervisord.conf rename to docker/main/ubuntu-14.04/conf/supervisord.conf diff --git a/docker/main/entrypoint.sh b/docker/main/ubuntu-14.04/entrypoint.sh similarity index 100% rename from docker/main/entrypoint.sh rename to docker/main/ubuntu-14.04/entrypoint.sh diff --git a/docker/main/htdocs/.gitkeep b/docker/main/ubuntu-14.04/htdocs/.gitkeep similarity index 100% rename from docker/main/htdocs/.gitkeep rename to docker/main/ubuntu-14.04/htdocs/.gitkeep From 539e827c019ad578b0731d550d943410ae12e3bd Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Mon, 29 Jun 2015 21:47:07 +0200 Subject: [PATCH 03/66] Added Ubuntu 12.04 --- docker/main/ubuntu-12.04/Dockerfile | 24 ++++ docker/main/ubuntu-12.04/bin/customization.sh | 10 ++ docker/main/ubuntu-12.04/bin/dnsmasq.sh | 63 ++++++++++ docker/main/ubuntu-12.04/bin/init-mysql.sh | 29 +++++ docker/main/ubuntu-12.04/bin/init-php.sh | 60 ++++++++++ docker/main/ubuntu-12.04/bin/init-ssmtp.sh | 8 ++ docker/main/ubuntu-12.04/bin/init-system.sh | 5 + docker/main/ubuntu-12.04/bin/install.sh | 108 ++++++++++++++++++ docker/main/ubuntu-12.04/bin/logwatch.sh | 8 ++ docker/main/ubuntu-12.04/conf/locale.conf | 11 ++ docker/main/ubuntu-12.04/conf/php.ini | 29 +++++ .../main/ubuntu-12.04/conf/supervisord.conf | 47 ++++++++ docker/main/ubuntu-12.04/entrypoint.sh | 63 ++++++++++ docker/main/ubuntu-12.04/htdocs/.gitkeep | 0 14 files changed, 465 insertions(+) create mode 100644 docker/main/ubuntu-12.04/Dockerfile create mode 100644 docker/main/ubuntu-12.04/bin/customization.sh create mode 100644 docker/main/ubuntu-12.04/bin/dnsmasq.sh create mode 100644 docker/main/ubuntu-12.04/bin/init-mysql.sh create mode 100644 docker/main/ubuntu-12.04/bin/init-php.sh create mode 100644 docker/main/ubuntu-12.04/bin/init-ssmtp.sh create mode 100644 docker/main/ubuntu-12.04/bin/init-system.sh create mode 100644 docker/main/ubuntu-12.04/bin/install.sh create mode 100644 docker/main/ubuntu-12.04/bin/logwatch.sh create mode 100644 docker/main/ubuntu-12.04/conf/locale.conf create mode 100644 docker/main/ubuntu-12.04/conf/php.ini create mode 100644 docker/main/ubuntu-12.04/conf/supervisord.conf create mode 100755 docker/main/ubuntu-12.04/entrypoint.sh create mode 100644 docker/main/ubuntu-12.04/htdocs/.gitkeep diff --git a/docker/main/ubuntu-12.04/Dockerfile b/docker/main/ubuntu-12.04/Dockerfile new file mode 100644 index 0000000..1e1c876 --- /dev/null +++ b/docker/main/ubuntu-12.04/Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:12.04 + +# Ensure UTF-8 +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY conf/locale.conf /opt/docker/locale.conf +COPY bin/* /opt/docker/ +ADD entrypoint.sh /entrypoint.sh + +RUN bash /opt/docker/install.sh +RUN bash /opt/docker/customization.sh + +COPY conf/php.ini /etc/php5/mods-available/docker-boilerplate.ini + +EXPOSE 9000 + +VOLUME /docker/ +WORKDIR /docker/code/ + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["supervisord"] diff --git a/docker/main/ubuntu-12.04/bin/customization.sh b/docker/main/ubuntu-12.04/bin/customization.sh new file mode 100644 index 0000000..861b916 --- /dev/null +++ b/docker/main/ubuntu-12.04/bin/customization.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export DEBIAN_FRONTEND="noninteractive" + +## add your custom stuff here diff --git a/docker/main/ubuntu-12.04/bin/dnsmasq.sh b/docker/main/ubuntu-12.04/bin/dnsmasq.sh new file mode 100644 index 0000000..8da4dfa --- /dev/null +++ b/docker/main/ubuntu-12.04/bin/dnsmasq.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +sleep 5 + +## backup original resolv.conf +if [ ! -f "/opt/docker/.resolv.conf" ]; then + ## backup original file + cp /etc/resolv.conf /opt/docker/.resolv.conf + + ## Copy resolv.conf for dnsmasq (default resolver) + cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf +fi + +## Restore original resolvconf +function restore_resolvconf() { + ## restore original resolv.conf + cp /opt/docker/.resolv.conf /etc/resolv.conf +} + +## Start and configure dnsmasq +function dnsmasq_start() { + echo "[dnsmasq] Found Webserver IP: $1" + + restore_resolvconf + + ## clear dns file + echo > /etc/dnsmasq.d/development + + ## add IP for each domain (wildcard!) + for DOMAIN in $DNS_DOMAIN; do + echo "address=/${DOMAIN}/${1}" >> /etc/dnsmasq.d/development + done + + ## set forward servers + cat /var/run/dnsmasq/resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward + + ## (re)start dnsmasq as DNS server + service dnsmasq restart + + ## set dnsmasq to main nameserver + echo "nameserver 127.0.0.1" > /etc/resolv.conf + + ## wait for 10 hours + sleep 10h +} + +## Fetch IP from services +if [ -f "/data/dns/web.ip" ]; then + ## Found WEB + dnsmasq_start "$(cat /data/dns/web.ip)" +elif [ -f "/data/dns/httpd.ip" ]; then + ## Found HTTPD (fallback) + dnsmasq_start "$(cat /data/dns/httpd.ip)" +elif [ -f "/data/dns/nginx.ip" ]; then + ## Found NGINX (fallback) + dnsmasq_start "$(cat /data/dns/nginx.ip)" +else + ## Found nothing, restore original resolvconf + restore_resolvconf + sleep 15 +fi + +exit 0 diff --git a/docker/main/ubuntu-12.04/bin/init-mysql.sh b/docker/main/ubuntu-12.04/bin/init-mysql.sh new file mode 100644 index 0000000..821754d --- /dev/null +++ b/docker/main/ubuntu-12.04/bin/init-mysql.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +############################# +## Init MySQL +############################# + +echo "[client] +host=mysql +user=\"root\" +password=\"$MYSQL_ROOT_PASSWORD\" + +[mysql] +host=mysql +user=\"root\" +password=\"$MYSQL_ROOT_PASSWORD\" +database=\"$MYSQL_DATABASE\" +default-character-set=utf8 +local-infile=1 +show-warnings +auto-rehash +sigint-ignore +reconnect + +[mysqldump] +host=mysql +user=\"root\" +password=\"$MYSQL_ROOT_PASSWORD\" + +" | tee /root/.my.cnf > /home/.my.cnf diff --git a/docker/main/ubuntu-12.04/bin/init-php.sh b/docker/main/ubuntu-12.04/bin/init-php.sh new file mode 100644 index 0000000..52be553 --- /dev/null +++ b/docker/main/ubuntu-12.04/bin/init-php.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +############################# +## Init PHP +############################# +echo " +date.timezone = ${PHP_TIMEZONE} +" >> /etc/php5/mods-available/docker-boilerplate.ini + +############################# +## Init PHP-FPM +############################# + +# Backup original +if [ ! -f "/opt/docker/.fpm-www.conf" ]; then + cp /etc/php5/fpm/pool.d/www.conf /opt/docker/.fpm-www.conf +fi + +if [ ! -f "/opt/docker/.fpm-main.conf" ]; then + cp /etc/php5/fpm/php-fpm.conf /opt/docker/.fpm-main.conf +fi + +## Remove old logs +rm -f -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log +touch -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log +chmod 666 /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log + +# Disable deamonize +cp /opt/docker/.fpm-main.conf /etc/php5/fpm/php-fpm.conf +sed -i "s@;daemonize = yes@daemonize = no@" /etc/php5/fpm/php-fpm.conf + +# Restore original +cp /opt/docker/.fpm-www.conf /etc/php5/fpm/pool.d/www.conf +sed -i "s@listen = /var/run/php5-fpm.sock@listen = 9000@" /etc/php5/fpm/pool.d/www.conf + +# Manipulate php-fpm configuration +echo " +; Server resource settings + +listen = 0.0.0.0:9000 + +pm.max_children = 10 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 + +catch_workers_output = yes + +access.format = \"%R - %u %t \\\"%m %r%Q%q\\\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d\" +access.log = /tmp/php.access.log +slowlog = /tmp/php.slow.log +request_slowlog_timeout = 30s + +php_admin_value[error_log] = /tmp/php.error.log +php_admin_flag[log_errors] = on + +env[TYPO3_CONTEXT] = ${TYPO3_CONTEXT} +env[FLOW_CONTEXT] = ${FLOW_CONTEXT} +env[FLOW_REWRITEURLS] = ${FLOW_REWRITEURLS} +" >> /etc/php5/fpm/pool.d/www.conf diff --git a/docker/main/ubuntu-12.04/bin/init-ssmtp.sh b/docker/main/ubuntu-12.04/bin/init-ssmtp.sh new file mode 100644 index 0000000..4bf8972 --- /dev/null +++ b/docker/main/ubuntu-12.04/bin/init-ssmtp.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +############################# +## Init SSMTP +############################# + +sed -i "s/mailhub=.*/mailhub=${MAIL_GATEWAY}/" /etc/ssmtp/ssmtp.conf +sed -i "s/#FromLineOverride=.*/FromLineOverride=YES/" /etc/ssmtp/ssmtp.conf diff --git a/docker/main/ubuntu-12.04/bin/init-system.sh b/docker/main/ubuntu-12.04/bin/init-system.sh new file mode 100644 index 0000000..fb98e9c --- /dev/null +++ b/docker/main/ubuntu-12.04/bin/init-system.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +## Set uid/gid for www-data user +usermod --uid "${EFFECTIVE_UID}" --shell /bin/bash --home /home www-data > /dev/null +groupmod --gid "${EFFECTIVE_GID}" www-data > /dev/null diff --git a/docker/main/ubuntu-12.04/bin/install.sh b/docker/main/ubuntu-12.04/bin/install.sh new file mode 100644 index 0000000..6cf3508 --- /dev/null +++ b/docker/main/ubuntu-12.04/bin/install.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export DEBIAN_FRONTEND="noninteractive" + +############################# +# Modify user +############################# + +usermod --shell /bin/bash --home /home www-data +chown www-data:www-data /home + +## Fix terminal +echo 'export TERM="xterm-color"' >> /root/.bashrc +echo 'export TERM="xterm-color"' >> /home/.bashrc + +############################# +# Common tasks +############################# + +mkdir -p /opt/docker/ \ + /var/log/supervisor + +############################# +# Install packages +############################# + +apt-get update + +apt-get install -y \ + sudo \ + supervisor \ + dnsmasq \ + ssmtp \ + php5-cli \ + php5-fpm \ + php5-json \ + php5-intl \ + php5-curl \ + php5-mysqlnd \ + php5-xdebug \ + php5-memcached \ + php5-mcrypt \ + php5-gd \ + php5-sqlite \ + php5-xmlrpc \ + php5-xsl \ + php5-geoip \ + php5-ldap \ + php5-memcache \ + php5-memcached + +apt-get install -y \ + graphicsmagick \ + zip \ + unzip \ + wget \ + curl \ + mysql-client \ + moreutils \ + dnsutils + +############################# +# Generate locales +############################# + +cat /opt/docker/locale.conf >> /var/lib/locales/supported.d/local +locale-gen + +############################# +# Enable php modules +############################# +## custom config +mkdir /etc/php5/mods-available/ +touch /etc/php5/mods-available/docker-boilerplate.ini +ln -fs /etc/php5/mods-available/docker-boilerplate.ini /etc/php5/conf.d/ + +# enable ext mcrypt +#php5enmod mcrypt + +############################# +# Composer +############################# + +curl -sS https://getcomposer.org/installer | php +mv composer.phar /usr/local/bin/composer + + +############################# +# Dnsmasq +############################# + +## Fix dnsmasqd +echo " +user=root +conf-dir=/etc/dnsmasq.d +" >> /etc/dnsmasq.conf + +############################# +# Cleanup +############################# + +apt-get clean -y +apt-get autoclean -y diff --git a/docker/main/ubuntu-12.04/bin/logwatch.sh b/docker/main/ubuntu-12.04/bin/logwatch.sh new file mode 100644 index 0000000..729e0ca --- /dev/null +++ b/docker/main/ubuntu-12.04/bin/logwatch.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +tail -F --quiet $2 | sed --unbuffered -e "s/^/\[$1\] /" diff --git a/docker/main/ubuntu-12.04/conf/locale.conf b/docker/main/ubuntu-12.04/conf/locale.conf new file mode 100644 index 0000000..7410061 --- /dev/null +++ b/docker/main/ubuntu-12.04/conf/locale.conf @@ -0,0 +1,11 @@ +en_GB.UTF-8 UTF-8 +en_GB ISO-8859-1 +en_GB.ISO-8859-15 ISO-8859-15 + +en_US.UTF-8 UTF-8 +en_US ISO-8859-1 +en_US.ISO-8859-15 ISO-8859-15 + +de_DE.UTF-8 UTF-8 +de_DE ISO-8859-1 +de_DE@euro ISO-8859-15 \ No newline at end of file diff --git a/docker/main/ubuntu-12.04/conf/php.ini b/docker/main/ubuntu-12.04/conf/php.ini new file mode 100644 index 0000000..b3b39c5 --- /dev/null +++ b/docker/main/ubuntu-12.04/conf/php.ini @@ -0,0 +1,29 @@ +; this file will overwrite default php.ini settings + +short_open_tag = On +variables_order = 'GPCS' +request_order = 'GP' + +allow_url_fopen = On +allow_url_include = Off + +memory_limit = 512M +max_execution_time = 900 +max_input_time = 300 +post_max_size = 50M +upload_max_filesize = 50M + +; timezone will be overwritten in startup, use docker-env.yml +date.timezone = Europe/Berlin + +mysql.default_host = mysql +mysqli.default_host = mysql + +xdebug.remote_enable = 1 +xdebug.remote_connect_back = on +xdebug.idekey = "docker" +xdebug.cli_color = 1 +xdebug.max_nesting_level = 1000 +xdebug.profiler_enable_trigger = 1 +xdebug.profiler_output_dir = '/tmp/debug/' +xhprof.output_dir = '/tmp/debug/' diff --git a/docker/main/ubuntu-12.04/conf/supervisord.conf b/docker/main/ubuntu-12.04/conf/supervisord.conf new file mode 100644 index 0000000..bd337cc --- /dev/null +++ b/docker/main/ubuntu-12.04/conf/supervisord.conf @@ -0,0 +1,47 @@ +[supervisord] +nodaemon=true + +[program:php-fpm] +command = /usr/sbin/php5-fpm +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:dnsmasq] +command = bash /opt/docker/dnsmasq.sh +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-access] +command = bash /opt/docker/logwatch.sh php:access /tmp/php.access.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-slow] +command = bash /opt/docker/logwatch.sh php:slow /tmp/php.slow.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-error] +command = bash /opt/docker/logwatch.sh php:error /tmp/php.error.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/docker/main/ubuntu-12.04/entrypoint.sh b/docker/main/ubuntu-12.04/entrypoint.sh new file mode 100755 index 0000000..838c922 --- /dev/null +++ b/docker/main/ubuntu-12.04/entrypoint.sh @@ -0,0 +1,63 @@ +#!/bin/bash +set -e + +## Init system +source /opt/docker/init-system.sh + +## Init MySQL (client) +source /opt/docker/init-mysql.sh + +## Init SSMTP +source /opt/docker/init-ssmtp.sh + +## Init PHP and PHP-FPM +source /opt/docker/init-php.sh + +############################# +## COMMAND +############################# + +case "$1" in + + ## Supervisord (start daemons) + supervisord) + ## Register IP + ETH0_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') + mkdir -p /data/dns/ + chmod 777 /data/dns/ + echo "${ETH0_IP}" > /data/dns/main.ip + echo "${ETH0_IP} main main_1" > /data/dns/main.hosts + + ## Start services + exec supervisord + ;; + + ## Root shell + root) + if [ "$#" -eq 1 ]; then + ## No command, fall back to shell + exec bash + else + ## Exec root command + shift + exec "$@" + fi + ;; + + ## Defined cli script + cli) + if [ -n "${CLI_SCRIPT}" ]; then + shift + exec sudo -H -E -u "${CLI_USER}" ${CLI_SCRIPT} "$@" + else + echo "[ERROR] No CLI_SCRIPT in docker-env.yml defined" + exit 1 + fi + ;; + + ## All other commands + *) + ## Execute cmd + exec sudo -H -E -u "${CLI_USER}" "$@" + ;; +esac diff --git a/docker/main/ubuntu-12.04/htdocs/.gitkeep b/docker/main/ubuntu-12.04/htdocs/.gitkeep new file mode 100644 index 0000000..e69de29 From 58d12814a43d07f629f27ef9696f171585eb7e6a Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Mon, 29 Jun 2015 21:47:23 +0200 Subject: [PATCH 04/66] Added support for ubuntu 12.04, 14.04 and 15.04 --- docker-compose.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 36b1455..da07e03 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,12 @@ # Main php container ####################################### main: - build: docker/main/ + # Ubuntu 12.04 (LTS, PHP 5.3) + #build: docker/main/ubuntu-12.04 + # Ubuntu 14.04 (LTS, PHP 5.5) + build: docker/main/ubuntu-14.04 + # Ubuntu 15.04 (PHP 5.6) + #build: docker/main/ubuntu-15.04 links: - mysql #- postgres @@ -28,7 +33,9 @@ main: # Webserver ####################################### web: + # Apache HTTPD webserver build: docker/httpd/ + # Nginx webserver #build: docker/nginx/ ports: - 8000:80 From 1a7c4dcec04e7fcf1a0d99d748f9909dff729f90 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Wed, 8 Jul 2015 21:14:05 +0200 Subject: [PATCH 05/66] Added ubuntu 15.10 --- docker-compose.yml | 10 +- docker/main/ubuntu-15.10/Dockerfile | 24 ++++ docker/main/ubuntu-15.10/bin/customization.sh | 10 ++ docker/main/ubuntu-15.10/bin/dnsmasq.sh | 63 +++++++++++ docker/main/ubuntu-15.10/bin/init-mysql.sh | 29 +++++ docker/main/ubuntu-15.10/bin/init-php.sh | 52 +++++++++ docker/main/ubuntu-15.10/bin/init-ssmtp.sh | 8 ++ docker/main/ubuntu-15.10/bin/init-system.sh | 5 + docker/main/ubuntu-15.10/bin/install.sh | 107 ++++++++++++++++++ docker/main/ubuntu-15.10/bin/logwatch.sh | 8 ++ docker/main/ubuntu-15.10/conf/locale.conf | 11 ++ docker/main/ubuntu-15.10/conf/php.ini | 29 +++++ .../main/ubuntu-15.10/conf/supervisord.conf | 47 ++++++++ docker/main/ubuntu-15.10/entrypoint.sh | 63 +++++++++++ docker/main/ubuntu-15.10/htdocs/.gitkeep | 0 15 files changed, 460 insertions(+), 6 deletions(-) create mode 100644 docker/main/ubuntu-15.10/Dockerfile create mode 100644 docker/main/ubuntu-15.10/bin/customization.sh create mode 100644 docker/main/ubuntu-15.10/bin/dnsmasq.sh create mode 100644 docker/main/ubuntu-15.10/bin/init-mysql.sh create mode 100644 docker/main/ubuntu-15.10/bin/init-php.sh create mode 100644 docker/main/ubuntu-15.10/bin/init-ssmtp.sh create mode 100644 docker/main/ubuntu-15.10/bin/init-system.sh create mode 100644 docker/main/ubuntu-15.10/bin/install.sh create mode 100644 docker/main/ubuntu-15.10/bin/logwatch.sh create mode 100644 docker/main/ubuntu-15.10/conf/locale.conf create mode 100644 docker/main/ubuntu-15.10/conf/php.ini create mode 100644 docker/main/ubuntu-15.10/conf/supervisord.conf create mode 100755 docker/main/ubuntu-15.10/entrypoint.sh create mode 100644 docker/main/ubuntu-15.10/htdocs/.gitkeep diff --git a/docker-compose.yml b/docker-compose.yml index da07e03..fc0e73b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,12 +2,10 @@ # Main php container ####################################### main: - # Ubuntu 12.04 (LTS, PHP 5.3) - #build: docker/main/ubuntu-12.04 - # Ubuntu 14.04 (LTS, PHP 5.5) - build: docker/main/ubuntu-14.04 - # Ubuntu 15.04 (PHP 5.6) - #build: docker/main/ubuntu-15.04 + #build: docker/main/ubuntu-12.04 # PHP 5.3, LTS (precise) + build: docker/main/ubuntu-14.04 # PHP 5.5, LTS (trusty) + #build: docker/main/ubuntu-15.04 # PHP 5.6 (vivid) + #build: docker/main/ubuntu-15.10 # PHP 5.6, LTS (wily) links: - mysql #- postgres diff --git a/docker/main/ubuntu-15.10/Dockerfile b/docker/main/ubuntu-15.10/Dockerfile new file mode 100644 index 0000000..3ad71c8 --- /dev/null +++ b/docker/main/ubuntu-15.10/Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:15.10 + +# Ensure UTF-8 +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY conf/locale.conf /opt/docker/locale.conf +COPY bin/* /opt/docker/ +ADD entrypoint.sh /entrypoint.sh + +RUN bash /opt/docker/install.sh +RUN bash /opt/docker/customization.sh + +COPY conf/php.ini /etc/php5/mods-available/docker-boilerplate.ini + +EXPOSE 9000 + +VOLUME /docker/ +WORKDIR /docker/code/ + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["supervisord"] diff --git a/docker/main/ubuntu-15.10/bin/customization.sh b/docker/main/ubuntu-15.10/bin/customization.sh new file mode 100644 index 0000000..861b916 --- /dev/null +++ b/docker/main/ubuntu-15.10/bin/customization.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export DEBIAN_FRONTEND="noninteractive" + +## add your custom stuff here diff --git a/docker/main/ubuntu-15.10/bin/dnsmasq.sh b/docker/main/ubuntu-15.10/bin/dnsmasq.sh new file mode 100644 index 0000000..8da4dfa --- /dev/null +++ b/docker/main/ubuntu-15.10/bin/dnsmasq.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +sleep 5 + +## backup original resolv.conf +if [ ! -f "/opt/docker/.resolv.conf" ]; then + ## backup original file + cp /etc/resolv.conf /opt/docker/.resolv.conf + + ## Copy resolv.conf for dnsmasq (default resolver) + cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf +fi + +## Restore original resolvconf +function restore_resolvconf() { + ## restore original resolv.conf + cp /opt/docker/.resolv.conf /etc/resolv.conf +} + +## Start and configure dnsmasq +function dnsmasq_start() { + echo "[dnsmasq] Found Webserver IP: $1" + + restore_resolvconf + + ## clear dns file + echo > /etc/dnsmasq.d/development + + ## add IP for each domain (wildcard!) + for DOMAIN in $DNS_DOMAIN; do + echo "address=/${DOMAIN}/${1}" >> /etc/dnsmasq.d/development + done + + ## set forward servers + cat /var/run/dnsmasq/resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward + + ## (re)start dnsmasq as DNS server + service dnsmasq restart + + ## set dnsmasq to main nameserver + echo "nameserver 127.0.0.1" > /etc/resolv.conf + + ## wait for 10 hours + sleep 10h +} + +## Fetch IP from services +if [ -f "/data/dns/web.ip" ]; then + ## Found WEB + dnsmasq_start "$(cat /data/dns/web.ip)" +elif [ -f "/data/dns/httpd.ip" ]; then + ## Found HTTPD (fallback) + dnsmasq_start "$(cat /data/dns/httpd.ip)" +elif [ -f "/data/dns/nginx.ip" ]; then + ## Found NGINX (fallback) + dnsmasq_start "$(cat /data/dns/nginx.ip)" +else + ## Found nothing, restore original resolvconf + restore_resolvconf + sleep 15 +fi + +exit 0 diff --git a/docker/main/ubuntu-15.10/bin/init-mysql.sh b/docker/main/ubuntu-15.10/bin/init-mysql.sh new file mode 100644 index 0000000..821754d --- /dev/null +++ b/docker/main/ubuntu-15.10/bin/init-mysql.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +############################# +## Init MySQL +############################# + +echo "[client] +host=mysql +user=\"root\" +password=\"$MYSQL_ROOT_PASSWORD\" + +[mysql] +host=mysql +user=\"root\" +password=\"$MYSQL_ROOT_PASSWORD\" +database=\"$MYSQL_DATABASE\" +default-character-set=utf8 +local-infile=1 +show-warnings +auto-rehash +sigint-ignore +reconnect + +[mysqldump] +host=mysql +user=\"root\" +password=\"$MYSQL_ROOT_PASSWORD\" + +" | tee /root/.my.cnf > /home/.my.cnf diff --git a/docker/main/ubuntu-15.10/bin/init-php.sh b/docker/main/ubuntu-15.10/bin/init-php.sh new file mode 100644 index 0000000..2f28aa6 --- /dev/null +++ b/docker/main/ubuntu-15.10/bin/init-php.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +############################# +## Init PHP +############################# +echo " +date.timezone = ${PHP_TIMEZONE} +" >> /etc/php5/mods-available/docker-boilerplate.ini + +############################# +## Init PHP-FPM +############################# + +# Backup original +if [ ! -f "/opt/docker/.fpm-www.conf" ]; then + cp /etc/php5/fpm/pool.d/www.conf /opt/docker/.fpm-www.conf +fi + +## Remove old logs +rm -f -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log +touch -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log +chmod 666 /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log + +# Restore original +cp /opt/docker/.fpm-www.conf /etc/php5/fpm/pool.d/www.conf +sed -i "s@listen = /var/run/php5-fpm.sock@listen = 9000@" /etc/php5/fpm/pool.d/www.conf + +# Manipulate php-fpm configuration +echo " +; Server resource settings + +listen = 0.0.0.0:9000 + +pm.max_children = 10 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 + +catch_workers_output = yes + +access.format = \"%R - %u %t \\\"%m %r%Q%q\\\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d\" +access.log = /tmp/php.access.log +slowlog = /tmp/php.slow.log +request_slowlog_timeout = 30s + +php_admin_value[error_log] = /tmp/php.error.log +php_admin_flag[log_errors] = on + +env[TYPO3_CONTEXT] = ${TYPO3_CONTEXT} +env[FLOW_CONTEXT] = ${FLOW_CONTEXT} +env[FLOW_REWRITEURLS] = ${FLOW_REWRITEURLS} +" >> /etc/php5/fpm/pool.d/www.conf diff --git a/docker/main/ubuntu-15.10/bin/init-ssmtp.sh b/docker/main/ubuntu-15.10/bin/init-ssmtp.sh new file mode 100644 index 0000000..4bf8972 --- /dev/null +++ b/docker/main/ubuntu-15.10/bin/init-ssmtp.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +############################# +## Init SSMTP +############################# + +sed -i "s/mailhub=.*/mailhub=${MAIL_GATEWAY}/" /etc/ssmtp/ssmtp.conf +sed -i "s/#FromLineOverride=.*/FromLineOverride=YES/" /etc/ssmtp/ssmtp.conf diff --git a/docker/main/ubuntu-15.10/bin/init-system.sh b/docker/main/ubuntu-15.10/bin/init-system.sh new file mode 100644 index 0000000..fb98e9c --- /dev/null +++ b/docker/main/ubuntu-15.10/bin/init-system.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +## Set uid/gid for www-data user +usermod --uid "${EFFECTIVE_UID}" --shell /bin/bash --home /home www-data > /dev/null +groupmod --gid "${EFFECTIVE_GID}" www-data > /dev/null diff --git a/docker/main/ubuntu-15.10/bin/install.sh b/docker/main/ubuntu-15.10/bin/install.sh new file mode 100644 index 0000000..8c446a1 --- /dev/null +++ b/docker/main/ubuntu-15.10/bin/install.sh @@ -0,0 +1,107 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export DEBIAN_FRONTEND="noninteractive" + +############################# +# Modify user +############################# + +usermod --shell /bin/bash --home /home www-data +chown www-data:www-data /home + +## Fix terminal +echo 'export TERM="xterm-color"' >> /root/.bashrc +echo 'export TERM="xterm-color"' >> /home/.bashrc + +############################# +# Common tasks +############################# + +mkdir -p /opt/docker/ \ + /var/log/supervisor + +############################# +# Install packages +############################# + +apt-get update + +apt-get install -y \ + sudo \ + supervisor \ + dnsmasq \ + ssmtp \ + php5-cli \ + php5-fpm \ + php5-json \ + php5-intl \ + php5-curl \ + php5-mysqlnd \ + php5-xdebug \ + php5-memcached \ + php5-mcrypt \ + php5-gd \ + php5-sqlite \ + php5-xmlrpc \ + php5-xsl \ + php5-geoip \ + php5-ldap \ + php5-memcache \ + php5-memcached + +apt-get install -y \ + graphicsmagick \ + zip \ + unzip \ + wget \ + curl \ + mysql-client \ + moreutils \ + dnsutils + +############################# +# Generate locales +############################# + +cat /opt/docker/locale.conf >> /var/lib/locales/supported.d/local +locale-gen + +############################# +# Enable php modules +############################# +## custom config +touch /etc/php5/mods-available/docker-boilerplate.ini +php5enmod docker-boilerplate + +# enable ext mcrypt +php5enmod mcrypt + +############################# +# Composer +############################# + +curl -sS https://getcomposer.org/installer | php +mv composer.phar /usr/local/bin/composer + + +############################# +# Dnsmasq +############################# + +## Fix dnsmasqd +echo " +user=root +conf-dir=/etc/dnsmasq.d +" >> /etc/dnsmasq.conf + +############################# +# Cleanup +############################# + +apt-get clean -y +apt-get autoclean -y diff --git a/docker/main/ubuntu-15.10/bin/logwatch.sh b/docker/main/ubuntu-15.10/bin/logwatch.sh new file mode 100644 index 0000000..729e0ca --- /dev/null +++ b/docker/main/ubuntu-15.10/bin/logwatch.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +tail -F --quiet $2 | sed --unbuffered -e "s/^/\[$1\] /" diff --git a/docker/main/ubuntu-15.10/conf/locale.conf b/docker/main/ubuntu-15.10/conf/locale.conf new file mode 100644 index 0000000..7410061 --- /dev/null +++ b/docker/main/ubuntu-15.10/conf/locale.conf @@ -0,0 +1,11 @@ +en_GB.UTF-8 UTF-8 +en_GB ISO-8859-1 +en_GB.ISO-8859-15 ISO-8859-15 + +en_US.UTF-8 UTF-8 +en_US ISO-8859-1 +en_US.ISO-8859-15 ISO-8859-15 + +de_DE.UTF-8 UTF-8 +de_DE ISO-8859-1 +de_DE@euro ISO-8859-15 \ No newline at end of file diff --git a/docker/main/ubuntu-15.10/conf/php.ini b/docker/main/ubuntu-15.10/conf/php.ini new file mode 100644 index 0000000..b3b39c5 --- /dev/null +++ b/docker/main/ubuntu-15.10/conf/php.ini @@ -0,0 +1,29 @@ +; this file will overwrite default php.ini settings + +short_open_tag = On +variables_order = 'GPCS' +request_order = 'GP' + +allow_url_fopen = On +allow_url_include = Off + +memory_limit = 512M +max_execution_time = 900 +max_input_time = 300 +post_max_size = 50M +upload_max_filesize = 50M + +; timezone will be overwritten in startup, use docker-env.yml +date.timezone = Europe/Berlin + +mysql.default_host = mysql +mysqli.default_host = mysql + +xdebug.remote_enable = 1 +xdebug.remote_connect_back = on +xdebug.idekey = "docker" +xdebug.cli_color = 1 +xdebug.max_nesting_level = 1000 +xdebug.profiler_enable_trigger = 1 +xdebug.profiler_output_dir = '/tmp/debug/' +xhprof.output_dir = '/tmp/debug/' diff --git a/docker/main/ubuntu-15.10/conf/supervisord.conf b/docker/main/ubuntu-15.10/conf/supervisord.conf new file mode 100644 index 0000000..d9802c9 --- /dev/null +++ b/docker/main/ubuntu-15.10/conf/supervisord.conf @@ -0,0 +1,47 @@ +[supervisord] +nodaemon=true + +[program:php-fpm] +command = /usr/sbin/php5-fpm --nodaemonize +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:dnsmasq] +command = bash /opt/docker/dnsmasq.sh +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-access] +command = bash /opt/docker/logwatch.sh php:access /tmp/php.access.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-slow] +command = bash /opt/docker/logwatch.sh php:slow /tmp/php.slow.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-error] +command = bash /opt/docker/logwatch.sh php:error /tmp/php.error.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/docker/main/ubuntu-15.10/entrypoint.sh b/docker/main/ubuntu-15.10/entrypoint.sh new file mode 100755 index 0000000..838c922 --- /dev/null +++ b/docker/main/ubuntu-15.10/entrypoint.sh @@ -0,0 +1,63 @@ +#!/bin/bash +set -e + +## Init system +source /opt/docker/init-system.sh + +## Init MySQL (client) +source /opt/docker/init-mysql.sh + +## Init SSMTP +source /opt/docker/init-ssmtp.sh + +## Init PHP and PHP-FPM +source /opt/docker/init-php.sh + +############################# +## COMMAND +############################# + +case "$1" in + + ## Supervisord (start daemons) + supervisord) + ## Register IP + ETH0_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') + mkdir -p /data/dns/ + chmod 777 /data/dns/ + echo "${ETH0_IP}" > /data/dns/main.ip + echo "${ETH0_IP} main main_1" > /data/dns/main.hosts + + ## Start services + exec supervisord + ;; + + ## Root shell + root) + if [ "$#" -eq 1 ]; then + ## No command, fall back to shell + exec bash + else + ## Exec root command + shift + exec "$@" + fi + ;; + + ## Defined cli script + cli) + if [ -n "${CLI_SCRIPT}" ]; then + shift + exec sudo -H -E -u "${CLI_USER}" ${CLI_SCRIPT} "$@" + else + echo "[ERROR] No CLI_SCRIPT in docker-env.yml defined" + exit 1 + fi + ;; + + ## All other commands + *) + ## Execute cmd + exec sudo -H -E -u "${CLI_USER}" "$@" + ;; +esac diff --git a/docker/main/ubuntu-15.10/htdocs/.gitkeep b/docker/main/ubuntu-15.10/htdocs/.gitkeep new file mode 100644 index 0000000..e69de29 From 227e879065b3ac4c7122c060285ee3b410be47fc Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Fri, 10 Jul 2015 22:06:34 +0200 Subject: [PATCH 06/66] Fixed typo --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index fc0e73b..fc14057 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ main: #build: docker/main/ubuntu-12.04 # PHP 5.3, LTS (precise) build: docker/main/ubuntu-14.04 # PHP 5.5, LTS (trusty) #build: docker/main/ubuntu-15.04 # PHP 5.6 (vivid) - #build: docker/main/ubuntu-15.10 # PHP 5.6, LTS (wily) + #build: docker/main/ubuntu-15.10 # PHP 5.6 (wily) links: - mysql #- postgres From 78fbeb1456572931351e73a974594115a455158a Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Fri, 10 Jul 2015 22:06:48 +0200 Subject: [PATCH 07/66] Added ubuntu with ansible provisioning --- docker-compose.yml | 9 ++- docker/main/ubuntu-ansible/Dockerfile | 53 ++++++++++++ docker/main/ubuntu-ansible/bin/bootstrap.sh | 29 +++++++ .../main/ubuntu-ansible/bin/customization.sh | 10 +++ docker/main/ubuntu-ansible/bin/dnsmasq.sh | 63 +++++++++++++++ docker/main/ubuntu-ansible/bin/logwatch.sh | 8 ++ docker/main/ubuntu-ansible/bin/provision.sh | 19 +++++ docker/main/ubuntu-ansible/conf/locale.conf | 11 +++ docker/main/ubuntu-ansible/conf/php.ini | 29 +++++++ .../main/ubuntu-ansible/conf/supervisord.conf | 47 +++++++++++ docker/main/ubuntu-ansible/entrypoint.sh | 53 ++++++++++++ docker/main/ubuntu-ansible/htdocs/.gitkeep | 0 .../main/ubuntu-ansible/provision/ansible.cfg | 0 .../main/ubuntu-ansible/provision/inventory | 1 + .../ubuntu-ansible/provision/playbook.yml | 13 +++ .../provision/roles/common/tasks/main.yml | 7 ++ .../provision/roles/common/tasks/packages.yml | 19 +++++ .../provision/roles/common/tasks/update.yml | 5 ++ .../roles/dnsmasqd/tasks/install.yml | 16 ++++ .../provision/roles/dnsmasqd/tasks/main.yml | 3 + .../roles/finalize/tasks/cleanup.yml | 5 ++ .../provision/roles/finalize/tasks/main.yml | 3 + .../roles/locales/tasks/generate.yml | 5 ++ .../provision/roles/locales/tasks/main.yml | 3 + .../roles/mysql/tasks/configuration.yml | 15 ++++ .../provision/roles/mysql/tasks/install.yml | 6 ++ .../provision/roles/mysql/tasks/main.yml | 7 ++ .../provision/roles/mysql/templates/my.cnf.j2 | 21 +++++ .../roles/php/tasks/configuration.yml | 25 ++++++ .../provision/roles/php/tasks/install.yml | 80 +++++++++++++++++++ .../provision/roles/php/tasks/main.yml | 7 ++ .../roles/ssmtp/tasks/configuration.yml | 9 +++ .../provision/roles/ssmtp/tasks/install.yml | 6 ++ .../provision/roles/ssmtp/tasks/main.yml | 7 ++ .../roles/supervisord/tasks/install.yml | 12 +++ .../roles/supervisord/tasks/main.yml | 3 + .../provision/roles/users/tasks/main.yml | 3 + .../provision/roles/users/tasks/www-data.yml | 9 +++ .../ubuntu-ansible/provision/variables.yml | 44 ++++++++++ 39 files changed, 661 insertions(+), 4 deletions(-) create mode 100644 docker/main/ubuntu-ansible/Dockerfile create mode 100644 docker/main/ubuntu-ansible/bin/bootstrap.sh create mode 100644 docker/main/ubuntu-ansible/bin/customization.sh create mode 100644 docker/main/ubuntu-ansible/bin/dnsmasq.sh create mode 100644 docker/main/ubuntu-ansible/bin/logwatch.sh create mode 100644 docker/main/ubuntu-ansible/bin/provision.sh create mode 100644 docker/main/ubuntu-ansible/conf/locale.conf create mode 100644 docker/main/ubuntu-ansible/conf/php.ini create mode 100644 docker/main/ubuntu-ansible/conf/supervisord.conf create mode 100755 docker/main/ubuntu-ansible/entrypoint.sh create mode 100644 docker/main/ubuntu-ansible/htdocs/.gitkeep create mode 100644 docker/main/ubuntu-ansible/provision/ansible.cfg create mode 100644 docker/main/ubuntu-ansible/provision/inventory create mode 100755 docker/main/ubuntu-ansible/provision/playbook.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/common/tasks/main.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/common/tasks/packages.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/common/tasks/update.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/install.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/main.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/finalize/tasks/cleanup.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/finalize/tasks/main.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/locales/tasks/generate.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/locales/tasks/main.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/mysql/tasks/configuration.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/mysql/tasks/install.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/mysql/tasks/main.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/mysql/templates/my.cnf.j2 create mode 100644 docker/main/ubuntu-ansible/provision/roles/php/tasks/configuration.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/php/tasks/install.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/php/tasks/main.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/configuration.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/install.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/main.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/install.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/main.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/users/tasks/main.yml create mode 100644 docker/main/ubuntu-ansible/provision/roles/users/tasks/www-data.yml create mode 100644 docker/main/ubuntu-ansible/provision/variables.yml diff --git a/docker-compose.yml b/docker-compose.yml index fc14057..e2521d0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,10 +2,11 @@ # Main php container ####################################### main: - #build: docker/main/ubuntu-12.04 # PHP 5.3, LTS (precise) - build: docker/main/ubuntu-14.04 # PHP 5.5, LTS (trusty) - #build: docker/main/ubuntu-15.04 # PHP 5.6 (vivid) - #build: docker/main/ubuntu-15.10 # PHP 5.6 (wily) + #build: docker/main/ubuntu-12.04 # PHP 5.3, LTS (precise) + build: docker/main/ubuntu-14.04 # PHP 5.5, LTS (trusty) + #build: docker/main/ubuntu-15.04 # PHP 5.6 (vivid) + #build: docker/main/ubuntu-15.10 # PHP 5.6 (wily) + #build: docker/main/ubuntu-ansible # any ubuntu version, ansible provisioning links: - mysql #- postgres diff --git a/docker/main/ubuntu-ansible/Dockerfile b/docker/main/ubuntu-ansible/Dockerfile new file mode 100644 index 0000000..1e849d8 --- /dev/null +++ b/docker/main/ubuntu-ansible/Dockerfile @@ -0,0 +1,53 @@ +#+++++++++++++++++++++++++++ +# Ubuntu PHP Docker container +# +# ubuntu:12.04 - PHP 5.3, LTS (precise) +# ubuntu:14.04 - PHP 5.5, LTS (trusty) +# ubuntu:15.10 - PHP 5.6 (vivid) +# ubuntu:15.10 - PHP 5.6, LTS (wily) +# +#+++++++++++++++++++++++++++ + +FROM ubuntu:14.04 + +# Ensure UTF-8 +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +## +# Bootstrap +## + +COPY conf/locale.conf /opt/docker/locale.conf +COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision/* /opt/docker/provision/ + +RUN bash /opt/docker/bin/bootstrap.sh +RUN bash /opt/docker/bin/provision.sh bootstrap + +## +# Customization +## + +COPY bin/customization.sh /opt/docker/bin/customization.sh +RUN bash /opt/docker/bin/customization.sh + +## +# Config +## + +COPY entrypoint.sh /entrypoint.sh +COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY conf/php.ini /etc/php5/mods-available/docker-boilerplate.ini + +EXPOSE 9000 + +VOLUME /docker/ +WORKDIR /docker/code/ + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["supervisord"] diff --git a/docker/main/ubuntu-ansible/bin/bootstrap.sh b/docker/main/ubuntu-ansible/bin/bootstrap.sh new file mode 100644 index 0000000..219992d --- /dev/null +++ b/docker/main/ubuntu-ansible/bin/bootstrap.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export DEBIAN_FRONTEND="noninteractive" + +# workaround for slow/freezing apt inside docker(?) +echo 'Acquire::http::Pipeline-Depth "0";' >> /etc/apt/apt.conf.d/00no-pipeline + +# install apt-add-repository if needed +if [ -z "`which apt-add-repository`" ]; then + + apt-get update -q + apt-get install -y --no-install-recommends lsb-release + + + if [ "`lsb_release -r -s`" = '12.04' ]; then + apt-get install -y python-software-properties + else + apt-get install -y software-properties-common + fi +fi + +apt-add-repository ppa:ansible/ansible +apt-get update -q +apt-get install -y ansible python-apt aptitude \ No newline at end of file diff --git a/docker/main/ubuntu-ansible/bin/customization.sh b/docker/main/ubuntu-ansible/bin/customization.sh new file mode 100644 index 0000000..861b916 --- /dev/null +++ b/docker/main/ubuntu-ansible/bin/customization.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export DEBIAN_FRONTEND="noninteractive" + +## add your custom stuff here diff --git a/docker/main/ubuntu-ansible/bin/dnsmasq.sh b/docker/main/ubuntu-ansible/bin/dnsmasq.sh new file mode 100644 index 0000000..8da4dfa --- /dev/null +++ b/docker/main/ubuntu-ansible/bin/dnsmasq.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +sleep 5 + +## backup original resolv.conf +if [ ! -f "/opt/docker/.resolv.conf" ]; then + ## backup original file + cp /etc/resolv.conf /opt/docker/.resolv.conf + + ## Copy resolv.conf for dnsmasq (default resolver) + cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf +fi + +## Restore original resolvconf +function restore_resolvconf() { + ## restore original resolv.conf + cp /opt/docker/.resolv.conf /etc/resolv.conf +} + +## Start and configure dnsmasq +function dnsmasq_start() { + echo "[dnsmasq] Found Webserver IP: $1" + + restore_resolvconf + + ## clear dns file + echo > /etc/dnsmasq.d/development + + ## add IP for each domain (wildcard!) + for DOMAIN in $DNS_DOMAIN; do + echo "address=/${DOMAIN}/${1}" >> /etc/dnsmasq.d/development + done + + ## set forward servers + cat /var/run/dnsmasq/resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward + + ## (re)start dnsmasq as DNS server + service dnsmasq restart + + ## set dnsmasq to main nameserver + echo "nameserver 127.0.0.1" > /etc/resolv.conf + + ## wait for 10 hours + sleep 10h +} + +## Fetch IP from services +if [ -f "/data/dns/web.ip" ]; then + ## Found WEB + dnsmasq_start "$(cat /data/dns/web.ip)" +elif [ -f "/data/dns/httpd.ip" ]; then + ## Found HTTPD (fallback) + dnsmasq_start "$(cat /data/dns/httpd.ip)" +elif [ -f "/data/dns/nginx.ip" ]; then + ## Found NGINX (fallback) + dnsmasq_start "$(cat /data/dns/nginx.ip)" +else + ## Found nothing, restore original resolvconf + restore_resolvconf + sleep 15 +fi + +exit 0 diff --git a/docker/main/ubuntu-ansible/bin/logwatch.sh b/docker/main/ubuntu-ansible/bin/logwatch.sh new file mode 100644 index 0000000..729e0ca --- /dev/null +++ b/docker/main/ubuntu-ansible/bin/logwatch.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +tail -F --quiet $2 | sed --unbuffered -e "s/^/\[$1\] /" diff --git a/docker/main/ubuntu-ansible/bin/provision.sh b/docker/main/ubuntu-ansible/bin/provision.sh new file mode 100644 index 0000000..c9d06fc --- /dev/null +++ b/docker/main/ubuntu-ansible/bin/provision.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export DEBIAN_FRONTEND="noninteractive" +export PYTHONUNBUFFERED=1 + +ANSIBLE_DIR='/opt/docker/provision' + +ANSIBLE_TAG="$1" + +# workaround if windows +chmod -x "$ANSIBLE_DIR/inventory" + +# run ansible +ansible-playbook "$ANSIBLE_DIR/playbook.yml" --inventory="$ANSIBLE_DIR/inventory" --tags="${ANSIBLE_TAG}" diff --git a/docker/main/ubuntu-ansible/conf/locale.conf b/docker/main/ubuntu-ansible/conf/locale.conf new file mode 100644 index 0000000..7410061 --- /dev/null +++ b/docker/main/ubuntu-ansible/conf/locale.conf @@ -0,0 +1,11 @@ +en_GB.UTF-8 UTF-8 +en_GB ISO-8859-1 +en_GB.ISO-8859-15 ISO-8859-15 + +en_US.UTF-8 UTF-8 +en_US ISO-8859-1 +en_US.ISO-8859-15 ISO-8859-15 + +de_DE.UTF-8 UTF-8 +de_DE ISO-8859-1 +de_DE@euro ISO-8859-15 \ No newline at end of file diff --git a/docker/main/ubuntu-ansible/conf/php.ini b/docker/main/ubuntu-ansible/conf/php.ini new file mode 100644 index 0000000..b3b39c5 --- /dev/null +++ b/docker/main/ubuntu-ansible/conf/php.ini @@ -0,0 +1,29 @@ +; this file will overwrite default php.ini settings + +short_open_tag = On +variables_order = 'GPCS' +request_order = 'GP' + +allow_url_fopen = On +allow_url_include = Off + +memory_limit = 512M +max_execution_time = 900 +max_input_time = 300 +post_max_size = 50M +upload_max_filesize = 50M + +; timezone will be overwritten in startup, use docker-env.yml +date.timezone = Europe/Berlin + +mysql.default_host = mysql +mysqli.default_host = mysql + +xdebug.remote_enable = 1 +xdebug.remote_connect_back = on +xdebug.idekey = "docker" +xdebug.cli_color = 1 +xdebug.max_nesting_level = 1000 +xdebug.profiler_enable_trigger = 1 +xdebug.profiler_output_dir = '/tmp/debug/' +xhprof.output_dir = '/tmp/debug/' diff --git a/docker/main/ubuntu-ansible/conf/supervisord.conf b/docker/main/ubuntu-ansible/conf/supervisord.conf new file mode 100644 index 0000000..e2d71a9 --- /dev/null +++ b/docker/main/ubuntu-ansible/conf/supervisord.conf @@ -0,0 +1,47 @@ +[supervisord] +nodaemon=true + +[program:php-fpm] +command = /usr/sbin/php5-fpm +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:dnsmasq] +command = bash /opt/docker/bin/dnsmasq.sh +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-access] +command = bash /opt/docker/bin/logwatch.sh php:access /tmp/php.access.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-slow] +command = bash /opt/docker/bin/logwatch.sh php:slow /tmp/php.slow.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-error] +command = bash /opt/docker/bin/logwatch.sh php:error /tmp/php.error.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/docker/main/ubuntu-ansible/entrypoint.sh b/docker/main/ubuntu-ansible/entrypoint.sh new file mode 100755 index 0000000..0f68e2f --- /dev/null +++ b/docker/main/ubuntu-ansible/entrypoint.sh @@ -0,0 +1,53 @@ +#!/bin/bash +set -e + +bash /opt/docker/bin/provision.sh entrypoint + +############################# +## COMMAND +############################# + +case "$1" in + + ## Supervisord (start daemons) + supervisord) + ## Register IP + ETH0_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') + mkdir -p /data/dns/ + chmod 777 /data/dns/ + echo "${ETH0_IP}" > /data/dns/main.ip + echo "${ETH0_IP} main main_1" > /data/dns/main.hosts + + ## Start services + exec supervisord + ;; + + ## Root shell + root) + if [ "$#" -eq 1 ]; then + ## No command, fall back to shell + exec bash + else + ## Exec root command + shift + exec "$@" + fi + ;; + + ## Defined cli script + cli) + if [ -n "${CLI_SCRIPT}" ]; then + shift + exec sudo -H -E -u "${CLI_USER}" ${CLI_SCRIPT} "$@" + else + echo "[ERROR] No CLI_SCRIPT in docker-env.yml defined" + exit 1 + fi + ;; + + ## All other commands + *) + ## Execute cmd + exec sudo -H -E -u "${CLI_USER}" "$@" + ;; +esac diff --git a/docker/main/ubuntu-ansible/htdocs/.gitkeep b/docker/main/ubuntu-ansible/htdocs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docker/main/ubuntu-ansible/provision/ansible.cfg b/docker/main/ubuntu-ansible/provision/ansible.cfg new file mode 100644 index 0000000..e69de29 diff --git a/docker/main/ubuntu-ansible/provision/inventory b/docker/main/ubuntu-ansible/provision/inventory new file mode 100644 index 0000000..00639f8 --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/inventory @@ -0,0 +1 @@ +localhost ansible_connection=local \ No newline at end of file diff --git a/docker/main/ubuntu-ansible/provision/playbook.yml b/docker/main/ubuntu-ansible/provision/playbook.yml new file mode 100755 index 0000000..ae9ae10 --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/playbook.yml @@ -0,0 +1,13 @@ +- hosts: all + vars_files: + - /opt/docker/provision/variables.yml + roles: + - common + - locales + - supervisord + - dnsmasqd + - ssmtp + - php + - mysql + - users + - finalize diff --git a/docker/main/ubuntu-ansible/provision/roles/common/tasks/main.yml b/docker/main/ubuntu-ansible/provision/roles/common/tasks/main.yml new file mode 100644 index 0000000..5a308a2 --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/common/tasks/main.yml @@ -0,0 +1,7 @@ +- include: update.yml + tags: + - bootstrap + +- include: packages.yml + tags: + - bootstrap diff --git a/docker/main/ubuntu-ansible/provision/roles/common/tasks/packages.yml b/docker/main/ubuntu-ansible/provision/roles/common/tasks/packages.yml new file mode 100644 index 0000000..1b155d9 --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/common/tasks/packages.yml @@ -0,0 +1,19 @@ +- name: Install default packages + apt: + pkg: '{{ item }}' + state: latest + with_items: + # System tools + - sudo + # Compression + - zip + - unzip + - bzip2 + # Graphic tools + - graphicsmagick + # Networking tools + - wget + - curl + # Utils + - moreutils + - dnsutils \ No newline at end of file diff --git a/docker/main/ubuntu-ansible/provision/roles/common/tasks/update.yml b/docker/main/ubuntu-ansible/provision/roles/common/tasks/update.yml new file mode 100644 index 0000000..e74dcee --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/common/tasks/update.yml @@ -0,0 +1,5 @@ +- name: Update system + apt: update_cache=yes + +- name: Upgrade system + apt: upgrade=full \ No newline at end of file diff --git a/docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/install.yml new file mode 100644 index 0000000..46c4d0b --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/install.yml @@ -0,0 +1,16 @@ +- name: Install dnsmasqd + apt: + pkg: '{{ item }}' + state: latest + with_items: + - dnsmasq + +- name: Configure dnsmasq + lineinfile: + dest: /etc/dnsmasq.conf + regexp: '{{ item.regexp }}' + line: '{{ item.line }}' + with_items: + - { regexp: '^user[\s]*=', line: 'user=root' } + - { regexp: '^conf-dir[\s]*=', line: 'conf-dir=/etc/dnsmasq.d' } + diff --git a/docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/main.yml b/docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/main.yml new file mode 100644 index 0000000..e3418cb --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/main.yml @@ -0,0 +1,3 @@ +- include: install.yml + tags: + - bootstrap diff --git a/docker/main/ubuntu-ansible/provision/roles/finalize/tasks/cleanup.yml b/docker/main/ubuntu-ansible/provision/roles/finalize/tasks/cleanup.yml new file mode 100644 index 0000000..c1233fe --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/finalize/tasks/cleanup.yml @@ -0,0 +1,5 @@ +- name: Cleanup apt + command: apt-get clean -y + +- name: Cleanup apt + command: apt-get autoclean -y diff --git a/docker/main/ubuntu-ansible/provision/roles/finalize/tasks/main.yml b/docker/main/ubuntu-ansible/provision/roles/finalize/tasks/main.yml new file mode 100644 index 0000000..bfb1442 --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/finalize/tasks/main.yml @@ -0,0 +1,3 @@ +- include: cleanup.yml + tags: + - bootstrap diff --git a/docker/main/ubuntu-ansible/provision/roles/locales/tasks/generate.yml b/docker/main/ubuntu-ansible/provision/roles/locales/tasks/generate.yml new file mode 100644 index 0000000..21ffe74 --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/locales/tasks/generate.yml @@ -0,0 +1,5 @@ +- name: Copy defined locales + raw: 'cat /opt/docker/locale.conf >> /var/lib/locales/supported.d/local' + +- name: Generate locales + command: locale-gen diff --git a/docker/main/ubuntu-ansible/provision/roles/locales/tasks/main.yml b/docker/main/ubuntu-ansible/provision/roles/locales/tasks/main.yml new file mode 100644 index 0000000..05aa97d --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/locales/tasks/main.yml @@ -0,0 +1,3 @@ +- include: generate.yml + tags: + - bootstrap diff --git a/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/configuration.yml b/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/configuration.yml new file mode 100644 index 0000000..4dbf3e3 --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/configuration.yml @@ -0,0 +1,15 @@ +- name: Deploy root my.cnf + template: + src: my.cnf.j2 + dest: /root/.my.cnf + owner: root + group: root + mode: 0644 + +- name: Deploy user my.cnf + template: + src: my.cnf.j2 + dest: /home/.my.cnf + owner: www-data + group: www-data + mode: 0644 \ No newline at end of file diff --git a/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/install.yml b/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/install.yml new file mode 100644 index 0000000..872433d --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/install.yml @@ -0,0 +1,6 @@ +- name: Install mysql client + apt: + pkg: '{{ item }}' + state: latest + with_items: + - mysql-client \ No newline at end of file diff --git a/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/main.yml b/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/main.yml new file mode 100644 index 0000000..35d0963 --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/main.yml @@ -0,0 +1,7 @@ +- include: install.yml + tags: + - bootstrap + +- include: configuration.yml + tags: + - entrypoint diff --git a/docker/main/ubuntu-ansible/provision/roles/mysql/templates/my.cnf.j2 b/docker/main/ubuntu-ansible/provision/roles/mysql/templates/my.cnf.j2 new file mode 100644 index 0000000..c0aaee8 --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/mysql/templates/my.cnf.j2 @@ -0,0 +1,21 @@ +[client] +host=mysql +user="root" +password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" + +[mysql] +host=mysql +user="root" +password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" +database="{{ DOCKER.MYSQL_DATABASE }}" +default-character-set=utf8 +local-infile=1 +show-warnings +auto-rehash +sigint-ignore +reconnect + +[mysqldump] +host=mysql +user="root" +password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" \ No newline at end of file diff --git a/docker/main/ubuntu-ansible/provision/roles/php/tasks/configuration.yml b/docker/main/ubuntu-ansible/provision/roles/php/tasks/configuration.yml new file mode 100644 index 0000000..0fd3bfe --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/php/tasks/configuration.yml @@ -0,0 +1,25 @@ +- name: Configure php-fpm (pool www.conf) + lineinfile: + dest: /etc/php5/fpm/pool.d/www.conf + regexp: '^{{ item.key }}[\s]*=' + line: '{{ item.key }} = {{ item.value }}' + with_items: + # Env + - { key: 'env[TYPO3_CONTEXT]', value: '{{ DOCKER.TYPO3_CONTEXT }}' } + - { key: 'env[FLOW_CONTEXT]', value: '{{ DOCKER.FLOW_CONTEXT }}' } + - { key: 'env[FLOW_REWRITEURLS]', value: '{{ DOCKER.FLOW_REWRITEURLS }}' } + +- name: Configure php (docker-boilerplate.ini) + lineinfile: + dest: /etc/php5/mods-available/docker-boilerplate.ini + regexp: '{{ item.regexp }}' + line: '{{ item.line }}' + with_items: + - { regexp: '^date.timezone', line: 'date.timezone={{ DOCKER.PHP_TIMEZONE }}' } + +- name: Truncate log files + command: 'cp /dev/null {{ item }}' + with_items: + - '/tmp/php.slow.log' + - '/tmp/php.error.log' + - '/tmp/php.access.log' diff --git a/docker/main/ubuntu-ansible/provision/roles/php/tasks/install.yml b/docker/main/ubuntu-ansible/provision/roles/php/tasks/install.yml new file mode 100644 index 0000000..57ae064 --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/php/tasks/install.yml @@ -0,0 +1,80 @@ +- name: Install php + apt: + pkg: '{{ item }}' + state: latest + with_items: + - php5-cli + - php5-fpm + - php5-json + - php5-intl + - php5-curl + - php5-mysqlnd + - php5-xdebug + - php5-memcached + - php5-mcrypt + - php5-gd + - php5-sqlite + - php5-xmlrpc + - php5-xsl + - php5-geoip + - php5-ldap + - php5-memcache + - php5-memcached + - php5-imagick + +- name: Create /etc/php5/mods-available/ + file: + path: /etc/php5/mods-available/ + state: directory + mode: 0755 + +- name: Create /etc/php5/mods-available/docker-boilerplate.ini + file: + path: /etc/php5/mods-available/docker-boilerplate.ini + state: touch + mode: 0755 + +- name: Activate /etc/php5/mods-available/docker-boilerplate.ini + file: + src: /etc/php5/conf.d/docker-boilerplate.ini + dest: /etc/php5/mods-available/docker-boilerplate.ini + force: yes + state: link + +- name: Activate /etc/php5/mods-available/docker-boilerplate.ini + file: + src: /etc/php5/conf.d/mcrypt.ini + dest: /etc/php5/mods-available/mcrypt.ini + state: link + ignore_errors: True + +- name: Configure php-fpm (php-fpm.conf) + lineinfile: + dest: /etc/php5/fpm/php-fpm.conf + regexp: '^[\s;]*{{ item.key }}[\s]*=' + line: '{{ item.key }} = {{ item.value }}' + with_items: + - { key: 'daemonize', value: 'no' } + +- name: Configure php-fpm (pool www.conf) + lineinfile: + dest: /etc/php5/fpm/pool.d/www.conf + regexp: '^{{ item.key }}[\s]*=' + line: '{{ item.key }} = {{ item.value }}' + with_items: + # Networking + - { key: 'listen', value: '0.0.0.0:9000' } + # Process manager + - { key: 'pm.max_children', value: '15' } + - { key: 'pm.start_servers', value: '2' } + - { key: 'pm.min_spare_servers', value: '1' } + - { key: 'pm.max_spare_servers', value: '3' } + - { key: 'catch_workers_output', value: 'yes' } + # Logs + - { key: 'access.format', value: '\"%R - %u %t \\\"%m %r%Q%q\\\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d\"' } + - { key: 'access.log', value: '/tmp/php.access.log' } + - { key: 'slowlog', value: '/tmp/php.slow.log' } + - { key: 'request_slowlog_timeout', value: '30s' } + # PHP flags + - { key: 'php_admin_value[error_log]', value: '/tmp/php.error.log' } + - { key: 'php_admin_flag[log_errors]', value: 'on' } diff --git a/docker/main/ubuntu-ansible/provision/roles/php/tasks/main.yml b/docker/main/ubuntu-ansible/provision/roles/php/tasks/main.yml new file mode 100644 index 0000000..35d0963 --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/php/tasks/main.yml @@ -0,0 +1,7 @@ +- include: install.yml + tags: + - bootstrap + +- include: configuration.yml + tags: + - entrypoint diff --git a/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/configuration.yml b/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/configuration.yml new file mode 100644 index 0000000..aed514f --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/configuration.yml @@ -0,0 +1,9 @@ +- name: Setup ssmtp + lineinfile: + dest: /etc/ssmtp/ssmtp.conf + regexp: '{{ item.regexp }}' + line: '{{ item.line }}' + with_items: + # Send buffer sizes + - { regexp: '^mailhub=', line: 'mailhub={{ DOCKER.MAIL_GATEWAY }}' } + - { regexp: '^#?FromLineOverride=', line: 'FromLineOverride=YES' } diff --git a/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/install.yml b/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/install.yml new file mode 100644 index 0000000..e769f2c --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/install.yml @@ -0,0 +1,6 @@ +- name: Install ssmtp + apt: + pkg: '{{ item }}' + state: latest + with_items: + - ssmtp diff --git a/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/main.yml b/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/main.yml new file mode 100644 index 0000000..35d0963 --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/main.yml @@ -0,0 +1,7 @@ +- include: install.yml + tags: + - bootstrap + +- include: configuration.yml + tags: + - entrypoint diff --git a/docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/install.yml b/docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/install.yml new file mode 100644 index 0000000..9c74a3f --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/install.yml @@ -0,0 +1,12 @@ +- name: Install supervisor + apt: + pkg: '{{ item }}' + state: latest + with_items: + - supervisor + +- name: Create /etc/supervisor/conf.d/supervisord.conf + file: + path: /etc/supervisor/conf.d/supervisord.conf + state: touch + mode: 0755 \ No newline at end of file diff --git a/docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/main.yml b/docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/main.yml new file mode 100644 index 0000000..e3418cb --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/main.yml @@ -0,0 +1,3 @@ +- include: install.yml + tags: + - bootstrap diff --git a/docker/main/ubuntu-ansible/provision/roles/users/tasks/main.yml b/docker/main/ubuntu-ansible/provision/roles/users/tasks/main.yml new file mode 100644 index 0000000..f421097 --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/users/tasks/main.yml @@ -0,0 +1,3 @@ +- include: www-data.yml + tags: + - entrypoint diff --git a/docker/main/ubuntu-ansible/provision/roles/users/tasks/www-data.yml b/docker/main/ubuntu-ansible/provision/roles/users/tasks/www-data.yml new file mode 100644 index 0000000..3f9bd9e --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/roles/users/tasks/www-data.yml @@ -0,0 +1,9 @@ +- group: + name: www-data + gid: "{{ DOCKER.EFFECTIVE_UID }}" + +- user: + name: www-data + uid: "{{ DOCKER.EFFECTIVE_GID }}" + shell: /bin/bash + home: /home diff --git a/docker/main/ubuntu-ansible/provision/variables.yml b/docker/main/ubuntu-ansible/provision/variables.yml new file mode 100644 index 0000000..54d4eea --- /dev/null +++ b/docker/main/ubuntu-ansible/provision/variables.yml @@ -0,0 +1,44 @@ +--- + +DOCKER: + # System + EFFECTIVE_UID: "{{ lookup('env','EFFECTIVE_UID') }}" + EFFECTIVE_GID: "{{ lookup('env','EFFECTIVE_GID') }}" + CLI_USER: "{{ lookup('env','CLI_USER') }}" + CLI_SCRIPT: "{{ lookup('env','CLI_SCRIPT') }}" + + # http + DOCUMENT_ROOT: "{{ lookup('env','DOCUMENT_ROOT') }}" + DOCUMENT_INDEX: "{{ lookup('env','DOCUMENT_INDEX') }}" + + + # MySQL + MYSQL_ROOT_PASSWORD: "{{ lookup('env','MYSQL_ROOT_PASSWORD') }}" + MYSQL_USER: "{{ lookup('env','MYSQL_USER') }}" + MYSQL_PASSWORD: "{{ lookup('env','MYSQL_PASSWORD') }}" + MYSQL_DATABASE: "{{ lookup('env','MYSQL_DATABASE') }}" + + # PostgreSQL + POSTGRES_USER: "{{ lookup('env','POSTGRES_USER') }}" + POSTGRES_PASSWORD: "{{ lookup('env','POSTGRES_PASSWORD') }}" + + # FTP + FTP_USER: "{{ lookup('env','FTP_USER') }}" + FTP_PASSWORD: "{{ lookup('env','FTP_PASSWORD') }}" + FTP_PATH: "{{ lookup('env','FTP_PATH') }}" + + # Mail + MAIL_GATEWAY: "{{ lookup('env','MAIL_GATEWAY') }}" + + # PHP + PHP_TIMEZONE: "{{ lookup('env','PHP_TIMEZONE') }}" + + # DNS + DNS_DOMAIN: "{{ lookup('env','DNS_DOMAIN') }}" + + # Context + TYPO3_CONTEXT: "{{ lookup('env','TYPO3_CONTEXT') }}" + FLOW_CONTEXT: "{{ lookup('env','FLOW_CONTEXT') }}" + FLOW_REWRITEURLS: "{{ lookup('env','FLOW_REWRITEURLS') }}" + SYMFONY_ENV: "{{ lookup('env','SYMFONY_ENV') }}" + SYMFONY_DEBUG: "{{ lookup('env','SYMFONY_DEBUG') }}" From 93892264a210e7f6391689d82f6b6dd0f6c4b796 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Fri, 10 Jul 2015 23:15:36 +0200 Subject: [PATCH 08/66] Fixed some issues with ubuntu-ansible --- .../provision/roles/common/tasks/packages.yml | 2 +- .../roles/dnsmasqd/tasks/install.yml | 2 +- .../provision/roles/mysql/tasks/install.yml | 2 +- .../provision/roles/php/tasks/install.yml | 22 +++++++++---------- .../provision/roles/ssmtp/tasks/install.yml | 2 +- .../roles/supervisord/tasks/install.yml | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docker/main/ubuntu-ansible/provision/roles/common/tasks/packages.yml b/docker/main/ubuntu-ansible/provision/roles/common/tasks/packages.yml index 1b155d9..24a7aa0 100644 --- a/docker/main/ubuntu-ansible/provision/roles/common/tasks/packages.yml +++ b/docker/main/ubuntu-ansible/provision/roles/common/tasks/packages.yml @@ -1,6 +1,6 @@ - name: Install default packages apt: - pkg: '{{ item }}' + name: '{{ item }}' state: latest with_items: # System tools diff --git a/docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/install.yml index 46c4d0b..f66d6d3 100644 --- a/docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/install.yml +++ b/docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/install.yml @@ -1,6 +1,6 @@ - name: Install dnsmasqd apt: - pkg: '{{ item }}' + name: '{{ item }}' state: latest with_items: - dnsmasq diff --git a/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/install.yml b/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/install.yml index 872433d..9770e60 100644 --- a/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/install.yml +++ b/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/install.yml @@ -1,6 +1,6 @@ - name: Install mysql client apt: - pkg: '{{ item }}' + name: '{{ item }}' state: latest with_items: - mysql-client \ No newline at end of file diff --git a/docker/main/ubuntu-ansible/provision/roles/php/tasks/install.yml b/docker/main/ubuntu-ansible/provision/roles/php/tasks/install.yml index 57ae064..b48432e 100644 --- a/docker/main/ubuntu-ansible/provision/roles/php/tasks/install.yml +++ b/docker/main/ubuntu-ansible/provision/roles/php/tasks/install.yml @@ -1,6 +1,6 @@ - name: Install php apt: - pkg: '{{ item }}' + name: '{{ item }}' state: latest with_items: - php5-cli @@ -34,19 +34,19 @@ state: touch mode: 0755 -- name: Activate /etc/php5/mods-available/docker-boilerplate.ini +- name: Activate php config files (fpm) file: - src: /etc/php5/conf.d/docker-boilerplate.ini - dest: /etc/php5/mods-available/docker-boilerplate.ini + src: '/etc/php5/mods-available/{{ item.file }}' + dest: '/etc/php5/{{ item.category }}/conf.d/{{ item.order }}-{{ item.file }}' force: yes state: link - -- name: Activate /etc/php5/mods-available/docker-boilerplate.ini - file: - src: /etc/php5/conf.d/mcrypt.ini - dest: /etc/php5/mods-available/mcrypt.ini - state: link - ignore_errors: True + with_items: + # PHP cli + - { category: 'cli', file: 'mcrypt.ini', order: '20' } + - { category: 'cli', file: 'docker-boilerplate.ini', order: '99' } + # PHP fpm + - { category: 'fpm', file: 'mcrypt.ini', order: '20' } + - { category: 'fpm', file: 'docker-boilerplate.ini', order: '99' } - name: Configure php-fpm (php-fpm.conf) lineinfile: diff --git a/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/install.yml b/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/install.yml index e769f2c..ef86799 100644 --- a/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/install.yml +++ b/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/install.yml @@ -1,6 +1,6 @@ - name: Install ssmtp apt: - pkg: '{{ item }}' + name: '{{ item }}' state: latest with_items: - ssmtp diff --git a/docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/install.yml b/docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/install.yml index 9c74a3f..f06be2e 100644 --- a/docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/install.yml +++ b/docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/install.yml @@ -1,6 +1,6 @@ - name: Install supervisor apt: - pkg: '{{ item }}' + name: '{{ item }}' state: latest with_items: - supervisor From 21ebe43b43d9f47c75b2f2d6d6e471a302767e7b Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 01:26:27 +0200 Subject: [PATCH 09/66] Removed symfony See https://github.com/mblaschke/php-docker-boilerplate --- CHANGELOG.md | 4 +++ README.md | 2 +- bin/create-project.sh | 11 +------- .../ubuntu-ansible/provision/variables.yml | 2 -- documentation/DOCKER-STARTUP.md | 1 - documentation/PROJECT-SYMFONY.md | 25 ------------------- 6 files changed, 6 insertions(+), 39 deletions(-) delete mode 100644 documentation/PROJECT-SYMFONY.md diff --git a/CHANGELOG.md b/CHANGELOG.md index b217093..d875b3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ TYPO3 Docker Boilerplate Changelog ================================== +4.0.0 - UPCOMING +----------------------- +- Seperated TYPO3 Docker Boilerplate and PHP Docker Boilerplate + 3.5.0 - 2015-06-23 ----------------------- - Added `ftp` container (with vsftpd) diff --git a/README.md b/README.md index ef5f6d5..42f3816 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Dockerized PHP web project boilerplate +# Dockerized TYPO3 project boilerplate ![latest v3.5.0](https://img.shields.io/badge/latest-v3.5.0-green.svg?style=flat) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat) diff --git a/bin/create-project.sh b/bin/create-project.sh index 155c1eb..70b270a 100755 --- a/bin/create-project.sh +++ b/bin/create-project.sh @@ -8,7 +8,7 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.config.sh" if [ "$#" -lt 1 ]; then - echo "No project type defined (either cms, neos, symfony or git)" + echo "No project type defined (either cms, neos or git)" exit 1 fi @@ -33,15 +33,6 @@ case "$1" in execInDir "$CODE_DIR" "composer create-project typo3/neos-base-distribution \"$CODE_DIR\"" ;; - ################################### - ## SYMFONY - ################################### - "symfony") - curl -LsS http://symfony.com/installer > /tmp/symfony.$$.phar - execInDir "$CODE_DIR" "php /tmp/symfony.$$.phar new '$CODE_DIR'" - rm -f -- /tmp/symfony.$$.phar - ;; - ################################### ## GIT ################################### diff --git a/docker/main/ubuntu-ansible/provision/variables.yml b/docker/main/ubuntu-ansible/provision/variables.yml index 54d4eea..a163d09 100644 --- a/docker/main/ubuntu-ansible/provision/variables.yml +++ b/docker/main/ubuntu-ansible/provision/variables.yml @@ -40,5 +40,3 @@ DOCKER: TYPO3_CONTEXT: "{{ lookup('env','TYPO3_CONTEXT') }}" FLOW_CONTEXT: "{{ lookup('env','FLOW_CONTEXT') }}" FLOW_REWRITEURLS: "{{ lookup('env','FLOW_REWRITEURLS') }}" - SYMFONY_ENV: "{{ lookup('env','SYMFONY_ENV') }}" - SYMFONY_DEBUG: "{{ lookup('env','SYMFONY_DEBUG') }}" diff --git a/documentation/DOCKER-STARTUP.md b/documentation/DOCKER-STARTUP.md index 896f38d..b46c6c6 100644 --- a/documentation/DOCKER-STARTUP.md +++ b/documentation/DOCKER-STARTUP.md @@ -15,7 +15,6 @@ docker-compose up -d Now create your project inside the docker boilerplate: - [Create new TYPO3 project](PROJECT-TYPO3.md) -- [Create new Symfony project](PROJECT-SYMFONY.md) - [Create new NEOS project](PROJECT-NEOS.md) - [Running any other php based project](PROJECT-OTHER.md) - [Running existing project](PROJECT-EXISTING.md) diff --git a/documentation/PROJECT-SYMFONY.md b/documentation/PROJECT-SYMFONY.md deleted file mode 100644 index 4d8e7c3..0000000 --- a/documentation/PROJECT-SYMFONY.md +++ /dev/null @@ -1,25 +0,0 @@ -[<-- Back to main section](../README.md) - -# Running SYMFONY - -## Create SYMFONY project - -```bash -make create-project symfony -``` - -And change `DOCUMENT_ROOT` and `DOCUMENT_ROOT` in `docker-env.yml`: - - DOCUMENT_ROOT=code/web/ - DOCUMENT_INDEX=app_dev.php - -## SYMFONY cli runner - -You can run one-shot command inside the `main` service container: - -```bash -docker-compose run --rm main php code/app/console -docker-compose run --rm main bash -``` - -Webserver is available at Port 8000 From 0e5530632ac9edcabf4e0842282857b72aa455de Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 01:33:45 +0200 Subject: [PATCH 10/66] Updated readme --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 42f3816..bb86932 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/mblaschke/typo3-docker-boilerplate.svg)](http://isitmaintained.com/project/mblaschke/typo3-docker-boilerplate "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/mblaschke/typo3-docker-boilerplate.svg)](http://isitmaintained.com/project/mblaschke/typo3-docker-boilerplate "Percentage of issues still open") -This is an easy customizable docker boilerplate for any PHP based projects like _TYPO3 CMS_, _Symfony Framework_, _FLOW/NEOS_ and many other frameworks or applications. +This is an easy customizable TYPO3 docker boilerplate. Supports: @@ -25,9 +25,6 @@ Supports: This Docker boilerplate based on the best practises and don't use too much magic. Configuration of each docker container is available in the `docker/` directory - feel free to customize. -This boilerplate can also be used for any other web project eg. Symfony, Magento and more. -Just customize the makefile for your needs - Warning: There may be issues when using it in production - if you have any success stories please contact me. Use can use my [Vagrant Development VM](https://github.com/mblaschke/vagrant-development) for this Docker boilerplate, eg. for easy creating new boilerplate installations with an easy shell command: `ct docker:create directory` From 856a56c548e1df87b25fc22aea2ababb64dfd2e3 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 02:52:33 +0200 Subject: [PATCH 11/66] Added centos --- docker/main/centos-ansible/Dockerfile | 52 ++++++++++++++ docker/main/centos-ansible/bin/bootstrap.sh | 22 ++++++ .../main/centos-ansible/bin/customization.sh | 10 +++ docker/main/centos-ansible/bin/dnsmasq.sh | 63 ++++++++++++++++ docker/main/centos-ansible/bin/logwatch.sh | 8 +++ docker/main/centos-ansible/bin/provision.sh | 18 +++++ docker/main/centos-ansible/conf/locale.conf | 11 +++ docker/main/centos-ansible/conf/php.ini | 29 ++++++++ .../main/centos-ansible/conf/supervisord.conf | 47 ++++++++++++ docker/main/centos-ansible/entrypoint.sh | 53 ++++++++++++++ docker/main/centos-ansible/htdocs/.gitkeep | 0 .../main/centos-ansible/provision/ansible.cfg | 0 .../main/centos-ansible/provision/inventory | 1 + .../centos-ansible/provision/playbook.yml | 13 ++++ .../provision/roles/common/tasks/main.yml | 8 +++ .../provision/roles/common/tasks/packages.yml | 19 +++++ .../provision/roles/common/tasks/update.yml | 2 + .../roles/dnsmasqd/tasks/install.yml | 16 +++++ .../provision/roles/dnsmasqd/tasks/main.yml | 3 + .../roles/finalize/tasks/cleanup.yml | 2 + .../provision/roles/finalize/tasks/main.yml | 3 + .../roles/mysql/tasks/configuration.yml | 15 ++++ .../provision/roles/mysql/tasks/install.yml | 6 ++ .../provision/roles/mysql/tasks/main.yml | 7 ++ .../provision/roles/mysql/templates/my.cnf.j2 | 21 ++++++ .../roles/php/tasks/configuration.yml | 28 ++++++++ .../provision/roles/php/tasks/install.yml | 72 +++++++++++++++++++ .../provision/roles/php/tasks/main.yml | 7 ++ .../roles/ssmtp/tasks/configuration.yml | 9 +++ .../provision/roles/ssmtp/tasks/install.yml | 6 ++ .../provision/roles/ssmtp/tasks/main.yml | 7 ++ .../roles/supervisord/tasks/install.yml | 12 ++++ .../roles/supervisord/tasks/main.yml | 3 + .../provision/roles/users/tasks/main.yml | 3 + .../provision/roles/users/tasks/www-data.yml | 18 +++++ .../centos-ansible/provision/variables.yml | 42 +++++++++++ 36 files changed, 636 insertions(+) create mode 100644 docker/main/centos-ansible/Dockerfile create mode 100644 docker/main/centos-ansible/bin/bootstrap.sh create mode 100644 docker/main/centos-ansible/bin/customization.sh create mode 100644 docker/main/centos-ansible/bin/dnsmasq.sh create mode 100644 docker/main/centos-ansible/bin/logwatch.sh create mode 100644 docker/main/centos-ansible/bin/provision.sh create mode 100644 docker/main/centos-ansible/conf/locale.conf create mode 100644 docker/main/centos-ansible/conf/php.ini create mode 100644 docker/main/centos-ansible/conf/supervisord.conf create mode 100755 docker/main/centos-ansible/entrypoint.sh create mode 100644 docker/main/centos-ansible/htdocs/.gitkeep create mode 100644 docker/main/centos-ansible/provision/ansible.cfg create mode 100644 docker/main/centos-ansible/provision/inventory create mode 100755 docker/main/centos-ansible/provision/playbook.yml create mode 100644 docker/main/centos-ansible/provision/roles/common/tasks/main.yml create mode 100644 docker/main/centos-ansible/provision/roles/common/tasks/packages.yml create mode 100644 docker/main/centos-ansible/provision/roles/common/tasks/update.yml create mode 100644 docker/main/centos-ansible/provision/roles/dnsmasqd/tasks/install.yml create mode 100644 docker/main/centos-ansible/provision/roles/dnsmasqd/tasks/main.yml create mode 100644 docker/main/centos-ansible/provision/roles/finalize/tasks/cleanup.yml create mode 100644 docker/main/centos-ansible/provision/roles/finalize/tasks/main.yml create mode 100644 docker/main/centos-ansible/provision/roles/mysql/tasks/configuration.yml create mode 100644 docker/main/centos-ansible/provision/roles/mysql/tasks/install.yml create mode 100644 docker/main/centos-ansible/provision/roles/mysql/tasks/main.yml create mode 100644 docker/main/centos-ansible/provision/roles/mysql/templates/my.cnf.j2 create mode 100644 docker/main/centos-ansible/provision/roles/php/tasks/configuration.yml create mode 100644 docker/main/centos-ansible/provision/roles/php/tasks/install.yml create mode 100644 docker/main/centos-ansible/provision/roles/php/tasks/main.yml create mode 100644 docker/main/centos-ansible/provision/roles/ssmtp/tasks/configuration.yml create mode 100644 docker/main/centos-ansible/provision/roles/ssmtp/tasks/install.yml create mode 100644 docker/main/centos-ansible/provision/roles/ssmtp/tasks/main.yml create mode 100644 docker/main/centos-ansible/provision/roles/supervisord/tasks/install.yml create mode 100644 docker/main/centos-ansible/provision/roles/supervisord/tasks/main.yml create mode 100644 docker/main/centos-ansible/provision/roles/users/tasks/main.yml create mode 100644 docker/main/centos-ansible/provision/roles/users/tasks/www-data.yml create mode 100644 docker/main/centos-ansible/provision/variables.yml diff --git a/docker/main/centos-ansible/Dockerfile b/docker/main/centos-ansible/Dockerfile new file mode 100644 index 0000000..250c382 --- /dev/null +++ b/docker/main/centos-ansible/Dockerfile @@ -0,0 +1,52 @@ +#+++++++++++++++++++++++++++ +# Ubuntu PHP Docker container +# +# ubuntu:12.04 - PHP 5.3, LTS (precise) +# ubuntu:14.04 - PHP 5.5, LTS (trusty) +# ubuntu:15.10 - PHP 5.6 (vivid) +# ubuntu:15.10 - PHP 5.6, LTS (wily) +# +#+++++++++++++++++++++++++++ + +FROM centos:7 + +ENV PATH /opt/ansible/bin:/bin:/usr/bin:/sbin:/usr/sbin +ENV PYTHONPATH /opt/ansible/lib +ENV ANSIBLE_LIBRARY /opt/ansible/library + +## +# Bootstrap +## + +COPY conf/locale.conf /opt/docker/locale.conf +COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision /opt/docker/provision/ + +RUN bash /opt/docker/bin/bootstrap.sh +RUN bash /opt/docker/bin/provision.sh bootstrap + +## +# Customization +## + +COPY bin/customization.sh /opt/docker/bin/customization.sh +RUN bash /opt/docker/bin/customization.sh + +## +# Config +## + +COPY entrypoint.sh /entrypoint.sh +COPY conf/supervisord.conf /etc/supervisord.d/supervisord.ini +COPY conf/php.ini /etc/php.d/zzz-docker-boilerplate.ini + +EXPOSE 9000 + +VOLUME /docker/ +WORKDIR /docker/code/ + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["supervisord"] diff --git a/docker/main/centos-ansible/bin/bootstrap.sh b/docker/main/centos-ansible/bin/bootstrap.sh new file mode 100644 index 0000000..51d7f2e --- /dev/null +++ b/docker/main/centos-ansible/bin/bootstrap.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +yum clean all +yum -y install \ + epel-release \ + PyYAML \ + python-jinja2 \ + python-httplib2 \ + python-keyczar \ + python-paramiko \ + python-setuptools \ + git \ + python-pip + +git clone http://github.com/ansible/ansible.git /opt/ansible +cd /opt/ansible +git submodule update --init \ No newline at end of file diff --git a/docker/main/centos-ansible/bin/customization.sh b/docker/main/centos-ansible/bin/customization.sh new file mode 100644 index 0000000..861b916 --- /dev/null +++ b/docker/main/centos-ansible/bin/customization.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export DEBIAN_FRONTEND="noninteractive" + +## add your custom stuff here diff --git a/docker/main/centos-ansible/bin/dnsmasq.sh b/docker/main/centos-ansible/bin/dnsmasq.sh new file mode 100644 index 0000000..8da4dfa --- /dev/null +++ b/docker/main/centos-ansible/bin/dnsmasq.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +sleep 5 + +## backup original resolv.conf +if [ ! -f "/opt/docker/.resolv.conf" ]; then + ## backup original file + cp /etc/resolv.conf /opt/docker/.resolv.conf + + ## Copy resolv.conf for dnsmasq (default resolver) + cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf +fi + +## Restore original resolvconf +function restore_resolvconf() { + ## restore original resolv.conf + cp /opt/docker/.resolv.conf /etc/resolv.conf +} + +## Start and configure dnsmasq +function dnsmasq_start() { + echo "[dnsmasq] Found Webserver IP: $1" + + restore_resolvconf + + ## clear dns file + echo > /etc/dnsmasq.d/development + + ## add IP for each domain (wildcard!) + for DOMAIN in $DNS_DOMAIN; do + echo "address=/${DOMAIN}/${1}" >> /etc/dnsmasq.d/development + done + + ## set forward servers + cat /var/run/dnsmasq/resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward + + ## (re)start dnsmasq as DNS server + service dnsmasq restart + + ## set dnsmasq to main nameserver + echo "nameserver 127.0.0.1" > /etc/resolv.conf + + ## wait for 10 hours + sleep 10h +} + +## Fetch IP from services +if [ -f "/data/dns/web.ip" ]; then + ## Found WEB + dnsmasq_start "$(cat /data/dns/web.ip)" +elif [ -f "/data/dns/httpd.ip" ]; then + ## Found HTTPD (fallback) + dnsmasq_start "$(cat /data/dns/httpd.ip)" +elif [ -f "/data/dns/nginx.ip" ]; then + ## Found NGINX (fallback) + dnsmasq_start "$(cat /data/dns/nginx.ip)" +else + ## Found nothing, restore original resolvconf + restore_resolvconf + sleep 15 +fi + +exit 0 diff --git a/docker/main/centos-ansible/bin/logwatch.sh b/docker/main/centos-ansible/bin/logwatch.sh new file mode 100644 index 0000000..729e0ca --- /dev/null +++ b/docker/main/centos-ansible/bin/logwatch.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +tail -F --quiet $2 | sed --unbuffered -e "s/^/\[$1\] /" diff --git a/docker/main/centos-ansible/bin/provision.sh b/docker/main/centos-ansible/bin/provision.sh new file mode 100644 index 0000000..0edba74 --- /dev/null +++ b/docker/main/centos-ansible/bin/provision.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export PYTHONUNBUFFERED=1 + +ANSIBLE_DIR='/opt/docker/provision' + +ANSIBLE_TAG="$1" + +# workaround if windows +chmod -x "$ANSIBLE_DIR/inventory" + +# run ansible +ansible-playbook "$ANSIBLE_DIR/playbook.yml" --inventory="$ANSIBLE_DIR/inventory" --tags="${ANSIBLE_TAG}" diff --git a/docker/main/centos-ansible/conf/locale.conf b/docker/main/centos-ansible/conf/locale.conf new file mode 100644 index 0000000..7410061 --- /dev/null +++ b/docker/main/centos-ansible/conf/locale.conf @@ -0,0 +1,11 @@ +en_GB.UTF-8 UTF-8 +en_GB ISO-8859-1 +en_GB.ISO-8859-15 ISO-8859-15 + +en_US.UTF-8 UTF-8 +en_US ISO-8859-1 +en_US.ISO-8859-15 ISO-8859-15 + +de_DE.UTF-8 UTF-8 +de_DE ISO-8859-1 +de_DE@euro ISO-8859-15 \ No newline at end of file diff --git a/docker/main/centos-ansible/conf/php.ini b/docker/main/centos-ansible/conf/php.ini new file mode 100644 index 0000000..b3b39c5 --- /dev/null +++ b/docker/main/centos-ansible/conf/php.ini @@ -0,0 +1,29 @@ +; this file will overwrite default php.ini settings + +short_open_tag = On +variables_order = 'GPCS' +request_order = 'GP' + +allow_url_fopen = On +allow_url_include = Off + +memory_limit = 512M +max_execution_time = 900 +max_input_time = 300 +post_max_size = 50M +upload_max_filesize = 50M + +; timezone will be overwritten in startup, use docker-env.yml +date.timezone = Europe/Berlin + +mysql.default_host = mysql +mysqli.default_host = mysql + +xdebug.remote_enable = 1 +xdebug.remote_connect_back = on +xdebug.idekey = "docker" +xdebug.cli_color = 1 +xdebug.max_nesting_level = 1000 +xdebug.profiler_enable_trigger = 1 +xdebug.profiler_output_dir = '/tmp/debug/' +xhprof.output_dir = '/tmp/debug/' diff --git a/docker/main/centos-ansible/conf/supervisord.conf b/docker/main/centos-ansible/conf/supervisord.conf new file mode 100644 index 0000000..088e054 --- /dev/null +++ b/docker/main/centos-ansible/conf/supervisord.conf @@ -0,0 +1,47 @@ +[supervisord] +nodaemon=true + +[program:php-fpm] +command = /sbin/php-fpm +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:dnsmasq] +command = bash /opt/docker/bin/dnsmasq.sh +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-access] +command = bash /opt/docker/bin/logwatch.sh php:access /tmp/php.access.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-slow] +command = bash /opt/docker/bin/logwatch.sh php:slow /tmp/php.slow.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-error] +command = bash /opt/docker/bin/logwatch.sh php:error /tmp/php.error.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/docker/main/centos-ansible/entrypoint.sh b/docker/main/centos-ansible/entrypoint.sh new file mode 100755 index 0000000..0f68e2f --- /dev/null +++ b/docker/main/centos-ansible/entrypoint.sh @@ -0,0 +1,53 @@ +#!/bin/bash +set -e + +bash /opt/docker/bin/provision.sh entrypoint + +############################# +## COMMAND +############################# + +case "$1" in + + ## Supervisord (start daemons) + supervisord) + ## Register IP + ETH0_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') + mkdir -p /data/dns/ + chmod 777 /data/dns/ + echo "${ETH0_IP}" > /data/dns/main.ip + echo "${ETH0_IP} main main_1" > /data/dns/main.hosts + + ## Start services + exec supervisord + ;; + + ## Root shell + root) + if [ "$#" -eq 1 ]; then + ## No command, fall back to shell + exec bash + else + ## Exec root command + shift + exec "$@" + fi + ;; + + ## Defined cli script + cli) + if [ -n "${CLI_SCRIPT}" ]; then + shift + exec sudo -H -E -u "${CLI_USER}" ${CLI_SCRIPT} "$@" + else + echo "[ERROR] No CLI_SCRIPT in docker-env.yml defined" + exit 1 + fi + ;; + + ## All other commands + *) + ## Execute cmd + exec sudo -H -E -u "${CLI_USER}" "$@" + ;; +esac diff --git a/docker/main/centos-ansible/htdocs/.gitkeep b/docker/main/centos-ansible/htdocs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docker/main/centos-ansible/provision/ansible.cfg b/docker/main/centos-ansible/provision/ansible.cfg new file mode 100644 index 0000000..e69de29 diff --git a/docker/main/centos-ansible/provision/inventory b/docker/main/centos-ansible/provision/inventory new file mode 100644 index 0000000..00639f8 --- /dev/null +++ b/docker/main/centos-ansible/provision/inventory @@ -0,0 +1 @@ +localhost ansible_connection=local \ No newline at end of file diff --git a/docker/main/centos-ansible/provision/playbook.yml b/docker/main/centos-ansible/provision/playbook.yml new file mode 100755 index 0000000..e0d3d12 --- /dev/null +++ b/docker/main/centos-ansible/provision/playbook.yml @@ -0,0 +1,13 @@ +- hosts: all + vars_files: + - /opt/docker/provision/variables.yml + roles: + - common + - users + #- locales + - supervisord + - dnsmasqd + - ssmtp + - php + - mysql + - finalize diff --git a/docker/main/centos-ansible/provision/roles/common/tasks/main.yml b/docker/main/centos-ansible/provision/roles/common/tasks/main.yml new file mode 100644 index 0000000..711f812 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/common/tasks/main.yml @@ -0,0 +1,8 @@ +# currently fails because of missing AUFS features +#- include: update.yml +# tags: +# - bootstrap + +- include: packages.yml + tags: + - bootstrap diff --git a/docker/main/centos-ansible/provision/roles/common/tasks/packages.yml b/docker/main/centos-ansible/provision/roles/common/tasks/packages.yml new file mode 100644 index 0000000..2eeb774 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/common/tasks/packages.yml @@ -0,0 +1,19 @@ +- name: Install default packages + yum: + name: '{{ item }}' + state: latest + with_items: + # System tools + - sudo + # Compression + - zip + - unzip + - bzip2 + # Graphic tools + - ImageMagick + # Networking tools + - wget + - curl + # Utils + - moreutils + - bind-utils \ No newline at end of file diff --git a/docker/main/centos-ansible/provision/roles/common/tasks/update.yml b/docker/main/centos-ansible/provision/roles/common/tasks/update.yml new file mode 100644 index 0000000..6e5627f --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/common/tasks/update.yml @@ -0,0 +1,2 @@ +- name: Update system + yum: name=* state=latest \ No newline at end of file diff --git a/docker/main/centos-ansible/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/centos-ansible/provision/roles/dnsmasqd/tasks/install.yml new file mode 100644 index 0000000..c612b91 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/dnsmasqd/tasks/install.yml @@ -0,0 +1,16 @@ +- name: Install dnsmasqd + yum: + name: '{{ item }}' + state: latest + with_items: + - dnsmasq + +- name: Configure dnsmasq + lineinfile: + dest: /etc/dnsmasq.conf + regexp: '{{ item.regexp }}' + line: '{{ item.line }}' + with_items: + - { regexp: '^user[\s]*=', line: 'user=root' } + - { regexp: '^conf-dir[\s]*=', line: 'conf-dir=/etc/dnsmasq.d' } + diff --git a/docker/main/centos-ansible/provision/roles/dnsmasqd/tasks/main.yml b/docker/main/centos-ansible/provision/roles/dnsmasqd/tasks/main.yml new file mode 100644 index 0000000..e3418cb --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/dnsmasqd/tasks/main.yml @@ -0,0 +1,3 @@ +- include: install.yml + tags: + - bootstrap diff --git a/docker/main/centos-ansible/provision/roles/finalize/tasks/cleanup.yml b/docker/main/centos-ansible/provision/roles/finalize/tasks/cleanup.yml new file mode 100644 index 0000000..d4b35f6 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/finalize/tasks/cleanup.yml @@ -0,0 +1,2 @@ +- name: Cleanup yum + command: yum clean all \ No newline at end of file diff --git a/docker/main/centos-ansible/provision/roles/finalize/tasks/main.yml b/docker/main/centos-ansible/provision/roles/finalize/tasks/main.yml new file mode 100644 index 0000000..bfb1442 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/finalize/tasks/main.yml @@ -0,0 +1,3 @@ +- include: cleanup.yml + tags: + - bootstrap diff --git a/docker/main/centos-ansible/provision/roles/mysql/tasks/configuration.yml b/docker/main/centos-ansible/provision/roles/mysql/tasks/configuration.yml new file mode 100644 index 0000000..4dbf3e3 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/mysql/tasks/configuration.yml @@ -0,0 +1,15 @@ +- name: Deploy root my.cnf + template: + src: my.cnf.j2 + dest: /root/.my.cnf + owner: root + group: root + mode: 0644 + +- name: Deploy user my.cnf + template: + src: my.cnf.j2 + dest: /home/.my.cnf + owner: www-data + group: www-data + mode: 0644 \ No newline at end of file diff --git a/docker/main/centos-ansible/provision/roles/mysql/tasks/install.yml b/docker/main/centos-ansible/provision/roles/mysql/tasks/install.yml new file mode 100644 index 0000000..db441af --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/mysql/tasks/install.yml @@ -0,0 +1,6 @@ +- name: Install mysql client + yum: + name: '{{ item }}' + state: latest + with_items: + - mysql \ No newline at end of file diff --git a/docker/main/centos-ansible/provision/roles/mysql/tasks/main.yml b/docker/main/centos-ansible/provision/roles/mysql/tasks/main.yml new file mode 100644 index 0000000..35d0963 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/mysql/tasks/main.yml @@ -0,0 +1,7 @@ +- include: install.yml + tags: + - bootstrap + +- include: configuration.yml + tags: + - entrypoint diff --git a/docker/main/centos-ansible/provision/roles/mysql/templates/my.cnf.j2 b/docker/main/centos-ansible/provision/roles/mysql/templates/my.cnf.j2 new file mode 100644 index 0000000..c0aaee8 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/mysql/templates/my.cnf.j2 @@ -0,0 +1,21 @@ +[client] +host=mysql +user="root" +password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" + +[mysql] +host=mysql +user="root" +password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" +database="{{ DOCKER.MYSQL_DATABASE }}" +default-character-set=utf8 +local-infile=1 +show-warnings +auto-rehash +sigint-ignore +reconnect + +[mysqldump] +host=mysql +user="root" +password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" \ No newline at end of file diff --git a/docker/main/centos-ansible/provision/roles/php/tasks/configuration.yml b/docker/main/centos-ansible/provision/roles/php/tasks/configuration.yml new file mode 100644 index 0000000..b33cb4e --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/php/tasks/configuration.yml @@ -0,0 +1,28 @@ +- name: Configure php-fpm (pool www.conf) + lineinfile: + dest: /etc/php-fpm.d/www.conf + regexp: '^{{ item.key }}[\s]*=' + line: '{{ item.key }} = {{ item.value }}' + with_items: + # User + - { key: 'user', value: '{{ DOCKER.CLI_USER }}' } + - { key: 'group', value: '{{ DOCKER.CLI_USER }}' } + # Env + - { key: 'env[TYPO3_CONTEXT]', value: '{{ DOCKER.TYPO3_CONTEXT }}' } + - { key: 'env[FLOW_CONTEXT]', value: '{{ DOCKER.FLOW_CONTEXT }}' } + - { key: 'env[FLOW_REWRITEURLS]', value: '{{ DOCKER.FLOW_REWRITEURLS }}' } + +- name: Configure php (docker-boilerplate.ini) + lineinfile: + dest: /etc/php.d/zzz-docker-boilerplate.ini + regexp: '{{ item.regexp }}' + line: '{{ item.line }}' + with_items: + - { regexp: '^date.timezone', line: 'date.timezone={{ DOCKER.PHP_TIMEZONE }}' } + +- name: Truncate log files + command: 'cp /dev/null {{ item }}' + with_items: + - '/tmp/php.slow.log' + - '/tmp/php.error.log' + - '/tmp/php.access.log' diff --git a/docker/main/centos-ansible/provision/roles/php/tasks/install.yml b/docker/main/centos-ansible/provision/roles/php/tasks/install.yml new file mode 100644 index 0000000..5181fd2 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/php/tasks/install.yml @@ -0,0 +1,72 @@ +- name: Install php + yum: + name: '{{ item }}' + state: latest + with_items: + - php-cli + - php-fpm + - php-json + - php-intl + - php-curl + - php-mysqlnd + - php-xdebug + - php-memcached + - php-mcrypt + - php-gd + - sqlite + - php-xmlrpc + - php-xsl + - geoip + - php-ldap + - php-memcache + - ImageMagick + - ImageMagick-devel + - ImageMagick-perl + - php-pear + - gcc + +- name: Install php pecl + command: 'pecl install {{ item }}' + with_items: + - imagick + +- name: Configure php-fpm (php-fpm.conf) + lineinfile: + dest: /etc/php-fpm.conf + regexp: '^[\s;]*{{ item.key }}[\s]*=' + line: '{{ item.key }} = {{ item.value }}' + with_items: + - { key: 'daemonize', value: 'no' } + +- name: Configure php-fpm (pool www.conf) + lineinfile: + dest: /etc/php-fpm.d/www.conf + regexp: '^{{ item.key }}[\s]*=' + line: '{{ item.key }} = {{ item.value }}' + with_items: + # Networking + - { key: 'listen', value: '0.0.0.0:9000' } + - { key: 'listen.allowed_clients', value: '' } + # Process manager + - { key: 'pm.max_children', value: '15' } + - { key: 'pm.start_servers', value: '2' } + - { key: 'pm.min_spare_servers', value: '1' } + - { key: 'pm.max_spare_servers', value: '3' } + - { key: 'catch_workers_output', value: 'yes' } + # Logs + - { key: 'access.format', value: '\"%R - %u %t \\\"%m %r%Q%q\\\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d\"' } + - { key: 'access.log', value: '/tmp/php.access.log' } + - { key: 'slowlog', value: '/tmp/php.slow.log' } + - { key: 'request_slowlog_timeout', value: '30s' } + # PHP flags + - { key: 'php_admin_value[error_log]', value: '/tmp/php.error.log' } + - { key: 'php_admin_flag[log_errors]', value: 'on' } + +- name: Configure php-fpm (pool www.conf) + lineinfile: + dest: /etc/php-fpm.d/www.conf + regexp: '^{{ item.key }}[\s]*=' + state: absent + with_items: + # Networking + - { key: 'listen.allowed_clients' } \ No newline at end of file diff --git a/docker/main/centos-ansible/provision/roles/php/tasks/main.yml b/docker/main/centos-ansible/provision/roles/php/tasks/main.yml new file mode 100644 index 0000000..35d0963 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/php/tasks/main.yml @@ -0,0 +1,7 @@ +- include: install.yml + tags: + - bootstrap + +- include: configuration.yml + tags: + - entrypoint diff --git a/docker/main/centos-ansible/provision/roles/ssmtp/tasks/configuration.yml b/docker/main/centos-ansible/provision/roles/ssmtp/tasks/configuration.yml new file mode 100644 index 0000000..aed514f --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/ssmtp/tasks/configuration.yml @@ -0,0 +1,9 @@ +- name: Setup ssmtp + lineinfile: + dest: /etc/ssmtp/ssmtp.conf + regexp: '{{ item.regexp }}' + line: '{{ item.line }}' + with_items: + # Send buffer sizes + - { regexp: '^mailhub=', line: 'mailhub={{ DOCKER.MAIL_GATEWAY }}' } + - { regexp: '^#?FromLineOverride=', line: 'FromLineOverride=YES' } diff --git a/docker/main/centos-ansible/provision/roles/ssmtp/tasks/install.yml b/docker/main/centos-ansible/provision/roles/ssmtp/tasks/install.yml new file mode 100644 index 0000000..990d2c2 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/ssmtp/tasks/install.yml @@ -0,0 +1,6 @@ +- name: Install ssmtp + yum: + name: '{{ item }}' + state: latest + with_items: + - ssmtp diff --git a/docker/main/centos-ansible/provision/roles/ssmtp/tasks/main.yml b/docker/main/centos-ansible/provision/roles/ssmtp/tasks/main.yml new file mode 100644 index 0000000..35d0963 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/ssmtp/tasks/main.yml @@ -0,0 +1,7 @@ +- include: install.yml + tags: + - bootstrap + +- include: configuration.yml + tags: + - entrypoint diff --git a/docker/main/centos-ansible/provision/roles/supervisord/tasks/install.yml b/docker/main/centos-ansible/provision/roles/supervisord/tasks/install.yml new file mode 100644 index 0000000..8b634b7 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/supervisord/tasks/install.yml @@ -0,0 +1,12 @@ +- name: Install supervisor + yum: + name: '{{ item }}' + state: latest + with_items: + - supervisor + +- name: Create /etc/supervisord.d/supervisord.conf + file: + path: /etc/supervisord.d/supervisord.conf + state: touch + mode: 0755 \ No newline at end of file diff --git a/docker/main/centos-ansible/provision/roles/supervisord/tasks/main.yml b/docker/main/centos-ansible/provision/roles/supervisord/tasks/main.yml new file mode 100644 index 0000000..e3418cb --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/supervisord/tasks/main.yml @@ -0,0 +1,3 @@ +- include: install.yml + tags: + - bootstrap diff --git a/docker/main/centos-ansible/provision/roles/users/tasks/main.yml b/docker/main/centos-ansible/provision/roles/users/tasks/main.yml new file mode 100644 index 0000000..f421097 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/users/tasks/main.yml @@ -0,0 +1,3 @@ +- include: www-data.yml + tags: + - entrypoint diff --git a/docker/main/centos-ansible/provision/roles/users/tasks/www-data.yml b/docker/main/centos-ansible/provision/roles/users/tasks/www-data.yml new file mode 100644 index 0000000..04b1d84 --- /dev/null +++ b/docker/main/centos-ansible/provision/roles/users/tasks/www-data.yml @@ -0,0 +1,18 @@ +- group: + name: "{{ DOCKER.CLI_USER }}" + gid: "{{ DOCKER.EFFECTIVE_UID }}" + +- user: + name: "{{ DOCKER.CLI_USER }}" + uid: "{{ DOCKER.EFFECTIVE_GID }}" + group: "{{ DOCKER.CLI_USER }}" + shell: /bin/bash + home: /home + +# create a directory if it doesn't exist +- file: + path: /home/ + state: directory + mode: 0755 + owner: "{{ DOCKER.CLI_USER }}" + group: "{{ DOCKER.CLI_USER }}" \ No newline at end of file diff --git a/docker/main/centos-ansible/provision/variables.yml b/docker/main/centos-ansible/provision/variables.yml new file mode 100644 index 0000000..a163d09 --- /dev/null +++ b/docker/main/centos-ansible/provision/variables.yml @@ -0,0 +1,42 @@ +--- + +DOCKER: + # System + EFFECTIVE_UID: "{{ lookup('env','EFFECTIVE_UID') }}" + EFFECTIVE_GID: "{{ lookup('env','EFFECTIVE_GID') }}" + CLI_USER: "{{ lookup('env','CLI_USER') }}" + CLI_SCRIPT: "{{ lookup('env','CLI_SCRIPT') }}" + + # http + DOCUMENT_ROOT: "{{ lookup('env','DOCUMENT_ROOT') }}" + DOCUMENT_INDEX: "{{ lookup('env','DOCUMENT_INDEX') }}" + + + # MySQL + MYSQL_ROOT_PASSWORD: "{{ lookup('env','MYSQL_ROOT_PASSWORD') }}" + MYSQL_USER: "{{ lookup('env','MYSQL_USER') }}" + MYSQL_PASSWORD: "{{ lookup('env','MYSQL_PASSWORD') }}" + MYSQL_DATABASE: "{{ lookup('env','MYSQL_DATABASE') }}" + + # PostgreSQL + POSTGRES_USER: "{{ lookup('env','POSTGRES_USER') }}" + POSTGRES_PASSWORD: "{{ lookup('env','POSTGRES_PASSWORD') }}" + + # FTP + FTP_USER: "{{ lookup('env','FTP_USER') }}" + FTP_PASSWORD: "{{ lookup('env','FTP_PASSWORD') }}" + FTP_PATH: "{{ lookup('env','FTP_PATH') }}" + + # Mail + MAIL_GATEWAY: "{{ lookup('env','MAIL_GATEWAY') }}" + + # PHP + PHP_TIMEZONE: "{{ lookup('env','PHP_TIMEZONE') }}" + + # DNS + DNS_DOMAIN: "{{ lookup('env','DNS_DOMAIN') }}" + + # Context + TYPO3_CONTEXT: "{{ lookup('env','TYPO3_CONTEXT') }}" + FLOW_CONTEXT: "{{ lookup('env','FLOW_CONTEXT') }}" + FLOW_REWRITEURLS: "{{ lookup('env','FLOW_REWRITEURLS') }}" From 1144e5b157c649fcbfd65a806eca973b161d8602 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 17:55:37 +0200 Subject: [PATCH 12/66] Fixed dnsmasq --- docker/main/centos-ansible/bin/customization.sh | 2 -- docker/main/centos-ansible/bin/dnsmasq.sh | 8 ++------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/docker/main/centos-ansible/bin/customization.sh b/docker/main/centos-ansible/bin/customization.sh index 861b916..65cbb7f 100644 --- a/docker/main/centos-ansible/bin/customization.sh +++ b/docker/main/centos-ansible/bin/customization.sh @@ -5,6 +5,4 @@ set -o errtrace # trace ERR through 'time command' and other functions set -o nounset ## set -u : exit the script if you try to use an uninitialised variable set -o errexit ## set -e : exit the script if any statement returns a non-true return value -export DEBIAN_FRONTEND="noninteractive" - ## add your custom stuff here diff --git a/docker/main/centos-ansible/bin/dnsmasq.sh b/docker/main/centos-ansible/bin/dnsmasq.sh index 8da4dfa..1ba5a96 100644 --- a/docker/main/centos-ansible/bin/dnsmasq.sh +++ b/docker/main/centos-ansible/bin/dnsmasq.sh @@ -6,9 +6,6 @@ sleep 5 if [ ! -f "/opt/docker/.resolv.conf" ]; then ## backup original file cp /etc/resolv.conf /opt/docker/.resolv.conf - - ## Copy resolv.conf for dnsmasq (default resolver) - cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf fi ## Restore original resolvconf @@ -32,7 +29,7 @@ function dnsmasq_start() { done ## set forward servers - cat /var/run/dnsmasq/resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward + cat /opt/docker/.resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward ## (re)start dnsmasq as DNS server service dnsmasq restart @@ -40,8 +37,7 @@ function dnsmasq_start() { ## set dnsmasq to main nameserver echo "nameserver 127.0.0.1" > /etc/resolv.conf - ## wait for 10 hours - sleep 10h + dnsmasq --keep-in-foreground } ## Fetch IP from services From 0c5988793f5c0d173bbb96ac16b28ce66db9a372 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 18:11:58 +0200 Subject: [PATCH 13/66] Fixed centos header --- docker/main/centos-ansible/Dockerfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docker/main/centos-ansible/Dockerfile b/docker/main/centos-ansible/Dockerfile index 250c382..6910f7b 100644 --- a/docker/main/centos-ansible/Dockerfile +++ b/docker/main/centos-ansible/Dockerfile @@ -1,10 +1,7 @@ #+++++++++++++++++++++++++++ -# Ubuntu PHP Docker container +# Centos PHP Docker container # -# ubuntu:12.04 - PHP 5.3, LTS (precise) -# ubuntu:14.04 - PHP 5.5, LTS (trusty) -# ubuntu:15.10 - PHP 5.6 (vivid) -# ubuntu:15.10 - PHP 5.6, LTS (wily) +# centos:7 - PHP 5.4 # #+++++++++++++++++++++++++++ From 8b0c86b65a5ea12909720828d5c92cda2aa2f3eb Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 18:12:06 +0200 Subject: [PATCH 14/66] Added centos build --- docker-compose.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e2521d0..d398012 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,8 @@ main: build: docker/main/ubuntu-14.04 # PHP 5.5, LTS (trusty) #build: docker/main/ubuntu-15.04 # PHP 5.6 (vivid) #build: docker/main/ubuntu-15.10 # PHP 5.6 (wily) - #build: docker/main/ubuntu-ansible # any ubuntu version, ansible provisioning + #build: docker/main/ubuntu-ansible # dynamic ubuntu version, ansible provisioning + #build: docker/main/centos-ansible # dynamic centos version, ansible provisioning links: - mysql #- postgres From 0940cab8d29453a8812dc2728285328035dd354a Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 18:12:49 +0200 Subject: [PATCH 15/66] Renamed ubuntu-ansible to ubuntu --- docker/main/{ubuntu-ansible => ubuntu}/Dockerfile | 0 docker/main/{ubuntu-ansible => ubuntu}/bin/bootstrap.sh | 0 docker/main/{ubuntu-ansible => ubuntu}/bin/customization.sh | 0 docker/main/{ubuntu-ansible => ubuntu}/bin/dnsmasq.sh | 0 docker/main/{ubuntu-ansible => ubuntu}/bin/logwatch.sh | 0 docker/main/{ubuntu-ansible => ubuntu}/bin/provision.sh | 0 docker/main/{ubuntu-ansible => ubuntu}/conf/locale.conf | 0 docker/main/{ubuntu-ansible => ubuntu}/conf/php.ini | 0 docker/main/{ubuntu-ansible => ubuntu}/conf/supervisord.conf | 0 docker/main/{ubuntu-ansible => ubuntu}/entrypoint.sh | 0 docker/main/{ubuntu-ansible => ubuntu}/htdocs/.gitkeep | 0 docker/main/{ubuntu-ansible => ubuntu}/provision/ansible.cfg | 0 docker/main/{ubuntu-ansible => ubuntu}/provision/inventory | 0 docker/main/{ubuntu-ansible => ubuntu}/provision/playbook.yml | 0 .../provision/roles/common/tasks/main.yml | 0 .../provision/roles/common/tasks/packages.yml | 0 .../provision/roles/common/tasks/update.yml | 0 .../provision/roles/dnsmasqd/tasks/install.yml | 0 .../provision/roles/dnsmasqd/tasks/main.yml | 0 .../provision/roles/finalize/tasks/cleanup.yml | 0 .../provision/roles/finalize/tasks/main.yml | 0 .../provision/roles/locales/tasks/generate.yml | 0 .../provision/roles/locales/tasks/main.yml | 0 .../provision/roles/mysql/tasks/configuration.yml | 0 .../provision/roles/mysql/tasks/install.yml | 0 .../provision/roles/mysql/tasks/main.yml | 0 .../provision/roles/mysql/templates/my.cnf.j2 | 0 .../provision/roles/php/tasks/configuration.yml | 0 .../provision/roles/php/tasks/install.yml | 0 .../{ubuntu-ansible => ubuntu}/provision/roles/php/tasks/main.yml | 0 .../provision/roles/ssmtp/tasks/configuration.yml | 0 .../provision/roles/ssmtp/tasks/install.yml | 0 .../provision/roles/ssmtp/tasks/main.yml | 0 .../provision/roles/supervisord/tasks/install.yml | 0 .../provision/roles/supervisord/tasks/main.yml | 0 .../provision/roles/users/tasks/main.yml | 0 .../provision/roles/users/tasks/www-data.yml | 0 docker/main/{ubuntu-ansible => ubuntu}/provision/variables.yml | 0 38 files changed, 0 insertions(+), 0 deletions(-) rename docker/main/{ubuntu-ansible => ubuntu}/Dockerfile (100%) rename docker/main/{ubuntu-ansible => ubuntu}/bin/bootstrap.sh (100%) rename docker/main/{ubuntu-ansible => ubuntu}/bin/customization.sh (100%) rename docker/main/{ubuntu-ansible => ubuntu}/bin/dnsmasq.sh (100%) rename docker/main/{ubuntu-ansible => ubuntu}/bin/logwatch.sh (100%) rename docker/main/{ubuntu-ansible => ubuntu}/bin/provision.sh (100%) rename docker/main/{ubuntu-ansible => ubuntu}/conf/locale.conf (100%) rename docker/main/{ubuntu-ansible => ubuntu}/conf/php.ini (100%) rename docker/main/{ubuntu-ansible => ubuntu}/conf/supervisord.conf (100%) rename docker/main/{ubuntu-ansible => ubuntu}/entrypoint.sh (100%) rename docker/main/{ubuntu-ansible => ubuntu}/htdocs/.gitkeep (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/ansible.cfg (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/inventory (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/playbook.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/common/tasks/main.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/common/tasks/packages.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/common/tasks/update.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/dnsmasqd/tasks/install.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/dnsmasqd/tasks/main.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/finalize/tasks/cleanup.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/finalize/tasks/main.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/locales/tasks/generate.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/locales/tasks/main.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/mysql/tasks/configuration.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/mysql/tasks/install.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/mysql/tasks/main.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/mysql/templates/my.cnf.j2 (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/php/tasks/configuration.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/php/tasks/install.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/php/tasks/main.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/ssmtp/tasks/configuration.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/ssmtp/tasks/install.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/ssmtp/tasks/main.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/supervisord/tasks/install.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/supervisord/tasks/main.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/users/tasks/main.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/roles/users/tasks/www-data.yml (100%) rename docker/main/{ubuntu-ansible => ubuntu}/provision/variables.yml (100%) diff --git a/docker/main/ubuntu-ansible/Dockerfile b/docker/main/ubuntu/Dockerfile similarity index 100% rename from docker/main/ubuntu-ansible/Dockerfile rename to docker/main/ubuntu/Dockerfile diff --git a/docker/main/ubuntu-ansible/bin/bootstrap.sh b/docker/main/ubuntu/bin/bootstrap.sh similarity index 100% rename from docker/main/ubuntu-ansible/bin/bootstrap.sh rename to docker/main/ubuntu/bin/bootstrap.sh diff --git a/docker/main/ubuntu-ansible/bin/customization.sh b/docker/main/ubuntu/bin/customization.sh similarity index 100% rename from docker/main/ubuntu-ansible/bin/customization.sh rename to docker/main/ubuntu/bin/customization.sh diff --git a/docker/main/ubuntu-ansible/bin/dnsmasq.sh b/docker/main/ubuntu/bin/dnsmasq.sh similarity index 100% rename from docker/main/ubuntu-ansible/bin/dnsmasq.sh rename to docker/main/ubuntu/bin/dnsmasq.sh diff --git a/docker/main/ubuntu-ansible/bin/logwatch.sh b/docker/main/ubuntu/bin/logwatch.sh similarity index 100% rename from docker/main/ubuntu-ansible/bin/logwatch.sh rename to docker/main/ubuntu/bin/logwatch.sh diff --git a/docker/main/ubuntu-ansible/bin/provision.sh b/docker/main/ubuntu/bin/provision.sh similarity index 100% rename from docker/main/ubuntu-ansible/bin/provision.sh rename to docker/main/ubuntu/bin/provision.sh diff --git a/docker/main/ubuntu-ansible/conf/locale.conf b/docker/main/ubuntu/conf/locale.conf similarity index 100% rename from docker/main/ubuntu-ansible/conf/locale.conf rename to docker/main/ubuntu/conf/locale.conf diff --git a/docker/main/ubuntu-ansible/conf/php.ini b/docker/main/ubuntu/conf/php.ini similarity index 100% rename from docker/main/ubuntu-ansible/conf/php.ini rename to docker/main/ubuntu/conf/php.ini diff --git a/docker/main/ubuntu-ansible/conf/supervisord.conf b/docker/main/ubuntu/conf/supervisord.conf similarity index 100% rename from docker/main/ubuntu-ansible/conf/supervisord.conf rename to docker/main/ubuntu/conf/supervisord.conf diff --git a/docker/main/ubuntu-ansible/entrypoint.sh b/docker/main/ubuntu/entrypoint.sh similarity index 100% rename from docker/main/ubuntu-ansible/entrypoint.sh rename to docker/main/ubuntu/entrypoint.sh diff --git a/docker/main/ubuntu-ansible/htdocs/.gitkeep b/docker/main/ubuntu/htdocs/.gitkeep similarity index 100% rename from docker/main/ubuntu-ansible/htdocs/.gitkeep rename to docker/main/ubuntu/htdocs/.gitkeep diff --git a/docker/main/ubuntu-ansible/provision/ansible.cfg b/docker/main/ubuntu/provision/ansible.cfg similarity index 100% rename from docker/main/ubuntu-ansible/provision/ansible.cfg rename to docker/main/ubuntu/provision/ansible.cfg diff --git a/docker/main/ubuntu-ansible/provision/inventory b/docker/main/ubuntu/provision/inventory similarity index 100% rename from docker/main/ubuntu-ansible/provision/inventory rename to docker/main/ubuntu/provision/inventory diff --git a/docker/main/ubuntu-ansible/provision/playbook.yml b/docker/main/ubuntu/provision/playbook.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/playbook.yml rename to docker/main/ubuntu/provision/playbook.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/common/tasks/main.yml b/docker/main/ubuntu/provision/roles/common/tasks/main.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/common/tasks/main.yml rename to docker/main/ubuntu/provision/roles/common/tasks/main.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/common/tasks/packages.yml b/docker/main/ubuntu/provision/roles/common/tasks/packages.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/common/tasks/packages.yml rename to docker/main/ubuntu/provision/roles/common/tasks/packages.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/common/tasks/update.yml b/docker/main/ubuntu/provision/roles/common/tasks/update.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/common/tasks/update.yml rename to docker/main/ubuntu/provision/roles/common/tasks/update.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/install.yml rename to docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/main.yml b/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/main.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/dnsmasqd/tasks/main.yml rename to docker/main/ubuntu/provision/roles/dnsmasqd/tasks/main.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/finalize/tasks/cleanup.yml b/docker/main/ubuntu/provision/roles/finalize/tasks/cleanup.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/finalize/tasks/cleanup.yml rename to docker/main/ubuntu/provision/roles/finalize/tasks/cleanup.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/finalize/tasks/main.yml b/docker/main/ubuntu/provision/roles/finalize/tasks/main.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/finalize/tasks/main.yml rename to docker/main/ubuntu/provision/roles/finalize/tasks/main.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/locales/tasks/generate.yml b/docker/main/ubuntu/provision/roles/locales/tasks/generate.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/locales/tasks/generate.yml rename to docker/main/ubuntu/provision/roles/locales/tasks/generate.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/locales/tasks/main.yml b/docker/main/ubuntu/provision/roles/locales/tasks/main.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/locales/tasks/main.yml rename to docker/main/ubuntu/provision/roles/locales/tasks/main.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/configuration.yml b/docker/main/ubuntu/provision/roles/mysql/tasks/configuration.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/mysql/tasks/configuration.yml rename to docker/main/ubuntu/provision/roles/mysql/tasks/configuration.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/install.yml b/docker/main/ubuntu/provision/roles/mysql/tasks/install.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/mysql/tasks/install.yml rename to docker/main/ubuntu/provision/roles/mysql/tasks/install.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/mysql/tasks/main.yml b/docker/main/ubuntu/provision/roles/mysql/tasks/main.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/mysql/tasks/main.yml rename to docker/main/ubuntu/provision/roles/mysql/tasks/main.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/mysql/templates/my.cnf.j2 b/docker/main/ubuntu/provision/roles/mysql/templates/my.cnf.j2 similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/mysql/templates/my.cnf.j2 rename to docker/main/ubuntu/provision/roles/mysql/templates/my.cnf.j2 diff --git a/docker/main/ubuntu-ansible/provision/roles/php/tasks/configuration.yml b/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/php/tasks/configuration.yml rename to docker/main/ubuntu/provision/roles/php/tasks/configuration.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/php/tasks/install.yml b/docker/main/ubuntu/provision/roles/php/tasks/install.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/php/tasks/install.yml rename to docker/main/ubuntu/provision/roles/php/tasks/install.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/php/tasks/main.yml b/docker/main/ubuntu/provision/roles/php/tasks/main.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/php/tasks/main.yml rename to docker/main/ubuntu/provision/roles/php/tasks/main.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/configuration.yml b/docker/main/ubuntu/provision/roles/ssmtp/tasks/configuration.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/configuration.yml rename to docker/main/ubuntu/provision/roles/ssmtp/tasks/configuration.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/install.yml b/docker/main/ubuntu/provision/roles/ssmtp/tasks/install.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/install.yml rename to docker/main/ubuntu/provision/roles/ssmtp/tasks/install.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/main.yml b/docker/main/ubuntu/provision/roles/ssmtp/tasks/main.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/ssmtp/tasks/main.yml rename to docker/main/ubuntu/provision/roles/ssmtp/tasks/main.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/install.yml b/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/install.yml rename to docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/main.yml b/docker/main/ubuntu/provision/roles/supervisord/tasks/main.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/supervisord/tasks/main.yml rename to docker/main/ubuntu/provision/roles/supervisord/tasks/main.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/users/tasks/main.yml b/docker/main/ubuntu/provision/roles/users/tasks/main.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/users/tasks/main.yml rename to docker/main/ubuntu/provision/roles/users/tasks/main.yml diff --git a/docker/main/ubuntu-ansible/provision/roles/users/tasks/www-data.yml b/docker/main/ubuntu/provision/roles/users/tasks/www-data.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/roles/users/tasks/www-data.yml rename to docker/main/ubuntu/provision/roles/users/tasks/www-data.yml diff --git a/docker/main/ubuntu-ansible/provision/variables.yml b/docker/main/ubuntu/provision/variables.yml similarity index 100% rename from docker/main/ubuntu-ansible/provision/variables.yml rename to docker/main/ubuntu/provision/variables.yml From 797615fd47f949b5852d94d77f1c988d0f29a067 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 18:13:08 +0200 Subject: [PATCH 16/66] Renamed centos-ansible to centos --- docker/main/{centos-ansible => centos}/Dockerfile | 0 docker/main/{centos-ansible => centos}/bin/bootstrap.sh | 0 docker/main/{centos-ansible => centos}/bin/customization.sh | 0 docker/main/{centos-ansible => centos}/bin/dnsmasq.sh | 0 docker/main/{centos-ansible => centos}/bin/logwatch.sh | 0 docker/main/{centos-ansible => centos}/bin/provision.sh | 0 docker/main/{centos-ansible => centos}/conf/locale.conf | 0 docker/main/{centos-ansible => centos}/conf/php.ini | 0 docker/main/{centos-ansible => centos}/conf/supervisord.conf | 0 docker/main/{centos-ansible => centos}/entrypoint.sh | 0 docker/main/{centos-ansible => centos}/htdocs/.gitkeep | 0 docker/main/{centos-ansible => centos}/provision/ansible.cfg | 0 docker/main/{centos-ansible => centos}/provision/inventory | 0 docker/main/{centos-ansible => centos}/provision/playbook.yml | 0 .../provision/roles/common/tasks/main.yml | 0 .../provision/roles/common/tasks/packages.yml | 0 .../provision/roles/common/tasks/update.yml | 0 .../provision/roles/dnsmasqd/tasks/install.yml | 0 .../provision/roles/dnsmasqd/tasks/main.yml | 0 .../provision/roles/finalize/tasks/cleanup.yml | 0 .../provision/roles/finalize/tasks/main.yml | 0 .../provision/roles/mysql/tasks/configuration.yml | 0 .../provision/roles/mysql/tasks/install.yml | 0 .../provision/roles/mysql/tasks/main.yml | 0 .../provision/roles/mysql/templates/my.cnf.j2 | 0 .../provision/roles/php/tasks/configuration.yml | 0 .../provision/roles/php/tasks/install.yml | 0 .../{centos-ansible => centos}/provision/roles/php/tasks/main.yml | 0 .../provision/roles/ssmtp/tasks/configuration.yml | 0 .../provision/roles/ssmtp/tasks/install.yml | 0 .../provision/roles/ssmtp/tasks/main.yml | 0 .../provision/roles/supervisord/tasks/install.yml | 0 .../provision/roles/supervisord/tasks/main.yml | 0 .../provision/roles/users/tasks/main.yml | 0 .../provision/roles/users/tasks/www-data.yml | 0 docker/main/{centos-ansible => centos}/provision/variables.yml | 0 36 files changed, 0 insertions(+), 0 deletions(-) rename docker/main/{centos-ansible => centos}/Dockerfile (100%) rename docker/main/{centos-ansible => centos}/bin/bootstrap.sh (100%) rename docker/main/{centos-ansible => centos}/bin/customization.sh (100%) rename docker/main/{centos-ansible => centos}/bin/dnsmasq.sh (100%) rename docker/main/{centos-ansible => centos}/bin/logwatch.sh (100%) rename docker/main/{centos-ansible => centos}/bin/provision.sh (100%) rename docker/main/{centos-ansible => centos}/conf/locale.conf (100%) rename docker/main/{centos-ansible => centos}/conf/php.ini (100%) rename docker/main/{centos-ansible => centos}/conf/supervisord.conf (100%) rename docker/main/{centos-ansible => centos}/entrypoint.sh (100%) rename docker/main/{centos-ansible => centos}/htdocs/.gitkeep (100%) rename docker/main/{centos-ansible => centos}/provision/ansible.cfg (100%) rename docker/main/{centos-ansible => centos}/provision/inventory (100%) rename docker/main/{centos-ansible => centos}/provision/playbook.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/common/tasks/main.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/common/tasks/packages.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/common/tasks/update.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/dnsmasqd/tasks/install.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/dnsmasqd/tasks/main.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/finalize/tasks/cleanup.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/finalize/tasks/main.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/mysql/tasks/configuration.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/mysql/tasks/install.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/mysql/tasks/main.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/mysql/templates/my.cnf.j2 (100%) rename docker/main/{centos-ansible => centos}/provision/roles/php/tasks/configuration.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/php/tasks/install.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/php/tasks/main.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/ssmtp/tasks/configuration.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/ssmtp/tasks/install.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/ssmtp/tasks/main.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/supervisord/tasks/install.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/supervisord/tasks/main.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/users/tasks/main.yml (100%) rename docker/main/{centos-ansible => centos}/provision/roles/users/tasks/www-data.yml (100%) rename docker/main/{centos-ansible => centos}/provision/variables.yml (100%) diff --git a/docker/main/centos-ansible/Dockerfile b/docker/main/centos/Dockerfile similarity index 100% rename from docker/main/centos-ansible/Dockerfile rename to docker/main/centos/Dockerfile diff --git a/docker/main/centos-ansible/bin/bootstrap.sh b/docker/main/centos/bin/bootstrap.sh similarity index 100% rename from docker/main/centos-ansible/bin/bootstrap.sh rename to docker/main/centos/bin/bootstrap.sh diff --git a/docker/main/centos-ansible/bin/customization.sh b/docker/main/centos/bin/customization.sh similarity index 100% rename from docker/main/centos-ansible/bin/customization.sh rename to docker/main/centos/bin/customization.sh diff --git a/docker/main/centos-ansible/bin/dnsmasq.sh b/docker/main/centos/bin/dnsmasq.sh similarity index 100% rename from docker/main/centos-ansible/bin/dnsmasq.sh rename to docker/main/centos/bin/dnsmasq.sh diff --git a/docker/main/centos-ansible/bin/logwatch.sh b/docker/main/centos/bin/logwatch.sh similarity index 100% rename from docker/main/centos-ansible/bin/logwatch.sh rename to docker/main/centos/bin/logwatch.sh diff --git a/docker/main/centos-ansible/bin/provision.sh b/docker/main/centos/bin/provision.sh similarity index 100% rename from docker/main/centos-ansible/bin/provision.sh rename to docker/main/centos/bin/provision.sh diff --git a/docker/main/centos-ansible/conf/locale.conf b/docker/main/centos/conf/locale.conf similarity index 100% rename from docker/main/centos-ansible/conf/locale.conf rename to docker/main/centos/conf/locale.conf diff --git a/docker/main/centos-ansible/conf/php.ini b/docker/main/centos/conf/php.ini similarity index 100% rename from docker/main/centos-ansible/conf/php.ini rename to docker/main/centos/conf/php.ini diff --git a/docker/main/centos-ansible/conf/supervisord.conf b/docker/main/centos/conf/supervisord.conf similarity index 100% rename from docker/main/centos-ansible/conf/supervisord.conf rename to docker/main/centos/conf/supervisord.conf diff --git a/docker/main/centos-ansible/entrypoint.sh b/docker/main/centos/entrypoint.sh similarity index 100% rename from docker/main/centos-ansible/entrypoint.sh rename to docker/main/centos/entrypoint.sh diff --git a/docker/main/centos-ansible/htdocs/.gitkeep b/docker/main/centos/htdocs/.gitkeep similarity index 100% rename from docker/main/centos-ansible/htdocs/.gitkeep rename to docker/main/centos/htdocs/.gitkeep diff --git a/docker/main/centos-ansible/provision/ansible.cfg b/docker/main/centos/provision/ansible.cfg similarity index 100% rename from docker/main/centos-ansible/provision/ansible.cfg rename to docker/main/centos/provision/ansible.cfg diff --git a/docker/main/centos-ansible/provision/inventory b/docker/main/centos/provision/inventory similarity index 100% rename from docker/main/centos-ansible/provision/inventory rename to docker/main/centos/provision/inventory diff --git a/docker/main/centos-ansible/provision/playbook.yml b/docker/main/centos/provision/playbook.yml similarity index 100% rename from docker/main/centos-ansible/provision/playbook.yml rename to docker/main/centos/provision/playbook.yml diff --git a/docker/main/centos-ansible/provision/roles/common/tasks/main.yml b/docker/main/centos/provision/roles/common/tasks/main.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/common/tasks/main.yml rename to docker/main/centos/provision/roles/common/tasks/main.yml diff --git a/docker/main/centos-ansible/provision/roles/common/tasks/packages.yml b/docker/main/centos/provision/roles/common/tasks/packages.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/common/tasks/packages.yml rename to docker/main/centos/provision/roles/common/tasks/packages.yml diff --git a/docker/main/centos-ansible/provision/roles/common/tasks/update.yml b/docker/main/centos/provision/roles/common/tasks/update.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/common/tasks/update.yml rename to docker/main/centos/provision/roles/common/tasks/update.yml diff --git a/docker/main/centos-ansible/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/dnsmasqd/tasks/install.yml rename to docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml diff --git a/docker/main/centos-ansible/provision/roles/dnsmasqd/tasks/main.yml b/docker/main/centos/provision/roles/dnsmasqd/tasks/main.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/dnsmasqd/tasks/main.yml rename to docker/main/centos/provision/roles/dnsmasqd/tasks/main.yml diff --git a/docker/main/centos-ansible/provision/roles/finalize/tasks/cleanup.yml b/docker/main/centos/provision/roles/finalize/tasks/cleanup.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/finalize/tasks/cleanup.yml rename to docker/main/centos/provision/roles/finalize/tasks/cleanup.yml diff --git a/docker/main/centos-ansible/provision/roles/finalize/tasks/main.yml b/docker/main/centos/provision/roles/finalize/tasks/main.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/finalize/tasks/main.yml rename to docker/main/centos/provision/roles/finalize/tasks/main.yml diff --git a/docker/main/centos-ansible/provision/roles/mysql/tasks/configuration.yml b/docker/main/centos/provision/roles/mysql/tasks/configuration.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/mysql/tasks/configuration.yml rename to docker/main/centos/provision/roles/mysql/tasks/configuration.yml diff --git a/docker/main/centos-ansible/provision/roles/mysql/tasks/install.yml b/docker/main/centos/provision/roles/mysql/tasks/install.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/mysql/tasks/install.yml rename to docker/main/centos/provision/roles/mysql/tasks/install.yml diff --git a/docker/main/centos-ansible/provision/roles/mysql/tasks/main.yml b/docker/main/centos/provision/roles/mysql/tasks/main.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/mysql/tasks/main.yml rename to docker/main/centos/provision/roles/mysql/tasks/main.yml diff --git a/docker/main/centos-ansible/provision/roles/mysql/templates/my.cnf.j2 b/docker/main/centos/provision/roles/mysql/templates/my.cnf.j2 similarity index 100% rename from docker/main/centos-ansible/provision/roles/mysql/templates/my.cnf.j2 rename to docker/main/centos/provision/roles/mysql/templates/my.cnf.j2 diff --git a/docker/main/centos-ansible/provision/roles/php/tasks/configuration.yml b/docker/main/centos/provision/roles/php/tasks/configuration.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/php/tasks/configuration.yml rename to docker/main/centos/provision/roles/php/tasks/configuration.yml diff --git a/docker/main/centos-ansible/provision/roles/php/tasks/install.yml b/docker/main/centos/provision/roles/php/tasks/install.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/php/tasks/install.yml rename to docker/main/centos/provision/roles/php/tasks/install.yml diff --git a/docker/main/centos-ansible/provision/roles/php/tasks/main.yml b/docker/main/centos/provision/roles/php/tasks/main.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/php/tasks/main.yml rename to docker/main/centos/provision/roles/php/tasks/main.yml diff --git a/docker/main/centos-ansible/provision/roles/ssmtp/tasks/configuration.yml b/docker/main/centos/provision/roles/ssmtp/tasks/configuration.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/ssmtp/tasks/configuration.yml rename to docker/main/centos/provision/roles/ssmtp/tasks/configuration.yml diff --git a/docker/main/centos-ansible/provision/roles/ssmtp/tasks/install.yml b/docker/main/centos/provision/roles/ssmtp/tasks/install.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/ssmtp/tasks/install.yml rename to docker/main/centos/provision/roles/ssmtp/tasks/install.yml diff --git a/docker/main/centos-ansible/provision/roles/ssmtp/tasks/main.yml b/docker/main/centos/provision/roles/ssmtp/tasks/main.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/ssmtp/tasks/main.yml rename to docker/main/centos/provision/roles/ssmtp/tasks/main.yml diff --git a/docker/main/centos-ansible/provision/roles/supervisord/tasks/install.yml b/docker/main/centos/provision/roles/supervisord/tasks/install.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/supervisord/tasks/install.yml rename to docker/main/centos/provision/roles/supervisord/tasks/install.yml diff --git a/docker/main/centos-ansible/provision/roles/supervisord/tasks/main.yml b/docker/main/centos/provision/roles/supervisord/tasks/main.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/supervisord/tasks/main.yml rename to docker/main/centos/provision/roles/supervisord/tasks/main.yml diff --git a/docker/main/centos-ansible/provision/roles/users/tasks/main.yml b/docker/main/centos/provision/roles/users/tasks/main.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/users/tasks/main.yml rename to docker/main/centos/provision/roles/users/tasks/main.yml diff --git a/docker/main/centos-ansible/provision/roles/users/tasks/www-data.yml b/docker/main/centos/provision/roles/users/tasks/www-data.yml similarity index 100% rename from docker/main/centos-ansible/provision/roles/users/tasks/www-data.yml rename to docker/main/centos/provision/roles/users/tasks/www-data.yml diff --git a/docker/main/centos-ansible/provision/variables.yml b/docker/main/centos/provision/variables.yml similarity index 100% rename from docker/main/centos-ansible/provision/variables.yml rename to docker/main/centos/provision/variables.yml From f4d740bbccb045259960b879ddd4abfe011997a7 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 18:13:30 +0200 Subject: [PATCH 17/66] Fixed main naming (remove ansible suffix) --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d398012..0e91de7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,8 +6,8 @@ main: build: docker/main/ubuntu-14.04 # PHP 5.5, LTS (trusty) #build: docker/main/ubuntu-15.04 # PHP 5.6 (vivid) #build: docker/main/ubuntu-15.10 # PHP 5.6 (wily) - #build: docker/main/ubuntu-ansible # dynamic ubuntu version, ansible provisioning - #build: docker/main/centos-ansible # dynamic centos version, ansible provisioning + #build: docker/main/ubuntu # dynamic ubuntu version (ansible provisioning) + #build: docker/main/centos # dynamic centos version (ansible provisioning) links: - mysql #- postgres From 3a5bed908c8e98fe770ee8da8f1fc717507f539e Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 19:16:49 +0200 Subject: [PATCH 18/66] Fixed documentation --- documentation/CUSTOMIZE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/CUSTOMIZE.md b/documentation/CUSTOMIZE.md index c07da60..e7b7344 100644 --- a/documentation/CUSTOMIZE.md +++ b/documentation/CUSTOMIZE.md @@ -4,12 +4,12 @@ ## Custom packages (`main` controller) -You can add custom shell commands in `docker/main/bin/customization.sh` +You can add custom shell commands in `docker/main/{DISTRIBUTION}/bin/customization.sh` ## Custom php.ini directives -Modify the `docker/main/conf/php.ini`, it will be added on top of the default php.ini so +Modify the `docker/main/{DISTRIBUTION}/conf/php.ini`, it will be added on top of the default php.ini so you can overwrite any directives. After modification rebuild your `main` container: From 28c8413705f3492772baa774a14fbc0051197a76 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 19:17:02 +0200 Subject: [PATCH 19/66] Updated docker image info --- documentation/DOCKER-INFO.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/documentation/DOCKER-INFO.md b/documentation/DOCKER-INFO.md index 566936d..304f4c8 100644 --- a/documentation/DOCKER-INFO.md +++ b/documentation/DOCKER-INFO.md @@ -23,7 +23,8 @@ This directory will be mounted under `/docker` in `main` and `web` container. ## Docker images Container | Source ------------------------- | ------------------------------- -main | [Ubuntu](https://registry.hub.docker.com/_/ubuntu/) *official* +main/ubuntu | [Ubuntu](https://registry.hub.docker.com/_/ubuntu/) *official* +main/centos | [CentOS](https://registry.hub.docker.com/_/centos/) *official* storage | [Ubuntu](https://registry.hub.docker.com/_/ubuntu/) *official* web | [Apache](https://registry.hub.docker.com/_/httpd/) *official* or [Nginx](https://registry.hub.docker.com/_/nginx/) *official* mysql | [MySQL](https://registry.hub.docker.com/_/mysql/) *official* From baab9b16ce61af1bdce89b370d4ae36f251e7118 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 20:01:16 +0200 Subject: [PATCH 20/66] Fixed possible docker copy issue --- docker/main/ubuntu/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/main/ubuntu/Dockerfile b/docker/main/ubuntu/Dockerfile index 1e849d8..788dc02 100644 --- a/docker/main/ubuntu/Dockerfile +++ b/docker/main/ubuntu/Dockerfile @@ -24,7 +24,7 @@ COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh COPY bin/provision.sh /opt/docker/bin/provision.sh COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh -COPY provision/* /opt/docker/provision/ +COPY provision /opt/docker/provision/ RUN bash /opt/docker/bin/bootstrap.sh RUN bash /opt/docker/bin/provision.sh bootstrap From a8e4617185f22492afb3c03aa0c021e5277f4aa4 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 20:05:21 +0200 Subject: [PATCH 21/66] Fixed dnsmasq script --- docker/main/centos/bin/dnsmasq.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/docker/main/centos/bin/dnsmasq.sh b/docker/main/centos/bin/dnsmasq.sh index 1ba5a96..67ee59f 100644 --- a/docker/main/centos/bin/dnsmasq.sh +++ b/docker/main/centos/bin/dnsmasq.sh @@ -31,9 +31,6 @@ function dnsmasq_start() { ## set forward servers cat /opt/docker/.resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward - ## (re)start dnsmasq as DNS server - service dnsmasq restart - ## set dnsmasq to main nameserver echo "nameserver 127.0.0.1" > /etc/resolv.conf From 05e6b282f5f5938a3f5b2be483b6968167b298a7 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 20:20:56 +0200 Subject: [PATCH 22/66] Fixed style # Conflicts: # docker/main/centos/provision/roles/php/tasks/configuration.yml # docker/main/ubuntu/provision/roles/php/tasks/configuration.yml --- .../provision/roles/php/tasks/configuration.yml | 6 +++--- .../main/centos/provision/roles/php/tasks/install.yml | 4 ++-- .../provision/roles/php/tasks/configuration.yml | 8 ++++---- .../main/ubuntu/provision/roles/php/tasks/install.yml | 11 ++++++++++- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/docker/main/centos/provision/roles/php/tasks/configuration.yml b/docker/main/centos/provision/roles/php/tasks/configuration.yml index b33cb4e..404f90f 100644 --- a/docker/main/centos/provision/roles/php/tasks/configuration.yml +++ b/docker/main/centos/provision/roles/php/tasks/configuration.yml @@ -5,8 +5,8 @@ line: '{{ item.key }} = {{ item.value }}' with_items: # User - - { key: 'user', value: '{{ DOCKER.CLI_USER }}' } - - { key: 'group', value: '{{ DOCKER.CLI_USER }}' } + - { key: 'user', value: '{{ DOCKER.CLI_USER }}' } + - { key: 'group', value: '{{ DOCKER.CLI_USER }}' } # Env - { key: 'env[TYPO3_CONTEXT]', value: '{{ DOCKER.TYPO3_CONTEXT }}' } - { key: 'env[FLOW_CONTEXT]', value: '{{ DOCKER.FLOW_CONTEXT }}' } @@ -18,7 +18,7 @@ regexp: '{{ item.regexp }}' line: '{{ item.line }}' with_items: - - { regexp: '^date.timezone', line: 'date.timezone={{ DOCKER.PHP_TIMEZONE }}' } + - { regexp: '^date.timezone', line: 'date.timezone={{ DOCKER.PHP_TIMEZONE }}' } - name: Truncate log files command: 'cp /dev/null {{ item }}' diff --git a/docker/main/centos/provision/roles/php/tasks/install.yml b/docker/main/centos/provision/roles/php/tasks/install.yml index 5181fd2..0a81d73 100644 --- a/docker/main/centos/provision/roles/php/tasks/install.yml +++ b/docker/main/centos/provision/roles/php/tasks/install.yml @@ -45,8 +45,8 @@ line: '{{ item.key }} = {{ item.value }}' with_items: # Networking - - { key: 'listen', value: '0.0.0.0:9000' } - - { key: 'listen.allowed_clients', value: '' } + - { key: 'listen', value: '0.0.0.0:9000' } + - { key: 'listen.allowed_clients', value: '' } # Process manager - { key: 'pm.max_children', value: '15' } - { key: 'pm.start_servers', value: '2' } diff --git a/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml b/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml index 0fd3bfe..1775fc6 100644 --- a/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml +++ b/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml @@ -5,9 +5,9 @@ line: '{{ item.key }} = {{ item.value }}' with_items: # Env - - { key: 'env[TYPO3_CONTEXT]', value: '{{ DOCKER.TYPO3_CONTEXT }}' } - - { key: 'env[FLOW_CONTEXT]', value: '{{ DOCKER.FLOW_CONTEXT }}' } - - { key: 'env[FLOW_REWRITEURLS]', value: '{{ DOCKER.FLOW_REWRITEURLS }}' } + - { key: 'env[TYPO3_CONTEXT]', value: '{{ DOCKER.TYPO3_CONTEXT }}' } + - { key: 'env[FLOW_CONTEXT]', value: '{{ DOCKER.FLOW_CONTEXT }}' } + - { key: 'env[FLOW_REWRITEURLS]', value: '{{ DOCKER.FLOW_REWRITEURLS }}' } - name: Configure php (docker-boilerplate.ini) lineinfile: @@ -15,7 +15,7 @@ regexp: '{{ item.regexp }}' line: '{{ item.line }}' with_items: - - { regexp: '^date.timezone', line: 'date.timezone={{ DOCKER.PHP_TIMEZONE }}' } + - { regexp: '^date.timezone', line: 'date.timezone={{ DOCKER.PHP_TIMEZONE }}' } - name: Truncate log files command: 'cp /dev/null {{ item }}' diff --git a/docker/main/ubuntu/provision/roles/php/tasks/install.yml b/docker/main/ubuntu/provision/roles/php/tasks/install.yml index b48432e..b060700 100644 --- a/docker/main/ubuntu/provision/roles/php/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/php/tasks/install.yml @@ -63,7 +63,7 @@ line: '{{ item.key }} = {{ item.value }}' with_items: # Networking - - { key: 'listen', value: '0.0.0.0:9000' } + - { key: 'listen', value: '0.0.0.0:9000' } # Process manager - { key: 'pm.max_children', value: '15' } - { key: 'pm.start_servers', value: '2' } @@ -78,3 +78,12 @@ # PHP flags - { key: 'php_admin_value[error_log]', value: '/tmp/php.error.log' } - { key: 'php_admin_flag[log_errors]', value: 'on' } + +- name: Configure php-fpm (pool www.conf) + lineinfile: + dest: /etc/php-fpm.d/www.conf + regexp: '^{{ item.key }}[\s]*=' + state: absent + with_items: + # Networking + - { key: 'listen.allowed_clients' } \ No newline at end of file From 0831e481e24f285b7d772c015db3091fb3d2550e Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 22:05:12 +0200 Subject: [PATCH 23/66] Improved docker main container Fixed some issues, Improved whole layout --- docker/main/centos/Dockerfile | 3 +-- docker/main/centos/entrypoint.sh | 2 +- .../centos/provision/roles/common/tasks/packages.yml | 1 + .../provision/roles/php/tasks/configuration.yml | 2 +- .../main/centos/provision/roles/php/tasks/install.yml | 11 +++++++++-- .../provision/roles/supervisord/tasks/install.yml | 6 ------ docker/main/ubuntu/Dockerfile | 3 +-- docker/main/ubuntu/entrypoint.sh | 2 +- .../main/ubuntu/provision/roles/php/tasks/install.yml | 9 ++------- .../provision/roles/supervisord/tasks/install.yml | 6 ------ 10 files changed, 17 insertions(+), 28 deletions(-) diff --git a/docker/main/centos/Dockerfile b/docker/main/centos/Dockerfile index 6910f7b..a13c3c4 100644 --- a/docker/main/centos/Dockerfile +++ b/docker/main/centos/Dockerfile @@ -37,8 +37,7 @@ RUN bash /opt/docker/bin/customization.sh ## COPY entrypoint.sh /entrypoint.sh -COPY conf/supervisord.conf /etc/supervisord.d/supervisord.ini -COPY conf/php.ini /etc/php.d/zzz-docker-boilerplate.ini +COPY conf /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/centos/entrypoint.sh b/docker/main/centos/entrypoint.sh index 0f68e2f..8c0a3fe 100755 --- a/docker/main/centos/entrypoint.sh +++ b/docker/main/centos/entrypoint.sh @@ -19,7 +19,7 @@ case "$1" in echo "${ETH0_IP} main main_1" > /data/dns/main.hosts ## Start services - exec supervisord + exec supervisord -c /opt/docker/conf/supervisord.conf ;; ## Root shell diff --git a/docker/main/centos/provision/roles/common/tasks/packages.yml b/docker/main/centos/provision/roles/common/tasks/packages.yml index 2eeb774..9d15228 100644 --- a/docker/main/centos/provision/roles/common/tasks/packages.yml +++ b/docker/main/centos/provision/roles/common/tasks/packages.yml @@ -14,6 +14,7 @@ # Networking tools - wget - curl + - net-tools # Utils - moreutils - bind-utils \ No newline at end of file diff --git a/docker/main/centos/provision/roles/php/tasks/configuration.yml b/docker/main/centos/provision/roles/php/tasks/configuration.yml index 404f90f..953082c 100644 --- a/docker/main/centos/provision/roles/php/tasks/configuration.yml +++ b/docker/main/centos/provision/roles/php/tasks/configuration.yml @@ -14,7 +14,7 @@ - name: Configure php (docker-boilerplate.ini) lineinfile: - dest: /etc/php.d/zzz-docker-boilerplate.ini + dest: /opt/docker/conf/php.ini regexp: '{{ item.regexp }}' line: '{{ item.line }}' with_items: diff --git a/docker/main/centos/provision/roles/php/tasks/install.yml b/docker/main/centos/provision/roles/php/tasks/install.yml index 0a81d73..b975d2e 100644 --- a/docker/main/centos/provision/roles/php/tasks/install.yml +++ b/docker/main/centos/provision/roles/php/tasks/install.yml @@ -54,7 +54,7 @@ - { key: 'pm.max_spare_servers', value: '3' } - { key: 'catch_workers_output', value: 'yes' } # Logs - - { key: 'access.format', value: '\"%R - %u %t \\\"%m %r%Q%q\\\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d\"' } + - { key: 'access.format', value: '"%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' } - { key: 'access.log', value: '/tmp/php.access.log' } - { key: 'slowlog', value: '/tmp/php.slow.log' } - { key: 'request_slowlog_timeout', value: '30s' } @@ -69,4 +69,11 @@ state: absent with_items: # Networking - - { key: 'listen.allowed_clients' } \ No newline at end of file + - { key: 'listen.allowed_clients' } + +- name: Create link for additional php.ini + file: + src: '/opt/docker/conf/php.ini' + dest: '/etc/php.d/zzz-docker-boilerplate.ini' + state: link + force: yes diff --git a/docker/main/centos/provision/roles/supervisord/tasks/install.yml b/docker/main/centos/provision/roles/supervisord/tasks/install.yml index 8b634b7..5e38b5f 100644 --- a/docker/main/centos/provision/roles/supervisord/tasks/install.yml +++ b/docker/main/centos/provision/roles/supervisord/tasks/install.yml @@ -4,9 +4,3 @@ state: latest with_items: - supervisor - -- name: Create /etc/supervisord.d/supervisord.conf - file: - path: /etc/supervisord.d/supervisord.conf - state: touch - mode: 0755 \ No newline at end of file diff --git a/docker/main/ubuntu/Dockerfile b/docker/main/ubuntu/Dockerfile index 788dc02..247ac43 100644 --- a/docker/main/ubuntu/Dockerfile +++ b/docker/main/ubuntu/Dockerfile @@ -41,8 +41,7 @@ RUN bash /opt/docker/bin/customization.sh ## COPY entrypoint.sh /entrypoint.sh -COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY conf/php.ini /etc/php5/mods-available/docker-boilerplate.ini +COPY conf /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/ubuntu/entrypoint.sh b/docker/main/ubuntu/entrypoint.sh index 0f68e2f..8c0a3fe 100755 --- a/docker/main/ubuntu/entrypoint.sh +++ b/docker/main/ubuntu/entrypoint.sh @@ -19,7 +19,7 @@ case "$1" in echo "${ETH0_IP} main main_1" > /data/dns/main.hosts ## Start services - exec supervisord + exec supervisord -c /opt/docker/conf/supervisord.conf ;; ## Root shell diff --git a/docker/main/ubuntu/provision/roles/php/tasks/install.yml b/docker/main/ubuntu/provision/roles/php/tasks/install.yml index b060700..6b90c6b 100644 --- a/docker/main/ubuntu/provision/roles/php/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/php/tasks/install.yml @@ -28,18 +28,13 @@ state: directory mode: 0755 -- name: Create /etc/php5/mods-available/docker-boilerplate.ini - file: - path: /etc/php5/mods-available/docker-boilerplate.ini - state: touch - mode: 0755 - - name: Activate php config files (fpm) file: src: '/etc/php5/mods-available/{{ item.file }}' dest: '/etc/php5/{{ item.category }}/conf.d/{{ item.order }}-{{ item.file }}' force: yes state: link + with_items: # PHP cli - { category: 'cli', file: 'mcrypt.ini', order: '20' } @@ -71,7 +66,7 @@ - { key: 'pm.max_spare_servers', value: '3' } - { key: 'catch_workers_output', value: 'yes' } # Logs - - { key: 'access.format', value: '\"%R - %u %t \\\"%m %r%Q%q\\\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d\"' } + - { key: 'access.format', value: '"%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' } - { key: 'access.log', value: '/tmp/php.access.log' } - { key: 'slowlog', value: '/tmp/php.slow.log' } - { key: 'request_slowlog_timeout', value: '30s' } diff --git a/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml b/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml index f06be2e..4d28817 100644 --- a/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml @@ -4,9 +4,3 @@ state: latest with_items: - supervisor - -- name: Create /etc/supervisor/conf.d/supervisord.conf - file: - path: /etc/supervisor/conf.d/supervisord.conf - state: touch - mode: 0755 \ No newline at end of file From 51cdd3926a9929d180c00d59dced498c7916fd52 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 23:06:36 +0200 Subject: [PATCH 24/66] Fixed provision issues # Conflicts: # docker/main/ubuntu/provision/roles/php/tasks/configuration.yml --- .../provision/roles/dnsmasqd/tasks/install.yml | 8 ++++---- .../provision/roles/php/tasks/configuration.yml | 8 ++++---- .../provision/roles/ssmtp/tasks/configuration.yml | 9 ++++----- .../provision/roles/dnsmasqd/tasks/install.yml | 8 ++++---- .../provision/roles/php/tasks/configuration.yml | 10 +++++----- .../ubuntu/provision/roles/php/tasks/install.yml | 13 ++++++------- .../provision/roles/ssmtp/tasks/configuration.yml | 9 ++++----- 7 files changed, 31 insertions(+), 34 deletions(-) diff --git a/docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml index c612b91..cf1d145 100644 --- a/docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml +++ b/docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml @@ -8,9 +8,9 @@ - name: Configure dnsmasq lineinfile: dest: /etc/dnsmasq.conf - regexp: '{{ item.regexp }}' - line: '{{ item.line }}' + regexp: '^[\s]*{{ item.key }}[\s]*=' + line: '{{ item.key }}={{ item.value }}' with_items: - - { regexp: '^user[\s]*=', line: 'user=root' } - - { regexp: '^conf-dir[\s]*=', line: 'conf-dir=/etc/dnsmasq.d' } + - { key: 'user', value: 'root' } + - { key: 'conf-dir', value: '/etc/dnsmasq.d' } diff --git a/docker/main/centos/provision/roles/php/tasks/configuration.yml b/docker/main/centos/provision/roles/php/tasks/configuration.yml index 953082c..183bce6 100644 --- a/docker/main/centos/provision/roles/php/tasks/configuration.yml +++ b/docker/main/centos/provision/roles/php/tasks/configuration.yml @@ -12,13 +12,13 @@ - { key: 'env[FLOW_CONTEXT]', value: '{{ DOCKER.FLOW_CONTEXT }}' } - { key: 'env[FLOW_REWRITEURLS]', value: '{{ DOCKER.FLOW_REWRITEURLS }}' } -- name: Configure php (docker-boilerplate.ini) +- name: Configure php (docker php.ini) lineinfile: dest: /opt/docker/conf/php.ini - regexp: '{{ item.regexp }}' - line: '{{ item.line }}' + regexp: '^{{ item.key }}[\s]*=' + line: '{{ item.key }} = {{ item.value }}' with_items: - - { regexp: '^date.timezone', line: 'date.timezone={{ DOCKER.PHP_TIMEZONE }}' } + - { key: 'date.timezone', value: '{{ DOCKER.PHP_TIMEZONE }}' } - name: Truncate log files command: 'cp /dev/null {{ item }}' diff --git a/docker/main/centos/provision/roles/ssmtp/tasks/configuration.yml b/docker/main/centos/provision/roles/ssmtp/tasks/configuration.yml index aed514f..44e39b8 100644 --- a/docker/main/centos/provision/roles/ssmtp/tasks/configuration.yml +++ b/docker/main/centos/provision/roles/ssmtp/tasks/configuration.yml @@ -1,9 +1,8 @@ - name: Setup ssmtp lineinfile: dest: /etc/ssmtp/ssmtp.conf - regexp: '{{ item.regexp }}' - line: '{{ item.line }}' + regexp: '^[\s]*{{ item.key }}[\s]*=' + line: '{{ item.key }}={{ item.value }}' with_items: - # Send buffer sizes - - { regexp: '^mailhub=', line: 'mailhub={{ DOCKER.MAIL_GATEWAY }}' } - - { regexp: '^#?FromLineOverride=', line: 'FromLineOverride=YES' } + - { key: 'mailhub', value: '{{ DOCKER.MAIL_GATEWAY }}' } + - { key: 'FromLineOverride', value: 'YES' } diff --git a/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml index f66d6d3..4575fba 100644 --- a/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml @@ -8,9 +8,9 @@ - name: Configure dnsmasq lineinfile: dest: /etc/dnsmasq.conf - regexp: '{{ item.regexp }}' - line: '{{ item.line }}' + regexp: '^[\s]*{{ item.key }}[\s]*=' + line: '{{ item.key }}={{ item.value }}' with_items: - - { regexp: '^user[\s]*=', line: 'user=root' } - - { regexp: '^conf-dir[\s]*=', line: 'conf-dir=/etc/dnsmasq.d' } + - { key: 'user', value: 'root' } + - { key: 'conf-dir', value: '/etc/dnsmasq.d' } diff --git a/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml b/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml index 1775fc6..ec2dbc3 100644 --- a/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml +++ b/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml @@ -9,13 +9,13 @@ - { key: 'env[FLOW_CONTEXT]', value: '{{ DOCKER.FLOW_CONTEXT }}' } - { key: 'env[FLOW_REWRITEURLS]', value: '{{ DOCKER.FLOW_REWRITEURLS }}' } -- name: Configure php (docker-boilerplate.ini) +- name: Configure php (docker php.ini) lineinfile: - dest: /etc/php5/mods-available/docker-boilerplate.ini - regexp: '{{ item.regexp }}' - line: '{{ item.line }}' + dest: /opt/docker/conf/php.ini + regexp: '^{{ item.key }}[\s]*=' + line: '{{ item.key }} = {{ item.value }}' with_items: - - { regexp: '^date.timezone', line: 'date.timezone={{ DOCKER.PHP_TIMEZONE }}' } + - { key: 'date.timezone', value: '{{ DOCKER.PHP_TIMEZONE }}' } - name: Truncate log files command: 'cp /dev/null {{ item }}' diff --git a/docker/main/ubuntu/provision/roles/php/tasks/install.yml b/docker/main/ubuntu/provision/roles/php/tasks/install.yml index 6b90c6b..5532af5 100644 --- a/docker/main/ubuntu/provision/roles/php/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/php/tasks/install.yml @@ -30,18 +30,17 @@ - name: Activate php config files (fpm) file: - src: '/etc/php5/mods-available/{{ item.file }}' - dest: '/etc/php5/{{ item.category }}/conf.d/{{ item.order }}-{{ item.file }}' + src: '{{ item.file }}' + dest: '/etc/php5/{{ item.category }}/conf.d/{{ item.target }}' force: yes state: link - with_items: # PHP cli - - { category: 'cli', file: 'mcrypt.ini', order: '20' } - - { category: 'cli', file: 'docker-boilerplate.ini', order: '99' } + - { category: 'cli', file: '/etc/php5/mods-available/mcrypt.ini', target: '20-mcrypt.ini' } + - { category: 'cli', file: '/opt/docker/conf/php.ini', target: '99-docker-boilerplate.ini' } # PHP fpm - - { category: 'fpm', file: 'mcrypt.ini', order: '20' } - - { category: 'fpm', file: 'docker-boilerplate.ini', order: '99' } + - { category: 'fpm', file: '/etc/php5/mods-available/mcrypt.ini', target: '20-mcrypt.ini' } + - { category: 'fpm', file: '/opt/docker/conf/php.ini', target: '99-docker-boilerplate.ini' } - name: Configure php-fpm (php-fpm.conf) lineinfile: diff --git a/docker/main/ubuntu/provision/roles/ssmtp/tasks/configuration.yml b/docker/main/ubuntu/provision/roles/ssmtp/tasks/configuration.yml index aed514f..44e39b8 100644 --- a/docker/main/ubuntu/provision/roles/ssmtp/tasks/configuration.yml +++ b/docker/main/ubuntu/provision/roles/ssmtp/tasks/configuration.yml @@ -1,9 +1,8 @@ - name: Setup ssmtp lineinfile: dest: /etc/ssmtp/ssmtp.conf - regexp: '{{ item.regexp }}' - line: '{{ item.line }}' + regexp: '^[\s]*{{ item.key }}[\s]*=' + line: '{{ item.key }}={{ item.value }}' with_items: - # Send buffer sizes - - { regexp: '^mailhub=', line: 'mailhub={{ DOCKER.MAIL_GATEWAY }}' } - - { regexp: '^#?FromLineOverride=', line: 'FromLineOverride=YES' } + - { key: 'mailhub', value: '{{ DOCKER.MAIL_GATEWAY }}' } + - { key: 'FromLineOverride', value: 'YES' } From 0f246e767e6ebd6fa3e5332a1139c03245ac1812 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sat, 11 Jul 2015 23:39:21 +0200 Subject: [PATCH 25/66] Improved ubuntu dnsmasq --- docker/main/ubuntu/bin/dnsmasq.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/main/ubuntu/bin/dnsmasq.sh b/docker/main/ubuntu/bin/dnsmasq.sh index 8da4dfa..ff75300 100644 --- a/docker/main/ubuntu/bin/dnsmasq.sh +++ b/docker/main/ubuntu/bin/dnsmasq.sh @@ -32,7 +32,7 @@ function dnsmasq_start() { done ## set forward servers - cat /var/run/dnsmasq/resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward + cat /opt/docker/.resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward ## (re)start dnsmasq as DNS server service dnsmasq restart From 45d84a2321f3845f426c054e9bfd9c487efe7382 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sun, 12 Jul 2015 00:00:24 +0200 Subject: [PATCH 26/66] Removed old ubuntu versions --- docker-compose.yml | 6 +- docker/main/ubuntu-12.04/Dockerfile | 24 ---- docker/main/ubuntu-12.04/bin/customization.sh | 10 -- docker/main/ubuntu-12.04/bin/dnsmasq.sh | 63 ---------- docker/main/ubuntu-12.04/bin/init-mysql.sh | 29 ----- docker/main/ubuntu-12.04/bin/init-php.sh | 60 ---------- docker/main/ubuntu-12.04/bin/init-ssmtp.sh | 8 -- docker/main/ubuntu-12.04/bin/init-system.sh | 5 - docker/main/ubuntu-12.04/bin/install.sh | 108 ------------------ docker/main/ubuntu-12.04/bin/logwatch.sh | 8 -- docker/main/ubuntu-12.04/conf/locale.conf | 11 -- docker/main/ubuntu-12.04/conf/php.ini | 29 ----- .../main/ubuntu-12.04/conf/supervisord.conf | 47 -------- docker/main/ubuntu-12.04/entrypoint.sh | 63 ---------- docker/main/ubuntu-12.04/htdocs/.gitkeep | 0 docker/main/ubuntu-14.04/Dockerfile | 24 ---- docker/main/ubuntu-14.04/bin/customization.sh | 10 -- docker/main/ubuntu-14.04/bin/dnsmasq.sh | 63 ---------- docker/main/ubuntu-14.04/bin/init-mysql.sh | 29 ----- docker/main/ubuntu-14.04/bin/init-php.sh | 52 --------- docker/main/ubuntu-14.04/bin/init-ssmtp.sh | 8 -- docker/main/ubuntu-14.04/bin/init-system.sh | 5 - docker/main/ubuntu-14.04/bin/install.sh | 107 ----------------- docker/main/ubuntu-14.04/bin/logwatch.sh | 8 -- docker/main/ubuntu-14.04/conf/locale.conf | 11 -- docker/main/ubuntu-14.04/conf/php.ini | 29 ----- .../main/ubuntu-14.04/conf/supervisord.conf | 47 -------- docker/main/ubuntu-14.04/entrypoint.sh | 63 ---------- docker/main/ubuntu-14.04/htdocs/.gitkeep | 0 docker/main/ubuntu-15.04/Dockerfile | 24 ---- docker/main/ubuntu-15.04/bin/customization.sh | 10 -- docker/main/ubuntu-15.04/bin/dnsmasq.sh | 63 ---------- docker/main/ubuntu-15.04/bin/init-mysql.sh | 29 ----- docker/main/ubuntu-15.04/bin/init-php.sh | 52 --------- docker/main/ubuntu-15.04/bin/init-ssmtp.sh | 8 -- docker/main/ubuntu-15.04/bin/init-system.sh | 5 - docker/main/ubuntu-15.04/bin/install.sh | 107 ----------------- docker/main/ubuntu-15.04/bin/logwatch.sh | 8 -- docker/main/ubuntu-15.04/conf/locale.conf | 11 -- docker/main/ubuntu-15.04/conf/php.ini | 29 ----- .../main/ubuntu-15.04/conf/supervisord.conf | 47 -------- docker/main/ubuntu-15.04/entrypoint.sh | 63 ---------- docker/main/ubuntu-15.04/htdocs/.gitkeep | 0 docker/main/ubuntu-15.10/Dockerfile | 24 ---- docker/main/ubuntu-15.10/bin/customization.sh | 10 -- docker/main/ubuntu-15.10/bin/dnsmasq.sh | 63 ---------- docker/main/ubuntu-15.10/bin/init-mysql.sh | 29 ----- docker/main/ubuntu-15.10/bin/init-php.sh | 52 --------- docker/main/ubuntu-15.10/bin/init-ssmtp.sh | 8 -- docker/main/ubuntu-15.10/bin/init-system.sh | 5 - docker/main/ubuntu-15.10/bin/install.sh | 107 ----------------- docker/main/ubuntu-15.10/bin/logwatch.sh | 8 -- docker/main/ubuntu-15.10/conf/locale.conf | 11 -- docker/main/ubuntu-15.10/conf/php.ini | 29 ----- .../main/ubuntu-15.10/conf/supervisord.conf | 47 -------- docker/main/ubuntu-15.10/entrypoint.sh | 63 ---------- docker/main/ubuntu-15.10/htdocs/.gitkeep | 0 57 files changed, 1 insertion(+), 1838 deletions(-) delete mode 100644 docker/main/ubuntu-12.04/Dockerfile delete mode 100644 docker/main/ubuntu-12.04/bin/customization.sh delete mode 100644 docker/main/ubuntu-12.04/bin/dnsmasq.sh delete mode 100644 docker/main/ubuntu-12.04/bin/init-mysql.sh delete mode 100644 docker/main/ubuntu-12.04/bin/init-php.sh delete mode 100644 docker/main/ubuntu-12.04/bin/init-ssmtp.sh delete mode 100644 docker/main/ubuntu-12.04/bin/init-system.sh delete mode 100644 docker/main/ubuntu-12.04/bin/install.sh delete mode 100644 docker/main/ubuntu-12.04/bin/logwatch.sh delete mode 100644 docker/main/ubuntu-12.04/conf/locale.conf delete mode 100644 docker/main/ubuntu-12.04/conf/php.ini delete mode 100644 docker/main/ubuntu-12.04/conf/supervisord.conf delete mode 100755 docker/main/ubuntu-12.04/entrypoint.sh delete mode 100644 docker/main/ubuntu-12.04/htdocs/.gitkeep delete mode 100644 docker/main/ubuntu-14.04/Dockerfile delete mode 100644 docker/main/ubuntu-14.04/bin/customization.sh delete mode 100644 docker/main/ubuntu-14.04/bin/dnsmasq.sh delete mode 100644 docker/main/ubuntu-14.04/bin/init-mysql.sh delete mode 100644 docker/main/ubuntu-14.04/bin/init-php.sh delete mode 100644 docker/main/ubuntu-14.04/bin/init-ssmtp.sh delete mode 100644 docker/main/ubuntu-14.04/bin/init-system.sh delete mode 100644 docker/main/ubuntu-14.04/bin/install.sh delete mode 100644 docker/main/ubuntu-14.04/bin/logwatch.sh delete mode 100644 docker/main/ubuntu-14.04/conf/locale.conf delete mode 100644 docker/main/ubuntu-14.04/conf/php.ini delete mode 100644 docker/main/ubuntu-14.04/conf/supervisord.conf delete mode 100755 docker/main/ubuntu-14.04/entrypoint.sh delete mode 100644 docker/main/ubuntu-14.04/htdocs/.gitkeep delete mode 100644 docker/main/ubuntu-15.04/Dockerfile delete mode 100644 docker/main/ubuntu-15.04/bin/customization.sh delete mode 100644 docker/main/ubuntu-15.04/bin/dnsmasq.sh delete mode 100644 docker/main/ubuntu-15.04/bin/init-mysql.sh delete mode 100644 docker/main/ubuntu-15.04/bin/init-php.sh delete mode 100644 docker/main/ubuntu-15.04/bin/init-ssmtp.sh delete mode 100644 docker/main/ubuntu-15.04/bin/init-system.sh delete mode 100644 docker/main/ubuntu-15.04/bin/install.sh delete mode 100644 docker/main/ubuntu-15.04/bin/logwatch.sh delete mode 100644 docker/main/ubuntu-15.04/conf/locale.conf delete mode 100644 docker/main/ubuntu-15.04/conf/php.ini delete mode 100644 docker/main/ubuntu-15.04/conf/supervisord.conf delete mode 100755 docker/main/ubuntu-15.04/entrypoint.sh delete mode 100644 docker/main/ubuntu-15.04/htdocs/.gitkeep delete mode 100644 docker/main/ubuntu-15.10/Dockerfile delete mode 100644 docker/main/ubuntu-15.10/bin/customization.sh delete mode 100644 docker/main/ubuntu-15.10/bin/dnsmasq.sh delete mode 100644 docker/main/ubuntu-15.10/bin/init-mysql.sh delete mode 100644 docker/main/ubuntu-15.10/bin/init-php.sh delete mode 100644 docker/main/ubuntu-15.10/bin/init-ssmtp.sh delete mode 100644 docker/main/ubuntu-15.10/bin/init-system.sh delete mode 100644 docker/main/ubuntu-15.10/bin/install.sh delete mode 100644 docker/main/ubuntu-15.10/bin/logwatch.sh delete mode 100644 docker/main/ubuntu-15.10/conf/locale.conf delete mode 100644 docker/main/ubuntu-15.10/conf/php.ini delete mode 100644 docker/main/ubuntu-15.10/conf/supervisord.conf delete mode 100755 docker/main/ubuntu-15.10/entrypoint.sh delete mode 100644 docker/main/ubuntu-15.10/htdocs/.gitkeep diff --git a/docker-compose.yml b/docker-compose.yml index 0e91de7..cb80a3c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,11 +2,7 @@ # Main php container ####################################### main: - #build: docker/main/ubuntu-12.04 # PHP 5.3, LTS (precise) - build: docker/main/ubuntu-14.04 # PHP 5.5, LTS (trusty) - #build: docker/main/ubuntu-15.04 # PHP 5.6 (vivid) - #build: docker/main/ubuntu-15.10 # PHP 5.6 (wily) - #build: docker/main/ubuntu # dynamic ubuntu version (ansible provisioning) + build: docker/main/ubuntu # dynamic ubuntu version (ansible provisioning) #build: docker/main/centos # dynamic centos version (ansible provisioning) links: - mysql diff --git a/docker/main/ubuntu-12.04/Dockerfile b/docker/main/ubuntu-12.04/Dockerfile deleted file mode 100644 index 1e1c876..0000000 --- a/docker/main/ubuntu-12.04/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM ubuntu:12.04 - -# Ensure UTF-8 -RUN locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LC_ALL en_US.UTF-8 - -COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY conf/locale.conf /opt/docker/locale.conf -COPY bin/* /opt/docker/ -ADD entrypoint.sh /entrypoint.sh - -RUN bash /opt/docker/install.sh -RUN bash /opt/docker/customization.sh - -COPY conf/php.ini /etc/php5/mods-available/docker-boilerplate.ini - -EXPOSE 9000 - -VOLUME /docker/ -WORKDIR /docker/code/ - -ENTRYPOINT ["/entrypoint.sh"] -CMD ["supervisord"] diff --git a/docker/main/ubuntu-12.04/bin/customization.sh b/docker/main/ubuntu-12.04/bin/customization.sh deleted file mode 100644 index 861b916..0000000 --- a/docker/main/ubuntu-12.04/bin/customization.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -export DEBIAN_FRONTEND="noninteractive" - -## add your custom stuff here diff --git a/docker/main/ubuntu-12.04/bin/dnsmasq.sh b/docker/main/ubuntu-12.04/bin/dnsmasq.sh deleted file mode 100644 index 8da4dfa..0000000 --- a/docker/main/ubuntu-12.04/bin/dnsmasq.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash - -sleep 5 - -## backup original resolv.conf -if [ ! -f "/opt/docker/.resolv.conf" ]; then - ## backup original file - cp /etc/resolv.conf /opt/docker/.resolv.conf - - ## Copy resolv.conf for dnsmasq (default resolver) - cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf -fi - -## Restore original resolvconf -function restore_resolvconf() { - ## restore original resolv.conf - cp /opt/docker/.resolv.conf /etc/resolv.conf -} - -## Start and configure dnsmasq -function dnsmasq_start() { - echo "[dnsmasq] Found Webserver IP: $1" - - restore_resolvconf - - ## clear dns file - echo > /etc/dnsmasq.d/development - - ## add IP for each domain (wildcard!) - for DOMAIN in $DNS_DOMAIN; do - echo "address=/${DOMAIN}/${1}" >> /etc/dnsmasq.d/development - done - - ## set forward servers - cat /var/run/dnsmasq/resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward - - ## (re)start dnsmasq as DNS server - service dnsmasq restart - - ## set dnsmasq to main nameserver - echo "nameserver 127.0.0.1" > /etc/resolv.conf - - ## wait for 10 hours - sleep 10h -} - -## Fetch IP from services -if [ -f "/data/dns/web.ip" ]; then - ## Found WEB - dnsmasq_start "$(cat /data/dns/web.ip)" -elif [ -f "/data/dns/httpd.ip" ]; then - ## Found HTTPD (fallback) - dnsmasq_start "$(cat /data/dns/httpd.ip)" -elif [ -f "/data/dns/nginx.ip" ]; then - ## Found NGINX (fallback) - dnsmasq_start "$(cat /data/dns/nginx.ip)" -else - ## Found nothing, restore original resolvconf - restore_resolvconf - sleep 15 -fi - -exit 0 diff --git a/docker/main/ubuntu-12.04/bin/init-mysql.sh b/docker/main/ubuntu-12.04/bin/init-mysql.sh deleted file mode 100644 index 821754d..0000000 --- a/docker/main/ubuntu-12.04/bin/init-mysql.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -############################# -## Init MySQL -############################# - -echo "[client] -host=mysql -user=\"root\" -password=\"$MYSQL_ROOT_PASSWORD\" - -[mysql] -host=mysql -user=\"root\" -password=\"$MYSQL_ROOT_PASSWORD\" -database=\"$MYSQL_DATABASE\" -default-character-set=utf8 -local-infile=1 -show-warnings -auto-rehash -sigint-ignore -reconnect - -[mysqldump] -host=mysql -user=\"root\" -password=\"$MYSQL_ROOT_PASSWORD\" - -" | tee /root/.my.cnf > /home/.my.cnf diff --git a/docker/main/ubuntu-12.04/bin/init-php.sh b/docker/main/ubuntu-12.04/bin/init-php.sh deleted file mode 100644 index 52be553..0000000 --- a/docker/main/ubuntu-12.04/bin/init-php.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env bash - -############################# -## Init PHP -############################# -echo " -date.timezone = ${PHP_TIMEZONE} -" >> /etc/php5/mods-available/docker-boilerplate.ini - -############################# -## Init PHP-FPM -############################# - -# Backup original -if [ ! -f "/opt/docker/.fpm-www.conf" ]; then - cp /etc/php5/fpm/pool.d/www.conf /opt/docker/.fpm-www.conf -fi - -if [ ! -f "/opt/docker/.fpm-main.conf" ]; then - cp /etc/php5/fpm/php-fpm.conf /opt/docker/.fpm-main.conf -fi - -## Remove old logs -rm -f -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log -touch -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log -chmod 666 /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log - -# Disable deamonize -cp /opt/docker/.fpm-main.conf /etc/php5/fpm/php-fpm.conf -sed -i "s@;daemonize = yes@daemonize = no@" /etc/php5/fpm/php-fpm.conf - -# Restore original -cp /opt/docker/.fpm-www.conf /etc/php5/fpm/pool.d/www.conf -sed -i "s@listen = /var/run/php5-fpm.sock@listen = 9000@" /etc/php5/fpm/pool.d/www.conf - -# Manipulate php-fpm configuration -echo " -; Server resource settings - -listen = 0.0.0.0:9000 - -pm.max_children = 10 -pm.start_servers = 2 -pm.min_spare_servers = 1 -pm.max_spare_servers = 3 - -catch_workers_output = yes - -access.format = \"%R - %u %t \\\"%m %r%Q%q\\\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d\" -access.log = /tmp/php.access.log -slowlog = /tmp/php.slow.log -request_slowlog_timeout = 30s - -php_admin_value[error_log] = /tmp/php.error.log -php_admin_flag[log_errors] = on - -env[TYPO3_CONTEXT] = ${TYPO3_CONTEXT} -env[FLOW_CONTEXT] = ${FLOW_CONTEXT} -env[FLOW_REWRITEURLS] = ${FLOW_REWRITEURLS} -" >> /etc/php5/fpm/pool.d/www.conf diff --git a/docker/main/ubuntu-12.04/bin/init-ssmtp.sh b/docker/main/ubuntu-12.04/bin/init-ssmtp.sh deleted file mode 100644 index 4bf8972..0000000 --- a/docker/main/ubuntu-12.04/bin/init-ssmtp.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -############################# -## Init SSMTP -############################# - -sed -i "s/mailhub=.*/mailhub=${MAIL_GATEWAY}/" /etc/ssmtp/ssmtp.conf -sed -i "s/#FromLineOverride=.*/FromLineOverride=YES/" /etc/ssmtp/ssmtp.conf diff --git a/docker/main/ubuntu-12.04/bin/init-system.sh b/docker/main/ubuntu-12.04/bin/init-system.sh deleted file mode 100644 index fb98e9c..0000000 --- a/docker/main/ubuntu-12.04/bin/init-system.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -## Set uid/gid for www-data user -usermod --uid "${EFFECTIVE_UID}" --shell /bin/bash --home /home www-data > /dev/null -groupmod --gid "${EFFECTIVE_GID}" www-data > /dev/null diff --git a/docker/main/ubuntu-12.04/bin/install.sh b/docker/main/ubuntu-12.04/bin/install.sh deleted file mode 100644 index 6cf3508..0000000 --- a/docker/main/ubuntu-12.04/bin/install.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -export DEBIAN_FRONTEND="noninteractive" - -############################# -# Modify user -############################# - -usermod --shell /bin/bash --home /home www-data -chown www-data:www-data /home - -## Fix terminal -echo 'export TERM="xterm-color"' >> /root/.bashrc -echo 'export TERM="xterm-color"' >> /home/.bashrc - -############################# -# Common tasks -############################# - -mkdir -p /opt/docker/ \ - /var/log/supervisor - -############################# -# Install packages -############################# - -apt-get update - -apt-get install -y \ - sudo \ - supervisor \ - dnsmasq \ - ssmtp \ - php5-cli \ - php5-fpm \ - php5-json \ - php5-intl \ - php5-curl \ - php5-mysqlnd \ - php5-xdebug \ - php5-memcached \ - php5-mcrypt \ - php5-gd \ - php5-sqlite \ - php5-xmlrpc \ - php5-xsl \ - php5-geoip \ - php5-ldap \ - php5-memcache \ - php5-memcached - -apt-get install -y \ - graphicsmagick \ - zip \ - unzip \ - wget \ - curl \ - mysql-client \ - moreutils \ - dnsutils - -############################# -# Generate locales -############################# - -cat /opt/docker/locale.conf >> /var/lib/locales/supported.d/local -locale-gen - -############################# -# Enable php modules -############################# -## custom config -mkdir /etc/php5/mods-available/ -touch /etc/php5/mods-available/docker-boilerplate.ini -ln -fs /etc/php5/mods-available/docker-boilerplate.ini /etc/php5/conf.d/ - -# enable ext mcrypt -#php5enmod mcrypt - -############################# -# Composer -############################# - -curl -sS https://getcomposer.org/installer | php -mv composer.phar /usr/local/bin/composer - - -############################# -# Dnsmasq -############################# - -## Fix dnsmasqd -echo " -user=root -conf-dir=/etc/dnsmasq.d -" >> /etc/dnsmasq.conf - -############################# -# Cleanup -############################# - -apt-get clean -y -apt-get autoclean -y diff --git a/docker/main/ubuntu-12.04/bin/logwatch.sh b/docker/main/ubuntu-12.04/bin/logwatch.sh deleted file mode 100644 index 729e0ca..0000000 --- a/docker/main/ubuntu-12.04/bin/logwatch.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -tail -F --quiet $2 | sed --unbuffered -e "s/^/\[$1\] /" diff --git a/docker/main/ubuntu-12.04/conf/locale.conf b/docker/main/ubuntu-12.04/conf/locale.conf deleted file mode 100644 index 7410061..0000000 --- a/docker/main/ubuntu-12.04/conf/locale.conf +++ /dev/null @@ -1,11 +0,0 @@ -en_GB.UTF-8 UTF-8 -en_GB ISO-8859-1 -en_GB.ISO-8859-15 ISO-8859-15 - -en_US.UTF-8 UTF-8 -en_US ISO-8859-1 -en_US.ISO-8859-15 ISO-8859-15 - -de_DE.UTF-8 UTF-8 -de_DE ISO-8859-1 -de_DE@euro ISO-8859-15 \ No newline at end of file diff --git a/docker/main/ubuntu-12.04/conf/php.ini b/docker/main/ubuntu-12.04/conf/php.ini deleted file mode 100644 index b3b39c5..0000000 --- a/docker/main/ubuntu-12.04/conf/php.ini +++ /dev/null @@ -1,29 +0,0 @@ -; this file will overwrite default php.ini settings - -short_open_tag = On -variables_order = 'GPCS' -request_order = 'GP' - -allow_url_fopen = On -allow_url_include = Off - -memory_limit = 512M -max_execution_time = 900 -max_input_time = 300 -post_max_size = 50M -upload_max_filesize = 50M - -; timezone will be overwritten in startup, use docker-env.yml -date.timezone = Europe/Berlin - -mysql.default_host = mysql -mysqli.default_host = mysql - -xdebug.remote_enable = 1 -xdebug.remote_connect_back = on -xdebug.idekey = "docker" -xdebug.cli_color = 1 -xdebug.max_nesting_level = 1000 -xdebug.profiler_enable_trigger = 1 -xdebug.profiler_output_dir = '/tmp/debug/' -xhprof.output_dir = '/tmp/debug/' diff --git a/docker/main/ubuntu-12.04/conf/supervisord.conf b/docker/main/ubuntu-12.04/conf/supervisord.conf deleted file mode 100644 index bd337cc..0000000 --- a/docker/main/ubuntu-12.04/conf/supervisord.conf +++ /dev/null @@ -1,47 +0,0 @@ -[supervisord] -nodaemon=true - -[program:php-fpm] -command = /usr/sbin/php5-fpm -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:dnsmasq] -command = bash /opt/docker/dnsmasq.sh -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:php-log-access] -command = bash /opt/docker/logwatch.sh php:access /tmp/php.access.log -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:php-log-slow] -command = bash /opt/docker/logwatch.sh php:slow /tmp/php.slow.log -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:php-log-error] -command = bash /opt/docker/logwatch.sh php:error /tmp/php.error.log -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 diff --git a/docker/main/ubuntu-12.04/entrypoint.sh b/docker/main/ubuntu-12.04/entrypoint.sh deleted file mode 100755 index 838c922..0000000 --- a/docker/main/ubuntu-12.04/entrypoint.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -set -e - -## Init system -source /opt/docker/init-system.sh - -## Init MySQL (client) -source /opt/docker/init-mysql.sh - -## Init SSMTP -source /opt/docker/init-ssmtp.sh - -## Init PHP and PHP-FPM -source /opt/docker/init-php.sh - -############################# -## COMMAND -############################# - -case "$1" in - - ## Supervisord (start daemons) - supervisord) - ## Register IP - ETH0_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') - mkdir -p /data/dns/ - chmod 777 /data/dns/ - echo "${ETH0_IP}" > /data/dns/main.ip - echo "${ETH0_IP} main main_1" > /data/dns/main.hosts - - ## Start services - exec supervisord - ;; - - ## Root shell - root) - if [ "$#" -eq 1 ]; then - ## No command, fall back to shell - exec bash - else - ## Exec root command - shift - exec "$@" - fi - ;; - - ## Defined cli script - cli) - if [ -n "${CLI_SCRIPT}" ]; then - shift - exec sudo -H -E -u "${CLI_USER}" ${CLI_SCRIPT} "$@" - else - echo "[ERROR] No CLI_SCRIPT in docker-env.yml defined" - exit 1 - fi - ;; - - ## All other commands - *) - ## Execute cmd - exec sudo -H -E -u "${CLI_USER}" "$@" - ;; -esac diff --git a/docker/main/ubuntu-12.04/htdocs/.gitkeep b/docker/main/ubuntu-12.04/htdocs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docker/main/ubuntu-14.04/Dockerfile b/docker/main/ubuntu-14.04/Dockerfile deleted file mode 100644 index c09328f..0000000 --- a/docker/main/ubuntu-14.04/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM ubuntu:14.04 - -# Ensure UTF-8 -RUN locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LC_ALL en_US.UTF-8 - -COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY conf/locale.conf /opt/docker/locale.conf -COPY bin/* /opt/docker/ -ADD entrypoint.sh /entrypoint.sh - -RUN bash /opt/docker/install.sh -RUN bash /opt/docker/customization.sh - -COPY conf/php.ini /etc/php5/mods-available/docker-boilerplate.ini - -EXPOSE 9000 - -VOLUME /docker/ -WORKDIR /docker/code/ - -ENTRYPOINT ["/entrypoint.sh"] -CMD ["supervisord"] diff --git a/docker/main/ubuntu-14.04/bin/customization.sh b/docker/main/ubuntu-14.04/bin/customization.sh deleted file mode 100644 index 861b916..0000000 --- a/docker/main/ubuntu-14.04/bin/customization.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -export DEBIAN_FRONTEND="noninteractive" - -## add your custom stuff here diff --git a/docker/main/ubuntu-14.04/bin/dnsmasq.sh b/docker/main/ubuntu-14.04/bin/dnsmasq.sh deleted file mode 100644 index 8da4dfa..0000000 --- a/docker/main/ubuntu-14.04/bin/dnsmasq.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash - -sleep 5 - -## backup original resolv.conf -if [ ! -f "/opt/docker/.resolv.conf" ]; then - ## backup original file - cp /etc/resolv.conf /opt/docker/.resolv.conf - - ## Copy resolv.conf for dnsmasq (default resolver) - cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf -fi - -## Restore original resolvconf -function restore_resolvconf() { - ## restore original resolv.conf - cp /opt/docker/.resolv.conf /etc/resolv.conf -} - -## Start and configure dnsmasq -function dnsmasq_start() { - echo "[dnsmasq] Found Webserver IP: $1" - - restore_resolvconf - - ## clear dns file - echo > /etc/dnsmasq.d/development - - ## add IP for each domain (wildcard!) - for DOMAIN in $DNS_DOMAIN; do - echo "address=/${DOMAIN}/${1}" >> /etc/dnsmasq.d/development - done - - ## set forward servers - cat /var/run/dnsmasq/resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward - - ## (re)start dnsmasq as DNS server - service dnsmasq restart - - ## set dnsmasq to main nameserver - echo "nameserver 127.0.0.1" > /etc/resolv.conf - - ## wait for 10 hours - sleep 10h -} - -## Fetch IP from services -if [ -f "/data/dns/web.ip" ]; then - ## Found WEB - dnsmasq_start "$(cat /data/dns/web.ip)" -elif [ -f "/data/dns/httpd.ip" ]; then - ## Found HTTPD (fallback) - dnsmasq_start "$(cat /data/dns/httpd.ip)" -elif [ -f "/data/dns/nginx.ip" ]; then - ## Found NGINX (fallback) - dnsmasq_start "$(cat /data/dns/nginx.ip)" -else - ## Found nothing, restore original resolvconf - restore_resolvconf - sleep 15 -fi - -exit 0 diff --git a/docker/main/ubuntu-14.04/bin/init-mysql.sh b/docker/main/ubuntu-14.04/bin/init-mysql.sh deleted file mode 100644 index 821754d..0000000 --- a/docker/main/ubuntu-14.04/bin/init-mysql.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -############################# -## Init MySQL -############################# - -echo "[client] -host=mysql -user=\"root\" -password=\"$MYSQL_ROOT_PASSWORD\" - -[mysql] -host=mysql -user=\"root\" -password=\"$MYSQL_ROOT_PASSWORD\" -database=\"$MYSQL_DATABASE\" -default-character-set=utf8 -local-infile=1 -show-warnings -auto-rehash -sigint-ignore -reconnect - -[mysqldump] -host=mysql -user=\"root\" -password=\"$MYSQL_ROOT_PASSWORD\" - -" | tee /root/.my.cnf > /home/.my.cnf diff --git a/docker/main/ubuntu-14.04/bin/init-php.sh b/docker/main/ubuntu-14.04/bin/init-php.sh deleted file mode 100644 index 2f28aa6..0000000 --- a/docker/main/ubuntu-14.04/bin/init-php.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash - -############################# -## Init PHP -############################# -echo " -date.timezone = ${PHP_TIMEZONE} -" >> /etc/php5/mods-available/docker-boilerplate.ini - -############################# -## Init PHP-FPM -############################# - -# Backup original -if [ ! -f "/opt/docker/.fpm-www.conf" ]; then - cp /etc/php5/fpm/pool.d/www.conf /opt/docker/.fpm-www.conf -fi - -## Remove old logs -rm -f -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log -touch -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log -chmod 666 /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log - -# Restore original -cp /opt/docker/.fpm-www.conf /etc/php5/fpm/pool.d/www.conf -sed -i "s@listen = /var/run/php5-fpm.sock@listen = 9000@" /etc/php5/fpm/pool.d/www.conf - -# Manipulate php-fpm configuration -echo " -; Server resource settings - -listen = 0.0.0.0:9000 - -pm.max_children = 10 -pm.start_servers = 2 -pm.min_spare_servers = 1 -pm.max_spare_servers = 3 - -catch_workers_output = yes - -access.format = \"%R - %u %t \\\"%m %r%Q%q\\\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d\" -access.log = /tmp/php.access.log -slowlog = /tmp/php.slow.log -request_slowlog_timeout = 30s - -php_admin_value[error_log] = /tmp/php.error.log -php_admin_flag[log_errors] = on - -env[TYPO3_CONTEXT] = ${TYPO3_CONTEXT} -env[FLOW_CONTEXT] = ${FLOW_CONTEXT} -env[FLOW_REWRITEURLS] = ${FLOW_REWRITEURLS} -" >> /etc/php5/fpm/pool.d/www.conf diff --git a/docker/main/ubuntu-14.04/bin/init-ssmtp.sh b/docker/main/ubuntu-14.04/bin/init-ssmtp.sh deleted file mode 100644 index 4bf8972..0000000 --- a/docker/main/ubuntu-14.04/bin/init-ssmtp.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -############################# -## Init SSMTP -############################# - -sed -i "s/mailhub=.*/mailhub=${MAIL_GATEWAY}/" /etc/ssmtp/ssmtp.conf -sed -i "s/#FromLineOverride=.*/FromLineOverride=YES/" /etc/ssmtp/ssmtp.conf diff --git a/docker/main/ubuntu-14.04/bin/init-system.sh b/docker/main/ubuntu-14.04/bin/init-system.sh deleted file mode 100644 index fb98e9c..0000000 --- a/docker/main/ubuntu-14.04/bin/init-system.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -## Set uid/gid for www-data user -usermod --uid "${EFFECTIVE_UID}" --shell /bin/bash --home /home www-data > /dev/null -groupmod --gid "${EFFECTIVE_GID}" www-data > /dev/null diff --git a/docker/main/ubuntu-14.04/bin/install.sh b/docker/main/ubuntu-14.04/bin/install.sh deleted file mode 100644 index 8c446a1..0000000 --- a/docker/main/ubuntu-14.04/bin/install.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -export DEBIAN_FRONTEND="noninteractive" - -############################# -# Modify user -############################# - -usermod --shell /bin/bash --home /home www-data -chown www-data:www-data /home - -## Fix terminal -echo 'export TERM="xterm-color"' >> /root/.bashrc -echo 'export TERM="xterm-color"' >> /home/.bashrc - -############################# -# Common tasks -############################# - -mkdir -p /opt/docker/ \ - /var/log/supervisor - -############################# -# Install packages -############################# - -apt-get update - -apt-get install -y \ - sudo \ - supervisor \ - dnsmasq \ - ssmtp \ - php5-cli \ - php5-fpm \ - php5-json \ - php5-intl \ - php5-curl \ - php5-mysqlnd \ - php5-xdebug \ - php5-memcached \ - php5-mcrypt \ - php5-gd \ - php5-sqlite \ - php5-xmlrpc \ - php5-xsl \ - php5-geoip \ - php5-ldap \ - php5-memcache \ - php5-memcached - -apt-get install -y \ - graphicsmagick \ - zip \ - unzip \ - wget \ - curl \ - mysql-client \ - moreutils \ - dnsutils - -############################# -# Generate locales -############################# - -cat /opt/docker/locale.conf >> /var/lib/locales/supported.d/local -locale-gen - -############################# -# Enable php modules -############################# -## custom config -touch /etc/php5/mods-available/docker-boilerplate.ini -php5enmod docker-boilerplate - -# enable ext mcrypt -php5enmod mcrypt - -############################# -# Composer -############################# - -curl -sS https://getcomposer.org/installer | php -mv composer.phar /usr/local/bin/composer - - -############################# -# Dnsmasq -############################# - -## Fix dnsmasqd -echo " -user=root -conf-dir=/etc/dnsmasq.d -" >> /etc/dnsmasq.conf - -############################# -# Cleanup -############################# - -apt-get clean -y -apt-get autoclean -y diff --git a/docker/main/ubuntu-14.04/bin/logwatch.sh b/docker/main/ubuntu-14.04/bin/logwatch.sh deleted file mode 100644 index 729e0ca..0000000 --- a/docker/main/ubuntu-14.04/bin/logwatch.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -tail -F --quiet $2 | sed --unbuffered -e "s/^/\[$1\] /" diff --git a/docker/main/ubuntu-14.04/conf/locale.conf b/docker/main/ubuntu-14.04/conf/locale.conf deleted file mode 100644 index 7410061..0000000 --- a/docker/main/ubuntu-14.04/conf/locale.conf +++ /dev/null @@ -1,11 +0,0 @@ -en_GB.UTF-8 UTF-8 -en_GB ISO-8859-1 -en_GB.ISO-8859-15 ISO-8859-15 - -en_US.UTF-8 UTF-8 -en_US ISO-8859-1 -en_US.ISO-8859-15 ISO-8859-15 - -de_DE.UTF-8 UTF-8 -de_DE ISO-8859-1 -de_DE@euro ISO-8859-15 \ No newline at end of file diff --git a/docker/main/ubuntu-14.04/conf/php.ini b/docker/main/ubuntu-14.04/conf/php.ini deleted file mode 100644 index b3b39c5..0000000 --- a/docker/main/ubuntu-14.04/conf/php.ini +++ /dev/null @@ -1,29 +0,0 @@ -; this file will overwrite default php.ini settings - -short_open_tag = On -variables_order = 'GPCS' -request_order = 'GP' - -allow_url_fopen = On -allow_url_include = Off - -memory_limit = 512M -max_execution_time = 900 -max_input_time = 300 -post_max_size = 50M -upload_max_filesize = 50M - -; timezone will be overwritten in startup, use docker-env.yml -date.timezone = Europe/Berlin - -mysql.default_host = mysql -mysqli.default_host = mysql - -xdebug.remote_enable = 1 -xdebug.remote_connect_back = on -xdebug.idekey = "docker" -xdebug.cli_color = 1 -xdebug.max_nesting_level = 1000 -xdebug.profiler_enable_trigger = 1 -xdebug.profiler_output_dir = '/tmp/debug/' -xhprof.output_dir = '/tmp/debug/' diff --git a/docker/main/ubuntu-14.04/conf/supervisord.conf b/docker/main/ubuntu-14.04/conf/supervisord.conf deleted file mode 100644 index d9802c9..0000000 --- a/docker/main/ubuntu-14.04/conf/supervisord.conf +++ /dev/null @@ -1,47 +0,0 @@ -[supervisord] -nodaemon=true - -[program:php-fpm] -command = /usr/sbin/php5-fpm --nodaemonize -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:dnsmasq] -command = bash /opt/docker/dnsmasq.sh -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:php-log-access] -command = bash /opt/docker/logwatch.sh php:access /tmp/php.access.log -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:php-log-slow] -command = bash /opt/docker/logwatch.sh php:slow /tmp/php.slow.log -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:php-log-error] -command = bash /opt/docker/logwatch.sh php:error /tmp/php.error.log -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 diff --git a/docker/main/ubuntu-14.04/entrypoint.sh b/docker/main/ubuntu-14.04/entrypoint.sh deleted file mode 100755 index 838c922..0000000 --- a/docker/main/ubuntu-14.04/entrypoint.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -set -e - -## Init system -source /opt/docker/init-system.sh - -## Init MySQL (client) -source /opt/docker/init-mysql.sh - -## Init SSMTP -source /opt/docker/init-ssmtp.sh - -## Init PHP and PHP-FPM -source /opt/docker/init-php.sh - -############################# -## COMMAND -############################# - -case "$1" in - - ## Supervisord (start daemons) - supervisord) - ## Register IP - ETH0_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') - mkdir -p /data/dns/ - chmod 777 /data/dns/ - echo "${ETH0_IP}" > /data/dns/main.ip - echo "${ETH0_IP} main main_1" > /data/dns/main.hosts - - ## Start services - exec supervisord - ;; - - ## Root shell - root) - if [ "$#" -eq 1 ]; then - ## No command, fall back to shell - exec bash - else - ## Exec root command - shift - exec "$@" - fi - ;; - - ## Defined cli script - cli) - if [ -n "${CLI_SCRIPT}" ]; then - shift - exec sudo -H -E -u "${CLI_USER}" ${CLI_SCRIPT} "$@" - else - echo "[ERROR] No CLI_SCRIPT in docker-env.yml defined" - exit 1 - fi - ;; - - ## All other commands - *) - ## Execute cmd - exec sudo -H -E -u "${CLI_USER}" "$@" - ;; -esac diff --git a/docker/main/ubuntu-14.04/htdocs/.gitkeep b/docker/main/ubuntu-14.04/htdocs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docker/main/ubuntu-15.04/Dockerfile b/docker/main/ubuntu-15.04/Dockerfile deleted file mode 100644 index db024c7..0000000 --- a/docker/main/ubuntu-15.04/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM ubuntu:15.04 - -# Ensure UTF-8 -RUN locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LC_ALL en_US.UTF-8 - -COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY conf/locale.conf /opt/docker/locale.conf -COPY bin/* /opt/docker/ -ADD entrypoint.sh /entrypoint.sh - -RUN bash /opt/docker/install.sh -RUN bash /opt/docker/customization.sh - -COPY conf/php.ini /etc/php5/mods-available/docker-boilerplate.ini - -EXPOSE 9000 - -VOLUME /docker/ -WORKDIR /docker/code/ - -ENTRYPOINT ["/entrypoint.sh"] -CMD ["supervisord"] diff --git a/docker/main/ubuntu-15.04/bin/customization.sh b/docker/main/ubuntu-15.04/bin/customization.sh deleted file mode 100644 index 861b916..0000000 --- a/docker/main/ubuntu-15.04/bin/customization.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -export DEBIAN_FRONTEND="noninteractive" - -## add your custom stuff here diff --git a/docker/main/ubuntu-15.04/bin/dnsmasq.sh b/docker/main/ubuntu-15.04/bin/dnsmasq.sh deleted file mode 100644 index 8da4dfa..0000000 --- a/docker/main/ubuntu-15.04/bin/dnsmasq.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash - -sleep 5 - -## backup original resolv.conf -if [ ! -f "/opt/docker/.resolv.conf" ]; then - ## backup original file - cp /etc/resolv.conf /opt/docker/.resolv.conf - - ## Copy resolv.conf for dnsmasq (default resolver) - cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf -fi - -## Restore original resolvconf -function restore_resolvconf() { - ## restore original resolv.conf - cp /opt/docker/.resolv.conf /etc/resolv.conf -} - -## Start and configure dnsmasq -function dnsmasq_start() { - echo "[dnsmasq] Found Webserver IP: $1" - - restore_resolvconf - - ## clear dns file - echo > /etc/dnsmasq.d/development - - ## add IP for each domain (wildcard!) - for DOMAIN in $DNS_DOMAIN; do - echo "address=/${DOMAIN}/${1}" >> /etc/dnsmasq.d/development - done - - ## set forward servers - cat /var/run/dnsmasq/resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward - - ## (re)start dnsmasq as DNS server - service dnsmasq restart - - ## set dnsmasq to main nameserver - echo "nameserver 127.0.0.1" > /etc/resolv.conf - - ## wait for 10 hours - sleep 10h -} - -## Fetch IP from services -if [ -f "/data/dns/web.ip" ]; then - ## Found WEB - dnsmasq_start "$(cat /data/dns/web.ip)" -elif [ -f "/data/dns/httpd.ip" ]; then - ## Found HTTPD (fallback) - dnsmasq_start "$(cat /data/dns/httpd.ip)" -elif [ -f "/data/dns/nginx.ip" ]; then - ## Found NGINX (fallback) - dnsmasq_start "$(cat /data/dns/nginx.ip)" -else - ## Found nothing, restore original resolvconf - restore_resolvconf - sleep 15 -fi - -exit 0 diff --git a/docker/main/ubuntu-15.04/bin/init-mysql.sh b/docker/main/ubuntu-15.04/bin/init-mysql.sh deleted file mode 100644 index 821754d..0000000 --- a/docker/main/ubuntu-15.04/bin/init-mysql.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -############################# -## Init MySQL -############################# - -echo "[client] -host=mysql -user=\"root\" -password=\"$MYSQL_ROOT_PASSWORD\" - -[mysql] -host=mysql -user=\"root\" -password=\"$MYSQL_ROOT_PASSWORD\" -database=\"$MYSQL_DATABASE\" -default-character-set=utf8 -local-infile=1 -show-warnings -auto-rehash -sigint-ignore -reconnect - -[mysqldump] -host=mysql -user=\"root\" -password=\"$MYSQL_ROOT_PASSWORD\" - -" | tee /root/.my.cnf > /home/.my.cnf diff --git a/docker/main/ubuntu-15.04/bin/init-php.sh b/docker/main/ubuntu-15.04/bin/init-php.sh deleted file mode 100644 index 2f28aa6..0000000 --- a/docker/main/ubuntu-15.04/bin/init-php.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash - -############################# -## Init PHP -############################# -echo " -date.timezone = ${PHP_TIMEZONE} -" >> /etc/php5/mods-available/docker-boilerplate.ini - -############################# -## Init PHP-FPM -############################# - -# Backup original -if [ ! -f "/opt/docker/.fpm-www.conf" ]; then - cp /etc/php5/fpm/pool.d/www.conf /opt/docker/.fpm-www.conf -fi - -## Remove old logs -rm -f -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log -touch -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log -chmod 666 /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log - -# Restore original -cp /opt/docker/.fpm-www.conf /etc/php5/fpm/pool.d/www.conf -sed -i "s@listen = /var/run/php5-fpm.sock@listen = 9000@" /etc/php5/fpm/pool.d/www.conf - -# Manipulate php-fpm configuration -echo " -; Server resource settings - -listen = 0.0.0.0:9000 - -pm.max_children = 10 -pm.start_servers = 2 -pm.min_spare_servers = 1 -pm.max_spare_servers = 3 - -catch_workers_output = yes - -access.format = \"%R - %u %t \\\"%m %r%Q%q\\\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d\" -access.log = /tmp/php.access.log -slowlog = /tmp/php.slow.log -request_slowlog_timeout = 30s - -php_admin_value[error_log] = /tmp/php.error.log -php_admin_flag[log_errors] = on - -env[TYPO3_CONTEXT] = ${TYPO3_CONTEXT} -env[FLOW_CONTEXT] = ${FLOW_CONTEXT} -env[FLOW_REWRITEURLS] = ${FLOW_REWRITEURLS} -" >> /etc/php5/fpm/pool.d/www.conf diff --git a/docker/main/ubuntu-15.04/bin/init-ssmtp.sh b/docker/main/ubuntu-15.04/bin/init-ssmtp.sh deleted file mode 100644 index 4bf8972..0000000 --- a/docker/main/ubuntu-15.04/bin/init-ssmtp.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -############################# -## Init SSMTP -############################# - -sed -i "s/mailhub=.*/mailhub=${MAIL_GATEWAY}/" /etc/ssmtp/ssmtp.conf -sed -i "s/#FromLineOverride=.*/FromLineOverride=YES/" /etc/ssmtp/ssmtp.conf diff --git a/docker/main/ubuntu-15.04/bin/init-system.sh b/docker/main/ubuntu-15.04/bin/init-system.sh deleted file mode 100644 index fb98e9c..0000000 --- a/docker/main/ubuntu-15.04/bin/init-system.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -## Set uid/gid for www-data user -usermod --uid "${EFFECTIVE_UID}" --shell /bin/bash --home /home www-data > /dev/null -groupmod --gid "${EFFECTIVE_GID}" www-data > /dev/null diff --git a/docker/main/ubuntu-15.04/bin/install.sh b/docker/main/ubuntu-15.04/bin/install.sh deleted file mode 100644 index 8c446a1..0000000 --- a/docker/main/ubuntu-15.04/bin/install.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -export DEBIAN_FRONTEND="noninteractive" - -############################# -# Modify user -############################# - -usermod --shell /bin/bash --home /home www-data -chown www-data:www-data /home - -## Fix terminal -echo 'export TERM="xterm-color"' >> /root/.bashrc -echo 'export TERM="xterm-color"' >> /home/.bashrc - -############################# -# Common tasks -############################# - -mkdir -p /opt/docker/ \ - /var/log/supervisor - -############################# -# Install packages -############################# - -apt-get update - -apt-get install -y \ - sudo \ - supervisor \ - dnsmasq \ - ssmtp \ - php5-cli \ - php5-fpm \ - php5-json \ - php5-intl \ - php5-curl \ - php5-mysqlnd \ - php5-xdebug \ - php5-memcached \ - php5-mcrypt \ - php5-gd \ - php5-sqlite \ - php5-xmlrpc \ - php5-xsl \ - php5-geoip \ - php5-ldap \ - php5-memcache \ - php5-memcached - -apt-get install -y \ - graphicsmagick \ - zip \ - unzip \ - wget \ - curl \ - mysql-client \ - moreutils \ - dnsutils - -############################# -# Generate locales -############################# - -cat /opt/docker/locale.conf >> /var/lib/locales/supported.d/local -locale-gen - -############################# -# Enable php modules -############################# -## custom config -touch /etc/php5/mods-available/docker-boilerplate.ini -php5enmod docker-boilerplate - -# enable ext mcrypt -php5enmod mcrypt - -############################# -# Composer -############################# - -curl -sS https://getcomposer.org/installer | php -mv composer.phar /usr/local/bin/composer - - -############################# -# Dnsmasq -############################# - -## Fix dnsmasqd -echo " -user=root -conf-dir=/etc/dnsmasq.d -" >> /etc/dnsmasq.conf - -############################# -# Cleanup -############################# - -apt-get clean -y -apt-get autoclean -y diff --git a/docker/main/ubuntu-15.04/bin/logwatch.sh b/docker/main/ubuntu-15.04/bin/logwatch.sh deleted file mode 100644 index 729e0ca..0000000 --- a/docker/main/ubuntu-15.04/bin/logwatch.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -tail -F --quiet $2 | sed --unbuffered -e "s/^/\[$1\] /" diff --git a/docker/main/ubuntu-15.04/conf/locale.conf b/docker/main/ubuntu-15.04/conf/locale.conf deleted file mode 100644 index 7410061..0000000 --- a/docker/main/ubuntu-15.04/conf/locale.conf +++ /dev/null @@ -1,11 +0,0 @@ -en_GB.UTF-8 UTF-8 -en_GB ISO-8859-1 -en_GB.ISO-8859-15 ISO-8859-15 - -en_US.UTF-8 UTF-8 -en_US ISO-8859-1 -en_US.ISO-8859-15 ISO-8859-15 - -de_DE.UTF-8 UTF-8 -de_DE ISO-8859-1 -de_DE@euro ISO-8859-15 \ No newline at end of file diff --git a/docker/main/ubuntu-15.04/conf/php.ini b/docker/main/ubuntu-15.04/conf/php.ini deleted file mode 100644 index b3b39c5..0000000 --- a/docker/main/ubuntu-15.04/conf/php.ini +++ /dev/null @@ -1,29 +0,0 @@ -; this file will overwrite default php.ini settings - -short_open_tag = On -variables_order = 'GPCS' -request_order = 'GP' - -allow_url_fopen = On -allow_url_include = Off - -memory_limit = 512M -max_execution_time = 900 -max_input_time = 300 -post_max_size = 50M -upload_max_filesize = 50M - -; timezone will be overwritten in startup, use docker-env.yml -date.timezone = Europe/Berlin - -mysql.default_host = mysql -mysqli.default_host = mysql - -xdebug.remote_enable = 1 -xdebug.remote_connect_back = on -xdebug.idekey = "docker" -xdebug.cli_color = 1 -xdebug.max_nesting_level = 1000 -xdebug.profiler_enable_trigger = 1 -xdebug.profiler_output_dir = '/tmp/debug/' -xhprof.output_dir = '/tmp/debug/' diff --git a/docker/main/ubuntu-15.04/conf/supervisord.conf b/docker/main/ubuntu-15.04/conf/supervisord.conf deleted file mode 100644 index d9802c9..0000000 --- a/docker/main/ubuntu-15.04/conf/supervisord.conf +++ /dev/null @@ -1,47 +0,0 @@ -[supervisord] -nodaemon=true - -[program:php-fpm] -command = /usr/sbin/php5-fpm --nodaemonize -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:dnsmasq] -command = bash /opt/docker/dnsmasq.sh -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:php-log-access] -command = bash /opt/docker/logwatch.sh php:access /tmp/php.access.log -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:php-log-slow] -command = bash /opt/docker/logwatch.sh php:slow /tmp/php.slow.log -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:php-log-error] -command = bash /opt/docker/logwatch.sh php:error /tmp/php.error.log -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 diff --git a/docker/main/ubuntu-15.04/entrypoint.sh b/docker/main/ubuntu-15.04/entrypoint.sh deleted file mode 100755 index 838c922..0000000 --- a/docker/main/ubuntu-15.04/entrypoint.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -set -e - -## Init system -source /opt/docker/init-system.sh - -## Init MySQL (client) -source /opt/docker/init-mysql.sh - -## Init SSMTP -source /opt/docker/init-ssmtp.sh - -## Init PHP and PHP-FPM -source /opt/docker/init-php.sh - -############################# -## COMMAND -############################# - -case "$1" in - - ## Supervisord (start daemons) - supervisord) - ## Register IP - ETH0_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') - mkdir -p /data/dns/ - chmod 777 /data/dns/ - echo "${ETH0_IP}" > /data/dns/main.ip - echo "${ETH0_IP} main main_1" > /data/dns/main.hosts - - ## Start services - exec supervisord - ;; - - ## Root shell - root) - if [ "$#" -eq 1 ]; then - ## No command, fall back to shell - exec bash - else - ## Exec root command - shift - exec "$@" - fi - ;; - - ## Defined cli script - cli) - if [ -n "${CLI_SCRIPT}" ]; then - shift - exec sudo -H -E -u "${CLI_USER}" ${CLI_SCRIPT} "$@" - else - echo "[ERROR] No CLI_SCRIPT in docker-env.yml defined" - exit 1 - fi - ;; - - ## All other commands - *) - ## Execute cmd - exec sudo -H -E -u "${CLI_USER}" "$@" - ;; -esac diff --git a/docker/main/ubuntu-15.04/htdocs/.gitkeep b/docker/main/ubuntu-15.04/htdocs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docker/main/ubuntu-15.10/Dockerfile b/docker/main/ubuntu-15.10/Dockerfile deleted file mode 100644 index 3ad71c8..0000000 --- a/docker/main/ubuntu-15.10/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM ubuntu:15.10 - -# Ensure UTF-8 -RUN locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LC_ALL en_US.UTF-8 - -COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY conf/locale.conf /opt/docker/locale.conf -COPY bin/* /opt/docker/ -ADD entrypoint.sh /entrypoint.sh - -RUN bash /opt/docker/install.sh -RUN bash /opt/docker/customization.sh - -COPY conf/php.ini /etc/php5/mods-available/docker-boilerplate.ini - -EXPOSE 9000 - -VOLUME /docker/ -WORKDIR /docker/code/ - -ENTRYPOINT ["/entrypoint.sh"] -CMD ["supervisord"] diff --git a/docker/main/ubuntu-15.10/bin/customization.sh b/docker/main/ubuntu-15.10/bin/customization.sh deleted file mode 100644 index 861b916..0000000 --- a/docker/main/ubuntu-15.10/bin/customization.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -export DEBIAN_FRONTEND="noninteractive" - -## add your custom stuff here diff --git a/docker/main/ubuntu-15.10/bin/dnsmasq.sh b/docker/main/ubuntu-15.10/bin/dnsmasq.sh deleted file mode 100644 index 8da4dfa..0000000 --- a/docker/main/ubuntu-15.10/bin/dnsmasq.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash - -sleep 5 - -## backup original resolv.conf -if [ ! -f "/opt/docker/.resolv.conf" ]; then - ## backup original file - cp /etc/resolv.conf /opt/docker/.resolv.conf - - ## Copy resolv.conf for dnsmasq (default resolver) - cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf -fi - -## Restore original resolvconf -function restore_resolvconf() { - ## restore original resolv.conf - cp /opt/docker/.resolv.conf /etc/resolv.conf -} - -## Start and configure dnsmasq -function dnsmasq_start() { - echo "[dnsmasq] Found Webserver IP: $1" - - restore_resolvconf - - ## clear dns file - echo > /etc/dnsmasq.d/development - - ## add IP for each domain (wildcard!) - for DOMAIN in $DNS_DOMAIN; do - echo "address=/${DOMAIN}/${1}" >> /etc/dnsmasq.d/development - done - - ## set forward servers - cat /var/run/dnsmasq/resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward - - ## (re)start dnsmasq as DNS server - service dnsmasq restart - - ## set dnsmasq to main nameserver - echo "nameserver 127.0.0.1" > /etc/resolv.conf - - ## wait for 10 hours - sleep 10h -} - -## Fetch IP from services -if [ -f "/data/dns/web.ip" ]; then - ## Found WEB - dnsmasq_start "$(cat /data/dns/web.ip)" -elif [ -f "/data/dns/httpd.ip" ]; then - ## Found HTTPD (fallback) - dnsmasq_start "$(cat /data/dns/httpd.ip)" -elif [ -f "/data/dns/nginx.ip" ]; then - ## Found NGINX (fallback) - dnsmasq_start "$(cat /data/dns/nginx.ip)" -else - ## Found nothing, restore original resolvconf - restore_resolvconf - sleep 15 -fi - -exit 0 diff --git a/docker/main/ubuntu-15.10/bin/init-mysql.sh b/docker/main/ubuntu-15.10/bin/init-mysql.sh deleted file mode 100644 index 821754d..0000000 --- a/docker/main/ubuntu-15.10/bin/init-mysql.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -############################# -## Init MySQL -############################# - -echo "[client] -host=mysql -user=\"root\" -password=\"$MYSQL_ROOT_PASSWORD\" - -[mysql] -host=mysql -user=\"root\" -password=\"$MYSQL_ROOT_PASSWORD\" -database=\"$MYSQL_DATABASE\" -default-character-set=utf8 -local-infile=1 -show-warnings -auto-rehash -sigint-ignore -reconnect - -[mysqldump] -host=mysql -user=\"root\" -password=\"$MYSQL_ROOT_PASSWORD\" - -" | tee /root/.my.cnf > /home/.my.cnf diff --git a/docker/main/ubuntu-15.10/bin/init-php.sh b/docker/main/ubuntu-15.10/bin/init-php.sh deleted file mode 100644 index 2f28aa6..0000000 --- a/docker/main/ubuntu-15.10/bin/init-php.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash - -############################# -## Init PHP -############################# -echo " -date.timezone = ${PHP_TIMEZONE} -" >> /etc/php5/mods-available/docker-boilerplate.ini - -############################# -## Init PHP-FPM -############################# - -# Backup original -if [ ! -f "/opt/docker/.fpm-www.conf" ]; then - cp /etc/php5/fpm/pool.d/www.conf /opt/docker/.fpm-www.conf -fi - -## Remove old logs -rm -f -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log -touch -- /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log -chmod 666 /tmp/php.access.log /tmp/php.slow.log /tmp/php.error.log - -# Restore original -cp /opt/docker/.fpm-www.conf /etc/php5/fpm/pool.d/www.conf -sed -i "s@listen = /var/run/php5-fpm.sock@listen = 9000@" /etc/php5/fpm/pool.d/www.conf - -# Manipulate php-fpm configuration -echo " -; Server resource settings - -listen = 0.0.0.0:9000 - -pm.max_children = 10 -pm.start_servers = 2 -pm.min_spare_servers = 1 -pm.max_spare_servers = 3 - -catch_workers_output = yes - -access.format = \"%R - %u %t \\\"%m %r%Q%q\\\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d\" -access.log = /tmp/php.access.log -slowlog = /tmp/php.slow.log -request_slowlog_timeout = 30s - -php_admin_value[error_log] = /tmp/php.error.log -php_admin_flag[log_errors] = on - -env[TYPO3_CONTEXT] = ${TYPO3_CONTEXT} -env[FLOW_CONTEXT] = ${FLOW_CONTEXT} -env[FLOW_REWRITEURLS] = ${FLOW_REWRITEURLS} -" >> /etc/php5/fpm/pool.d/www.conf diff --git a/docker/main/ubuntu-15.10/bin/init-ssmtp.sh b/docker/main/ubuntu-15.10/bin/init-ssmtp.sh deleted file mode 100644 index 4bf8972..0000000 --- a/docker/main/ubuntu-15.10/bin/init-ssmtp.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -############################# -## Init SSMTP -############################# - -sed -i "s/mailhub=.*/mailhub=${MAIL_GATEWAY}/" /etc/ssmtp/ssmtp.conf -sed -i "s/#FromLineOverride=.*/FromLineOverride=YES/" /etc/ssmtp/ssmtp.conf diff --git a/docker/main/ubuntu-15.10/bin/init-system.sh b/docker/main/ubuntu-15.10/bin/init-system.sh deleted file mode 100644 index fb98e9c..0000000 --- a/docker/main/ubuntu-15.10/bin/init-system.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -## Set uid/gid for www-data user -usermod --uid "${EFFECTIVE_UID}" --shell /bin/bash --home /home www-data > /dev/null -groupmod --gid "${EFFECTIVE_GID}" www-data > /dev/null diff --git a/docker/main/ubuntu-15.10/bin/install.sh b/docker/main/ubuntu-15.10/bin/install.sh deleted file mode 100644 index 8c446a1..0000000 --- a/docker/main/ubuntu-15.10/bin/install.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -export DEBIAN_FRONTEND="noninteractive" - -############################# -# Modify user -############################# - -usermod --shell /bin/bash --home /home www-data -chown www-data:www-data /home - -## Fix terminal -echo 'export TERM="xterm-color"' >> /root/.bashrc -echo 'export TERM="xterm-color"' >> /home/.bashrc - -############################# -# Common tasks -############################# - -mkdir -p /opt/docker/ \ - /var/log/supervisor - -############################# -# Install packages -############################# - -apt-get update - -apt-get install -y \ - sudo \ - supervisor \ - dnsmasq \ - ssmtp \ - php5-cli \ - php5-fpm \ - php5-json \ - php5-intl \ - php5-curl \ - php5-mysqlnd \ - php5-xdebug \ - php5-memcached \ - php5-mcrypt \ - php5-gd \ - php5-sqlite \ - php5-xmlrpc \ - php5-xsl \ - php5-geoip \ - php5-ldap \ - php5-memcache \ - php5-memcached - -apt-get install -y \ - graphicsmagick \ - zip \ - unzip \ - wget \ - curl \ - mysql-client \ - moreutils \ - dnsutils - -############################# -# Generate locales -############################# - -cat /opt/docker/locale.conf >> /var/lib/locales/supported.d/local -locale-gen - -############################# -# Enable php modules -############################# -## custom config -touch /etc/php5/mods-available/docker-boilerplate.ini -php5enmod docker-boilerplate - -# enable ext mcrypt -php5enmod mcrypt - -############################# -# Composer -############################# - -curl -sS https://getcomposer.org/installer | php -mv composer.phar /usr/local/bin/composer - - -############################# -# Dnsmasq -############################# - -## Fix dnsmasqd -echo " -user=root -conf-dir=/etc/dnsmasq.d -" >> /etc/dnsmasq.conf - -############################# -# Cleanup -############################# - -apt-get clean -y -apt-get autoclean -y diff --git a/docker/main/ubuntu-15.10/bin/logwatch.sh b/docker/main/ubuntu-15.10/bin/logwatch.sh deleted file mode 100644 index 729e0ca..0000000 --- a/docker/main/ubuntu-15.10/bin/logwatch.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -tail -F --quiet $2 | sed --unbuffered -e "s/^/\[$1\] /" diff --git a/docker/main/ubuntu-15.10/conf/locale.conf b/docker/main/ubuntu-15.10/conf/locale.conf deleted file mode 100644 index 7410061..0000000 --- a/docker/main/ubuntu-15.10/conf/locale.conf +++ /dev/null @@ -1,11 +0,0 @@ -en_GB.UTF-8 UTF-8 -en_GB ISO-8859-1 -en_GB.ISO-8859-15 ISO-8859-15 - -en_US.UTF-8 UTF-8 -en_US ISO-8859-1 -en_US.ISO-8859-15 ISO-8859-15 - -de_DE.UTF-8 UTF-8 -de_DE ISO-8859-1 -de_DE@euro ISO-8859-15 \ No newline at end of file diff --git a/docker/main/ubuntu-15.10/conf/php.ini b/docker/main/ubuntu-15.10/conf/php.ini deleted file mode 100644 index b3b39c5..0000000 --- a/docker/main/ubuntu-15.10/conf/php.ini +++ /dev/null @@ -1,29 +0,0 @@ -; this file will overwrite default php.ini settings - -short_open_tag = On -variables_order = 'GPCS' -request_order = 'GP' - -allow_url_fopen = On -allow_url_include = Off - -memory_limit = 512M -max_execution_time = 900 -max_input_time = 300 -post_max_size = 50M -upload_max_filesize = 50M - -; timezone will be overwritten in startup, use docker-env.yml -date.timezone = Europe/Berlin - -mysql.default_host = mysql -mysqli.default_host = mysql - -xdebug.remote_enable = 1 -xdebug.remote_connect_back = on -xdebug.idekey = "docker" -xdebug.cli_color = 1 -xdebug.max_nesting_level = 1000 -xdebug.profiler_enable_trigger = 1 -xdebug.profiler_output_dir = '/tmp/debug/' -xhprof.output_dir = '/tmp/debug/' diff --git a/docker/main/ubuntu-15.10/conf/supervisord.conf b/docker/main/ubuntu-15.10/conf/supervisord.conf deleted file mode 100644 index d9802c9..0000000 --- a/docker/main/ubuntu-15.10/conf/supervisord.conf +++ /dev/null @@ -1,47 +0,0 @@ -[supervisord] -nodaemon=true - -[program:php-fpm] -command = /usr/sbin/php5-fpm --nodaemonize -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:dnsmasq] -command = bash /opt/docker/dnsmasq.sh -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:php-log-access] -command = bash /opt/docker/logwatch.sh php:access /tmp/php.access.log -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:php-log-slow] -command = bash /opt/docker/logwatch.sh php:slow /tmp/php.slow.log -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:php-log-error] -command = bash /opt/docker/logwatch.sh php:error /tmp/php.error.log -autostart = true -autorestart = true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 diff --git a/docker/main/ubuntu-15.10/entrypoint.sh b/docker/main/ubuntu-15.10/entrypoint.sh deleted file mode 100755 index 838c922..0000000 --- a/docker/main/ubuntu-15.10/entrypoint.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -set -e - -## Init system -source /opt/docker/init-system.sh - -## Init MySQL (client) -source /opt/docker/init-mysql.sh - -## Init SSMTP -source /opt/docker/init-ssmtp.sh - -## Init PHP and PHP-FPM -source /opt/docker/init-php.sh - -############################# -## COMMAND -############################# - -case "$1" in - - ## Supervisord (start daemons) - supervisord) - ## Register IP - ETH0_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') - mkdir -p /data/dns/ - chmod 777 /data/dns/ - echo "${ETH0_IP}" > /data/dns/main.ip - echo "${ETH0_IP} main main_1" > /data/dns/main.hosts - - ## Start services - exec supervisord - ;; - - ## Root shell - root) - if [ "$#" -eq 1 ]; then - ## No command, fall back to shell - exec bash - else - ## Exec root command - shift - exec "$@" - fi - ;; - - ## Defined cli script - cli) - if [ -n "${CLI_SCRIPT}" ]; then - shift - exec sudo -H -E -u "${CLI_USER}" ${CLI_SCRIPT} "$@" - else - echo "[ERROR] No CLI_SCRIPT in docker-env.yml defined" - exit 1 - fi - ;; - - ## All other commands - *) - ## Execute cmd - exec sudo -H -E -u "${CLI_USER}" "$@" - ;; -esac diff --git a/docker/main/ubuntu-15.10/htdocs/.gitkeep b/docker/main/ubuntu-15.10/htdocs/.gitkeep deleted file mode 100644 index e69de29..0000000 From be163ddfd2e1f2d4d7236cac3d8db11d012805c6 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sun, 12 Jul 2015 00:02:06 +0200 Subject: [PATCH 27/66] Added package net-tools --- docker/main/ubuntu/provision/roles/common/tasks/packages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/main/ubuntu/provision/roles/common/tasks/packages.yml b/docker/main/ubuntu/provision/roles/common/tasks/packages.yml index 24a7aa0..cf6259c 100644 --- a/docker/main/ubuntu/provision/roles/common/tasks/packages.yml +++ b/docker/main/ubuntu/provision/roles/common/tasks/packages.yml @@ -14,6 +14,7 @@ # Networking tools - wget - curl + - net-tools # Utils - moreutils - dnsutils \ No newline at end of file From 819c08da426627cc8fb6ab060b3ea822347a01e7 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sun, 12 Jul 2015 16:12:55 +0200 Subject: [PATCH 28/66] Added prebuild docker image support --- docker/main/centos/Dockerfile | 15 +++++++--- docker/main/centos/bin/bootstrap.sh | 28 +++++++++---------- .../provision/roles/common/tasks/packages.yml | 2 +- .../roles/dnsmasqd/tasks/install.yml | 2 +- .../provision/roles/mysql/tasks/install.yml | 2 +- .../provision/roles/php/tasks/install.yml | 2 +- .../provision/roles/ssmtp/tasks/install.yml | 2 +- .../roles/supervisord/tasks/install.yml | 2 +- docker/main/ubuntu/Dockerfile | 24 +++++++++++----- docker/main/ubuntu/bin/bootstrap.sh | 27 ++++++++++-------- .../provision/roles/common/tasks/packages.yml | 2 +- .../roles/dnsmasqd/tasks/install.yml | 2 +- .../provision/roles/mysql/tasks/install.yml | 2 +- .../provision/roles/php/tasks/install.yml | 2 +- .../provision/roles/ssmtp/tasks/install.yml | 2 +- .../roles/supervisord/tasks/install.yml | 2 +- documentation/DOCKER-INFO.md | 4 +-- 17 files changed, 71 insertions(+), 51 deletions(-) diff --git a/docker/main/centos/Dockerfile b/docker/main/centos/Dockerfile index a13c3c4..e6e1c4c 100644 --- a/docker/main/centos/Dockerfile +++ b/docker/main/centos/Dockerfile @@ -1,11 +1,18 @@ -#+++++++++++++++++++++++++++ +#++++++++++++++++++++++++++++++++++++++ # Centos PHP Docker container +#++++++++++++++++++++++++++++++++++++++ # -# centos:7 - PHP 5.4 +# Prebuild images: # -#+++++++++++++++++++++++++++ +# mblaschke/php-boilerplate:centos-7 +# +# Official images: +# +# centos:7 - PHP 5.4 +# +#++++++++++++++++++++++++++++++++++++++ -FROM centos:7 +FROM mblaschke/php-boilerplate:centos-7 ENV PATH /opt/ansible/bin:/bin:/usr/bin:/sbin:/usr/sbin ENV PYTHONPATH /opt/ansible/lib diff --git a/docker/main/centos/bin/bootstrap.sh b/docker/main/centos/bin/bootstrap.sh index 51d7f2e..dd618db 100644 --- a/docker/main/centos/bin/bootstrap.sh +++ b/docker/main/centos/bin/bootstrap.sh @@ -5,18 +5,18 @@ set -o errtrace # trace ERR through 'time command' and other functions set -o nounset ## set -u : exit the script if you try to use an uninitialised variable set -o errexit ## set -e : exit the script if any statement returns a non-true return value -yum clean all -yum -y install \ - epel-release \ - PyYAML \ - python-jinja2 \ - python-httplib2 \ - python-keyczar \ - python-paramiko \ - python-setuptools \ - git \ - python-pip +if [ ! -d '/opt/ansible/' ]; then + yum clean all + yum -y install \ + epel-release \ + PyYAML \ + python-jinja2 \ + python-httplib2 \ + python-keyczar \ + python-paramiko \ + python-setuptools \ + git \ + python-pip -git clone http://github.com/ansible/ansible.git /opt/ansible -cd /opt/ansible -git submodule update --init \ No newline at end of file + git clone --recursive http://github.com/ansible/ansible.git /opt/ansible +fi \ No newline at end of file diff --git a/docker/main/centos/provision/roles/common/tasks/packages.yml b/docker/main/centos/provision/roles/common/tasks/packages.yml index 9d15228..110fb8b 100644 --- a/docker/main/centos/provision/roles/common/tasks/packages.yml +++ b/docker/main/centos/provision/roles/common/tasks/packages.yml @@ -1,7 +1,7 @@ - name: Install default packages yum: name: '{{ item }}' - state: latest + state: present with_items: # System tools - sudo diff --git a/docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml index cf1d145..74a58cb 100644 --- a/docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml +++ b/docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml @@ -1,7 +1,7 @@ - name: Install dnsmasqd yum: name: '{{ item }}' - state: latest + state: present with_items: - dnsmasq diff --git a/docker/main/centos/provision/roles/mysql/tasks/install.yml b/docker/main/centos/provision/roles/mysql/tasks/install.yml index db441af..39037a1 100644 --- a/docker/main/centos/provision/roles/mysql/tasks/install.yml +++ b/docker/main/centos/provision/roles/mysql/tasks/install.yml @@ -1,6 +1,6 @@ - name: Install mysql client yum: name: '{{ item }}' - state: latest + state: present with_items: - mysql \ No newline at end of file diff --git a/docker/main/centos/provision/roles/php/tasks/install.yml b/docker/main/centos/provision/roles/php/tasks/install.yml index b975d2e..db5c022 100644 --- a/docker/main/centos/provision/roles/php/tasks/install.yml +++ b/docker/main/centos/provision/roles/php/tasks/install.yml @@ -1,7 +1,7 @@ - name: Install php yum: name: '{{ item }}' - state: latest + state: present with_items: - php-cli - php-fpm diff --git a/docker/main/centos/provision/roles/ssmtp/tasks/install.yml b/docker/main/centos/provision/roles/ssmtp/tasks/install.yml index 990d2c2..c9136a9 100644 --- a/docker/main/centos/provision/roles/ssmtp/tasks/install.yml +++ b/docker/main/centos/provision/roles/ssmtp/tasks/install.yml @@ -1,6 +1,6 @@ - name: Install ssmtp yum: name: '{{ item }}' - state: latest + state: present with_items: - ssmtp diff --git a/docker/main/centos/provision/roles/supervisord/tasks/install.yml b/docker/main/centos/provision/roles/supervisord/tasks/install.yml index 5e38b5f..464ce4b 100644 --- a/docker/main/centos/provision/roles/supervisord/tasks/install.yml +++ b/docker/main/centos/provision/roles/supervisord/tasks/install.yml @@ -1,6 +1,6 @@ - name: Install supervisor yum: name: '{{ item }}' - state: latest + state: present with_items: - supervisor diff --git a/docker/main/ubuntu/Dockerfile b/docker/main/ubuntu/Dockerfile index 247ac43..96a749c 100644 --- a/docker/main/ubuntu/Dockerfile +++ b/docker/main/ubuntu/Dockerfile @@ -1,14 +1,24 @@ -#+++++++++++++++++++++++++++ +#++++++++++++++++++++++++++++++++++++++ # Ubuntu PHP Docker container +#++++++++++++++++++++++++++++++++++++++ # -# ubuntu:12.04 - PHP 5.3, LTS (precise) -# ubuntu:14.04 - PHP 5.5, LTS (trusty) -# ubuntu:15.10 - PHP 5.6 (vivid) -# ubuntu:15.10 - PHP 5.6, LTS (wily) +# Prebuild images: # -#+++++++++++++++++++++++++++ +# mblaschke/php-boilerplate:ubuntu-12.04 +# mblaschke/php-boilerplate:ubuntu-14.04 +# mblaschke/php-boilerplate:ubuntu-15.04 +# mblaschke/php-boilerplate:ubuntu-15.10 +# +# Official images: +# +# ubuntu:12.04 - PHP 5.3, LTS (precise) +# ubuntu:14.04 - PHP 5.5, LTS (trusty) +# ubuntu:15.04 - PHP 5.6 (vivid) +# ubuntu:15.10 - PHP 5.6 (wily) +# +#++++++++++++++++++++++++++++++++++++++ -FROM ubuntu:14.04 +FROM mblaschke/php-boilerplate:ubuntu-14.04 # Ensure UTF-8 RUN locale-gen en_US.UTF-8 diff --git a/docker/main/ubuntu/bin/bootstrap.sh b/docker/main/ubuntu/bin/bootstrap.sh index 219992d..a8060f6 100644 --- a/docker/main/ubuntu/bin/bootstrap.sh +++ b/docker/main/ubuntu/bin/bootstrap.sh @@ -10,20 +10,23 @@ export DEBIAN_FRONTEND="noninteractive" # workaround for slow/freezing apt inside docker(?) echo 'Acquire::http::Pipeline-Depth "0";' >> /etc/apt/apt.conf.d/00no-pipeline -# install apt-add-repository if needed -if [ -z "`which apt-add-repository`" ]; then +if [ -z "`which ansible`" ]; then + # install apt-add-repository if needed + if [ -z "`which apt-add-repository`" ]; then - apt-get update -q - apt-get install -y --no-install-recommends lsb-release + apt-get update -q + apt-get install -y --no-install-recommends lsb-release - if [ "`lsb_release -r -s`" = '12.04' ]; then - apt-get install -y python-software-properties - else - apt-get install -y software-properties-common + if [ "`lsb_release -r -s`" = '12.04' ]; then + apt-get install -y python-software-properties + else + apt-get install -y software-properties-common + fi fi -fi -apt-add-repository ppa:ansible/ansible -apt-get update -q -apt-get install -y ansible python-apt aptitude \ No newline at end of file + # Register and install ansible + apt-add-repository ppa:ansible/ansible + apt-get update -q + apt-get install -y ansible python-apt aptitude +fi \ No newline at end of file diff --git a/docker/main/ubuntu/provision/roles/common/tasks/packages.yml b/docker/main/ubuntu/provision/roles/common/tasks/packages.yml index cf6259c..4058c01 100644 --- a/docker/main/ubuntu/provision/roles/common/tasks/packages.yml +++ b/docker/main/ubuntu/provision/roles/common/tasks/packages.yml @@ -1,7 +1,7 @@ - name: Install default packages apt: name: '{{ item }}' - state: latest + state: present with_items: # System tools - sudo diff --git a/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml index 4575fba..b09159e 100644 --- a/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml @@ -1,7 +1,7 @@ - name: Install dnsmasqd apt: name: '{{ item }}' - state: latest + state: present with_items: - dnsmasq diff --git a/docker/main/ubuntu/provision/roles/mysql/tasks/install.yml b/docker/main/ubuntu/provision/roles/mysql/tasks/install.yml index 9770e60..4a79cd3 100644 --- a/docker/main/ubuntu/provision/roles/mysql/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/mysql/tasks/install.yml @@ -1,6 +1,6 @@ - name: Install mysql client apt: name: '{{ item }}' - state: latest + state: present with_items: - mysql-client \ No newline at end of file diff --git a/docker/main/ubuntu/provision/roles/php/tasks/install.yml b/docker/main/ubuntu/provision/roles/php/tasks/install.yml index 5532af5..79aa278 100644 --- a/docker/main/ubuntu/provision/roles/php/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/php/tasks/install.yml @@ -1,7 +1,7 @@ - name: Install php apt: name: '{{ item }}' - state: latest + state: present with_items: - php5-cli - php5-fpm diff --git a/docker/main/ubuntu/provision/roles/ssmtp/tasks/install.yml b/docker/main/ubuntu/provision/roles/ssmtp/tasks/install.yml index ef86799..9e20fc6 100644 --- a/docker/main/ubuntu/provision/roles/ssmtp/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/ssmtp/tasks/install.yml @@ -1,6 +1,6 @@ - name: Install ssmtp apt: name: '{{ item }}' - state: latest + state: present with_items: - ssmtp diff --git a/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml b/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml index 4d28817..891a714 100644 --- a/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml @@ -1,6 +1,6 @@ - name: Install supervisor apt: name: '{{ item }}' - state: latest + state: present with_items: - supervisor diff --git a/documentation/DOCKER-INFO.md b/documentation/DOCKER-INFO.md index 304f4c8..91dfe1b 100644 --- a/documentation/DOCKER-INFO.md +++ b/documentation/DOCKER-INFO.md @@ -23,8 +23,8 @@ This directory will be mounted under `/docker` in `main` and `web` container. ## Docker images Container | Source ------------------------- | ------------------------------- -main/ubuntu | [Ubuntu](https://registry.hub.docker.com/_/ubuntu/) *official* -main/centos | [CentOS](https://registry.hub.docker.com/_/centos/) *official* +main/ubuntu | [Ubuntu](https://registry.hub.docker.com/_/ubuntu/) *official* (prebuild available from https://registry.hub.docker.com/u/mblaschke/php-boilerplate/) +main/centos | [CentOS](https://registry.hub.docker.com/_/centos/) *official* (prebuild available from https://registry.hub.docker.com/u/mblaschke/php-boilerplate/) storage | [Ubuntu](https://registry.hub.docker.com/_/ubuntu/) *official* web | [Apache](https://registry.hub.docker.com/_/httpd/) *official* or [Nginx](https://registry.hub.docker.com/_/nginx/) *official* mysql | [MySQL](https://registry.hub.docker.com/_/mysql/) *official* From 0de1742e097ba52cf6924f84fa5ea81bcc58a4dd Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sun, 12 Jul 2015 18:54:04 +0200 Subject: [PATCH 29/66] Added imagemagick (ubuntu) --- docker/main/ubuntu/provision/roles/common/tasks/packages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/main/ubuntu/provision/roles/common/tasks/packages.yml b/docker/main/ubuntu/provision/roles/common/tasks/packages.yml index 4058c01..4e0dcb4 100644 --- a/docker/main/ubuntu/provision/roles/common/tasks/packages.yml +++ b/docker/main/ubuntu/provision/roles/common/tasks/packages.yml @@ -10,6 +10,7 @@ - unzip - bzip2 # Graphic tools + - imagemagick - graphicsmagick # Networking tools - wget From 5138ab1baeddc78101c3f33a7acd5f93409c1a56 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Sun, 12 Jul 2015 18:56:21 +0200 Subject: [PATCH 30/66] Updated changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d875b3d..bf8b402 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ TYPO3 Docker Boilerplate Changelog 4.0.0 - UPCOMING ----------------------- - Seperated TYPO3 Docker Boilerplate and PHP Docker Boilerplate +- Switched to Ansible provisioning (playbook) +- Added multiple Ubuntu versions +- Added CentOS +- Improved provisioning +- Added prebuilt Docker images 3.5.0 - 2015-06-23 ----------------------- From df3f2927f5fdc5d8336acf0d442b854a4e24d672 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Mon, 13 Jul 2015 13:13:58 +0200 Subject: [PATCH 31/66] Fixed supervisord log/pid file --- docker/main/centos/entrypoint.sh | 3 ++- docker/main/ubuntu/entrypoint.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docker/main/centos/entrypoint.sh b/docker/main/centos/entrypoint.sh index 8c0a3fe..aef20bc 100755 --- a/docker/main/centos/entrypoint.sh +++ b/docker/main/centos/entrypoint.sh @@ -19,7 +19,8 @@ case "$1" in echo "${ETH0_IP} main main_1" > /data/dns/main.hosts ## Start services - exec supervisord -c /opt/docker/conf/supervisord.conf + cd / + exec supervisord -c /opt/docker/conf/supervisord.conf --logfile /dev/null --pidfile /dev/null --user root ;; ## Root shell diff --git a/docker/main/ubuntu/entrypoint.sh b/docker/main/ubuntu/entrypoint.sh index 8c0a3fe..aef20bc 100755 --- a/docker/main/ubuntu/entrypoint.sh +++ b/docker/main/ubuntu/entrypoint.sh @@ -19,7 +19,8 @@ case "$1" in echo "${ETH0_IP} main main_1" > /data/dns/main.hosts ## Start services - exec supervisord -c /opt/docker/conf/supervisord.conf + cd / + exec supervisord -c /opt/docker/conf/supervisord.conf --logfile /dev/null --pidfile /dev/null --user root ;; ## Root shell From 13861024806ba4ff47085b9bf10d05a4054b15c6 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Mon, 13 Jul 2015 22:54:29 +0200 Subject: [PATCH 32/66] Styleguide --- docker/main/centos/Dockerfile | 22 +++++++++++----------- docker/main/ubuntu/Dockerfile | 22 +++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/docker/main/centos/Dockerfile b/docker/main/centos/Dockerfile index e6e1c4c..84d42d2 100644 --- a/docker/main/centos/Dockerfile +++ b/docker/main/centos/Dockerfile @@ -14,20 +14,20 @@ FROM mblaschke/php-boilerplate:centos-7 -ENV PATH /opt/ansible/bin:/bin:/usr/bin:/sbin:/usr/sbin -ENV PYTHONPATH /opt/ansible/lib -ENV ANSIBLE_LIBRARY /opt/ansible/library +ENV PATH /opt/ansible/bin:/bin:/usr/bin:/sbin:/usr/sbin +ENV PYTHONPATH /opt/ansible/lib +ENV ANSIBLE_LIBRARY /opt/ansible/library ## # Bootstrap ## -COPY conf/locale.conf /opt/docker/locale.conf -COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh -COPY bin/provision.sh /opt/docker/bin/provision.sh -COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh -COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh -COPY provision /opt/docker/provision/ +COPY conf/locale.conf /opt/docker/locale.conf +COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision /opt/docker/provision/ RUN bash /opt/docker/bin/bootstrap.sh RUN bash /opt/docker/bin/provision.sh bootstrap @@ -43,8 +43,8 @@ RUN bash /opt/docker/bin/customization.sh # Config ## -COPY entrypoint.sh /entrypoint.sh -COPY conf /opt/docker/conf/ +COPY entrypoint.sh /entrypoint.sh +COPY conf /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/ubuntu/Dockerfile b/docker/main/ubuntu/Dockerfile index 96a749c..bea9d49 100644 --- a/docker/main/ubuntu/Dockerfile +++ b/docker/main/ubuntu/Dockerfile @@ -21,20 +21,20 @@ FROM mblaschke/php-boilerplate:ubuntu-14.04 # Ensure UTF-8 -RUN locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LC_ALL en_US.UTF-8 +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 ## # Bootstrap ## -COPY conf/locale.conf /opt/docker/locale.conf -COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh -COPY bin/provision.sh /opt/docker/bin/provision.sh -COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh -COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh -COPY provision /opt/docker/provision/ +COPY conf/locale.conf /opt/docker/locale.conf +COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision /opt/docker/provision/ RUN bash /opt/docker/bin/bootstrap.sh RUN bash /opt/docker/bin/provision.sh bootstrap @@ -50,8 +50,8 @@ RUN bash /opt/docker/bin/customization.sh # Config ## -COPY entrypoint.sh /entrypoint.sh -COPY conf /opt/docker/conf/ +COPY entrypoint.sh /entrypoint.sh +COPY conf /opt/docker/conf/ EXPOSE 9000 From 0ffb4d2227c7a46780a4049d49de1ecc53d28717 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Tue, 14 Jul 2015 19:44:55 +0200 Subject: [PATCH 33/66] Refactoring # Conflicts: # README.md # docker-compose.yml # docker-env.yml # docker/main/ubuntu/provision/variables.yml --- docker-compose.yml | 12 +++++------- docker-env.yml | 5 ----- docker/elasticsearch/Dockerfile | 11 +++++++++++ docker/mail/Dockerfile | 11 +++++++++++ docker/main/centos/Dockerfile | 1 + docker/main/centos/conf/php.ini | 9 +++++++++ docker/main/ubuntu/Dockerfile | 1 + docker/main/ubuntu/conf/php.ini | 9 +++++++++ docker/memcached/Dockerfile | 11 +++++++++++ docker/mysql/Dockerfile | 21 ++++++++++++++++++--- docker/nginx/Dockerfile | 13 ------------- docker/postgres/Dockerfile | 11 +++++++++++ docker/redis/Dockerfile | 11 +++++++++++ docker/solr/Dockerfile | 11 +++++++++++ docker/storage/Dockerfile | 11 +++++++++++ docker/vsftpd/Dockerfile | 11 +++++++++++ docker/{ => web}/httpd/Dockerfile | 11 +++++++++++ docker/{ => web}/httpd/conf/vhost.conf | 0 docker/{ => web}/httpd/entrypoint.sh | 0 docker/{ => web}/httpd/ssl/server.crt | 0 docker/{ => web}/httpd/ssl/server.csr | 0 docker/{ => web}/httpd/ssl/server.key | 0 docker/web/nginx/Dockerfile | 24 ++++++++++++++++++++++++ docker/{ => web}/nginx/conf/vhost.conf | 0 docker/{ => web}/nginx/entrypoint.sh | 0 docker/{ => web}/nginx/ssl/server.crt | 0 docker/{ => web}/nginx/ssl/server.csr | 0 docker/{ => web}/nginx/ssl/server.key | 0 28 files changed, 166 insertions(+), 28 deletions(-) delete mode 100644 docker/nginx/Dockerfile rename docker/{ => web}/httpd/Dockerfile (53%) rename docker/{ => web}/httpd/conf/vhost.conf (100%) rename docker/{ => web}/httpd/entrypoint.sh (100%) rename docker/{ => web}/httpd/ssl/server.crt (100%) rename docker/{ => web}/httpd/ssl/server.csr (100%) rename docker/{ => web}/httpd/ssl/server.key (100%) create mode 100644 docker/web/nginx/Dockerfile rename docker/{ => web}/nginx/conf/vhost.conf (100%) rename docker/{ => web}/nginx/entrypoint.sh (100%) rename docker/{ => web}/nginx/ssl/server.crt (100%) rename docker/{ => web}/nginx/ssl/server.csr (100%) rename docker/{ => web}/nginx/ssl/server.key (100%) diff --git a/docker-compose.yml b/docker-compose.yml index cb80a3c..f236698 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,8 +2,8 @@ # Main php container ####################################### main: - build: docker/main/ubuntu # dynamic ubuntu version (ansible provisioning) - #build: docker/main/centos # dynamic centos version (ansible provisioning) + build: docker/main/ubuntu # dynamic ubuntu version (ansible provisioning) + #build: docker/main/centos # dynamic centos version (ansible provisioning) links: - mysql #- postgres @@ -29,10 +29,8 @@ main: # Webserver ####################################### web: - # Apache HTTPD webserver - build: docker/httpd/ - # Nginx webserver - #build: docker/nginx/ + build: docker/web/httpd/ # Apache HTTPD webserver + #build: docker/web/nginx/ # Nginx ports: - 8000:80 - 8443:443 @@ -48,7 +46,7 @@ web: # MySQL server ####################################### mysql: - build: docker/mysql/ + build: docker/mysql/ # MySQL, MariaDB or PerconaDB ports: - 13306:3306 volumes_from: diff --git a/docker-env.yml b/docker-env.yml index 6351ec0..f57b483 100644 --- a/docker-env.yml +++ b/docker-env.yml @@ -14,11 +14,6 @@ DOCUMENT_ROOT=code/ DOCUMENT_INDEX=index.php CLI_SCRIPT=php typo3/cli_dispatch.phpsh -# SYMFONY FRAMEWORK -#DOCUMENT_ROOT=code/web/ -#DOCUMENT_INDEX=app_dev.php -#CLI_SCRIPT=php app/console - # NEOS or FLOW #DOCUMENT_ROOT=code/Web/ #DOCUMENT_INDEX=index.php diff --git a/docker/elasticsearch/Dockerfile b/docker/elasticsearch/Dockerfile index 1d6d195..9886c6f 100644 --- a/docker/elasticsearch/Dockerfile +++ b/docker/elasticsearch/Dockerfile @@ -1 +1,12 @@ +#++++++++++++++++++++++++++++++++++++++ +# Elasticsearch Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Official images: +# +# elasticsearch - official Elasticsaerch +# https://registry.hub.docker.com/u/library/elasticsearch/ +# +#++++++++++++++++++++++++++++++++++++++ + FROM elasticsearch diff --git a/docker/mail/Dockerfile b/docker/mail/Dockerfile index ff98445..3bf5d5b 100644 --- a/docker/mail/Dockerfile +++ b/docker/mail/Dockerfile @@ -1 +1,12 @@ +#++++++++++++++++++++++++++++++++++++++ +# Mailcatcher Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Images: +# +# schickling/mailcatcher +# https://registry.hub.docker.com/u/schickling/mailcatcher/ +# +#++++++++++++++++++++++++++++++++++++++ + FROM schickling/mailcatcher diff --git a/docker/main/centos/Dockerfile b/docker/main/centos/Dockerfile index 84d42d2..21b4b23 100644 --- a/docker/main/centos/Dockerfile +++ b/docker/main/centos/Dockerfile @@ -9,6 +9,7 @@ # Official images: # # centos:7 - PHP 5.4 +# https://registry.hub.docker.com/u/library/centos/ # #++++++++++++++++++++++++++++++++++++++ diff --git a/docker/main/centos/conf/php.ini b/docker/main/centos/conf/php.ini index b3b39c5..1cc0b98 100644 --- a/docker/main/centos/conf/php.ini +++ b/docker/main/centos/conf/php.ini @@ -19,6 +19,15 @@ date.timezone = Europe/Berlin mysql.default_host = mysql mysqli.default_host = mysql +; Zend OPCache +opcache.enable = 1 +opcache.memory_consumption = 128 +opcache.interned_strings_buffer = 8 +opcache.max_accelerated_files = 4000 +opcache.fast_shutdown = 1 +opcache.enable_cli = 1 + +; XDebug xdebug.remote_enable = 1 xdebug.remote_connect_back = on xdebug.idekey = "docker" diff --git a/docker/main/ubuntu/Dockerfile b/docker/main/ubuntu/Dockerfile index bea9d49..8e671ef 100644 --- a/docker/main/ubuntu/Dockerfile +++ b/docker/main/ubuntu/Dockerfile @@ -15,6 +15,7 @@ # ubuntu:14.04 - PHP 5.5, LTS (trusty) # ubuntu:15.04 - PHP 5.6 (vivid) # ubuntu:15.10 - PHP 5.6 (wily) +# https://registry.hub.docker.com/u/library/ubuntu/ # #++++++++++++++++++++++++++++++++++++++ diff --git a/docker/main/ubuntu/conf/php.ini b/docker/main/ubuntu/conf/php.ini index b3b39c5..1cc0b98 100644 --- a/docker/main/ubuntu/conf/php.ini +++ b/docker/main/ubuntu/conf/php.ini @@ -19,6 +19,15 @@ date.timezone = Europe/Berlin mysql.default_host = mysql mysqli.default_host = mysql +; Zend OPCache +opcache.enable = 1 +opcache.memory_consumption = 128 +opcache.interned_strings_buffer = 8 +opcache.max_accelerated_files = 4000 +opcache.fast_shutdown = 1 +opcache.enable_cli = 1 + +; XDebug xdebug.remote_enable = 1 xdebug.remote_connect_back = on xdebug.idekey = "docker" diff --git a/docker/memcached/Dockerfile b/docker/memcached/Dockerfile index bc5a340..3125e4b 100644 --- a/docker/memcached/Dockerfile +++ b/docker/memcached/Dockerfile @@ -1 +1,12 @@ +#++++++++++++++++++++++++++++++++++++++ +# Memcached Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Official images: +# +# memcached - official Memcached +# https://registry.hub.docker.com/u/library/memcached/ +# +#++++++++++++++++++++++++++++++++++++++ + FROM memcached \ No newline at end of file diff --git a/docker/mysql/Dockerfile b/docker/mysql/Dockerfile index 399261d..9388d28 100644 --- a/docker/mysql/Dockerfile +++ b/docker/mysql/Dockerfile @@ -1,5 +1,20 @@ +#++++++++++++++++++++++++++++++++++++++ +# MySQL Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Official images: +# +# mysql - official MySQL from Oracle +# https://registry.hub.docker.com/u/library/mysql/ +# +# mariadb - MariaDB (MySQL fork) from MariaDB Foundation +# https://registry.hub.docker.com/u/library/mariadb/ +# +# percona - PerconaDB (MySQL fork) from Percona +# https://registry.hub.docker.com/u/library/percona/ +# +#++++++++++++++++++++++++++++++++++++++ + FROM mysql:5.5 -#FROM mariadb:5.5 -#FROM percona:5.5 -ADD conf/mysql-docker.cnf /etc/mysql/conf.d/z99-docker.cnf \ No newline at end of file +ADD conf/mysql-docker.cnf /etc/mysql/conf.d/z99-docker.cnf diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile deleted file mode 100644 index f20d995..0000000 --- a/docker/nginx/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM nginx - -RUN apt-get update && apt-get install -y net-tools - -ADD conf/vhost.conf /opt/docker/vhost.conf -ADD ssl/* /etc/nginx/ssl/ -ADD entrypoint.sh /entrypoint.sh - -EXPOSE 80 -EXPOSE 8000 - -ENTRYPOINT ["/entrypoint.sh"] -CMD ["nginx"] diff --git a/docker/postgres/Dockerfile b/docker/postgres/Dockerfile index de887ed..8bf9b40 100644 --- a/docker/postgres/Dockerfile +++ b/docker/postgres/Dockerfile @@ -1 +1,12 @@ +#++++++++++++++++++++++++++++++++++++++ +# PostgreSQL Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Official images: +# +# postgres - official PostgreSQL +# https://registry.hub.docker.com/u/library/postgres/ +# +#++++++++++++++++++++++++++++++++++++++ + FROM postgres:9.4 diff --git a/docker/redis/Dockerfile b/docker/redis/Dockerfile index fff8490..6211807 100644 --- a/docker/redis/Dockerfile +++ b/docker/redis/Dockerfile @@ -1 +1,12 @@ +#++++++++++++++++++++++++++++++++++++++ +# Redis Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Official images: +# +# redis - official Redis +# https://registry.hub.docker.com/u/library/redis/ +# +#++++++++++++++++++++++++++++++++++++++ + FROM redis \ No newline at end of file diff --git a/docker/solr/Dockerfile b/docker/solr/Dockerfile index 6f6d8dc..f3659c0 100644 --- a/docker/solr/Dockerfile +++ b/docker/solr/Dockerfile @@ -1,3 +1,14 @@ +#++++++++++++++++++++++++++++++++++++++ +# Solr Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Images: +# +# guywithnose/solr +# https://registry.hub.docker.com/u/guywithnose/solr/ +# +#++++++++++++++++++++++++++++++++++++++ + FROM guywithnose/solr:4.9.0 ENV DEBIAN_FRONTEND noninteractive diff --git a/docker/storage/Dockerfile b/docker/storage/Dockerfile index c30902b..6a30d90 100644 --- a/docker/storage/Dockerfile +++ b/docker/storage/Dockerfile @@ -1,3 +1,14 @@ +#++++++++++++++++++++++++++++++++++++++ +# Storage Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Official images: +# +# ubuntu:14.04 - PHP 5.5, LTS (trusty) +# https://registry.hub.docker.com/u/library/ubuntu/ +# +#++++++++++++++++++++++++++++++++++++++ + FROM ubuntu:14.04 ADD entrypoint.sh /entrypoint.sh diff --git a/docker/vsftpd/Dockerfile b/docker/vsftpd/Dockerfile index e76a37c..100659d 100644 --- a/docker/vsftpd/Dockerfile +++ b/docker/vsftpd/Dockerfile @@ -1,3 +1,14 @@ +#++++++++++++++++++++++++++++++++++++++ +# VSFTP Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Official images: +# +# ubuntu:14.04 - PHP 5.5, LTS (trusty) +# https://registry.hub.docker.com/u/library/ubuntu/ +# +#++++++++++++++++++++++++++++++++++++++ + FROM ubuntu:14.04 ENV VSFTP_USER dev diff --git a/docker/httpd/Dockerfile b/docker/web/httpd/Dockerfile similarity index 53% rename from docker/httpd/Dockerfile rename to docker/web/httpd/Dockerfile index 14ada85..90193c1 100644 --- a/docker/httpd/Dockerfile +++ b/docker/web/httpd/Dockerfile @@ -1,3 +1,14 @@ +#++++++++++++++++++++++++++++++++++++++ +# HTTPD Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Official images: +# +# httpd:14.04 - Apache HTTPD +# https://registry.hub.docker.com/u/library/httpd/ +# +#++++++++++++++++++++++++++++++++++++++ + FROM httpd:2.4 RUN apt-get update && apt-get install -y net-tools diff --git a/docker/httpd/conf/vhost.conf b/docker/web/httpd/conf/vhost.conf similarity index 100% rename from docker/httpd/conf/vhost.conf rename to docker/web/httpd/conf/vhost.conf diff --git a/docker/httpd/entrypoint.sh b/docker/web/httpd/entrypoint.sh similarity index 100% rename from docker/httpd/entrypoint.sh rename to docker/web/httpd/entrypoint.sh diff --git a/docker/httpd/ssl/server.crt b/docker/web/httpd/ssl/server.crt similarity index 100% rename from docker/httpd/ssl/server.crt rename to docker/web/httpd/ssl/server.crt diff --git a/docker/httpd/ssl/server.csr b/docker/web/httpd/ssl/server.csr similarity index 100% rename from docker/httpd/ssl/server.csr rename to docker/web/httpd/ssl/server.csr diff --git a/docker/httpd/ssl/server.key b/docker/web/httpd/ssl/server.key similarity index 100% rename from docker/httpd/ssl/server.key rename to docker/web/httpd/ssl/server.key diff --git a/docker/web/nginx/Dockerfile b/docker/web/nginx/Dockerfile new file mode 100644 index 0000000..9926119 --- /dev/null +++ b/docker/web/nginx/Dockerfile @@ -0,0 +1,24 @@ +#++++++++++++++++++++++++++++++++++++++ +# Nginx Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Official images: +# +# nginx:14.04 - Nginx Webserver +# https://registry.hub.docker.com/u/library/nginx/ +# +#++++++++++++++++++++++++++++++++++++++ + +FROM nginx + +RUN apt-get update && apt-get install -y net-tools + +ADD conf/vhost.conf /opt/docker/vhost.conf +ADD ssl/* /etc/nginx/ssl/ +ADD entrypoint.sh /entrypoint.sh + +EXPOSE 80 +EXPOSE 8000 + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["nginx"] diff --git a/docker/nginx/conf/vhost.conf b/docker/web/nginx/conf/vhost.conf similarity index 100% rename from docker/nginx/conf/vhost.conf rename to docker/web/nginx/conf/vhost.conf diff --git a/docker/nginx/entrypoint.sh b/docker/web/nginx/entrypoint.sh similarity index 100% rename from docker/nginx/entrypoint.sh rename to docker/web/nginx/entrypoint.sh diff --git a/docker/nginx/ssl/server.crt b/docker/web/nginx/ssl/server.crt similarity index 100% rename from docker/nginx/ssl/server.crt rename to docker/web/nginx/ssl/server.crt diff --git a/docker/nginx/ssl/server.csr b/docker/web/nginx/ssl/server.csr similarity index 100% rename from docker/nginx/ssl/server.csr rename to docker/web/nginx/ssl/server.csr diff --git a/docker/nginx/ssl/server.key b/docker/web/nginx/ssl/server.key similarity index 100% rename from docker/nginx/ssl/server.key rename to docker/web/nginx/ssl/server.key From c8d7282add5fea3b22500e9013c7560c5e369e27 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Tue, 14 Jul 2015 19:51:55 +0200 Subject: [PATCH 34/66] Added ubuntu hhvm --- docker-compose.yml | 5 +- docker/main/ubuntu-hhvm/Dockerfile | 57 +++++++++++++ docker/main/ubuntu-hhvm/bin/bootstrap.sh | 32 +++++++ docker/main/ubuntu-hhvm/bin/customization.sh | 10 +++ docker/main/ubuntu-hhvm/bin/dnsmasq.sh | 63 ++++++++++++++ docker/main/ubuntu-hhvm/bin/logwatch.sh | 8 ++ docker/main/ubuntu-hhvm/bin/provision.sh | 19 +++++ docker/main/ubuntu-hhvm/conf/locale.conf | 11 +++ docker/main/ubuntu-hhvm/conf/php.ini | 38 +++++++++ docker/main/ubuntu-hhvm/conf/supervisord.conf | 47 +++++++++++ docker/main/ubuntu-hhvm/entrypoint.sh | 54 ++++++++++++ docker/main/ubuntu-hhvm/htdocs/.gitkeep | 0 docker/main/ubuntu-hhvm/provision/ansible.cfg | 0 docker/main/ubuntu-hhvm/provision/inventory | 1 + .../main/ubuntu-hhvm/provision/playbook.yml | 13 +++ .../provision/roles/common/tasks/main.yml | 7 ++ .../provision/roles/common/tasks/packages.yml | 21 +++++ .../provision/roles/common/tasks/update.yml | 5 ++ .../roles/dnsmasqd/tasks/install.yml | 16 ++++ .../provision/roles/dnsmasqd/tasks/main.yml | 3 + .../roles/finalize/tasks/cleanup.yml | 5 ++ .../provision/roles/finalize/tasks/main.yml | 3 + .../roles/hhvm/tasks/configuration.yml | 0 .../provision/roles/hhvm/tasks/install.yml | 30 +++++++ .../provision/roles/hhvm/tasks/main.yml | 7 ++ .../roles/locales/tasks/generate.yml | 5 ++ .../provision/roles/locales/tasks/main.yml | 3 + .../roles/mysql/tasks/configuration.yml | 15 ++++ .../provision/roles/mysql/tasks/install.yml | 6 ++ .../provision/roles/mysql/tasks/main.yml | 7 ++ .../provision/roles/mysql/templates/my.cnf.j2 | 21 +++++ .../roles/php/tasks/configuration.yml | 24 ++++++ .../provision/roles/php/tasks/install.yml | 83 +++++++++++++++++++ .../provision/roles/php/tasks/main.yml | 7 ++ .../roles/ssmtp/tasks/configuration.yml | 8 ++ .../provision/roles/ssmtp/tasks/install.yml | 6 ++ .../provision/roles/ssmtp/tasks/main.yml | 7 ++ .../roles/supervisord/tasks/install.yml | 6 ++ .../roles/supervisord/tasks/main.yml | 3 + .../provision/roles/users/tasks/main.yml | 3 + .../provision/roles/users/tasks/www-data.yml | 9 ++ .../main/ubuntu-hhvm/provision/variables.yml | 43 ++++++++++ 42 files changed, 709 insertions(+), 2 deletions(-) create mode 100644 docker/main/ubuntu-hhvm/Dockerfile create mode 100644 docker/main/ubuntu-hhvm/bin/bootstrap.sh create mode 100644 docker/main/ubuntu-hhvm/bin/customization.sh create mode 100644 docker/main/ubuntu-hhvm/bin/dnsmasq.sh create mode 100644 docker/main/ubuntu-hhvm/bin/logwatch.sh create mode 100644 docker/main/ubuntu-hhvm/bin/provision.sh create mode 100644 docker/main/ubuntu-hhvm/conf/locale.conf create mode 100644 docker/main/ubuntu-hhvm/conf/php.ini create mode 100644 docker/main/ubuntu-hhvm/conf/supervisord.conf create mode 100755 docker/main/ubuntu-hhvm/entrypoint.sh create mode 100644 docker/main/ubuntu-hhvm/htdocs/.gitkeep create mode 100644 docker/main/ubuntu-hhvm/provision/ansible.cfg create mode 100644 docker/main/ubuntu-hhvm/provision/inventory create mode 100755 docker/main/ubuntu-hhvm/provision/playbook.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/common/tasks/main.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/common/tasks/packages.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/common/tasks/update.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/install.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/main.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/cleanup.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/main.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/configuration.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/install.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/main.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/locales/tasks/generate.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/locales/tasks/main.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/configuration.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/install.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/main.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/mysql/templates/my.cnf.j2 create mode 100644 docker/main/ubuntu-hhvm/provision/roles/php/tasks/configuration.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/php/tasks/install.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/php/tasks/main.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/configuration.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/install.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/main.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/install.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/main.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/users/tasks/main.yml create mode 100644 docker/main/ubuntu-hhvm/provision/roles/users/tasks/www-data.yml create mode 100644 docker/main/ubuntu-hhvm/provision/variables.yml diff --git a/docker-compose.yml b/docker-compose.yml index f236698..db05d65 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,8 +2,9 @@ # Main php container ####################################### main: - build: docker/main/ubuntu # dynamic ubuntu version (ansible provisioning) - #build: docker/main/centos # dynamic centos version (ansible provisioning) + build: docker/main/ubuntu # dynamic ubuntu version (ansible provisioning) + #build: docker/main/centos # dynamic centos version (ansible provisioning) + #build: docker/main/ubuntu-hhvm # ubuntu lts with HHVM (ansible provisioning) links: - mysql #- postgres diff --git a/docker/main/ubuntu-hhvm/Dockerfile b/docker/main/ubuntu-hhvm/Dockerfile new file mode 100644 index 0000000..8eaafe6 --- /dev/null +++ b/docker/main/ubuntu-hhvm/Dockerfile @@ -0,0 +1,57 @@ +#++++++++++++++++++++++++++++++++++++++ +# Ubuntu PHP Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Prebuild images: +# +# mblaschke/php-boilerplate:ubuntu-14.04 +# +# Official images: +# +# ubuntu:14.04 - PHP 5.5, LTS (trusty) +# https://registry.hub.docker.com/u/library/ubuntu/ +# +#++++++++++++++++++++++++++++++++++++++ + +FROM mblaschke/php-boilerplate:ubuntu-14.04 + +# Ensure UTF-8 +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +## +# Bootstrap +## + +COPY conf/locale.conf /opt/docker/locale.conf +COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision /opt/docker/provision/ + +RUN bash /opt/docker/bin/bootstrap.sh +RUN bash /opt/docker/bin/provision.sh bootstrap + +## +# Customization +## + +COPY bin/customization.sh /opt/docker/bin/customization.sh +RUN bash /opt/docker/bin/customization.sh + +## +# Config +## + +COPY entrypoint.sh /entrypoint.sh +COPY conf /opt/docker/conf/ + +EXPOSE 9000 + +VOLUME /docker/ +WORKDIR /docker/code/ + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["supervisord"] diff --git a/docker/main/ubuntu-hhvm/bin/bootstrap.sh b/docker/main/ubuntu-hhvm/bin/bootstrap.sh new file mode 100644 index 0000000..a8060f6 --- /dev/null +++ b/docker/main/ubuntu-hhvm/bin/bootstrap.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export DEBIAN_FRONTEND="noninteractive" + +# workaround for slow/freezing apt inside docker(?) +echo 'Acquire::http::Pipeline-Depth "0";' >> /etc/apt/apt.conf.d/00no-pipeline + +if [ -z "`which ansible`" ]; then + # install apt-add-repository if needed + if [ -z "`which apt-add-repository`" ]; then + + apt-get update -q + apt-get install -y --no-install-recommends lsb-release + + + if [ "`lsb_release -r -s`" = '12.04' ]; then + apt-get install -y python-software-properties + else + apt-get install -y software-properties-common + fi + fi + + # Register and install ansible + apt-add-repository ppa:ansible/ansible + apt-get update -q + apt-get install -y ansible python-apt aptitude +fi \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/bin/customization.sh b/docker/main/ubuntu-hhvm/bin/customization.sh new file mode 100644 index 0000000..861b916 --- /dev/null +++ b/docker/main/ubuntu-hhvm/bin/customization.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export DEBIAN_FRONTEND="noninteractive" + +## add your custom stuff here diff --git a/docker/main/ubuntu-hhvm/bin/dnsmasq.sh b/docker/main/ubuntu-hhvm/bin/dnsmasq.sh new file mode 100644 index 0000000..ff75300 --- /dev/null +++ b/docker/main/ubuntu-hhvm/bin/dnsmasq.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +sleep 5 + +## backup original resolv.conf +if [ ! -f "/opt/docker/.resolv.conf" ]; then + ## backup original file + cp /etc/resolv.conf /opt/docker/.resolv.conf + + ## Copy resolv.conf for dnsmasq (default resolver) + cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf +fi + +## Restore original resolvconf +function restore_resolvconf() { + ## restore original resolv.conf + cp /opt/docker/.resolv.conf /etc/resolv.conf +} + +## Start and configure dnsmasq +function dnsmasq_start() { + echo "[dnsmasq] Found Webserver IP: $1" + + restore_resolvconf + + ## clear dns file + echo > /etc/dnsmasq.d/development + + ## add IP for each domain (wildcard!) + for DOMAIN in $DNS_DOMAIN; do + echo "address=/${DOMAIN}/${1}" >> /etc/dnsmasq.d/development + done + + ## set forward servers + cat /opt/docker/.resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward + + ## (re)start dnsmasq as DNS server + service dnsmasq restart + + ## set dnsmasq to main nameserver + echo "nameserver 127.0.0.1" > /etc/resolv.conf + + ## wait for 10 hours + sleep 10h +} + +## Fetch IP from services +if [ -f "/data/dns/web.ip" ]; then + ## Found WEB + dnsmasq_start "$(cat /data/dns/web.ip)" +elif [ -f "/data/dns/httpd.ip" ]; then + ## Found HTTPD (fallback) + dnsmasq_start "$(cat /data/dns/httpd.ip)" +elif [ -f "/data/dns/nginx.ip" ]; then + ## Found NGINX (fallback) + dnsmasq_start "$(cat /data/dns/nginx.ip)" +else + ## Found nothing, restore original resolvconf + restore_resolvconf + sleep 15 +fi + +exit 0 diff --git a/docker/main/ubuntu-hhvm/bin/logwatch.sh b/docker/main/ubuntu-hhvm/bin/logwatch.sh new file mode 100644 index 0000000..729e0ca --- /dev/null +++ b/docker/main/ubuntu-hhvm/bin/logwatch.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +tail -F --quiet $2 | sed --unbuffered -e "s/^/\[$1\] /" diff --git a/docker/main/ubuntu-hhvm/bin/provision.sh b/docker/main/ubuntu-hhvm/bin/provision.sh new file mode 100644 index 0000000..c9d06fc --- /dev/null +++ b/docker/main/ubuntu-hhvm/bin/provision.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o nounset ## set -u : exit the script if you try to use an uninitialised variable +set -o errexit ## set -e : exit the script if any statement returns a non-true return value + +export DEBIAN_FRONTEND="noninteractive" +export PYTHONUNBUFFERED=1 + +ANSIBLE_DIR='/opt/docker/provision' + +ANSIBLE_TAG="$1" + +# workaround if windows +chmod -x "$ANSIBLE_DIR/inventory" + +# run ansible +ansible-playbook "$ANSIBLE_DIR/playbook.yml" --inventory="$ANSIBLE_DIR/inventory" --tags="${ANSIBLE_TAG}" diff --git a/docker/main/ubuntu-hhvm/conf/locale.conf b/docker/main/ubuntu-hhvm/conf/locale.conf new file mode 100644 index 0000000..7410061 --- /dev/null +++ b/docker/main/ubuntu-hhvm/conf/locale.conf @@ -0,0 +1,11 @@ +en_GB.UTF-8 UTF-8 +en_GB ISO-8859-1 +en_GB.ISO-8859-15 ISO-8859-15 + +en_US.UTF-8 UTF-8 +en_US ISO-8859-1 +en_US.ISO-8859-15 ISO-8859-15 + +de_DE.UTF-8 UTF-8 +de_DE ISO-8859-1 +de_DE@euro ISO-8859-15 \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/conf/php.ini b/docker/main/ubuntu-hhvm/conf/php.ini new file mode 100644 index 0000000..1cc0b98 --- /dev/null +++ b/docker/main/ubuntu-hhvm/conf/php.ini @@ -0,0 +1,38 @@ +; this file will overwrite default php.ini settings + +short_open_tag = On +variables_order = 'GPCS' +request_order = 'GP' + +allow_url_fopen = On +allow_url_include = Off + +memory_limit = 512M +max_execution_time = 900 +max_input_time = 300 +post_max_size = 50M +upload_max_filesize = 50M + +; timezone will be overwritten in startup, use docker-env.yml +date.timezone = Europe/Berlin + +mysql.default_host = mysql +mysqli.default_host = mysql + +; Zend OPCache +opcache.enable = 1 +opcache.memory_consumption = 128 +opcache.interned_strings_buffer = 8 +opcache.max_accelerated_files = 4000 +opcache.fast_shutdown = 1 +opcache.enable_cli = 1 + +; XDebug +xdebug.remote_enable = 1 +xdebug.remote_connect_back = on +xdebug.idekey = "docker" +xdebug.cli_color = 1 +xdebug.max_nesting_level = 1000 +xdebug.profiler_enable_trigger = 1 +xdebug.profiler_output_dir = '/tmp/debug/' +xhprof.output_dir = '/tmp/debug/' diff --git a/docker/main/ubuntu-hhvm/conf/supervisord.conf b/docker/main/ubuntu-hhvm/conf/supervisord.conf new file mode 100644 index 0000000..910f873 --- /dev/null +++ b/docker/main/ubuntu-hhvm/conf/supervisord.conf @@ -0,0 +1,47 @@ +[supervisord] +nodaemon=true + +[program:php-fpm] +command = /usr/bin/hhvm --mode server -vServer.Type=fastcgi -vServer.Port=9000 +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:dnsmasq] +command = bash /opt/docker/bin/dnsmasq.sh +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-access] +command = bash /opt/docker/bin/logwatch.sh php:access /tmp/php.access.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-slow] +command = bash /opt/docker/bin/logwatch.sh php:slow /tmp/php.slow.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-log-error] +command = bash /opt/docker/bin/logwatch.sh php:error /tmp/php.error.log +autostart = true +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/docker/main/ubuntu-hhvm/entrypoint.sh b/docker/main/ubuntu-hhvm/entrypoint.sh new file mode 100755 index 0000000..aef20bc --- /dev/null +++ b/docker/main/ubuntu-hhvm/entrypoint.sh @@ -0,0 +1,54 @@ +#!/bin/bash +set -e + +bash /opt/docker/bin/provision.sh entrypoint + +############################# +## COMMAND +############################# + +case "$1" in + + ## Supervisord (start daemons) + supervisord) + ## Register IP + ETH0_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') + mkdir -p /data/dns/ + chmod 777 /data/dns/ + echo "${ETH0_IP}" > /data/dns/main.ip + echo "${ETH0_IP} main main_1" > /data/dns/main.hosts + + ## Start services + cd / + exec supervisord -c /opt/docker/conf/supervisord.conf --logfile /dev/null --pidfile /dev/null --user root + ;; + + ## Root shell + root) + if [ "$#" -eq 1 ]; then + ## No command, fall back to shell + exec bash + else + ## Exec root command + shift + exec "$@" + fi + ;; + + ## Defined cli script + cli) + if [ -n "${CLI_SCRIPT}" ]; then + shift + exec sudo -H -E -u "${CLI_USER}" ${CLI_SCRIPT} "$@" + else + echo "[ERROR] No CLI_SCRIPT in docker-env.yml defined" + exit 1 + fi + ;; + + ## All other commands + *) + ## Execute cmd + exec sudo -H -E -u "${CLI_USER}" "$@" + ;; +esac diff --git a/docker/main/ubuntu-hhvm/htdocs/.gitkeep b/docker/main/ubuntu-hhvm/htdocs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docker/main/ubuntu-hhvm/provision/ansible.cfg b/docker/main/ubuntu-hhvm/provision/ansible.cfg new file mode 100644 index 0000000..e69de29 diff --git a/docker/main/ubuntu-hhvm/provision/inventory b/docker/main/ubuntu-hhvm/provision/inventory new file mode 100644 index 0000000..00639f8 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/inventory @@ -0,0 +1 @@ +localhost ansible_connection=local \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/playbook.yml b/docker/main/ubuntu-hhvm/provision/playbook.yml new file mode 100755 index 0000000..2f7b1c2 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/playbook.yml @@ -0,0 +1,13 @@ +- hosts: all + vars_files: + - /opt/docker/provision/variables.yml + roles: + - common + - locales + - supervisord + - dnsmasqd + - ssmtp + - hhvm + - mysql + - users + - finalize diff --git a/docker/main/ubuntu-hhvm/provision/roles/common/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/common/tasks/main.yml new file mode 100644 index 0000000..5a308a2 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/common/tasks/main.yml @@ -0,0 +1,7 @@ +- include: update.yml + tags: + - bootstrap + +- include: packages.yml + tags: + - bootstrap diff --git a/docker/main/ubuntu-hhvm/provision/roles/common/tasks/packages.yml b/docker/main/ubuntu-hhvm/provision/roles/common/tasks/packages.yml new file mode 100644 index 0000000..4e0dcb4 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/common/tasks/packages.yml @@ -0,0 +1,21 @@ +- name: Install default packages + apt: + name: '{{ item }}' + state: present + with_items: + # System tools + - sudo + # Compression + - zip + - unzip + - bzip2 + # Graphic tools + - imagemagick + - graphicsmagick + # Networking tools + - wget + - curl + - net-tools + # Utils + - moreutils + - dnsutils \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/common/tasks/update.yml b/docker/main/ubuntu-hhvm/provision/roles/common/tasks/update.yml new file mode 100644 index 0000000..e74dcee --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/common/tasks/update.yml @@ -0,0 +1,5 @@ +- name: Update system + apt: update_cache=yes + +- name: Upgrade system + apt: upgrade=full \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/install.yml new file mode 100644 index 0000000..b09159e --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/install.yml @@ -0,0 +1,16 @@ +- name: Install dnsmasqd + apt: + name: '{{ item }}' + state: present + with_items: + - dnsmasq + +- name: Configure dnsmasq + lineinfile: + dest: /etc/dnsmasq.conf + regexp: '^[\s]*{{ item.key }}[\s]*=' + line: '{{ item.key }}={{ item.value }}' + with_items: + - { key: 'user', value: 'root' } + - { key: 'conf-dir', value: '/etc/dnsmasq.d' } + diff --git a/docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/main.yml new file mode 100644 index 0000000..e3418cb --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/main.yml @@ -0,0 +1,3 @@ +- include: install.yml + tags: + - bootstrap diff --git a/docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/cleanup.yml b/docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/cleanup.yml new file mode 100644 index 0000000..c1233fe --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/cleanup.yml @@ -0,0 +1,5 @@ +- name: Cleanup apt + command: apt-get clean -y + +- name: Cleanup apt + command: apt-get autoclean -y diff --git a/docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/main.yml new file mode 100644 index 0000000..bfb1442 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/main.yml @@ -0,0 +1,3 @@ +- include: cleanup.yml + tags: + - bootstrap diff --git a/docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/configuration.yml b/docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/configuration.yml new file mode 100644 index 0000000..e69de29 diff --git a/docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/install.yml b/docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/install.yml new file mode 100644 index 0000000..d122c1f --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/install.yml @@ -0,0 +1,30 @@ +- name: Install hhvm gpg key + apt_key: + url: http://dl.hhvm.com/conf/hhvm.gpg.key + state: present + +- name: Add hhvm deb repository + apt_repository: + repo: 'deb http://dl.hhvm.com/ubuntu trusty main' + state: present + +- name: Install hhvm packages + apt: + pkg: '{{ item }}' + state: latest + update_cache: yes + force: yes + with_items: + - hhvm-fastcgi + +- name: check hhvm path + shell: which hhvm + register: current_hhvm + ignore_errors: True + +- name: Symlink hhvm as php + file: + src: '{{ current_hhvm.stdout }}' + dest: /usr/bin/php + state: link + force: yes \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/main.yml new file mode 100644 index 0000000..35d0963 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/main.yml @@ -0,0 +1,7 @@ +- include: install.yml + tags: + - bootstrap + +- include: configuration.yml + tags: + - entrypoint diff --git a/docker/main/ubuntu-hhvm/provision/roles/locales/tasks/generate.yml b/docker/main/ubuntu-hhvm/provision/roles/locales/tasks/generate.yml new file mode 100644 index 0000000..21ffe74 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/locales/tasks/generate.yml @@ -0,0 +1,5 @@ +- name: Copy defined locales + raw: 'cat /opt/docker/locale.conf >> /var/lib/locales/supported.d/local' + +- name: Generate locales + command: locale-gen diff --git a/docker/main/ubuntu-hhvm/provision/roles/locales/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/locales/tasks/main.yml new file mode 100644 index 0000000..05aa97d --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/locales/tasks/main.yml @@ -0,0 +1,3 @@ +- include: generate.yml + tags: + - bootstrap diff --git a/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/configuration.yml b/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/configuration.yml new file mode 100644 index 0000000..4dbf3e3 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/configuration.yml @@ -0,0 +1,15 @@ +- name: Deploy root my.cnf + template: + src: my.cnf.j2 + dest: /root/.my.cnf + owner: root + group: root + mode: 0644 + +- name: Deploy user my.cnf + template: + src: my.cnf.j2 + dest: /home/.my.cnf + owner: www-data + group: www-data + mode: 0644 \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/install.yml b/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/install.yml new file mode 100644 index 0000000..4a79cd3 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/install.yml @@ -0,0 +1,6 @@ +- name: Install mysql client + apt: + name: '{{ item }}' + state: present + with_items: + - mysql-client \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/main.yml new file mode 100644 index 0000000..35d0963 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/main.yml @@ -0,0 +1,7 @@ +- include: install.yml + tags: + - bootstrap + +- include: configuration.yml + tags: + - entrypoint diff --git a/docker/main/ubuntu-hhvm/provision/roles/mysql/templates/my.cnf.j2 b/docker/main/ubuntu-hhvm/provision/roles/mysql/templates/my.cnf.j2 new file mode 100644 index 0000000..c0aaee8 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/mysql/templates/my.cnf.j2 @@ -0,0 +1,21 @@ +[client] +host=mysql +user="root" +password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" + +[mysql] +host=mysql +user="root" +password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" +database="{{ DOCKER.MYSQL_DATABASE }}" +default-character-set=utf8 +local-infile=1 +show-warnings +auto-rehash +sigint-ignore +reconnect + +[mysqldump] +host=mysql +user="root" +password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/php/tasks/configuration.yml b/docker/main/ubuntu-hhvm/provision/roles/php/tasks/configuration.yml new file mode 100644 index 0000000..7781690 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/php/tasks/configuration.yml @@ -0,0 +1,24 @@ +- name: Configure php-fpm (pool www.conf) + lineinfile: + dest: /etc/php5/fpm/pool.d/www.conf + regexp: '^{{ item.key }}[\s]*=' + line: '{{ item.key }} = {{ item.value }}' + with_items: + # Env + - { key: 'env[SYMFONY_ENV]', value: '{{ DOCKER.SYMFONY_ENV }}' } + - { key: 'env[SYMFONY_DEBUG]', value: '{{ DOCKER.SYMFONY_DEBUG }}' } + +- name: Configure php (docker php.ini) + lineinfile: + dest: /opt/docker/conf/php.ini + regexp: '^{{ item.key }}[\s]*=' + line: '{{ item.key }} = {{ item.value }}' + with_items: + - { key: 'date.timezone', value: '{{ DOCKER.PHP_TIMEZONE }}' } + +- name: Truncate log files + command: 'cp /dev/null {{ item }}' + with_items: + - '/tmp/php.slow.log' + - '/tmp/php.error.log' + - '/tmp/php.access.log' diff --git a/docker/main/ubuntu-hhvm/provision/roles/php/tasks/install.yml b/docker/main/ubuntu-hhvm/provision/roles/php/tasks/install.yml new file mode 100644 index 0000000..79aa278 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/php/tasks/install.yml @@ -0,0 +1,83 @@ +- name: Install php + apt: + name: '{{ item }}' + state: present + with_items: + - php5-cli + - php5-fpm + - php5-json + - php5-intl + - php5-curl + - php5-mysqlnd + - php5-xdebug + - php5-memcached + - php5-mcrypt + - php5-gd + - php5-sqlite + - php5-xmlrpc + - php5-xsl + - php5-geoip + - php5-ldap + - php5-memcache + - php5-memcached + - php5-imagick + +- name: Create /etc/php5/mods-available/ + file: + path: /etc/php5/mods-available/ + state: directory + mode: 0755 + +- name: Activate php config files (fpm) + file: + src: '{{ item.file }}' + dest: '/etc/php5/{{ item.category }}/conf.d/{{ item.target }}' + force: yes + state: link + with_items: + # PHP cli + - { category: 'cli', file: '/etc/php5/mods-available/mcrypt.ini', target: '20-mcrypt.ini' } + - { category: 'cli', file: '/opt/docker/conf/php.ini', target: '99-docker-boilerplate.ini' } + # PHP fpm + - { category: 'fpm', file: '/etc/php5/mods-available/mcrypt.ini', target: '20-mcrypt.ini' } + - { category: 'fpm', file: '/opt/docker/conf/php.ini', target: '99-docker-boilerplate.ini' } + +- name: Configure php-fpm (php-fpm.conf) + lineinfile: + dest: /etc/php5/fpm/php-fpm.conf + regexp: '^[\s;]*{{ item.key }}[\s]*=' + line: '{{ item.key }} = {{ item.value }}' + with_items: + - { key: 'daemonize', value: 'no' } + +- name: Configure php-fpm (pool www.conf) + lineinfile: + dest: /etc/php5/fpm/pool.d/www.conf + regexp: '^{{ item.key }}[\s]*=' + line: '{{ item.key }} = {{ item.value }}' + with_items: + # Networking + - { key: 'listen', value: '0.0.0.0:9000' } + # Process manager + - { key: 'pm.max_children', value: '15' } + - { key: 'pm.start_servers', value: '2' } + - { key: 'pm.min_spare_servers', value: '1' } + - { key: 'pm.max_spare_servers', value: '3' } + - { key: 'catch_workers_output', value: 'yes' } + # Logs + - { key: 'access.format', value: '"%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' } + - { key: 'access.log', value: '/tmp/php.access.log' } + - { key: 'slowlog', value: '/tmp/php.slow.log' } + - { key: 'request_slowlog_timeout', value: '30s' } + # PHP flags + - { key: 'php_admin_value[error_log]', value: '/tmp/php.error.log' } + - { key: 'php_admin_flag[log_errors]', value: 'on' } + +- name: Configure php-fpm (pool www.conf) + lineinfile: + dest: /etc/php-fpm.d/www.conf + regexp: '^{{ item.key }}[\s]*=' + state: absent + with_items: + # Networking + - { key: 'listen.allowed_clients' } \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/php/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/php/tasks/main.yml new file mode 100644 index 0000000..35d0963 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/php/tasks/main.yml @@ -0,0 +1,7 @@ +- include: install.yml + tags: + - bootstrap + +- include: configuration.yml + tags: + - entrypoint diff --git a/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/configuration.yml b/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/configuration.yml new file mode 100644 index 0000000..44e39b8 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/configuration.yml @@ -0,0 +1,8 @@ +- name: Setup ssmtp + lineinfile: + dest: /etc/ssmtp/ssmtp.conf + regexp: '^[\s]*{{ item.key }}[\s]*=' + line: '{{ item.key }}={{ item.value }}' + with_items: + - { key: 'mailhub', value: '{{ DOCKER.MAIL_GATEWAY }}' } + - { key: 'FromLineOverride', value: 'YES' } diff --git a/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/install.yml b/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/install.yml new file mode 100644 index 0000000..9e20fc6 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/install.yml @@ -0,0 +1,6 @@ +- name: Install ssmtp + apt: + name: '{{ item }}' + state: present + with_items: + - ssmtp diff --git a/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/main.yml new file mode 100644 index 0000000..35d0963 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/main.yml @@ -0,0 +1,7 @@ +- include: install.yml + tags: + - bootstrap + +- include: configuration.yml + tags: + - entrypoint diff --git a/docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/install.yml b/docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/install.yml new file mode 100644 index 0000000..891a714 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/install.yml @@ -0,0 +1,6 @@ +- name: Install supervisor + apt: + name: '{{ item }}' + state: present + with_items: + - supervisor diff --git a/docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/main.yml new file mode 100644 index 0000000..e3418cb --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/main.yml @@ -0,0 +1,3 @@ +- include: install.yml + tags: + - bootstrap diff --git a/docker/main/ubuntu-hhvm/provision/roles/users/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/users/tasks/main.yml new file mode 100644 index 0000000..f421097 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/users/tasks/main.yml @@ -0,0 +1,3 @@ +- include: www-data.yml + tags: + - entrypoint diff --git a/docker/main/ubuntu-hhvm/provision/roles/users/tasks/www-data.yml b/docker/main/ubuntu-hhvm/provision/roles/users/tasks/www-data.yml new file mode 100644 index 0000000..3f9bd9e --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/roles/users/tasks/www-data.yml @@ -0,0 +1,9 @@ +- group: + name: www-data + gid: "{{ DOCKER.EFFECTIVE_UID }}" + +- user: + name: www-data + uid: "{{ DOCKER.EFFECTIVE_GID }}" + shell: /bin/bash + home: /home diff --git a/docker/main/ubuntu-hhvm/provision/variables.yml b/docker/main/ubuntu-hhvm/provision/variables.yml new file mode 100644 index 0000000..ea63ce5 --- /dev/null +++ b/docker/main/ubuntu-hhvm/provision/variables.yml @@ -0,0 +1,43 @@ +--- + +DOCKER: + # System + EFFECTIVE_UID: "{{ lookup('env','EFFECTIVE_UID') }}" + EFFECTIVE_GID: "{{ lookup('env','EFFECTIVE_GID') }}" + CLI_USER: "{{ lookup('env','CLI_USER') }}" + CLI_SCRIPT: "{{ lookup('env','CLI_SCRIPT') }}" + + # http + DOCUMENT_ROOT: "{{ lookup('env','DOCUMENT_ROOT') }}" + DOCUMENT_INDEX: "{{ lookup('env','DOCUMENT_INDEX') }}" + + + # MySQL + MYSQL_ROOT_PASSWORD: "{{ lookup('env','MYSQL_ROOT_PASSWORD') }}" + MYSQL_USER: "{{ lookup('env','MYSQL_USER') }}" + MYSQL_PASSWORD: "{{ lookup('env','MYSQL_PASSWORD') }}" + MYSQL_DATABASE: "{{ lookup('env','MYSQL_DATABASE') }}" + + # PostgreSQL + POSTGRES_USER: "{{ lookup('env','POSTGRES_USER') }}" + POSTGRES_PASSWORD: "{{ lookup('env','POSTGRES_PASSWORD') }}" + + # FTP + FTP_USER: "{{ lookup('env','FTP_USER') }}" + FTP_PASSWORD: "{{ lookup('env','FTP_PASSWORD') }}" + FTP_PATH: "{{ lookup('env','FTP_PATH') }}" + + # Mail + MAIL_GATEWAY: "{{ lookup('env','MAIL_GATEWAY') }}" + + # PHP + PHP_TIMEZONE: "{{ lookup('env','PHP_TIMEZONE') }}" + + # DNS + DNS_DOMAIN: "{{ lookup('env','DNS_DOMAIN') }}" + + # Context + SYMFONY_ENV: "{{ lookup('env','SYMFONY_ENV') }}" + SYMFONY_DEBUG: "{{ lookup('env','SYMFONY_DEBUG') }}" + CAKE_ENV: "{{ lookup('env','CAKE_ENV') }}" + YII_ENVIRONMENT: "{{ lookup('env','YII_ENVIRONMENT') }}" From 84c23948bb05ee86e1ef02e01eb89b446f0451c5 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Tue, 14 Jul 2015 20:18:41 +0200 Subject: [PATCH 35/66] Updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf8b402..c75e8f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ TYPO3 Docker Boilerplate Changelog - Switched to Ansible provisioning (playbook) - Added multiple Ubuntu versions - Added CentOS +- Added Ubuntu with HHVM - Improved provisioning +- Refactored layout - Added prebuilt Docker images 3.5.0 - 2015-06-23 From 7407106632986856423f5db0c0c8c4d98dfc1b6a Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Tue, 14 Jul 2015 21:25:41 +0200 Subject: [PATCH 36/66] Fixed /home directory rights --- .../provision/roles/users/tasks/www-data.yml | 3 ++- .../provision/roles/users/tasks/www-data.yml | 14 ++++++++++++-- .../provision/roles/users/tasks/www-data.yml | 14 ++++++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/docker/main/centos/provision/roles/users/tasks/www-data.yml b/docker/main/centos/provision/roles/users/tasks/www-data.yml index 04b1d84..7eafb22 100644 --- a/docker/main/centos/provision/roles/users/tasks/www-data.yml +++ b/docker/main/centos/provision/roles/users/tasks/www-data.yml @@ -15,4 +15,5 @@ state: directory mode: 0755 owner: "{{ DOCKER.CLI_USER }}" - group: "{{ DOCKER.CLI_USER }}" \ No newline at end of file + group: "{{ DOCKER.CLI_USER }}" + recurse: yes \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/users/tasks/www-data.yml b/docker/main/ubuntu-hhvm/provision/roles/users/tasks/www-data.yml index 3f9bd9e..32b6405 100644 --- a/docker/main/ubuntu-hhvm/provision/roles/users/tasks/www-data.yml +++ b/docker/main/ubuntu-hhvm/provision/roles/users/tasks/www-data.yml @@ -1,9 +1,19 @@ - group: - name: www-data + name: "www-data" gid: "{{ DOCKER.EFFECTIVE_UID }}" - user: - name: www-data + name: "www-data" uid: "{{ DOCKER.EFFECTIVE_GID }}" + group: "www-data" shell: /bin/bash home: /home + +# create a directory if it doesn't exist +- file: + path: /home/ + state: directory + mode: 0755 + owner: "www-data" + group: "www-data" + recurse: yes \ No newline at end of file diff --git a/docker/main/ubuntu/provision/roles/users/tasks/www-data.yml b/docker/main/ubuntu/provision/roles/users/tasks/www-data.yml index 3f9bd9e..32b6405 100644 --- a/docker/main/ubuntu/provision/roles/users/tasks/www-data.yml +++ b/docker/main/ubuntu/provision/roles/users/tasks/www-data.yml @@ -1,9 +1,19 @@ - group: - name: www-data + name: "www-data" gid: "{{ DOCKER.EFFECTIVE_UID }}" - user: - name: www-data + name: "www-data" uid: "{{ DOCKER.EFFECTIVE_GID }}" + group: "www-data" shell: /bin/bash home: /home + +# create a directory if it doesn't exist +- file: + path: /home/ + state: directory + mode: 0755 + owner: "www-data" + group: "www-data" + recurse: yes \ No newline at end of file From b8c1d215d67a2b3a427a93ea8c80d93dd19e4a25 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Tue, 14 Jul 2015 21:25:49 +0200 Subject: [PATCH 37/66] Run hhvm under www-data --- docker/main/ubuntu-hhvm/conf/supervisord.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/main/ubuntu-hhvm/conf/supervisord.conf b/docker/main/ubuntu-hhvm/conf/supervisord.conf index 910f873..19b994b 100644 --- a/docker/main/ubuntu-hhvm/conf/supervisord.conf +++ b/docker/main/ubuntu-hhvm/conf/supervisord.conf @@ -1,8 +1,9 @@ [supervisord] nodaemon=true -[program:php-fpm] +[program:hhvm] command = /usr/bin/hhvm --mode server -vServer.Type=fastcgi -vServer.Port=9000 +user = www-data autostart = true autorestart = true stdout_logfile=/dev/stdout From d0fbf2aa80f4b55e180307a1b4d7624d5349a420 Mon Sep 17 00:00:00 2001 From: Josef Florian Glatz Date: Wed, 15 Jul 2015 07:59:19 +0200 Subject: [PATCH 38/66] [BUGFIX] Small typo in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bb86932..d2fd62e 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Configuration of each docker container is available in the `docker/` directory - Warning: There may be issues when using it in production - if you have any success stories please contact me. -Use can use my [Vagrant Development VM](https://github.com/mblaschke/vagrant-development) for this Docker boilerplate, eg. for easy creating new boilerplate installations with an easy shell command: `ct docker:create directory` +You can use my [Vagrant Development VM](https://github.com/mblaschke/vagrant-development) for this Docker boilerplate, eg. for easy creating new boilerplate installations with an easy shell command: `ct docker:create directory` ## Table of contents From c60b55dd1bdcd4cc587100c7c1125a162e8bc43c Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Fri, 17 Jul 2015 00:35:04 +0200 Subject: [PATCH 39/66] Switched to webdevops docker images --- docker/main/centos/Dockerfile | 4 ++-- docker/main/ubuntu-hhvm/Dockerfile | 4 ++-- docker/main/ubuntu/Dockerfile | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docker/main/centos/Dockerfile b/docker/main/centos/Dockerfile index 21b4b23..298f0c7 100644 --- a/docker/main/centos/Dockerfile +++ b/docker/main/centos/Dockerfile @@ -4,7 +4,7 @@ # # Prebuild images: # -# mblaschke/php-boilerplate:centos-7 +# webdevops/php-boilerplate:centos-7 # # Official images: # @@ -13,7 +13,7 @@ # #++++++++++++++++++++++++++++++++++++++ -FROM mblaschke/php-boilerplate:centos-7 +FROM webdevops/php-boilerplate:centos-7 ENV PATH /opt/ansible/bin:/bin:/usr/bin:/sbin:/usr/sbin ENV PYTHONPATH /opt/ansible/lib diff --git a/docker/main/ubuntu-hhvm/Dockerfile b/docker/main/ubuntu-hhvm/Dockerfile index 8eaafe6..567b8fc 100644 --- a/docker/main/ubuntu-hhvm/Dockerfile +++ b/docker/main/ubuntu-hhvm/Dockerfile @@ -4,7 +4,7 @@ # # Prebuild images: # -# mblaschke/php-boilerplate:ubuntu-14.04 +# webdevops/php-boilerplate:ubuntu-14.04 # # Official images: # @@ -13,7 +13,7 @@ # #++++++++++++++++++++++++++++++++++++++ -FROM mblaschke/php-boilerplate:ubuntu-14.04 +FROM webdevops/php-boilerplate:ubuntu-14.04 # Ensure UTF-8 RUN locale-gen en_US.UTF-8 diff --git a/docker/main/ubuntu/Dockerfile b/docker/main/ubuntu/Dockerfile index 8e671ef..9e0926a 100644 --- a/docker/main/ubuntu/Dockerfile +++ b/docker/main/ubuntu/Dockerfile @@ -4,10 +4,10 @@ # # Prebuild images: # -# mblaschke/php-boilerplate:ubuntu-12.04 -# mblaschke/php-boilerplate:ubuntu-14.04 -# mblaschke/php-boilerplate:ubuntu-15.04 -# mblaschke/php-boilerplate:ubuntu-15.10 +# webdevops/php-boilerplate:ubuntu-12.04 +# webdevops/php-boilerplate:ubuntu-14.04 +# webdevops/php-boilerplate:ubuntu-15.04 +# webdevops/php-boilerplate:ubuntu-15.10 # # Official images: # @@ -19,7 +19,7 @@ # #++++++++++++++++++++++++++++++++++++++ -FROM mblaschke/php-boilerplate:ubuntu-14.04 +FROM webdevops/php-boilerplate:ubuntu-14.04 # Ensure UTF-8 RUN locale-gen en_US.UTF-8 From 501c1de681627cef034404d95bfd463bf3e6acba Mon Sep 17 00:00:00 2001 From: Josef Florian Glatz Date: Sat, 18 Jul 2015 15:25:50 +0200 Subject: [PATCH 40/66] [FEATURE] Improve xdebug documentation --- documentation/DOCKER-INFO.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/documentation/DOCKER-INFO.md b/documentation/DOCKER-INFO.md index 91dfe1b..ebf7c55 100644 --- a/documentation/DOCKER-INFO.md +++ b/documentation/DOCKER-INFO.md @@ -169,16 +169,17 @@ EFFECTIVE_GID | Effective GID for php, fpm und webserver ## Xdebug Remote debugger (PhpStorm) -Add a server (Preferences -> PHP -> Servers): +### 1.) Add a server (Preferences -> Languages & Frameworks -> PHP -> Servers): -Setting | Value ------------------------ | ------------- -Hostname | IP or Hostname of VM -Port | 8000 -Use path mappings | Check -Path mapping of code | /docker/code/ +Setting | Value +---------------------------------| ------------- +Hostname | IP or Hostname of VM +Port | 8000 +Debugger | Xdebug +Use path mappings | Check +Path mapping of folder 'code' | /docker/code/ -Add a debug connection (Run -> Edit -> Connections) and create a new connection. +### Add a debug connection (Run -> Edit Configurations... -> Connections) and create a new configuration (PHP Web Application). Setting | Value --------------------- | ------------- From f590d1bcf2f9242b9d5a8a4a885308a7aba2ba90 Mon Sep 17 00:00:00 2001 From: Josef Florian Glatz Date: Sat, 18 Jul 2015 15:25:50 +0200 Subject: [PATCH 41/66] [FEATURE] Improve xdebug documentation --- documentation/DOCKER-INFO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/DOCKER-INFO.md b/documentation/DOCKER-INFO.md index ebf7c55..efa752c 100644 --- a/documentation/DOCKER-INFO.md +++ b/documentation/DOCKER-INFO.md @@ -179,7 +179,7 @@ Debugger | Xdebug Use path mappings | Check Path mapping of folder 'code' | /docker/code/ -### Add a debug connection (Run -> Edit Configurations... -> Connections) and create a new configuration (PHP Web Application). +### 2.) Add a debug connection (Run -> Edit Configurations... -> Connections) and create a new configuration (PHP Web Application). Setting | Value --------------------- | ------------- From e6ed87a910d4276fa2d9c37579d80ad6b64ef7e5 Mon Sep 17 00:00:00 2001 From: Josef Florian Glatz Date: Sat, 18 Jul 2015 15:25:50 +0200 Subject: [PATCH 42/66] [FEATURE] Improve xdebug documentation --- documentation/DOCKER-INFO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/DOCKER-INFO.md b/documentation/DOCKER-INFO.md index efa752c..5c5178c 100644 --- a/documentation/DOCKER-INFO.md +++ b/documentation/DOCKER-INFO.md @@ -169,7 +169,7 @@ EFFECTIVE_GID | Effective GID for php, fpm und webserver ## Xdebug Remote debugger (PhpStorm) -### 1.) Add a server (Preferences -> Languages & Frameworks -> PHP -> Servers): +### 1.) Add a server (Preferences -> Languages & Frameworks -> PHP -> Servers). Setting | Value ---------------------------------| ------------- From 13bd1e669a1e9f41cd653abdd4978a7352ff7603 Mon Sep 17 00:00:00 2001 From: Josef Florian Glatz Date: Sat, 18 Jul 2015 23:30:51 +0200 Subject: [PATCH 43/66] [FEATURE] Prevent lost information on submitting forms with lots of data TYPO3 CMS highly recommends to raise max_input_vars to at least 1500. --- docker/main/centos/conf/php.ini | 1 + docker/main/ubuntu-hhvm/conf/php.ini | 1 + docker/main/ubuntu/conf/php.ini | 1 + 3 files changed, 3 insertions(+) diff --git a/docker/main/centos/conf/php.ini b/docker/main/centos/conf/php.ini index 1cc0b98..e97faf7 100644 --- a/docker/main/centos/conf/php.ini +++ b/docker/main/centos/conf/php.ini @@ -12,6 +12,7 @@ max_execution_time = 900 max_input_time = 300 post_max_size = 50M upload_max_filesize = 50M +max_input_vars = 5000 ; timezone will be overwritten in startup, use docker-env.yml date.timezone = Europe/Berlin diff --git a/docker/main/ubuntu-hhvm/conf/php.ini b/docker/main/ubuntu-hhvm/conf/php.ini index 1cc0b98..e97faf7 100644 --- a/docker/main/ubuntu-hhvm/conf/php.ini +++ b/docker/main/ubuntu-hhvm/conf/php.ini @@ -12,6 +12,7 @@ max_execution_time = 900 max_input_time = 300 post_max_size = 50M upload_max_filesize = 50M +max_input_vars = 5000 ; timezone will be overwritten in startup, use docker-env.yml date.timezone = Europe/Berlin diff --git a/docker/main/ubuntu/conf/php.ini b/docker/main/ubuntu/conf/php.ini index 1cc0b98..e97faf7 100644 --- a/docker/main/ubuntu/conf/php.ini +++ b/docker/main/ubuntu/conf/php.ini @@ -12,6 +12,7 @@ max_execution_time = 900 max_input_time = 300 post_max_size = 50M upload_max_filesize = 50M +max_input_vars = 5000 ; timezone will be overwritten in startup, use docker-env.yml date.timezone = Europe/Berlin From ddba9b9c99d64324235fcc43948a26cb22e4d785 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Wed, 22 Jul 2015 23:00:08 +0200 Subject: [PATCH 44/66] Added blackfire.io Fixed mblaschke/TYPO3-docker-boilerplate#69 --- .../provision/roles/php/tasks/blackfire.yml | 17 +++++++++++++++++ .../ubuntu/provision/roles/php/tasks/main.yml | 4 ++++ 2 files changed, 21 insertions(+) create mode 100644 docker/main/ubuntu/provision/roles/php/tasks/blackfire.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/blackfire.yml b/docker/main/ubuntu/provision/roles/php/tasks/blackfire.yml new file mode 100644 index 0000000..ac23b88 --- /dev/null +++ b/docker/main/ubuntu/provision/roles/php/tasks/blackfire.yml @@ -0,0 +1,17 @@ +- name: Add blackfire.io key + apt_key: + url: https://packagecloud.io/gpg.key + state: present + +- name: Add blackfire.io repository + apt_repository: + repo: 'deb http://packages.blackfire.io/debian any main' + state: present + update_cache: yes + +- name: Install blackfire-php + apt: + name: '{{ item }}' + state: present + with_items: + - blackfire-php diff --git a/docker/main/ubuntu/provision/roles/php/tasks/main.yml b/docker/main/ubuntu/provision/roles/php/tasks/main.yml index 35d0963..aadbe49 100644 --- a/docker/main/ubuntu/provision/roles/php/tasks/main.yml +++ b/docker/main/ubuntu/provision/roles/php/tasks/main.yml @@ -2,6 +2,10 @@ tags: - bootstrap +- include: blackfire.yml + tags: + - bootstrap + - include: configuration.yml tags: - entrypoint From 59e74dcaf2ae4327e9d7a90ce09dd9638220790c Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Wed, 22 Jul 2015 23:04:38 +0200 Subject: [PATCH 45/66] Updated opcache settings Fixes mblaschke/TYPO3-docker-boilerplate#67 --- docker/main/centos/conf/php.ini | 7 ++++--- docker/main/ubuntu/conf/php.ini | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docker/main/centos/conf/php.ini b/docker/main/centos/conf/php.ini index e97faf7..7b67dd8 100644 --- a/docker/main/centos/conf/php.ini +++ b/docker/main/centos/conf/php.ini @@ -22,11 +22,12 @@ mysqli.default_host = mysql ; Zend OPCache opcache.enable = 1 -opcache.memory_consumption = 128 -opcache.interned_strings_buffer = 8 -opcache.max_accelerated_files = 4000 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 10000 opcache.fast_shutdown = 1 opcache.enable_cli = 1 +opcache.revalidate_freq = 0 ; XDebug xdebug.remote_enable = 1 diff --git a/docker/main/ubuntu/conf/php.ini b/docker/main/ubuntu/conf/php.ini index e97faf7..7b67dd8 100644 --- a/docker/main/ubuntu/conf/php.ini +++ b/docker/main/ubuntu/conf/php.ini @@ -22,11 +22,12 @@ mysqli.default_host = mysql ; Zend OPCache opcache.enable = 1 -opcache.memory_consumption = 128 -opcache.interned_strings_buffer = 8 -opcache.max_accelerated_files = 4000 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 10000 opcache.fast_shutdown = 1 opcache.enable_cli = 1 +opcache.revalidate_freq = 0 ; XDebug xdebug.remote_enable = 1 From ba1a639e1d0f3608a3e56fff830bcfa8a50b824e Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Fri, 24 Jul 2015 01:53:12 +0200 Subject: [PATCH 46/66] Added development/production context Fixes mblaschke/TYPO3-docker-boilerplate#70 --- docker-env.yml | 10 +++++ .../conf/{php.ini => php.development.ini} | 2 + docker/main/centos/conf/php.production.ini | 37 +++++++++++++++++++ .../provision/roles/common/tasks/packages.yml | 3 +- .../provision/roles/php/tasks/blackfire.yml | 24 ++++++++++++ .../roles/php/tasks/configuration.yml | 16 ++++++++ .../centos/provision/roles/php/tasks/main.yml | 8 ++++ .../provision/roles/php/tasks/modules.yml | 15 ++++++++ docker/main/centos/provision/variables.yml | 7 ++++ .../conf/{php.ini => php.development.ini} | 2 + docker/main/ubuntu/conf/php.production.ini | 37 +++++++++++++++++++ .../roles/php/tasks/configuration.yml | 16 ++++++++ .../provision/roles/php/tasks/install.yml | 4 +- .../ubuntu/provision/roles/php/tasks/main.yml | 4 ++ .../provision/roles/php/tasks/modules.yml | 17 +++++++++ docker/main/ubuntu/provision/variables.yml | 7 ++++ 16 files changed, 206 insertions(+), 3 deletions(-) rename docker/main/centos/conf/{php.ini => php.development.ini} (98%) create mode 100644 docker/main/centos/conf/php.production.ini create mode 100644 docker/main/centos/provision/roles/php/tasks/blackfire.yml create mode 100644 docker/main/centos/provision/roles/php/tasks/modules.yml rename docker/main/ubuntu/conf/{php.ini => php.development.ini} (98%) create mode 100644 docker/main/ubuntu/conf/php.production.ini create mode 100644 docker/main/ubuntu/provision/roles/php/tasks/modules.yml diff --git a/docker-env.yml b/docker-env.yml index f57b483..7b1acb3 100644 --- a/docker-env.yml +++ b/docker-env.yml @@ -27,6 +27,16 @@ FLOW_REWRITEURLS=1 SYMFONY_ENV=dev SYMFONY_DEBUG=0 +####################################### +# PROVISION environment + +# Context for provision [development|production] +PROVISION_CONTEXT=development + +# PHP Modules +PROVISION_PHP_BLACKFIRE=1 +PROVISION_PHP_XDEBUG=1 + ####################################### # Mail diff --git a/docker/main/centos/conf/php.ini b/docker/main/centos/conf/php.development.ini similarity index 98% rename from docker/main/centos/conf/php.ini rename to docker/main/centos/conf/php.development.ini index 7b67dd8..2bd3f41 100644 --- a/docker/main/centos/conf/php.ini +++ b/docker/main/centos/conf/php.development.ini @@ -1,5 +1,7 @@ ; this file will overwrite default php.ini settings +display_errors = 1 + short_open_tag = On variables_order = 'GPCS' request_order = 'GP' diff --git a/docker/main/centos/conf/php.production.ini b/docker/main/centos/conf/php.production.ini new file mode 100644 index 0000000..3603b1a --- /dev/null +++ b/docker/main/centos/conf/php.production.ini @@ -0,0 +1,37 @@ +; this file will overwrite default php.ini settings + +display_errors = 0 + +short_open_tag = On +variables_order = 'GPCS' +request_order = 'GP' + +allow_url_fopen = On +allow_url_include = Off + +memory_limit = 512M +max_execution_time = 900 +max_input_time = 300 +post_max_size = 50M +upload_max_filesize = 50M +max_input_vars = 5000 + +; timezone will be overwritten in startup, use docker-env.yml +date.timezone = Europe/Berlin + +mysql.default_host = mysql +mysqli.default_host = mysql + +; Zend OPCache +opcache.enable = 1 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 10000 +opcache.fast_shutdown = 1 +opcache.enable_cli = 1 +opcache.revalidate_freq = 2 +opcache.validate_timestamps = 1 + +; XDebug +xdebug.remote_enable = 0 +xdebug.remote_connect_back = off diff --git a/docker/main/centos/provision/roles/common/tasks/packages.yml b/docker/main/centos/provision/roles/common/tasks/packages.yml index 110fb8b..d5b135c 100644 --- a/docker/main/centos/provision/roles/common/tasks/packages.yml +++ b/docker/main/centos/provision/roles/common/tasks/packages.yml @@ -17,4 +17,5 @@ - net-tools # Utils - moreutils - - bind-utils \ No newline at end of file + - bind-utils + - pygpgme diff --git a/docker/main/centos/provision/roles/php/tasks/blackfire.yml b/docker/main/centos/provision/roles/php/tasks/blackfire.yml new file mode 100644 index 0000000..34921d2 --- /dev/null +++ b/docker/main/centos/provision/roles/php/tasks/blackfire.yml @@ -0,0 +1,24 @@ +- name: Add blackfire.io key + rpm_key: + key: https://packagecloud.io/gpg.key + state: present + +- name: Add blackfire.io repository + get_url: + url: http://packages.blackfire.io/fedora/blackfire.repo + dest: /etc/yum.repos.d/blackfire.repo + mode: 0644 + +- name: Disable gpg check for blackfire (CentOS 7 workaround) + lineinfile: + dest: /etc/yum.repos.d/blackfire.repo + regexp: '^repo_gpgcheck=1' + line: 'repo_gpgcheck=0' +# when: ansible_distribution == 'CentOS' and ansible_distribution_version == "7" + +- name: Install blackfire-php + yum: + name: '{{ item }}' + state: present + with_items: + - blackfire-php diff --git a/docker/main/centos/provision/roles/php/tasks/configuration.yml b/docker/main/centos/provision/roles/php/tasks/configuration.yml index 183bce6..c2cf5d8 100644 --- a/docker/main/centos/provision/roles/php/tasks/configuration.yml +++ b/docker/main/centos/provision/roles/php/tasks/configuration.yml @@ -12,6 +12,22 @@ - { key: 'env[FLOW_CONTEXT]', value: '{{ DOCKER.FLOW_CONTEXT }}' } - { key: 'env[FLOW_REWRITEURLS]', value: '{{ DOCKER.FLOW_REWRITEURLS }}' } +- name: Set development environment php.ini + file: + src: '/opt/docker/conf/php.development.ini' + dest: '/opt/docker/conf/php.ini' + force: yes + state: link + when: PROVISION.CONTEXT == "development" or PROVISION.CONTEXT == "" + +- name: Enable production environment php.ini + file: + src: '/opt/docker/conf/php.production.ini' + dest: '/opt/docker/conf/php.ini' + force: yes + state: link + when: PROVISION.CONTEXT == "production" + - name: Configure php (docker php.ini) lineinfile: dest: /opt/docker/conf/php.ini diff --git a/docker/main/centos/provision/roles/php/tasks/main.yml b/docker/main/centos/provision/roles/php/tasks/main.yml index 35d0963..f96032a 100644 --- a/docker/main/centos/provision/roles/php/tasks/main.yml +++ b/docker/main/centos/provision/roles/php/tasks/main.yml @@ -2,6 +2,14 @@ tags: - bootstrap +- include: blackfire.yml + tags: + - bootstrap + - include: configuration.yml tags: - entrypoint + +- include: modules.yml + tags: + - entrypoint diff --git a/docker/main/centos/provision/roles/php/tasks/modules.yml b/docker/main/centos/provision/roles/php/tasks/modules.yml new file mode 100644 index 0000000..4800f77 --- /dev/null +++ b/docker/main/centos/provision/roles/php/tasks/modules.yml @@ -0,0 +1,15 @@ +- name: Disable XDebug + file: + path: "{{ item }}" + state: absent + with_fileglob: + - /etc/php.d/*xdebug*.ini + when: PROVISION.PHP.XDEBUG == "" or PROVISION.PHP.XDEBUG == "0" + +- name: Disable Blackfire + file: + path: "{{ item }}" + state: absent + with_fileglob: + - /etc/php.d/*blackfire*.ini + when: PROVISION.PHP.XDEBUG == "" or PROVISION.PHP.BLACKFIRE == "0" diff --git a/docker/main/centos/provision/variables.yml b/docker/main/centos/provision/variables.yml index a163d09..2540317 100644 --- a/docker/main/centos/provision/variables.yml +++ b/docker/main/centos/provision/variables.yml @@ -1,5 +1,12 @@ --- +PROVISION: + CONTEXT: "{{ lookup('env','PROVISION_CONTEXT') }}" + + PHP: + BLACKFIRE: "{{ lookup('env','PROVISION_PHP_BLACKFIRE') }}" + XDEBUG: "{{ lookup('env','PROVISION_PHP_XDEBUG') }}" + DOCKER: # System EFFECTIVE_UID: "{{ lookup('env','EFFECTIVE_UID') }}" diff --git a/docker/main/ubuntu/conf/php.ini b/docker/main/ubuntu/conf/php.development.ini similarity index 98% rename from docker/main/ubuntu/conf/php.ini rename to docker/main/ubuntu/conf/php.development.ini index 7b67dd8..2bd3f41 100644 --- a/docker/main/ubuntu/conf/php.ini +++ b/docker/main/ubuntu/conf/php.development.ini @@ -1,5 +1,7 @@ ; this file will overwrite default php.ini settings +display_errors = 1 + short_open_tag = On variables_order = 'GPCS' request_order = 'GP' diff --git a/docker/main/ubuntu/conf/php.production.ini b/docker/main/ubuntu/conf/php.production.ini new file mode 100644 index 0000000..3603b1a --- /dev/null +++ b/docker/main/ubuntu/conf/php.production.ini @@ -0,0 +1,37 @@ +; this file will overwrite default php.ini settings + +display_errors = 0 + +short_open_tag = On +variables_order = 'GPCS' +request_order = 'GP' + +allow_url_fopen = On +allow_url_include = Off + +memory_limit = 512M +max_execution_time = 900 +max_input_time = 300 +post_max_size = 50M +upload_max_filesize = 50M +max_input_vars = 5000 + +; timezone will be overwritten in startup, use docker-env.yml +date.timezone = Europe/Berlin + +mysql.default_host = mysql +mysqli.default_host = mysql + +; Zend OPCache +opcache.enable = 1 +opcache.memory_consumption = 256 +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 10000 +opcache.fast_shutdown = 1 +opcache.enable_cli = 1 +opcache.revalidate_freq = 2 +opcache.validate_timestamps = 1 + +; XDebug +xdebug.remote_enable = 0 +xdebug.remote_connect_back = off diff --git a/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml b/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml index ec2dbc3..ca41370 100644 --- a/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml +++ b/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml @@ -9,6 +9,22 @@ - { key: 'env[FLOW_CONTEXT]', value: '{{ DOCKER.FLOW_CONTEXT }}' } - { key: 'env[FLOW_REWRITEURLS]', value: '{{ DOCKER.FLOW_REWRITEURLS }}' } +- name: Set development environment php.ini + file: + src: '/opt/docker/conf/php.development.ini' + dest: '/opt/docker/conf/php.ini' + force: yes + state: link + when: PROVISION.CONTEXT == "development" or PROVISION.CONTEXT == "" + +- name: Enable production environment php.ini + file: + src: '/opt/docker/conf/php.production.ini' + dest: '/opt/docker/conf/php.ini' + force: yes + state: link + when: PROVISION.CONTEXT == "production" + - name: Configure php (docker php.ini) lineinfile: dest: /opt/docker/conf/php.ini diff --git a/docker/main/ubuntu/provision/roles/php/tasks/install.yml b/docker/main/ubuntu/provision/roles/php/tasks/install.yml index 79aa278..4258d1e 100644 --- a/docker/main/ubuntu/provision/roles/php/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/php/tasks/install.yml @@ -28,7 +28,7 @@ state: directory mode: 0755 -- name: Activate php config files (fpm) +- name: Link php.ini for cli and fpm file: src: '{{ item.file }}' dest: '/etc/php5/{{ item.category }}/conf.d/{{ item.target }}' @@ -80,4 +80,4 @@ state: absent with_items: # Networking - - { key: 'listen.allowed_clients' } \ No newline at end of file + - { key: 'listen.allowed_clients' } diff --git a/docker/main/ubuntu/provision/roles/php/tasks/main.yml b/docker/main/ubuntu/provision/roles/php/tasks/main.yml index aadbe49..f96032a 100644 --- a/docker/main/ubuntu/provision/roles/php/tasks/main.yml +++ b/docker/main/ubuntu/provision/roles/php/tasks/main.yml @@ -9,3 +9,7 @@ - include: configuration.yml tags: - entrypoint + +- include: modules.yml + tags: + - entrypoint diff --git a/docker/main/ubuntu/provision/roles/php/tasks/modules.yml b/docker/main/ubuntu/provision/roles/php/tasks/modules.yml new file mode 100644 index 0000000..a3eb587 --- /dev/null +++ b/docker/main/ubuntu/provision/roles/php/tasks/modules.yml @@ -0,0 +1,17 @@ +- name: Disable XDebug + file: + path: "{{ item }}" + state: absent + with_fileglob: + - /etc/php5/fpm/conf.d/*xdebug*.ini + - /etc/php5/cli/conf.d/*xdebug*.ini + when: PROVISION.PHP.XDEBUG == "" or PROVISION.PHP.XDEBUG == "0" + +- name: Disable Blackfire + file: + path: "{{ item }}" + state: absent + with_fileglob: + - /etc/php5/fpm/conf.d/*blackfire*.ini + - /etc/php5/cli/conf.d/*blackfire*.ini + when: PROVISION.PHP.XDEBUG == "" or PROVISION.PHP.BLACKFIRE == "0" diff --git a/docker/main/ubuntu/provision/variables.yml b/docker/main/ubuntu/provision/variables.yml index a163d09..2540317 100644 --- a/docker/main/ubuntu/provision/variables.yml +++ b/docker/main/ubuntu/provision/variables.yml @@ -1,5 +1,12 @@ --- +PROVISION: + CONTEXT: "{{ lookup('env','PROVISION_CONTEXT') }}" + + PHP: + BLACKFIRE: "{{ lookup('env','PROVISION_PHP_BLACKFIRE') }}" + XDEBUG: "{{ lookup('env','PROVISION_PHP_XDEBUG') }}" + DOCKER: # System EFFECTIVE_UID: "{{ lookup('env','EFFECTIVE_UID') }}" From 79b0fcca49454a184e4b9fd0729d42c1363acbbb Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Fri, 24 Jul 2015 01:55:51 +0200 Subject: [PATCH 47/66] Updated changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c75e8f0..10ae3b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ TYPO3 Docker Boilerplate Changelog - Added multiple Ubuntu versions - Added CentOS - Added Ubuntu with HHVM +- Added development/production context +- Added blackfire.io +- Added possiblity to disable Xdebug and Blackfire - Improved provisioning - Refactored layout - Added prebuilt Docker images From c77b535995ec2467ba9e4022d1f6a38db0efec51 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Fri, 24 Jul 2015 02:10:51 +0200 Subject: [PATCH 48/66] Enabled workaround condition for blackfire repo --- docker/main/centos/provision/roles/php/tasks/blackfire.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/main/centos/provision/roles/php/tasks/blackfire.yml b/docker/main/centos/provision/roles/php/tasks/blackfire.yml index 34921d2..20ceb74 100644 --- a/docker/main/centos/provision/roles/php/tasks/blackfire.yml +++ b/docker/main/centos/provision/roles/php/tasks/blackfire.yml @@ -14,7 +14,7 @@ dest: /etc/yum.repos.d/blackfire.repo regexp: '^repo_gpgcheck=1' line: 'repo_gpgcheck=0' -# when: ansible_distribution == 'CentOS' and ansible_distribution_version == "7" + when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' - name: Install blackfire-php yum: From b2180836f7e5b2eb3239c951a5b0b69b3be124aa Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Tue, 28 Jul 2015 21:27:27 +0200 Subject: [PATCH 49/66] Moved php ini files to etc/php/ --- docker-env.yml | 4 -- docker/main/centos/conf/supervisord.conf | 3 ++ .../roles/php/tasks/configuration.yml | 12 +----- docker/main/centos/provision/variables.yml | 3 -- docker/main/ubuntu-hhvm/conf/php.ini | 39 ----------------- docker/main/ubuntu-hhvm/conf/supervisord.conf | 3 ++ .../main/ubuntu-hhvm/provision/variables.yml | 3 -- docker/main/ubuntu/conf/php.development.ini | 42 ------------------- docker/main/ubuntu/conf/php.production.ini | 37 ---------------- .../roles/php/tasks/configuration.yml | 12 +----- docker/main/ubuntu/provision/variables.yml | 3 -- etc/php/.gitkeep | 1 + .../php/development.ini | 1 - .../php/production.ini | 1 - etc/ssh/.gitkeep | 0 15 files changed, 11 insertions(+), 153 deletions(-) delete mode 100644 docker/main/ubuntu-hhvm/conf/php.ini delete mode 100644 docker/main/ubuntu/conf/php.development.ini delete mode 100644 docker/main/ubuntu/conf/php.production.ini create mode 100644 etc/php/.gitkeep rename docker/main/centos/conf/php.development.ini => etc/php/development.ini (94%) rename docker/main/centos/conf/php.production.ini => etc/php/production.ini (92%) create mode 100644 etc/ssh/.gitkeep diff --git a/docker-env.yml b/docker-env.yml index 7b1acb3..1b7f97e 100644 --- a/docker-env.yml +++ b/docker-env.yml @@ -75,10 +75,6 @@ FTP_PASSWORD=dev FTP_PATH=/data/ftp/ #FTP_PATH=/docker/code/ -####################################### -# PHP Settings -PHP_TIMEZONE=UTC - ####################################### # Permission settings EFFECTIVE_UID=1000 diff --git a/docker/main/centos/conf/supervisord.conf b/docker/main/centos/conf/supervisord.conf index 088e054..6c9261f 100644 --- a/docker/main/centos/conf/supervisord.conf +++ b/docker/main/centos/conf/supervisord.conf @@ -1,6 +1,9 @@ [supervisord] nodaemon=true +[unix_http_server] +file = /var/tmp/supervisor.sock + [program:php-fpm] command = /sbin/php-fpm autostart = true diff --git a/docker/main/centos/provision/roles/php/tasks/configuration.yml b/docker/main/centos/provision/roles/php/tasks/configuration.yml index c2cf5d8..971d65f 100644 --- a/docker/main/centos/provision/roles/php/tasks/configuration.yml +++ b/docker/main/centos/provision/roles/php/tasks/configuration.yml @@ -14,7 +14,7 @@ - name: Set development environment php.ini file: - src: '/opt/docker/conf/php.development.ini' + src: '/docker/etc/php/development.ini' dest: '/opt/docker/conf/php.ini' force: yes state: link @@ -22,20 +22,12 @@ - name: Enable production environment php.ini file: - src: '/opt/docker/conf/php.production.ini' + src: '/docker/etc/php/production.ini' dest: '/opt/docker/conf/php.ini' force: yes state: link when: PROVISION.CONTEXT == "production" -- name: Configure php (docker php.ini) - lineinfile: - dest: /opt/docker/conf/php.ini - regexp: '^{{ item.key }}[\s]*=' - line: '{{ item.key }} = {{ item.value }}' - with_items: - - { key: 'date.timezone', value: '{{ DOCKER.PHP_TIMEZONE }}' } - - name: Truncate log files command: 'cp /dev/null {{ item }}' with_items: diff --git a/docker/main/centos/provision/variables.yml b/docker/main/centos/provision/variables.yml index 2540317..f5cf6ec 100644 --- a/docker/main/centos/provision/variables.yml +++ b/docker/main/centos/provision/variables.yml @@ -37,9 +37,6 @@ DOCKER: # Mail MAIL_GATEWAY: "{{ lookup('env','MAIL_GATEWAY') }}" - # PHP - PHP_TIMEZONE: "{{ lookup('env','PHP_TIMEZONE') }}" - # DNS DNS_DOMAIN: "{{ lookup('env','DNS_DOMAIN') }}" diff --git a/docker/main/ubuntu-hhvm/conf/php.ini b/docker/main/ubuntu-hhvm/conf/php.ini deleted file mode 100644 index e97faf7..0000000 --- a/docker/main/ubuntu-hhvm/conf/php.ini +++ /dev/null @@ -1,39 +0,0 @@ -; this file will overwrite default php.ini settings - -short_open_tag = On -variables_order = 'GPCS' -request_order = 'GP' - -allow_url_fopen = On -allow_url_include = Off - -memory_limit = 512M -max_execution_time = 900 -max_input_time = 300 -post_max_size = 50M -upload_max_filesize = 50M -max_input_vars = 5000 - -; timezone will be overwritten in startup, use docker-env.yml -date.timezone = Europe/Berlin - -mysql.default_host = mysql -mysqli.default_host = mysql - -; Zend OPCache -opcache.enable = 1 -opcache.memory_consumption = 128 -opcache.interned_strings_buffer = 8 -opcache.max_accelerated_files = 4000 -opcache.fast_shutdown = 1 -opcache.enable_cli = 1 - -; XDebug -xdebug.remote_enable = 1 -xdebug.remote_connect_back = on -xdebug.idekey = "docker" -xdebug.cli_color = 1 -xdebug.max_nesting_level = 1000 -xdebug.profiler_enable_trigger = 1 -xdebug.profiler_output_dir = '/tmp/debug/' -xhprof.output_dir = '/tmp/debug/' diff --git a/docker/main/ubuntu-hhvm/conf/supervisord.conf b/docker/main/ubuntu-hhvm/conf/supervisord.conf index 19b994b..bda2234 100644 --- a/docker/main/ubuntu-hhvm/conf/supervisord.conf +++ b/docker/main/ubuntu-hhvm/conf/supervisord.conf @@ -1,6 +1,9 @@ [supervisord] nodaemon=true +[unix_http_server] +file = /var/tmp/supervisor.sock + [program:hhvm] command = /usr/bin/hhvm --mode server -vServer.Type=fastcgi -vServer.Port=9000 user = www-data diff --git a/docker/main/ubuntu-hhvm/provision/variables.yml b/docker/main/ubuntu-hhvm/provision/variables.yml index ea63ce5..f987a3d 100644 --- a/docker/main/ubuntu-hhvm/provision/variables.yml +++ b/docker/main/ubuntu-hhvm/provision/variables.yml @@ -30,9 +30,6 @@ DOCKER: # Mail MAIL_GATEWAY: "{{ lookup('env','MAIL_GATEWAY') }}" - # PHP - PHP_TIMEZONE: "{{ lookup('env','PHP_TIMEZONE') }}" - # DNS DNS_DOMAIN: "{{ lookup('env','DNS_DOMAIN') }}" diff --git a/docker/main/ubuntu/conf/php.development.ini b/docker/main/ubuntu/conf/php.development.ini deleted file mode 100644 index 2bd3f41..0000000 --- a/docker/main/ubuntu/conf/php.development.ini +++ /dev/null @@ -1,42 +0,0 @@ -; this file will overwrite default php.ini settings - -display_errors = 1 - -short_open_tag = On -variables_order = 'GPCS' -request_order = 'GP' - -allow_url_fopen = On -allow_url_include = Off - -memory_limit = 512M -max_execution_time = 900 -max_input_time = 300 -post_max_size = 50M -upload_max_filesize = 50M -max_input_vars = 5000 - -; timezone will be overwritten in startup, use docker-env.yml -date.timezone = Europe/Berlin - -mysql.default_host = mysql -mysqli.default_host = mysql - -; Zend OPCache -opcache.enable = 1 -opcache.memory_consumption = 256 -opcache.interned_strings_buffer = 16 -opcache.max_accelerated_files = 10000 -opcache.fast_shutdown = 1 -opcache.enable_cli = 1 -opcache.revalidate_freq = 0 - -; XDebug -xdebug.remote_enable = 1 -xdebug.remote_connect_back = on -xdebug.idekey = "docker" -xdebug.cli_color = 1 -xdebug.max_nesting_level = 1000 -xdebug.profiler_enable_trigger = 1 -xdebug.profiler_output_dir = '/tmp/debug/' -xhprof.output_dir = '/tmp/debug/' diff --git a/docker/main/ubuntu/conf/php.production.ini b/docker/main/ubuntu/conf/php.production.ini deleted file mode 100644 index 3603b1a..0000000 --- a/docker/main/ubuntu/conf/php.production.ini +++ /dev/null @@ -1,37 +0,0 @@ -; this file will overwrite default php.ini settings - -display_errors = 0 - -short_open_tag = On -variables_order = 'GPCS' -request_order = 'GP' - -allow_url_fopen = On -allow_url_include = Off - -memory_limit = 512M -max_execution_time = 900 -max_input_time = 300 -post_max_size = 50M -upload_max_filesize = 50M -max_input_vars = 5000 - -; timezone will be overwritten in startup, use docker-env.yml -date.timezone = Europe/Berlin - -mysql.default_host = mysql -mysqli.default_host = mysql - -; Zend OPCache -opcache.enable = 1 -opcache.memory_consumption = 256 -opcache.interned_strings_buffer = 16 -opcache.max_accelerated_files = 10000 -opcache.fast_shutdown = 1 -opcache.enable_cli = 1 -opcache.revalidate_freq = 2 -opcache.validate_timestamps = 1 - -; XDebug -xdebug.remote_enable = 0 -xdebug.remote_connect_back = off diff --git a/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml b/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml index ca41370..6ed6da4 100644 --- a/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml +++ b/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml @@ -11,7 +11,7 @@ - name: Set development environment php.ini file: - src: '/opt/docker/conf/php.development.ini' + src: '/docker/etc/php/development.ini' dest: '/opt/docker/conf/php.ini' force: yes state: link @@ -19,20 +19,12 @@ - name: Enable production environment php.ini file: - src: '/opt/docker/conf/php.production.ini' + src: '/docker/etc/php/production.ini' dest: '/opt/docker/conf/php.ini' force: yes state: link when: PROVISION.CONTEXT == "production" -- name: Configure php (docker php.ini) - lineinfile: - dest: /opt/docker/conf/php.ini - regexp: '^{{ item.key }}[\s]*=' - line: '{{ item.key }} = {{ item.value }}' - with_items: - - { key: 'date.timezone', value: '{{ DOCKER.PHP_TIMEZONE }}' } - - name: Truncate log files command: 'cp /dev/null {{ item }}' with_items: diff --git a/docker/main/ubuntu/provision/variables.yml b/docker/main/ubuntu/provision/variables.yml index 2540317..f5cf6ec 100644 --- a/docker/main/ubuntu/provision/variables.yml +++ b/docker/main/ubuntu/provision/variables.yml @@ -37,9 +37,6 @@ DOCKER: # Mail MAIL_GATEWAY: "{{ lookup('env','MAIL_GATEWAY') }}" - # PHP - PHP_TIMEZONE: "{{ lookup('env','PHP_TIMEZONE') }}" - # DNS DNS_DOMAIN: "{{ lookup('env','DNS_DOMAIN') }}" diff --git a/etc/php/.gitkeep b/etc/php/.gitkeep new file mode 100644 index 0000000..e166442 --- /dev/null +++ b/etc/php/.gitkeep @@ -0,0 +1 @@ +.gitkeep diff --git a/docker/main/centos/conf/php.development.ini b/etc/php/development.ini similarity index 94% rename from docker/main/centos/conf/php.development.ini rename to etc/php/development.ini index 2bd3f41..d823fcf 100644 --- a/docker/main/centos/conf/php.development.ini +++ b/etc/php/development.ini @@ -16,7 +16,6 @@ post_max_size = 50M upload_max_filesize = 50M max_input_vars = 5000 -; timezone will be overwritten in startup, use docker-env.yml date.timezone = Europe/Berlin mysql.default_host = mysql diff --git a/docker/main/centos/conf/php.production.ini b/etc/php/production.ini similarity index 92% rename from docker/main/centos/conf/php.production.ini rename to etc/php/production.ini index 3603b1a..d457fab 100644 --- a/docker/main/centos/conf/php.production.ini +++ b/etc/php/production.ini @@ -16,7 +16,6 @@ post_max_size = 50M upload_max_filesize = 50M max_input_vars = 5000 -; timezone will be overwritten in startup, use docker-env.yml date.timezone = Europe/Berlin mysql.default_host = mysql diff --git a/etc/ssh/.gitkeep b/etc/ssh/.gitkeep new file mode 100644 index 0000000..e69de29 From 8ef10b687dfa870616e83d7995d9562cc4be035a Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Tue, 28 Jul 2015 21:29:32 +0200 Subject: [PATCH 50/66] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10ae3b7..b5ccda5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ TYPO3 Docker Boilerplate Changelog - Added development/production context - Added blackfire.io - Added possiblity to disable Xdebug and Blackfire +- Moved php.ini to etc/php/development.ini and etc/php/production.ini - Improved provisioning - Refactored layout - Added prebuilt Docker images From ed77aee34813fb9a293882411cae4bec549d37af Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Tue, 28 Jul 2015 22:07:04 +0200 Subject: [PATCH 51/66] Added possibility to use supervisorctl (as root) --- CHANGELOG.md | 1 + docker/main/centos/conf/supervisord.conf | 3 +++ docker/main/ubuntu/conf/supervisord.conf | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5ccda5..b7d20a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ TYPO3 Docker Boilerplate Changelog - Added blackfire.io - Added possiblity to disable Xdebug and Blackfire - Moved php.ini to etc/php/development.ini and etc/php/production.ini +- Added possibility to use supervisorctl (as root) - Improved provisioning - Refactored layout - Added prebuilt Docker images diff --git a/docker/main/centos/conf/supervisord.conf b/docker/main/centos/conf/supervisord.conf index 6c9261f..f12afda 100644 --- a/docker/main/centos/conf/supervisord.conf +++ b/docker/main/centos/conf/supervisord.conf @@ -4,6 +4,9 @@ nodaemon=true [unix_http_server] file = /var/tmp/supervisor.sock +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + [program:php-fpm] command = /sbin/php-fpm autostart = true diff --git a/docker/main/ubuntu/conf/supervisord.conf b/docker/main/ubuntu/conf/supervisord.conf index e2d71a9..618da4d 100644 --- a/docker/main/ubuntu/conf/supervisord.conf +++ b/docker/main/ubuntu/conf/supervisord.conf @@ -1,6 +1,12 @@ [supervisord] nodaemon=true +[unix_http_server] +file = /var/run/supervisor.sock + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + [program:php-fpm] command = /usr/sbin/php5-fpm autostart = true From c252b93c18638f7c0a9a705a2d5f663293375535 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Tue, 28 Jul 2015 23:53:07 +0200 Subject: [PATCH 52/66] Added etc/ssh copy (to /home/.ssh/) --- CHANGELOG.md | 1 + .../provision/roles/common/tasks/packages.yml | 33 ++++++++++++++---- .../provision/roles/users/tasks/home-ssh.yml | 29 ++++++++++++++++ .../provision/roles/users/tasks/main.yml | 4 +++ .../provision/roles/common/tasks/packages.yml | 34 +++++++++++++++---- .../provision/roles/users/tasks/home-ssh.yml | 29 ++++++++++++++++ .../provision/roles/users/tasks/main.yml | 4 +++ 7 files changed, 121 insertions(+), 13 deletions(-) create mode 100644 docker/main/centos/provision/roles/users/tasks/home-ssh.yml create mode 100644 docker/main/ubuntu/provision/roles/users/tasks/home-ssh.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index b7d20a1..b3c8455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ TYPO3 Docker Boilerplate Changelog - Added blackfire.io - Added possiblity to disable Xdebug and Blackfire - Moved php.ini to etc/php/development.ini and etc/php/production.ini +- Added ssh key/config (etc/ssh) setting for /home/.ssh/ - Added possibility to use supervisorctl (as root) - Improved provisioning - Refactored layout diff --git a/docker/main/centos/provision/roles/common/tasks/packages.yml b/docker/main/centos/provision/roles/common/tasks/packages.yml index d5b135c..9529dc9 100644 --- a/docker/main/centos/provision/roles/common/tasks/packages.yml +++ b/docker/main/centos/provision/roles/common/tasks/packages.yml @@ -1,21 +1,42 @@ -- name: Install default packages +- name: Install packages (system tools) yum: name: '{{ item }}' state: present with_items: - # System tools - sudo - # Compression + +- name: Install packages (compression tools) + yum: + name: '{{ item }}' + state: present + with_items: - zip - unzip - bzip2 - # Graphic tools + +- name: Install packages (graphic tools) + yum: + name: '{{ item }}' + state: present + with_items: - ImageMagick - # Networking tools + +- name: Install packages (network tools) + yum: + name: '{{ item }}' + state: present + with_items: - wget - curl - net-tools - # Utils + - rsync + +- name: Install packages (general tools) + yum: + name: '{{ item }}' + state: present + with_items: - moreutils - bind-utils - pygpgme + diff --git a/docker/main/centos/provision/roles/users/tasks/home-ssh.yml b/docker/main/centos/provision/roles/users/tasks/home-ssh.yml new file mode 100644 index 0000000..f3b21a7 --- /dev/null +++ b/docker/main/centos/provision/roles/users/tasks/home-ssh.yml @@ -0,0 +1,29 @@ +# create a directory if it doesn't exist +- name: Create /home/.ssh/ + file: + path: /home/.ssh/ + state: directory + mode: 0750 + owner: "{{ DOCKER.CLI_USER }}" + group: "{{ DOCKER.CLI_USER }}" + +- name: Sync etc/ssh/ to /home/.ssh + local_action: synchronize src=/docker/etc/ssh/ dest=/home/.ssh/ perms=no + ignore_errors: True + +- name: Fix /home/.ssh/ permissions + file: + path: /home/.ssh/ + state: directory + owner: "{{ DOCKER.CLI_USER }}" + group: "{{ DOCKER.CLI_USER }}" + recurse: yes + ignore_errors: True + +- name: Fix ssh key permissions (if exists) + file: + path: /home/.ssh/id_rsa + mode: 0600 + owner: "{{ DOCKER.CLI_USER }}" + group: "{{ DOCKER.CLI_USER }}" + ignore_errors: True diff --git a/docker/main/centos/provision/roles/users/tasks/main.yml b/docker/main/centos/provision/roles/users/tasks/main.yml index f421097..bec6f03 100644 --- a/docker/main/centos/provision/roles/users/tasks/main.yml +++ b/docker/main/centos/provision/roles/users/tasks/main.yml @@ -1,3 +1,7 @@ - include: www-data.yml tags: - entrypoint + +- include: home-ssh.yml + tags: + - entrypoint diff --git a/docker/main/ubuntu/provision/roles/common/tasks/packages.yml b/docker/main/ubuntu/provision/roles/common/tasks/packages.yml index 4e0dcb4..2970716 100644 --- a/docker/main/ubuntu/provision/roles/common/tasks/packages.yml +++ b/docker/main/ubuntu/provision/roles/common/tasks/packages.yml @@ -1,21 +1,41 @@ -- name: Install default packages +- name: Install packages (system tools) apt: name: '{{ item }}' state: present with_items: - # System tools - sudo - # Compression + +- name: Install packages (compression tools) + apt: + name: '{{ item }}' + state: present + with_items: - zip - unzip - bzip2 - # Graphic tools + +- name: Install packages (graphic tools) + apt: + name: '{{ item }}' + state: present + with_items: - imagemagick - graphicsmagick - # Networking tools + +- name: Install packages (network tools) + apt: + name: '{{ item }}' + state: present + with_items: - wget - curl - net-tools - # Utils + - rsync + +- name: Install packages (general tools) + apt: + name: '{{ item }}' + state: present + with_items: - moreutils - - dnsutils \ No newline at end of file + - dnsutils diff --git a/docker/main/ubuntu/provision/roles/users/tasks/home-ssh.yml b/docker/main/ubuntu/provision/roles/users/tasks/home-ssh.yml new file mode 100644 index 0000000..30cc4cd --- /dev/null +++ b/docker/main/ubuntu/provision/roles/users/tasks/home-ssh.yml @@ -0,0 +1,29 @@ +# create a directory if it doesn't exist +- name: Create /home/.ssh/ + file: + path: /home/.ssh/ + state: directory + mode: 0750 + owner: www-data + group: www-data + +- name: Sync etc/ssh/ to /home/.ssh + local_action: synchronize src=/docker/etc/ssh/ dest=/home/.ssh/ perms=no + ignore_errors: True + +- name: Fix /home/.ssh/ permissions + file: + path: /home/.ssh/ + state: directory + owner: www-data + group: www-data + recurse: yes + ignore_errors: True + +- name: Fix ssh key permissions (if exists) + file: + path: /home/.ssh/id_rsa + mode: 0600 + owner: www-data + group: www-data + ignore_errors: True diff --git a/docker/main/ubuntu/provision/roles/users/tasks/main.yml b/docker/main/ubuntu/provision/roles/users/tasks/main.yml index f421097..bec6f03 100644 --- a/docker/main/ubuntu/provision/roles/users/tasks/main.yml +++ b/docker/main/ubuntu/provision/roles/users/tasks/main.yml @@ -1,3 +1,7 @@ - include: www-data.yml tags: - entrypoint + +- include: home-ssh.yml + tags: + - entrypoint From cd66dda32e9beafcf327c82054259a0d791b86db Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Tue, 28 Jul 2015 23:58:49 +0200 Subject: [PATCH 53/66] Updated changelog --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3c8455..3a29f8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,9 @@ TYPO3 Docker Boilerplate Changelog - Added development/production context - Added blackfire.io - Added possiblity to disable Xdebug and Blackfire -- Moved php.ini to etc/php/development.ini and etc/php/production.ini -- Added ssh key/config (etc/ssh) setting for /home/.ssh/ -- Added possibility to use supervisorctl (as root) +- Moved php.ini to `etc/php/development.ini` and `etc/php/production.ini` +- Added ssh key/config (`etc/ssh`) setting for `/home/.ssh/` +- Added possibility to use `supervisorctl` (only for root) - Improved provisioning - Refactored layout - Added prebuilt Docker images From 867ac4571e0d233e27542be102ca473fe96d9d31 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Wed, 29 Jul 2015 21:32:57 +0200 Subject: [PATCH 54/66] Fixed ssl configuration (removed RC4) --- docker/web/httpd/conf/vhost.conf | 4 ++-- docker/web/nginx/conf/vhost.conf | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docker/web/httpd/conf/vhost.conf b/docker/web/httpd/conf/vhost.conf index 2eee222..06eb594 100644 --- a/docker/web/httpd/conf/vhost.conf +++ b/docker/web/httpd/conf/vhost.conf @@ -108,9 +108,9 @@ CustomLog /proc/self/fd/1 dockerlog BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown ## SSL Hardening - SSLProtocol all -SSLv2 -SSLv3 + SSLProtocol All -SSLv2 -SSLv3 SSLHonorCipherOrder on - SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS" SSLCompression off + SSLCipherSuite 'EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA' diff --git a/docker/web/nginx/conf/vhost.conf b/docker/web/nginx/conf/vhost.conf index 218ecd7..544938b 100644 --- a/docker/web/nginx/conf/vhost.conf +++ b/docker/web/nginx/conf/vhost.conf @@ -54,7 +54,11 @@ server { root ""; index ; - ssl on; + ssl on; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # not possible to do exclusive + ssl_ciphers 'EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA'; + ssl_prefer_server_ciphers on; + ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; From 5b5a34a0739af9dae16840e2a7bb89d77a173c51 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Thu, 30 Jul 2015 20:22:06 +0200 Subject: [PATCH 55/66] Removed Dockerfiles to specific version Dockerfiles --- docker-compose.yml | 14 ++++- docker/main/centos/{Dockerfile => Centos-7} | 0 docker/main/ubuntu/Ubuntu-12.04 | 57 +++++++++++++++++++ .../main/ubuntu/{Dockerfile => Ubuntu-14.04} | 6 -- docker/main/ubuntu/Ubuntu-15.04 | 57 +++++++++++++++++++ docker/main/ubuntu/Ubuntu-15.10 | 57 +++++++++++++++++++ 6 files changed, 182 insertions(+), 9 deletions(-) rename docker/main/centos/{Dockerfile => Centos-7} (100%) create mode 100644 docker/main/ubuntu/Ubuntu-12.04 rename docker/main/ubuntu/{Dockerfile => Ubuntu-14.04} (83%) create mode 100644 docker/main/ubuntu/Ubuntu-15.04 create mode 100644 docker/main/ubuntu/Ubuntu-15.10 diff --git a/docker-compose.yml b/docker-compose.yml index db05d65..edbefd4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,9 +2,17 @@ # Main php container ####################################### main: - build: docker/main/ubuntu # dynamic ubuntu version (ansible provisioning) - #build: docker/main/centos # dynamic centos version (ansible provisioning) - #build: docker/main/ubuntu-hhvm # ubuntu lts with HHVM (ansible provisioning) + ## Ubuntu + build: docker/main/ubuntu + #dockerfile: Ubuntu-12.04 # Ubuntu 12.04 - PHP 5.3, LTS (precise) + dockerfile: Ubuntu-14.04 # Ubuntu 14.04 - PHP 5.5, LTS (trusty) + #dockerfile: Ubuntu-15.04 # Ubuntu 15.04 - PHP 5.6 (vivid) + #dockerfile: Ubuntu-15.10 # Ubuntu 15.10 - PHP 5.6 (wily) + + ## CentOS + #build: docker/main/centos + #dockerfile: docker/main/centos/Centos-7 # CentOS 7 - PHP 5.4 + #dockerfile: docker/main/ubuntu-hhvm # ubuntu lts with HHVM (ansible provisioning) links: - mysql #- postgres diff --git a/docker/main/centos/Dockerfile b/docker/main/centos/Centos-7 similarity index 100% rename from docker/main/centos/Dockerfile rename to docker/main/centos/Centos-7 diff --git a/docker/main/ubuntu/Ubuntu-12.04 b/docker/main/ubuntu/Ubuntu-12.04 new file mode 100644 index 0000000..9528778 --- /dev/null +++ b/docker/main/ubuntu/Ubuntu-12.04 @@ -0,0 +1,57 @@ +#++++++++++++++++++++++++++++++++++++++ +# Ubuntu PHP Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Prebuild images: +# +# webdevops/php-boilerplate:ubuntu-12.04 +# +# Official images: +# +# ubuntu:12.04 - PHP 5.3, LTS (precise) +# https://registry.hub.docker.com/u/library/ubuntu/ +# +#++++++++++++++++++++++++++++++++++++++ + +FROM webdevops/php-boilerplate:ubuntu-12.04 + +# Ensure UTF-8 +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +## +# Bootstrap +## + +COPY conf/locale.conf /opt/docker/locale.conf +COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision /opt/docker/provision/ + +RUN bash /opt/docker/bin/bootstrap.sh +RUN bash /opt/docker/bin/provision.sh bootstrap + +## +# Customization +## + +COPY bin/customization.sh /opt/docker/bin/customization.sh +RUN bash /opt/docker/bin/customization.sh + +## +# Config +## + +COPY entrypoint.sh /entrypoint.sh +COPY conf /opt/docker/conf/ + +EXPOSE 9000 + +VOLUME /docker/ +WORKDIR /docker/code/ + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["supervisord"] diff --git a/docker/main/ubuntu/Dockerfile b/docker/main/ubuntu/Ubuntu-14.04 similarity index 83% rename from docker/main/ubuntu/Dockerfile rename to docker/main/ubuntu/Ubuntu-14.04 index 9e0926a..567b8fc 100644 --- a/docker/main/ubuntu/Dockerfile +++ b/docker/main/ubuntu/Ubuntu-14.04 @@ -4,17 +4,11 @@ # # Prebuild images: # -# webdevops/php-boilerplate:ubuntu-12.04 # webdevops/php-boilerplate:ubuntu-14.04 -# webdevops/php-boilerplate:ubuntu-15.04 -# webdevops/php-boilerplate:ubuntu-15.10 # # Official images: # -# ubuntu:12.04 - PHP 5.3, LTS (precise) # ubuntu:14.04 - PHP 5.5, LTS (trusty) -# ubuntu:15.04 - PHP 5.6 (vivid) -# ubuntu:15.10 - PHP 5.6 (wily) # https://registry.hub.docker.com/u/library/ubuntu/ # #++++++++++++++++++++++++++++++++++++++ diff --git a/docker/main/ubuntu/Ubuntu-15.04 b/docker/main/ubuntu/Ubuntu-15.04 new file mode 100644 index 0000000..7cd3889 --- /dev/null +++ b/docker/main/ubuntu/Ubuntu-15.04 @@ -0,0 +1,57 @@ +#++++++++++++++++++++++++++++++++++++++ +# Ubuntu PHP Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Prebuild images: +# +# webdevops/php-boilerplate:ubuntu-15.04 +# +# Official images: +# +# ubuntu:15.04 - PHP 5.6 (vivid) +# https://registry.hub.docker.com/u/library/ubuntu/ +# +#++++++++++++++++++++++++++++++++++++++ + +FROM webdevops/php-boilerplate:ubuntu-15.04 + +# Ensure UTF-8 +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +## +# Bootstrap +## + +COPY conf/locale.conf /opt/docker/locale.conf +COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision /opt/docker/provision/ + +RUN bash /opt/docker/bin/bootstrap.sh +RUN bash /opt/docker/bin/provision.sh bootstrap + +## +# Customization +## + +COPY bin/customization.sh /opt/docker/bin/customization.sh +RUN bash /opt/docker/bin/customization.sh + +## +# Config +## + +COPY entrypoint.sh /entrypoint.sh +COPY conf /opt/docker/conf/ + +EXPOSE 9000 + +VOLUME /docker/ +WORKDIR /docker/code/ + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["supervisord"] diff --git a/docker/main/ubuntu/Ubuntu-15.10 b/docker/main/ubuntu/Ubuntu-15.10 new file mode 100644 index 0000000..fef1c2e --- /dev/null +++ b/docker/main/ubuntu/Ubuntu-15.10 @@ -0,0 +1,57 @@ +#++++++++++++++++++++++++++++++++++++++ +# Ubuntu PHP Docker container +#++++++++++++++++++++++++++++++++++++++ +# +# Prebuild images: +# +# webdevops/php-boilerplate:ubuntu-15.10 +# +# Official images: +# +# ubuntu:15.10 - PHP 5.6 (wily) +# https://registry.hub.docker.com/u/library/ubuntu/ +# +#++++++++++++++++++++++++++++++++++++++ + +FROM webdevops/php-boilerplate:ubuntu-15.10 + +# Ensure UTF-8 +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +## +# Bootstrap +## + +COPY conf/locale.conf /opt/docker/locale.conf +COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision /opt/docker/provision/ + +RUN bash /opt/docker/bin/bootstrap.sh +RUN bash /opt/docker/bin/provision.sh bootstrap + +## +# Customization +## + +COPY bin/customization.sh /opt/docker/bin/customization.sh +RUN bash /opt/docker/bin/customization.sh + +## +# Config +## + +COPY entrypoint.sh /entrypoint.sh +COPY conf /opt/docker/conf/ + +EXPOSE 9000 + +VOLUME /docker/ +WORKDIR /docker/code/ + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["supervisord"] From af26648be731891cdd0b38613f05a0b18b7a69ad Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Thu, 30 Jul 2015 20:51:34 +0200 Subject: [PATCH 56/66] Cleanup common docker main container --- docker/main/centos/bin/customization.sh | 8 --- docker/main/centos/bin/dnsmasq.sh | 56 ------------------- docker/main/centos/bin/logwatch.sh | 8 --- docker/main/centos/bin/provision.sh | 18 ------ docker/main/centos/entrypoint.sh | 54 ------------------ docker/main/centos/htdocs/.gitkeep | 0 docker/main/ubuntu/Ubuntu-12.04 | 14 ++--- docker/main/ubuntu/Ubuntu-14.04 | 14 ++--- docker/main/ubuntu/Ubuntu-15.04 | 14 ++--- docker/main/ubuntu/Ubuntu-15.10 | 14 ++--- .../bin => ubuntu/bin/centos}/bootstrap.sh | 0 docker/main/ubuntu/bin/dnsmasq.sh | 9 +-- docker/main/ubuntu/bin/provision.sh | 1 - .../main/ubuntu/bin/{ => ubuntu}/bootstrap.sh | 0 .../conf => ubuntu/conf/centos}/locale.conf | 0 .../conf/centos}/supervisord.conf | 0 .../main/ubuntu/conf/{ => ubuntu}/locale.conf | 0 .../ubuntu/conf/{ => ubuntu}/supervisord.conf | 0 18 files changed, 29 insertions(+), 181 deletions(-) delete mode 100644 docker/main/centos/bin/customization.sh delete mode 100644 docker/main/centos/bin/dnsmasq.sh delete mode 100644 docker/main/centos/bin/logwatch.sh delete mode 100644 docker/main/centos/bin/provision.sh delete mode 100755 docker/main/centos/entrypoint.sh delete mode 100644 docker/main/centos/htdocs/.gitkeep rename docker/main/{centos/bin => ubuntu/bin/centos}/bootstrap.sh (100%) rename docker/main/ubuntu/bin/{ => ubuntu}/bootstrap.sh (100%) rename docker/main/{centos/conf => ubuntu/conf/centos}/locale.conf (100%) rename docker/main/{centos/conf => ubuntu/conf/centos}/supervisord.conf (100%) rename docker/main/ubuntu/conf/{ => ubuntu}/locale.conf (100%) rename docker/main/ubuntu/conf/{ => ubuntu}/supervisord.conf (100%) diff --git a/docker/main/centos/bin/customization.sh b/docker/main/centos/bin/customization.sh deleted file mode 100644 index 65cbb7f..0000000 --- a/docker/main/centos/bin/customization.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -## add your custom stuff here diff --git a/docker/main/centos/bin/dnsmasq.sh b/docker/main/centos/bin/dnsmasq.sh deleted file mode 100644 index 67ee59f..0000000 --- a/docker/main/centos/bin/dnsmasq.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -sleep 5 - -## backup original resolv.conf -if [ ! -f "/opt/docker/.resolv.conf" ]; then - ## backup original file - cp /etc/resolv.conf /opt/docker/.resolv.conf -fi - -## Restore original resolvconf -function restore_resolvconf() { - ## restore original resolv.conf - cp /opt/docker/.resolv.conf /etc/resolv.conf -} - -## Start and configure dnsmasq -function dnsmasq_start() { - echo "[dnsmasq] Found Webserver IP: $1" - - restore_resolvconf - - ## clear dns file - echo > /etc/dnsmasq.d/development - - ## add IP for each domain (wildcard!) - for DOMAIN in $DNS_DOMAIN; do - echo "address=/${DOMAIN}/${1}" >> /etc/dnsmasq.d/development - done - - ## set forward servers - cat /opt/docker/.resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward - - ## set dnsmasq to main nameserver - echo "nameserver 127.0.0.1" > /etc/resolv.conf - - dnsmasq --keep-in-foreground -} - -## Fetch IP from services -if [ -f "/data/dns/web.ip" ]; then - ## Found WEB - dnsmasq_start "$(cat /data/dns/web.ip)" -elif [ -f "/data/dns/httpd.ip" ]; then - ## Found HTTPD (fallback) - dnsmasq_start "$(cat /data/dns/httpd.ip)" -elif [ -f "/data/dns/nginx.ip" ]; then - ## Found NGINX (fallback) - dnsmasq_start "$(cat /data/dns/nginx.ip)" -else - ## Found nothing, restore original resolvconf - restore_resolvconf - sleep 15 -fi - -exit 0 diff --git a/docker/main/centos/bin/logwatch.sh b/docker/main/centos/bin/logwatch.sh deleted file mode 100644 index 729e0ca..0000000 --- a/docker/main/centos/bin/logwatch.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -tail -F --quiet $2 | sed --unbuffered -e "s/^/\[$1\] /" diff --git a/docker/main/centos/bin/provision.sh b/docker/main/centos/bin/provision.sh deleted file mode 100644 index 0edba74..0000000 --- a/docker/main/centos/bin/provision.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -export PYTHONUNBUFFERED=1 - -ANSIBLE_DIR='/opt/docker/provision' - -ANSIBLE_TAG="$1" - -# workaround if windows -chmod -x "$ANSIBLE_DIR/inventory" - -# run ansible -ansible-playbook "$ANSIBLE_DIR/playbook.yml" --inventory="$ANSIBLE_DIR/inventory" --tags="${ANSIBLE_TAG}" diff --git a/docker/main/centos/entrypoint.sh b/docker/main/centos/entrypoint.sh deleted file mode 100755 index aef20bc..0000000 --- a/docker/main/centos/entrypoint.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -set -e - -bash /opt/docker/bin/provision.sh entrypoint - -############################# -## COMMAND -############################# - -case "$1" in - - ## Supervisord (start daemons) - supervisord) - ## Register IP - ETH0_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') - mkdir -p /data/dns/ - chmod 777 /data/dns/ - echo "${ETH0_IP}" > /data/dns/main.ip - echo "${ETH0_IP} main main_1" > /data/dns/main.hosts - - ## Start services - cd / - exec supervisord -c /opt/docker/conf/supervisord.conf --logfile /dev/null --pidfile /dev/null --user root - ;; - - ## Root shell - root) - if [ "$#" -eq 1 ]; then - ## No command, fall back to shell - exec bash - else - ## Exec root command - shift - exec "$@" - fi - ;; - - ## Defined cli script - cli) - if [ -n "${CLI_SCRIPT}" ]; then - shift - exec sudo -H -E -u "${CLI_USER}" ${CLI_SCRIPT} "$@" - else - echo "[ERROR] No CLI_SCRIPT in docker-env.yml defined" - exit 1 - fi - ;; - - ## All other commands - *) - ## Execute cmd - exec sudo -H -E -u "${CLI_USER}" "$@" - ;; -esac diff --git a/docker/main/centos/htdocs/.gitkeep b/docker/main/centos/htdocs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docker/main/ubuntu/Ubuntu-12.04 b/docker/main/ubuntu/Ubuntu-12.04 index 9528778..607d49b 100644 --- a/docker/main/ubuntu/Ubuntu-12.04 +++ b/docker/main/ubuntu/Ubuntu-12.04 @@ -24,12 +24,12 @@ ENV LC_ALL en_US.UTF-8 # Bootstrap ## -COPY conf/locale.conf /opt/docker/locale.conf -COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh -COPY bin/provision.sh /opt/docker/bin/provision.sh -COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh -COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh -COPY provision /opt/docker/provision/ +COPY conf/ubuntu/locale.conf /opt/docker/locale.conf +COPY bin/ubuntu/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision /opt/docker/provision/ RUN bash /opt/docker/bin/bootstrap.sh RUN bash /opt/docker/bin/provision.sh bootstrap @@ -46,7 +46,7 @@ RUN bash /opt/docker/bin/customization.sh ## COPY entrypoint.sh /entrypoint.sh -COPY conf /opt/docker/conf/ +COPY conf/ubuntu /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/ubuntu/Ubuntu-14.04 b/docker/main/ubuntu/Ubuntu-14.04 index 567b8fc..09540eb 100644 --- a/docker/main/ubuntu/Ubuntu-14.04 +++ b/docker/main/ubuntu/Ubuntu-14.04 @@ -24,12 +24,12 @@ ENV LC_ALL en_US.UTF-8 # Bootstrap ## -COPY conf/locale.conf /opt/docker/locale.conf -COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh -COPY bin/provision.sh /opt/docker/bin/provision.sh -COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh -COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh -COPY provision /opt/docker/provision/ +COPY conf/ubuntu/locale.conf /opt/docker/locale.conf +COPY bin/ubuntu/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision /opt/docker/provision/ RUN bash /opt/docker/bin/bootstrap.sh RUN bash /opt/docker/bin/provision.sh bootstrap @@ -46,7 +46,7 @@ RUN bash /opt/docker/bin/customization.sh ## COPY entrypoint.sh /entrypoint.sh -COPY conf /opt/docker/conf/ +COPY conf/ubuntu /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/ubuntu/Ubuntu-15.04 b/docker/main/ubuntu/Ubuntu-15.04 index 7cd3889..432d016 100644 --- a/docker/main/ubuntu/Ubuntu-15.04 +++ b/docker/main/ubuntu/Ubuntu-15.04 @@ -24,12 +24,12 @@ ENV LC_ALL en_US.UTF-8 # Bootstrap ## -COPY conf/locale.conf /opt/docker/locale.conf -COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh -COPY bin/provision.sh /opt/docker/bin/provision.sh -COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh -COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh -COPY provision /opt/docker/provision/ +COPY conf/ubuntu/locale.conf /opt/docker/locale.conf +COPY bin/ubuntu/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision /opt/docker/provision/ RUN bash /opt/docker/bin/bootstrap.sh RUN bash /opt/docker/bin/provision.sh bootstrap @@ -46,7 +46,7 @@ RUN bash /opt/docker/bin/customization.sh ## COPY entrypoint.sh /entrypoint.sh -COPY conf /opt/docker/conf/ +COPY conf/ubuntu /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/ubuntu/Ubuntu-15.10 b/docker/main/ubuntu/Ubuntu-15.10 index fef1c2e..a03d1eb 100644 --- a/docker/main/ubuntu/Ubuntu-15.10 +++ b/docker/main/ubuntu/Ubuntu-15.10 @@ -24,12 +24,12 @@ ENV LC_ALL en_US.UTF-8 # Bootstrap ## -COPY conf/locale.conf /opt/docker/locale.conf -COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh -COPY bin/provision.sh /opt/docker/bin/provision.sh -COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh -COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh -COPY provision /opt/docker/provision/ +COPY conf/ubuntu/locale.conf /opt/docker/locale.conf +COPY bin/ubuntu/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision /opt/docker/provision/ RUN bash /opt/docker/bin/bootstrap.sh RUN bash /opt/docker/bin/provision.sh bootstrap @@ -46,7 +46,7 @@ RUN bash /opt/docker/bin/customization.sh ## COPY entrypoint.sh /entrypoint.sh -COPY conf /opt/docker/conf/ +COPY conf/ubuntu /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/centos/bin/bootstrap.sh b/docker/main/ubuntu/bin/centos/bootstrap.sh similarity index 100% rename from docker/main/centos/bin/bootstrap.sh rename to docker/main/ubuntu/bin/centos/bootstrap.sh diff --git a/docker/main/ubuntu/bin/dnsmasq.sh b/docker/main/ubuntu/bin/dnsmasq.sh index ff75300..67ee59f 100644 --- a/docker/main/ubuntu/bin/dnsmasq.sh +++ b/docker/main/ubuntu/bin/dnsmasq.sh @@ -6,9 +6,6 @@ sleep 5 if [ ! -f "/opt/docker/.resolv.conf" ]; then ## backup original file cp /etc/resolv.conf /opt/docker/.resolv.conf - - ## Copy resolv.conf for dnsmasq (default resolver) - cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf fi ## Restore original resolvconf @@ -34,14 +31,10 @@ function dnsmasq_start() { ## set forward servers cat /opt/docker/.resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward - ## (re)start dnsmasq as DNS server - service dnsmasq restart - ## set dnsmasq to main nameserver echo "nameserver 127.0.0.1" > /etc/resolv.conf - ## wait for 10 hours - sleep 10h + dnsmasq --keep-in-foreground } ## Fetch IP from services diff --git a/docker/main/ubuntu/bin/provision.sh b/docker/main/ubuntu/bin/provision.sh index c9d06fc..0edba74 100644 --- a/docker/main/ubuntu/bin/provision.sh +++ b/docker/main/ubuntu/bin/provision.sh @@ -5,7 +5,6 @@ set -o errtrace # trace ERR through 'time command' and other functions set -o nounset ## set -u : exit the script if you try to use an uninitialised variable set -o errexit ## set -e : exit the script if any statement returns a non-true return value -export DEBIAN_FRONTEND="noninteractive" export PYTHONUNBUFFERED=1 ANSIBLE_DIR='/opt/docker/provision' diff --git a/docker/main/ubuntu/bin/bootstrap.sh b/docker/main/ubuntu/bin/ubuntu/bootstrap.sh similarity index 100% rename from docker/main/ubuntu/bin/bootstrap.sh rename to docker/main/ubuntu/bin/ubuntu/bootstrap.sh diff --git a/docker/main/centos/conf/locale.conf b/docker/main/ubuntu/conf/centos/locale.conf similarity index 100% rename from docker/main/centos/conf/locale.conf rename to docker/main/ubuntu/conf/centos/locale.conf diff --git a/docker/main/centos/conf/supervisord.conf b/docker/main/ubuntu/conf/centos/supervisord.conf similarity index 100% rename from docker/main/centos/conf/supervisord.conf rename to docker/main/ubuntu/conf/centos/supervisord.conf diff --git a/docker/main/ubuntu/conf/locale.conf b/docker/main/ubuntu/conf/ubuntu/locale.conf similarity index 100% rename from docker/main/ubuntu/conf/locale.conf rename to docker/main/ubuntu/conf/ubuntu/locale.conf diff --git a/docker/main/ubuntu/conf/supervisord.conf b/docker/main/ubuntu/conf/ubuntu/supervisord.conf similarity index 100% rename from docker/main/ubuntu/conf/supervisord.conf rename to docker/main/ubuntu/conf/ubuntu/supervisord.conf From 92b7eda84340c6609ec3c7130ce2520cf1d4f67a Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Thu, 30 Jul 2015 21:35:32 +0200 Subject: [PATCH 57/66] Refactored main container into a single one container # Conflicts: # docker/main/centos/provision/variables.yml --- docker/main/centos/provision/ansible.cfg | 0 docker/main/centos/provision/inventory | 1 - docker/main/centos/provision/playbook.yml | 13 ------ .../provision/roles/common/tasks/main.yml | 8 ---- .../provision/roles/common/tasks/update.yml | 2 - .../roles/dnsmasqd/tasks/install.yml | 16 ------- .../provision/roles/dnsmasqd/tasks/main.yml | 3 -- .../roles/finalize/tasks/cleanup.yml | 2 - .../provision/roles/finalize/tasks/main.yml | 3 -- .../roles/mysql/tasks/configuration.yml | 15 ------ .../provision/roles/mysql/tasks/install.yml | 6 --- .../provision/roles/mysql/tasks/main.yml | 7 --- .../provision/roles/mysql/templates/my.cnf.j2 | 21 --------- .../centos/provision/roles/php/tasks/main.yml | 15 ------ .../roles/ssmtp/tasks/configuration.yml | 8 ---- .../provision/roles/ssmtp/tasks/install.yml | 6 --- .../provision/roles/ssmtp/tasks/main.yml | 7 --- .../roles/supervisord/tasks/install.yml | 6 --- .../roles/supervisord/tasks/main.yml | 3 -- .../provision/roles/users/tasks/home-ssh.yml | 29 ------------ .../provision/roles/users/tasks/main.yml | 7 --- docker/main/centos/provision/variables.yml | 46 ------------------- docker/main/{centos => ubuntu}/Centos-7 | 14 +++--- docker/main/ubuntu/Ubuntu-15.10 | 4 +- docker/main/ubuntu/bin/provision.sh | 2 +- .../provision/roles/common/tasks/main.yml | 16 ++++++- .../roles/common/tasks/packages-centos.yml} | 0 .../{packages.yml => packages-ubuntu.yml} | 0 .../roles/common/tasks/update-centos.yml | 2 + .../roles/common/tasks/update-ubuntu.yml | 5 ++ .../provision/roles/common/tasks/update.yml | 5 -- .../roles/dnsmasqd/tasks/install.yml | 9 ++++ .../roles/finalize/tasks/cleanup.yml | 6 +++ .../provision/roles/locales/tasks/main.yml | 1 + .../roles/mysql/tasks/configuration.yml | 6 +-- .../provision/roles/mysql/tasks/install.yml | 11 ++++- .../roles/php/tasks/centos}/blackfire.yml | 0 .../roles/php/tasks/centos}/configuration.yml | 0 .../roles/php/tasks/centos}/install.yml | 0 .../roles/php/tasks/centos}/modules.yml | 0 .../ubuntu/provision/roles/php/tasks/main.yml | 38 +++++++++++++-- .../php/tasks/{ => ubuntu}/blackfire.yml | 0 .../php/tasks/{ => ubuntu}/configuration.yml | 0 .../roles/php/tasks/{ => ubuntu}/install.yml | 0 .../roles/php/tasks/{ => ubuntu}/modules.yml | 0 .../provision/roles/ssmtp/tasks/install.yml | 9 ++++ .../roles/supervisord/tasks/install.yml | 9 ++++ .../provision/roles/users/tasks/home-ssh.yml | 12 ++--- .../provision/roles/users/tasks/main.yml | 2 +- .../provision/roles/users/tasks/user.yml} | 2 +- .../provision/roles/users/tasks/www-data.yml | 19 -------- 51 files changed, 120 insertions(+), 276 deletions(-) delete mode 100644 docker/main/centos/provision/ansible.cfg delete mode 100644 docker/main/centos/provision/inventory delete mode 100755 docker/main/centos/provision/playbook.yml delete mode 100644 docker/main/centos/provision/roles/common/tasks/main.yml delete mode 100644 docker/main/centos/provision/roles/common/tasks/update.yml delete mode 100644 docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml delete mode 100644 docker/main/centos/provision/roles/dnsmasqd/tasks/main.yml delete mode 100644 docker/main/centos/provision/roles/finalize/tasks/cleanup.yml delete mode 100644 docker/main/centos/provision/roles/finalize/tasks/main.yml delete mode 100644 docker/main/centos/provision/roles/mysql/tasks/configuration.yml delete mode 100644 docker/main/centos/provision/roles/mysql/tasks/install.yml delete mode 100644 docker/main/centos/provision/roles/mysql/tasks/main.yml delete mode 100644 docker/main/centos/provision/roles/mysql/templates/my.cnf.j2 delete mode 100644 docker/main/centos/provision/roles/php/tasks/main.yml delete mode 100644 docker/main/centos/provision/roles/ssmtp/tasks/configuration.yml delete mode 100644 docker/main/centos/provision/roles/ssmtp/tasks/install.yml delete mode 100644 docker/main/centos/provision/roles/ssmtp/tasks/main.yml delete mode 100644 docker/main/centos/provision/roles/supervisord/tasks/install.yml delete mode 100644 docker/main/centos/provision/roles/supervisord/tasks/main.yml delete mode 100644 docker/main/centos/provision/roles/users/tasks/home-ssh.yml delete mode 100644 docker/main/centos/provision/roles/users/tasks/main.yml delete mode 100644 docker/main/centos/provision/variables.yml rename docker/main/{centos => ubuntu}/Centos-7 (70%) rename docker/main/{centos/provision/roles/common/tasks/packages.yml => ubuntu/provision/roles/common/tasks/packages-centos.yml} (100%) rename docker/main/ubuntu/provision/roles/common/tasks/{packages.yml => packages-ubuntu.yml} (100%) create mode 100644 docker/main/ubuntu/provision/roles/common/tasks/update-centos.yml create mode 100644 docker/main/ubuntu/provision/roles/common/tasks/update-ubuntu.yml delete mode 100644 docker/main/ubuntu/provision/roles/common/tasks/update.yml rename docker/main/{centos/provision/roles/php/tasks => ubuntu/provision/roles/php/tasks/centos}/blackfire.yml (100%) rename docker/main/{centos/provision/roles/php/tasks => ubuntu/provision/roles/php/tasks/centos}/configuration.yml (100%) rename docker/main/{centos/provision/roles/php/tasks => ubuntu/provision/roles/php/tasks/centos}/install.yml (100%) rename docker/main/{centos/provision/roles/php/tasks => ubuntu/provision/roles/php/tasks/centos}/modules.yml (100%) rename docker/main/ubuntu/provision/roles/php/tasks/{ => ubuntu}/blackfire.yml (100%) rename docker/main/ubuntu/provision/roles/php/tasks/{ => ubuntu}/configuration.yml (100%) rename docker/main/ubuntu/provision/roles/php/tasks/{ => ubuntu}/install.yml (100%) rename docker/main/ubuntu/provision/roles/php/tasks/{ => ubuntu}/modules.yml (100%) rename docker/main/{centos/provision/roles/users/tasks/www-data.yml => ubuntu/provision/roles/users/tasks/user.yml} (96%) delete mode 100644 docker/main/ubuntu/provision/roles/users/tasks/www-data.yml diff --git a/docker/main/centos/provision/ansible.cfg b/docker/main/centos/provision/ansible.cfg deleted file mode 100644 index e69de29..0000000 diff --git a/docker/main/centos/provision/inventory b/docker/main/centos/provision/inventory deleted file mode 100644 index 00639f8..0000000 --- a/docker/main/centos/provision/inventory +++ /dev/null @@ -1 +0,0 @@ -localhost ansible_connection=local \ No newline at end of file diff --git a/docker/main/centos/provision/playbook.yml b/docker/main/centos/provision/playbook.yml deleted file mode 100755 index e0d3d12..0000000 --- a/docker/main/centos/provision/playbook.yml +++ /dev/null @@ -1,13 +0,0 @@ -- hosts: all - vars_files: - - /opt/docker/provision/variables.yml - roles: - - common - - users - #- locales - - supervisord - - dnsmasqd - - ssmtp - - php - - mysql - - finalize diff --git a/docker/main/centos/provision/roles/common/tasks/main.yml b/docker/main/centos/provision/roles/common/tasks/main.yml deleted file mode 100644 index 711f812..0000000 --- a/docker/main/centos/provision/roles/common/tasks/main.yml +++ /dev/null @@ -1,8 +0,0 @@ -# currently fails because of missing AUFS features -#- include: update.yml -# tags: -# - bootstrap - -- include: packages.yml - tags: - - bootstrap diff --git a/docker/main/centos/provision/roles/common/tasks/update.yml b/docker/main/centos/provision/roles/common/tasks/update.yml deleted file mode 100644 index 6e5627f..0000000 --- a/docker/main/centos/provision/roles/common/tasks/update.yml +++ /dev/null @@ -1,2 +0,0 @@ -- name: Update system - yum: name=* state=latest \ No newline at end of file diff --git a/docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml deleted file mode 100644 index 74a58cb..0000000 --- a/docker/main/centos/provision/roles/dnsmasqd/tasks/install.yml +++ /dev/null @@ -1,16 +0,0 @@ -- name: Install dnsmasqd - yum: - name: '{{ item }}' - state: present - with_items: - - dnsmasq - -- name: Configure dnsmasq - lineinfile: - dest: /etc/dnsmasq.conf - regexp: '^[\s]*{{ item.key }}[\s]*=' - line: '{{ item.key }}={{ item.value }}' - with_items: - - { key: 'user', value: 'root' } - - { key: 'conf-dir', value: '/etc/dnsmasq.d' } - diff --git a/docker/main/centos/provision/roles/dnsmasqd/tasks/main.yml b/docker/main/centos/provision/roles/dnsmasqd/tasks/main.yml deleted file mode 100644 index e3418cb..0000000 --- a/docker/main/centos/provision/roles/dnsmasqd/tasks/main.yml +++ /dev/null @@ -1,3 +0,0 @@ -- include: install.yml - tags: - - bootstrap diff --git a/docker/main/centos/provision/roles/finalize/tasks/cleanup.yml b/docker/main/centos/provision/roles/finalize/tasks/cleanup.yml deleted file mode 100644 index d4b35f6..0000000 --- a/docker/main/centos/provision/roles/finalize/tasks/cleanup.yml +++ /dev/null @@ -1,2 +0,0 @@ -- name: Cleanup yum - command: yum clean all \ No newline at end of file diff --git a/docker/main/centos/provision/roles/finalize/tasks/main.yml b/docker/main/centos/provision/roles/finalize/tasks/main.yml deleted file mode 100644 index bfb1442..0000000 --- a/docker/main/centos/provision/roles/finalize/tasks/main.yml +++ /dev/null @@ -1,3 +0,0 @@ -- include: cleanup.yml - tags: - - bootstrap diff --git a/docker/main/centos/provision/roles/mysql/tasks/configuration.yml b/docker/main/centos/provision/roles/mysql/tasks/configuration.yml deleted file mode 100644 index 4dbf3e3..0000000 --- a/docker/main/centos/provision/roles/mysql/tasks/configuration.yml +++ /dev/null @@ -1,15 +0,0 @@ -- name: Deploy root my.cnf - template: - src: my.cnf.j2 - dest: /root/.my.cnf - owner: root - group: root - mode: 0644 - -- name: Deploy user my.cnf - template: - src: my.cnf.j2 - dest: /home/.my.cnf - owner: www-data - group: www-data - mode: 0644 \ No newline at end of file diff --git a/docker/main/centos/provision/roles/mysql/tasks/install.yml b/docker/main/centos/provision/roles/mysql/tasks/install.yml deleted file mode 100644 index 39037a1..0000000 --- a/docker/main/centos/provision/roles/mysql/tasks/install.yml +++ /dev/null @@ -1,6 +0,0 @@ -- name: Install mysql client - yum: - name: '{{ item }}' - state: present - with_items: - - mysql \ No newline at end of file diff --git a/docker/main/centos/provision/roles/mysql/tasks/main.yml b/docker/main/centos/provision/roles/mysql/tasks/main.yml deleted file mode 100644 index 35d0963..0000000 --- a/docker/main/centos/provision/roles/mysql/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ -- include: install.yml - tags: - - bootstrap - -- include: configuration.yml - tags: - - entrypoint diff --git a/docker/main/centos/provision/roles/mysql/templates/my.cnf.j2 b/docker/main/centos/provision/roles/mysql/templates/my.cnf.j2 deleted file mode 100644 index c0aaee8..0000000 --- a/docker/main/centos/provision/roles/mysql/templates/my.cnf.j2 +++ /dev/null @@ -1,21 +0,0 @@ -[client] -host=mysql -user="root" -password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" - -[mysql] -host=mysql -user="root" -password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" -database="{{ DOCKER.MYSQL_DATABASE }}" -default-character-set=utf8 -local-infile=1 -show-warnings -auto-rehash -sigint-ignore -reconnect - -[mysqldump] -host=mysql -user="root" -password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" \ No newline at end of file diff --git a/docker/main/centos/provision/roles/php/tasks/main.yml b/docker/main/centos/provision/roles/php/tasks/main.yml deleted file mode 100644 index f96032a..0000000 --- a/docker/main/centos/provision/roles/php/tasks/main.yml +++ /dev/null @@ -1,15 +0,0 @@ -- include: install.yml - tags: - - bootstrap - -- include: blackfire.yml - tags: - - bootstrap - -- include: configuration.yml - tags: - - entrypoint - -- include: modules.yml - tags: - - entrypoint diff --git a/docker/main/centos/provision/roles/ssmtp/tasks/configuration.yml b/docker/main/centos/provision/roles/ssmtp/tasks/configuration.yml deleted file mode 100644 index 44e39b8..0000000 --- a/docker/main/centos/provision/roles/ssmtp/tasks/configuration.yml +++ /dev/null @@ -1,8 +0,0 @@ -- name: Setup ssmtp - lineinfile: - dest: /etc/ssmtp/ssmtp.conf - regexp: '^[\s]*{{ item.key }}[\s]*=' - line: '{{ item.key }}={{ item.value }}' - with_items: - - { key: 'mailhub', value: '{{ DOCKER.MAIL_GATEWAY }}' } - - { key: 'FromLineOverride', value: 'YES' } diff --git a/docker/main/centos/provision/roles/ssmtp/tasks/install.yml b/docker/main/centos/provision/roles/ssmtp/tasks/install.yml deleted file mode 100644 index c9136a9..0000000 --- a/docker/main/centos/provision/roles/ssmtp/tasks/install.yml +++ /dev/null @@ -1,6 +0,0 @@ -- name: Install ssmtp - yum: - name: '{{ item }}' - state: present - with_items: - - ssmtp diff --git a/docker/main/centos/provision/roles/ssmtp/tasks/main.yml b/docker/main/centos/provision/roles/ssmtp/tasks/main.yml deleted file mode 100644 index 35d0963..0000000 --- a/docker/main/centos/provision/roles/ssmtp/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ -- include: install.yml - tags: - - bootstrap - -- include: configuration.yml - tags: - - entrypoint diff --git a/docker/main/centos/provision/roles/supervisord/tasks/install.yml b/docker/main/centos/provision/roles/supervisord/tasks/install.yml deleted file mode 100644 index 464ce4b..0000000 --- a/docker/main/centos/provision/roles/supervisord/tasks/install.yml +++ /dev/null @@ -1,6 +0,0 @@ -- name: Install supervisor - yum: - name: '{{ item }}' - state: present - with_items: - - supervisor diff --git a/docker/main/centos/provision/roles/supervisord/tasks/main.yml b/docker/main/centos/provision/roles/supervisord/tasks/main.yml deleted file mode 100644 index e3418cb..0000000 --- a/docker/main/centos/provision/roles/supervisord/tasks/main.yml +++ /dev/null @@ -1,3 +0,0 @@ -- include: install.yml - tags: - - bootstrap diff --git a/docker/main/centos/provision/roles/users/tasks/home-ssh.yml b/docker/main/centos/provision/roles/users/tasks/home-ssh.yml deleted file mode 100644 index f3b21a7..0000000 --- a/docker/main/centos/provision/roles/users/tasks/home-ssh.yml +++ /dev/null @@ -1,29 +0,0 @@ -# create a directory if it doesn't exist -- name: Create /home/.ssh/ - file: - path: /home/.ssh/ - state: directory - mode: 0750 - owner: "{{ DOCKER.CLI_USER }}" - group: "{{ DOCKER.CLI_USER }}" - -- name: Sync etc/ssh/ to /home/.ssh - local_action: synchronize src=/docker/etc/ssh/ dest=/home/.ssh/ perms=no - ignore_errors: True - -- name: Fix /home/.ssh/ permissions - file: - path: /home/.ssh/ - state: directory - owner: "{{ DOCKER.CLI_USER }}" - group: "{{ DOCKER.CLI_USER }}" - recurse: yes - ignore_errors: True - -- name: Fix ssh key permissions (if exists) - file: - path: /home/.ssh/id_rsa - mode: 0600 - owner: "{{ DOCKER.CLI_USER }}" - group: "{{ DOCKER.CLI_USER }}" - ignore_errors: True diff --git a/docker/main/centos/provision/roles/users/tasks/main.yml b/docker/main/centos/provision/roles/users/tasks/main.yml deleted file mode 100644 index bec6f03..0000000 --- a/docker/main/centos/provision/roles/users/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ -- include: www-data.yml - tags: - - entrypoint - -- include: home-ssh.yml - tags: - - entrypoint diff --git a/docker/main/centos/provision/variables.yml b/docker/main/centos/provision/variables.yml deleted file mode 100644 index f5cf6ec..0000000 --- a/docker/main/centos/provision/variables.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- - -PROVISION: - CONTEXT: "{{ lookup('env','PROVISION_CONTEXT') }}" - - PHP: - BLACKFIRE: "{{ lookup('env','PROVISION_PHP_BLACKFIRE') }}" - XDEBUG: "{{ lookup('env','PROVISION_PHP_XDEBUG') }}" - -DOCKER: - # System - EFFECTIVE_UID: "{{ lookup('env','EFFECTIVE_UID') }}" - EFFECTIVE_GID: "{{ lookup('env','EFFECTIVE_GID') }}" - CLI_USER: "{{ lookup('env','CLI_USER') }}" - CLI_SCRIPT: "{{ lookup('env','CLI_SCRIPT') }}" - - # http - DOCUMENT_ROOT: "{{ lookup('env','DOCUMENT_ROOT') }}" - DOCUMENT_INDEX: "{{ lookup('env','DOCUMENT_INDEX') }}" - - - # MySQL - MYSQL_ROOT_PASSWORD: "{{ lookup('env','MYSQL_ROOT_PASSWORD') }}" - MYSQL_USER: "{{ lookup('env','MYSQL_USER') }}" - MYSQL_PASSWORD: "{{ lookup('env','MYSQL_PASSWORD') }}" - MYSQL_DATABASE: "{{ lookup('env','MYSQL_DATABASE') }}" - - # PostgreSQL - POSTGRES_USER: "{{ lookup('env','POSTGRES_USER') }}" - POSTGRES_PASSWORD: "{{ lookup('env','POSTGRES_PASSWORD') }}" - - # FTP - FTP_USER: "{{ lookup('env','FTP_USER') }}" - FTP_PASSWORD: "{{ lookup('env','FTP_PASSWORD') }}" - FTP_PATH: "{{ lookup('env','FTP_PATH') }}" - - # Mail - MAIL_GATEWAY: "{{ lookup('env','MAIL_GATEWAY') }}" - - # DNS - DNS_DOMAIN: "{{ lookup('env','DNS_DOMAIN') }}" - - # Context - TYPO3_CONTEXT: "{{ lookup('env','TYPO3_CONTEXT') }}" - FLOW_CONTEXT: "{{ lookup('env','FLOW_CONTEXT') }}" - FLOW_REWRITEURLS: "{{ lookup('env','FLOW_REWRITEURLS') }}" diff --git a/docker/main/centos/Centos-7 b/docker/main/ubuntu/Centos-7 similarity index 70% rename from docker/main/centos/Centos-7 rename to docker/main/ubuntu/Centos-7 index 298f0c7..d52ebb5 100644 --- a/docker/main/centos/Centos-7 +++ b/docker/main/ubuntu/Centos-7 @@ -23,12 +23,12 @@ ENV ANSIBLE_LIBRARY /opt/ansible/library # Bootstrap ## -COPY conf/locale.conf /opt/docker/locale.conf -COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh -COPY bin/provision.sh /opt/docker/bin/provision.sh -COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh -COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh -COPY provision /opt/docker/provision/ +COPY conf/centos/locale.conf /opt/docker/locale.conf +COPY bin/centos/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision /opt/docker/provision/ RUN bash /opt/docker/bin/bootstrap.sh RUN bash /opt/docker/bin/provision.sh bootstrap @@ -45,7 +45,7 @@ RUN bash /opt/docker/bin/customization.sh ## COPY entrypoint.sh /entrypoint.sh -COPY conf /opt/docker/conf/ +COPY conf/centos /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/ubuntu/Ubuntu-15.10 b/docker/main/ubuntu/Ubuntu-15.10 index a03d1eb..be103a9 100644 --- a/docker/main/ubuntu/Ubuntu-15.10 +++ b/docker/main/ubuntu/Ubuntu-15.10 @@ -24,7 +24,7 @@ ENV LC_ALL en_US.UTF-8 # Bootstrap ## -COPY conf/ubuntu/locale.conf /opt/docker/locale.conf +COPY conf/locale.conf /opt/docker/locale.conf COPY bin/ubuntu/bootstrap.sh /opt/docker/bin/bootstrap.sh COPY bin/provision.sh /opt/docker/bin/provision.sh COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh @@ -46,7 +46,7 @@ RUN bash /opt/docker/bin/customization.sh ## COPY entrypoint.sh /entrypoint.sh -COPY conf/ubuntu /opt/docker/conf/ +COPY conf /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/ubuntu/bin/provision.sh b/docker/main/ubuntu/bin/provision.sh index 0edba74..a943865 100644 --- a/docker/main/ubuntu/bin/provision.sh +++ b/docker/main/ubuntu/bin/provision.sh @@ -9,7 +9,7 @@ export PYTHONUNBUFFERED=1 ANSIBLE_DIR='/opt/docker/provision' -ANSIBLE_TAG="$1" +ANSIBLE_TAG="$*" # workaround if windows chmod -x "$ANSIBLE_DIR/inventory" diff --git a/docker/main/ubuntu/provision/roles/common/tasks/main.yml b/docker/main/ubuntu/provision/roles/common/tasks/main.yml index 5a308a2..3f59e1d 100644 --- a/docker/main/ubuntu/provision/roles/common/tasks/main.yml +++ b/docker/main/ubuntu/provision/roles/common/tasks/main.yml @@ -1,7 +1,19 @@ -- include: update.yml +- include: update-centos.yml + when: ansible_distribution == 'CentOS' tags: - bootstrap -- include: packages.yml +- include: update-ubuntu.yml + when: ansible_distribution == 'Ubuntu' + tags: + - bootstrap + +- include: packages-centos.yml + when: ansible_distribution == 'CentOS' + tags: + - bootstrap + +- include: packages-ubuntu.yml + when: ansible_distribution == 'Ubuntu' tags: - bootstrap diff --git a/docker/main/centos/provision/roles/common/tasks/packages.yml b/docker/main/ubuntu/provision/roles/common/tasks/packages-centos.yml similarity index 100% rename from docker/main/centos/provision/roles/common/tasks/packages.yml rename to docker/main/ubuntu/provision/roles/common/tasks/packages-centos.yml diff --git a/docker/main/ubuntu/provision/roles/common/tasks/packages.yml b/docker/main/ubuntu/provision/roles/common/tasks/packages-ubuntu.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/common/tasks/packages.yml rename to docker/main/ubuntu/provision/roles/common/tasks/packages-ubuntu.yml diff --git a/docker/main/ubuntu/provision/roles/common/tasks/update-centos.yml b/docker/main/ubuntu/provision/roles/common/tasks/update-centos.yml new file mode 100644 index 0000000..be21a80 --- /dev/null +++ b/docker/main/ubuntu/provision/roles/common/tasks/update-centos.yml @@ -0,0 +1,2 @@ +- name: Update system ... will take some time + yum: name=* state=latest diff --git a/docker/main/ubuntu/provision/roles/common/tasks/update-ubuntu.yml b/docker/main/ubuntu/provision/roles/common/tasks/update-ubuntu.yml new file mode 100644 index 0000000..6588c26 --- /dev/null +++ b/docker/main/ubuntu/provision/roles/common/tasks/update-ubuntu.yml @@ -0,0 +1,5 @@ +- name: Update system (apt-get update) ... will take some time + apt: update_cache=yes + +- name: Upgrade system (apt-get dist-upgrade) ... will take some time + apt: upgrade=dist diff --git a/docker/main/ubuntu/provision/roles/common/tasks/update.yml b/docker/main/ubuntu/provision/roles/common/tasks/update.yml deleted file mode 100644 index e74dcee..0000000 --- a/docker/main/ubuntu/provision/roles/common/tasks/update.yml +++ /dev/null @@ -1,5 +0,0 @@ -- name: Update system - apt: update_cache=yes - -- name: Upgrade system - apt: upgrade=full \ No newline at end of file diff --git a/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml index b09159e..6071ec3 100644 --- a/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml @@ -2,6 +2,15 @@ apt: name: '{{ item }}' state: present + when: ansible_distribution == 'Ubuntu' + with_items: + - dnsmasq + +- name: Install dnsmasqd + yum: + name: '{{ item }}' + state: present + when: ansible_distribution == 'CentOS' with_items: - dnsmasq diff --git a/docker/main/ubuntu/provision/roles/finalize/tasks/cleanup.yml b/docker/main/ubuntu/provision/roles/finalize/tasks/cleanup.yml index c1233fe..aaf085d 100644 --- a/docker/main/ubuntu/provision/roles/finalize/tasks/cleanup.yml +++ b/docker/main/ubuntu/provision/roles/finalize/tasks/cleanup.yml @@ -1,5 +1,11 @@ - name: Cleanup apt command: apt-get clean -y + when: ansible_distribution == 'Ubuntu' - name: Cleanup apt command: apt-get autoclean -y + when: ansible_distribution == 'Ubuntu' + +- name: Cleanup yum + command: yum clean all + when: ansible_distribution == 'CentOS' diff --git a/docker/main/ubuntu/provision/roles/locales/tasks/main.yml b/docker/main/ubuntu/provision/roles/locales/tasks/main.yml index 05aa97d..82ec09e 100644 --- a/docker/main/ubuntu/provision/roles/locales/tasks/main.yml +++ b/docker/main/ubuntu/provision/roles/locales/tasks/main.yml @@ -1,3 +1,4 @@ - include: generate.yml + when: ansible_distribution == 'Ubuntu' tags: - bootstrap diff --git a/docker/main/ubuntu/provision/roles/mysql/tasks/configuration.yml b/docker/main/ubuntu/provision/roles/mysql/tasks/configuration.yml index 4dbf3e3..0840ffa 100644 --- a/docker/main/ubuntu/provision/roles/mysql/tasks/configuration.yml +++ b/docker/main/ubuntu/provision/roles/mysql/tasks/configuration.yml @@ -10,6 +10,6 @@ template: src: my.cnf.j2 dest: /home/.my.cnf - owner: www-data - group: www-data - mode: 0644 \ No newline at end of file + owner: "{{ DOCKER.CLI_USER }}" + group: "{{ DOCKER.CLI_USER }}" + mode: 0644 diff --git a/docker/main/ubuntu/provision/roles/mysql/tasks/install.yml b/docker/main/ubuntu/provision/roles/mysql/tasks/install.yml index 4a79cd3..3506ae2 100644 --- a/docker/main/ubuntu/provision/roles/mysql/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/mysql/tasks/install.yml @@ -2,5 +2,14 @@ apt: name: '{{ item }}' state: present + when: ansible_distribution == 'Ubuntu' with_items: - - mysql-client \ No newline at end of file + - mysql-client + +- name: Install mysql client + yum: + name: '{{ item }}' + state: present + when: ansible_distribution == 'CentOS' + with_items: + - mysql diff --git a/docker/main/centos/provision/roles/php/tasks/blackfire.yml b/docker/main/ubuntu/provision/roles/php/tasks/centos/blackfire.yml similarity index 100% rename from docker/main/centos/provision/roles/php/tasks/blackfire.yml rename to docker/main/ubuntu/provision/roles/php/tasks/centos/blackfire.yml diff --git a/docker/main/centos/provision/roles/php/tasks/configuration.yml b/docker/main/ubuntu/provision/roles/php/tasks/centos/configuration.yml similarity index 100% rename from docker/main/centos/provision/roles/php/tasks/configuration.yml rename to docker/main/ubuntu/provision/roles/php/tasks/centos/configuration.yml diff --git a/docker/main/centos/provision/roles/php/tasks/install.yml b/docker/main/ubuntu/provision/roles/php/tasks/centos/install.yml similarity index 100% rename from docker/main/centos/provision/roles/php/tasks/install.yml rename to docker/main/ubuntu/provision/roles/php/tasks/centos/install.yml diff --git a/docker/main/centos/provision/roles/php/tasks/modules.yml b/docker/main/ubuntu/provision/roles/php/tasks/centos/modules.yml similarity index 100% rename from docker/main/centos/provision/roles/php/tasks/modules.yml rename to docker/main/ubuntu/provision/roles/php/tasks/centos/modules.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/main.yml b/docker/main/ubuntu/provision/roles/php/tasks/main.yml index f96032a..650c67c 100644 --- a/docker/main/ubuntu/provision/roles/php/tasks/main.yml +++ b/docker/main/ubuntu/provision/roles/php/tasks/main.yml @@ -1,15 +1,45 @@ -- include: install.yml +############################# +# Ubuntu +############################# + +- include: ubuntu/install.yml + when: ansible_distribution == 'Ubuntu' + tags: + - bootstrap + +- include: ubuntu/blackfire.yml + when: ansible_distribution == 'Ubuntu' + tags: + - bootstrap + +- include: ubuntu/configuration.yml + tags: + - entrypoint + +- include: ubuntu/modules.yml + tags: + - entrypoint + +############################# +# CentOS +############################# + +- include: centos/install.yml + when: ansible_distribution == 'CentOS' tags: - bootstrap -- include: blackfire.yml +- include: centos/blackfire.yml + when: ansible_distribution == 'CentOS' tags: - bootstrap -- include: configuration.yml +- include: centos/configuration.yml + when: ansible_distribution == 'CentOS' tags: - entrypoint -- include: modules.yml +- include: centos/modules.yml + when: ansible_distribution == 'CentOS' tags: - entrypoint diff --git a/docker/main/ubuntu/provision/roles/php/tasks/blackfire.yml b/docker/main/ubuntu/provision/roles/php/tasks/ubuntu/blackfire.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/php/tasks/blackfire.yml rename to docker/main/ubuntu/provision/roles/php/tasks/ubuntu/blackfire.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/configuration.yml b/docker/main/ubuntu/provision/roles/php/tasks/ubuntu/configuration.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/php/tasks/configuration.yml rename to docker/main/ubuntu/provision/roles/php/tasks/ubuntu/configuration.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/install.yml b/docker/main/ubuntu/provision/roles/php/tasks/ubuntu/install.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/php/tasks/install.yml rename to docker/main/ubuntu/provision/roles/php/tasks/ubuntu/install.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/modules.yml b/docker/main/ubuntu/provision/roles/php/tasks/ubuntu/modules.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/php/tasks/modules.yml rename to docker/main/ubuntu/provision/roles/php/tasks/ubuntu/modules.yml diff --git a/docker/main/ubuntu/provision/roles/ssmtp/tasks/install.yml b/docker/main/ubuntu/provision/roles/ssmtp/tasks/install.yml index 9e20fc6..927e6de 100644 --- a/docker/main/ubuntu/provision/roles/ssmtp/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/ssmtp/tasks/install.yml @@ -2,5 +2,14 @@ apt: name: '{{ item }}' state: present + when: ansible_distribution == 'Ubuntu' + with_items: + - ssmtp + +- name: Install ssmtp + yum: + name: '{{ item }}' + state: present + when: ansible_distribution == 'CentOS' with_items: - ssmtp diff --git a/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml b/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml index 891a714..569d7bc 100644 --- a/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml +++ b/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml @@ -2,5 +2,14 @@ apt: name: '{{ item }}' state: present + when: ansible_distribution == 'Ubuntu' + with_items: + - supervisor + +- name: Install supervisor + yum: + name: '{{ item }}' + state: present + when: ansible_distribution == 'CentOS' with_items: - supervisor diff --git a/docker/main/ubuntu/provision/roles/users/tasks/home-ssh.yml b/docker/main/ubuntu/provision/roles/users/tasks/home-ssh.yml index 30cc4cd..f3b21a7 100644 --- a/docker/main/ubuntu/provision/roles/users/tasks/home-ssh.yml +++ b/docker/main/ubuntu/provision/roles/users/tasks/home-ssh.yml @@ -4,8 +4,8 @@ path: /home/.ssh/ state: directory mode: 0750 - owner: www-data - group: www-data + owner: "{{ DOCKER.CLI_USER }}" + group: "{{ DOCKER.CLI_USER }}" - name: Sync etc/ssh/ to /home/.ssh local_action: synchronize src=/docker/etc/ssh/ dest=/home/.ssh/ perms=no @@ -15,8 +15,8 @@ file: path: /home/.ssh/ state: directory - owner: www-data - group: www-data + owner: "{{ DOCKER.CLI_USER }}" + group: "{{ DOCKER.CLI_USER }}" recurse: yes ignore_errors: True @@ -24,6 +24,6 @@ file: path: /home/.ssh/id_rsa mode: 0600 - owner: www-data - group: www-data + owner: "{{ DOCKER.CLI_USER }}" + group: "{{ DOCKER.CLI_USER }}" ignore_errors: True diff --git a/docker/main/ubuntu/provision/roles/users/tasks/main.yml b/docker/main/ubuntu/provision/roles/users/tasks/main.yml index bec6f03..39d63b2 100644 --- a/docker/main/ubuntu/provision/roles/users/tasks/main.yml +++ b/docker/main/ubuntu/provision/roles/users/tasks/main.yml @@ -1,4 +1,4 @@ -- include: www-data.yml +- include: user.yml tags: - entrypoint diff --git a/docker/main/centos/provision/roles/users/tasks/www-data.yml b/docker/main/ubuntu/provision/roles/users/tasks/user.yml similarity index 96% rename from docker/main/centos/provision/roles/users/tasks/www-data.yml rename to docker/main/ubuntu/provision/roles/users/tasks/user.yml index 7eafb22..b148008 100644 --- a/docker/main/centos/provision/roles/users/tasks/www-data.yml +++ b/docker/main/ubuntu/provision/roles/users/tasks/user.yml @@ -16,4 +16,4 @@ mode: 0755 owner: "{{ DOCKER.CLI_USER }}" group: "{{ DOCKER.CLI_USER }}" - recurse: yes \ No newline at end of file + recurse: yes diff --git a/docker/main/ubuntu/provision/roles/users/tasks/www-data.yml b/docker/main/ubuntu/provision/roles/users/tasks/www-data.yml deleted file mode 100644 index 32b6405..0000000 --- a/docker/main/ubuntu/provision/roles/users/tasks/www-data.yml +++ /dev/null @@ -1,19 +0,0 @@ -- group: - name: "www-data" - gid: "{{ DOCKER.EFFECTIVE_UID }}" - -- user: - name: "www-data" - uid: "{{ DOCKER.EFFECTIVE_GID }}" - group: "www-data" - shell: /bin/bash - home: /home - -# create a directory if it doesn't exist -- file: - path: /home/ - state: directory - mode: 0755 - owner: "www-data" - group: "www-data" - recurse: yes \ No newline at end of file From 41a08a56c3c683be5cab02a5bc7cd4cc883d37f8 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Thu, 30 Jul 2015 22:39:43 +0200 Subject: [PATCH 58/66] Refactored main container (overall provisioning) --- docker-compose.yml | 7 +- docker/main/ubuntu-hhvm/bin/bootstrap.sh | 32 ------- docker/main/ubuntu-hhvm/bin/customization.sh | 10 --- docker/main/ubuntu-hhvm/bin/dnsmasq.sh | 63 -------------- docker/main/ubuntu-hhvm/bin/logwatch.sh | 8 -- docker/main/ubuntu-hhvm/bin/provision.sh | 19 ----- docker/main/ubuntu-hhvm/htdocs/.gitkeep | 0 docker/main/ubuntu-hhvm/provision/ansible.cfg | 0 docker/main/ubuntu-hhvm/provision/inventory | 1 - .../main/ubuntu-hhvm/provision/playbook.yml | 13 --- .../provision/roles/common/tasks/main.yml | 7 -- .../provision/roles/common/tasks/packages.yml | 21 ----- .../provision/roles/common/tasks/update.yml | 5 -- .../roles/dnsmasqd/tasks/install.yml | 16 ---- .../provision/roles/dnsmasqd/tasks/main.yml | 3 - .../roles/finalize/tasks/cleanup.yml | 5 -- .../provision/roles/finalize/tasks/main.yml | 3 - .../roles/locales/tasks/generate.yml | 5 -- .../provision/roles/locales/tasks/main.yml | 3 - .../roles/mysql/tasks/configuration.yml | 15 ---- .../provision/roles/mysql/tasks/install.yml | 6 -- .../provision/roles/mysql/tasks/main.yml | 7 -- .../provision/roles/mysql/templates/my.cnf.j2 | 21 ----- .../roles/php/tasks/configuration.yml | 24 ------ .../provision/roles/php/tasks/install.yml | 83 ------------------- .../provision/roles/php/tasks/main.yml | 7 -- .../roles/ssmtp/tasks/configuration.yml | 8 -- .../provision/roles/ssmtp/tasks/install.yml | 6 -- .../provision/roles/ssmtp/tasks/main.yml | 7 -- .../roles/supervisord/tasks/install.yml | 6 -- .../roles/supervisord/tasks/main.yml | 3 - .../provision/roles/users/tasks/main.yml | 3 - .../provision/roles/users/tasks/www-data.yml | 19 ----- .../main/ubuntu-hhvm/provision/variables.yml | 40 --------- docker/main/ubuntu/Centos-7 | 6 +- docker/main/ubuntu/Ubuntu-12.04 | 6 +- docker/main/ubuntu/Ubuntu-14.04 | 6 +- docker/main/ubuntu/Ubuntu-15.04 | 6 +- docker/main/ubuntu/Ubuntu-15.10 | 8 +- .../Dockerfile => ubuntu/Ubuntu-HHVM} | 18 ++-- .../{ubuntu-hhvm => ubuntu/bin}/entrypoint.sh | 0 docker/main/ubuntu/bin/provision.sh | 6 +- .../conf/ubuntu-hhvm}/locale.conf | 0 .../conf/ubuntu-hhvm}/supervisord.conf | 0 docker/main/ubuntu/entrypoint.sh | 54 ------------ docker/main/ubuntu/provision/playbook.yml | 5 +- .../roles/hhvm/tasks/configuration.yml | 0 .../provision/roles/hhvm/tasks/install.yml | 0 .../provision/roles/hhvm/tasks/main.yml | 0 .../ubuntu/provision/roles/php/tasks/main.yml | 2 + docker/main/ubuntu/provision/variables.yml | 2 + 51 files changed, 44 insertions(+), 551 deletions(-) delete mode 100644 docker/main/ubuntu-hhvm/bin/bootstrap.sh delete mode 100644 docker/main/ubuntu-hhvm/bin/customization.sh delete mode 100644 docker/main/ubuntu-hhvm/bin/dnsmasq.sh delete mode 100644 docker/main/ubuntu-hhvm/bin/logwatch.sh delete mode 100644 docker/main/ubuntu-hhvm/bin/provision.sh delete mode 100644 docker/main/ubuntu-hhvm/htdocs/.gitkeep delete mode 100644 docker/main/ubuntu-hhvm/provision/ansible.cfg delete mode 100644 docker/main/ubuntu-hhvm/provision/inventory delete mode 100755 docker/main/ubuntu-hhvm/provision/playbook.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/common/tasks/main.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/common/tasks/packages.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/common/tasks/update.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/install.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/main.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/cleanup.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/main.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/locales/tasks/generate.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/locales/tasks/main.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/configuration.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/install.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/main.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/mysql/templates/my.cnf.j2 delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/php/tasks/configuration.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/php/tasks/install.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/php/tasks/main.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/configuration.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/install.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/main.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/install.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/main.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/users/tasks/main.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/roles/users/tasks/www-data.yml delete mode 100644 docker/main/ubuntu-hhvm/provision/variables.yml rename docker/main/{ubuntu-hhvm/Dockerfile => ubuntu/Ubuntu-HHVM} (64%) rename docker/main/{ubuntu-hhvm => ubuntu/bin}/entrypoint.sh (100%) rename docker/main/{ubuntu-hhvm/conf => ubuntu/conf/ubuntu-hhvm}/locale.conf (100%) rename docker/main/{ubuntu-hhvm/conf => ubuntu/conf/ubuntu-hhvm}/supervisord.conf (100%) delete mode 100755 docker/main/ubuntu/entrypoint.sh rename docker/main/{ubuntu-hhvm => ubuntu}/provision/roles/hhvm/tasks/configuration.yml (100%) rename docker/main/{ubuntu-hhvm => ubuntu}/provision/roles/hhvm/tasks/install.yml (100%) rename docker/main/{ubuntu-hhvm => ubuntu}/provision/roles/hhvm/tasks/main.yml (100%) diff --git a/docker-compose.yml b/docker-compose.yml index edbefd4..879e26e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,11 +8,8 @@ main: dockerfile: Ubuntu-14.04 # Ubuntu 14.04 - PHP 5.5, LTS (trusty) #dockerfile: Ubuntu-15.04 # Ubuntu 15.04 - PHP 5.6 (vivid) #dockerfile: Ubuntu-15.10 # Ubuntu 15.10 - PHP 5.6 (wily) - - ## CentOS - #build: docker/main/centos - #dockerfile: docker/main/centos/Centos-7 # CentOS 7 - PHP 5.4 - #dockerfile: docker/main/ubuntu-hhvm # ubuntu lts with HHVM (ansible provisioning) + #dockerfile: Ubuntu-HHVM # Ubuntu 14.04 - HHVM (trusty) + #dockerfile: Centos-7 # CentOS 7 - PHP 5.4 links: - mysql #- postgres diff --git a/docker/main/ubuntu-hhvm/bin/bootstrap.sh b/docker/main/ubuntu-hhvm/bin/bootstrap.sh deleted file mode 100644 index a8060f6..0000000 --- a/docker/main/ubuntu-hhvm/bin/bootstrap.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -export DEBIAN_FRONTEND="noninteractive" - -# workaround for slow/freezing apt inside docker(?) -echo 'Acquire::http::Pipeline-Depth "0";' >> /etc/apt/apt.conf.d/00no-pipeline - -if [ -z "`which ansible`" ]; then - # install apt-add-repository if needed - if [ -z "`which apt-add-repository`" ]; then - - apt-get update -q - apt-get install -y --no-install-recommends lsb-release - - - if [ "`lsb_release -r -s`" = '12.04' ]; then - apt-get install -y python-software-properties - else - apt-get install -y software-properties-common - fi - fi - - # Register and install ansible - apt-add-repository ppa:ansible/ansible - apt-get update -q - apt-get install -y ansible python-apt aptitude -fi \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/bin/customization.sh b/docker/main/ubuntu-hhvm/bin/customization.sh deleted file mode 100644 index 861b916..0000000 --- a/docker/main/ubuntu-hhvm/bin/customization.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -export DEBIAN_FRONTEND="noninteractive" - -## add your custom stuff here diff --git a/docker/main/ubuntu-hhvm/bin/dnsmasq.sh b/docker/main/ubuntu-hhvm/bin/dnsmasq.sh deleted file mode 100644 index ff75300..0000000 --- a/docker/main/ubuntu-hhvm/bin/dnsmasq.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash - -sleep 5 - -## backup original resolv.conf -if [ ! -f "/opt/docker/.resolv.conf" ]; then - ## backup original file - cp /etc/resolv.conf /opt/docker/.resolv.conf - - ## Copy resolv.conf for dnsmasq (default resolver) - cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf -fi - -## Restore original resolvconf -function restore_resolvconf() { - ## restore original resolv.conf - cp /opt/docker/.resolv.conf /etc/resolv.conf -} - -## Start and configure dnsmasq -function dnsmasq_start() { - echo "[dnsmasq] Found Webserver IP: $1" - - restore_resolvconf - - ## clear dns file - echo > /etc/dnsmasq.d/development - - ## add IP for each domain (wildcard!) - for DOMAIN in $DNS_DOMAIN; do - echo "address=/${DOMAIN}/${1}" >> /etc/dnsmasq.d/development - done - - ## set forward servers - cat /opt/docker/.resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward - - ## (re)start dnsmasq as DNS server - service dnsmasq restart - - ## set dnsmasq to main nameserver - echo "nameserver 127.0.0.1" > /etc/resolv.conf - - ## wait for 10 hours - sleep 10h -} - -## Fetch IP from services -if [ -f "/data/dns/web.ip" ]; then - ## Found WEB - dnsmasq_start "$(cat /data/dns/web.ip)" -elif [ -f "/data/dns/httpd.ip" ]; then - ## Found HTTPD (fallback) - dnsmasq_start "$(cat /data/dns/httpd.ip)" -elif [ -f "/data/dns/nginx.ip" ]; then - ## Found NGINX (fallback) - dnsmasq_start "$(cat /data/dns/nginx.ip)" -else - ## Found nothing, restore original resolvconf - restore_resolvconf - sleep 15 -fi - -exit 0 diff --git a/docker/main/ubuntu-hhvm/bin/logwatch.sh b/docker/main/ubuntu-hhvm/bin/logwatch.sh deleted file mode 100644 index 729e0ca..0000000 --- a/docker/main/ubuntu-hhvm/bin/logwatch.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -tail -F --quiet $2 | sed --unbuffered -e "s/^/\[$1\] /" diff --git a/docker/main/ubuntu-hhvm/bin/provision.sh b/docker/main/ubuntu-hhvm/bin/provision.sh deleted file mode 100644 index c9d06fc..0000000 --- a/docker/main/ubuntu-hhvm/bin/provision.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # trace ERR through pipes -set -o errtrace # trace ERR through 'time command' and other functions -set -o nounset ## set -u : exit the script if you try to use an uninitialised variable -set -o errexit ## set -e : exit the script if any statement returns a non-true return value - -export DEBIAN_FRONTEND="noninteractive" -export PYTHONUNBUFFERED=1 - -ANSIBLE_DIR='/opt/docker/provision' - -ANSIBLE_TAG="$1" - -# workaround if windows -chmod -x "$ANSIBLE_DIR/inventory" - -# run ansible -ansible-playbook "$ANSIBLE_DIR/playbook.yml" --inventory="$ANSIBLE_DIR/inventory" --tags="${ANSIBLE_TAG}" diff --git a/docker/main/ubuntu-hhvm/htdocs/.gitkeep b/docker/main/ubuntu-hhvm/htdocs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docker/main/ubuntu-hhvm/provision/ansible.cfg b/docker/main/ubuntu-hhvm/provision/ansible.cfg deleted file mode 100644 index e69de29..0000000 diff --git a/docker/main/ubuntu-hhvm/provision/inventory b/docker/main/ubuntu-hhvm/provision/inventory deleted file mode 100644 index 00639f8..0000000 --- a/docker/main/ubuntu-hhvm/provision/inventory +++ /dev/null @@ -1 +0,0 @@ -localhost ansible_connection=local \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/playbook.yml b/docker/main/ubuntu-hhvm/provision/playbook.yml deleted file mode 100755 index 2f7b1c2..0000000 --- a/docker/main/ubuntu-hhvm/provision/playbook.yml +++ /dev/null @@ -1,13 +0,0 @@ -- hosts: all - vars_files: - - /opt/docker/provision/variables.yml - roles: - - common - - locales - - supervisord - - dnsmasqd - - ssmtp - - hhvm - - mysql - - users - - finalize diff --git a/docker/main/ubuntu-hhvm/provision/roles/common/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/common/tasks/main.yml deleted file mode 100644 index 5a308a2..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/common/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ -- include: update.yml - tags: - - bootstrap - -- include: packages.yml - tags: - - bootstrap diff --git a/docker/main/ubuntu-hhvm/provision/roles/common/tasks/packages.yml b/docker/main/ubuntu-hhvm/provision/roles/common/tasks/packages.yml deleted file mode 100644 index 4e0dcb4..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/common/tasks/packages.yml +++ /dev/null @@ -1,21 +0,0 @@ -- name: Install default packages - apt: - name: '{{ item }}' - state: present - with_items: - # System tools - - sudo - # Compression - - zip - - unzip - - bzip2 - # Graphic tools - - imagemagick - - graphicsmagick - # Networking tools - - wget - - curl - - net-tools - # Utils - - moreutils - - dnsutils \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/common/tasks/update.yml b/docker/main/ubuntu-hhvm/provision/roles/common/tasks/update.yml deleted file mode 100644 index e74dcee..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/common/tasks/update.yml +++ /dev/null @@ -1,5 +0,0 @@ -- name: Update system - apt: update_cache=yes - -- name: Upgrade system - apt: upgrade=full \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/install.yml deleted file mode 100644 index b09159e..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/install.yml +++ /dev/null @@ -1,16 +0,0 @@ -- name: Install dnsmasqd - apt: - name: '{{ item }}' - state: present - with_items: - - dnsmasq - -- name: Configure dnsmasq - lineinfile: - dest: /etc/dnsmasq.conf - regexp: '^[\s]*{{ item.key }}[\s]*=' - line: '{{ item.key }}={{ item.value }}' - with_items: - - { key: 'user', value: 'root' } - - { key: 'conf-dir', value: '/etc/dnsmasq.d' } - diff --git a/docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/main.yml deleted file mode 100644 index e3418cb..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/dnsmasqd/tasks/main.yml +++ /dev/null @@ -1,3 +0,0 @@ -- include: install.yml - tags: - - bootstrap diff --git a/docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/cleanup.yml b/docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/cleanup.yml deleted file mode 100644 index c1233fe..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/cleanup.yml +++ /dev/null @@ -1,5 +0,0 @@ -- name: Cleanup apt - command: apt-get clean -y - -- name: Cleanup apt - command: apt-get autoclean -y diff --git a/docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/main.yml deleted file mode 100644 index bfb1442..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/finalize/tasks/main.yml +++ /dev/null @@ -1,3 +0,0 @@ -- include: cleanup.yml - tags: - - bootstrap diff --git a/docker/main/ubuntu-hhvm/provision/roles/locales/tasks/generate.yml b/docker/main/ubuntu-hhvm/provision/roles/locales/tasks/generate.yml deleted file mode 100644 index 21ffe74..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/locales/tasks/generate.yml +++ /dev/null @@ -1,5 +0,0 @@ -- name: Copy defined locales - raw: 'cat /opt/docker/locale.conf >> /var/lib/locales/supported.d/local' - -- name: Generate locales - command: locale-gen diff --git a/docker/main/ubuntu-hhvm/provision/roles/locales/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/locales/tasks/main.yml deleted file mode 100644 index 05aa97d..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/locales/tasks/main.yml +++ /dev/null @@ -1,3 +0,0 @@ -- include: generate.yml - tags: - - bootstrap diff --git a/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/configuration.yml b/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/configuration.yml deleted file mode 100644 index 4dbf3e3..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/configuration.yml +++ /dev/null @@ -1,15 +0,0 @@ -- name: Deploy root my.cnf - template: - src: my.cnf.j2 - dest: /root/.my.cnf - owner: root - group: root - mode: 0644 - -- name: Deploy user my.cnf - template: - src: my.cnf.j2 - dest: /home/.my.cnf - owner: www-data - group: www-data - mode: 0644 \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/install.yml b/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/install.yml deleted file mode 100644 index 4a79cd3..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/install.yml +++ /dev/null @@ -1,6 +0,0 @@ -- name: Install mysql client - apt: - name: '{{ item }}' - state: present - with_items: - - mysql-client \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/main.yml deleted file mode 100644 index 35d0963..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/mysql/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ -- include: install.yml - tags: - - bootstrap - -- include: configuration.yml - tags: - - entrypoint diff --git a/docker/main/ubuntu-hhvm/provision/roles/mysql/templates/my.cnf.j2 b/docker/main/ubuntu-hhvm/provision/roles/mysql/templates/my.cnf.j2 deleted file mode 100644 index c0aaee8..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/mysql/templates/my.cnf.j2 +++ /dev/null @@ -1,21 +0,0 @@ -[client] -host=mysql -user="root" -password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" - -[mysql] -host=mysql -user="root" -password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" -database="{{ DOCKER.MYSQL_DATABASE }}" -default-character-set=utf8 -local-infile=1 -show-warnings -auto-rehash -sigint-ignore -reconnect - -[mysqldump] -host=mysql -user="root" -password="{{ DOCKER.MYSQL_ROOT_PASSWORD }}" \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/php/tasks/configuration.yml b/docker/main/ubuntu-hhvm/provision/roles/php/tasks/configuration.yml deleted file mode 100644 index 7781690..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/php/tasks/configuration.yml +++ /dev/null @@ -1,24 +0,0 @@ -- name: Configure php-fpm (pool www.conf) - lineinfile: - dest: /etc/php5/fpm/pool.d/www.conf - regexp: '^{{ item.key }}[\s]*=' - line: '{{ item.key }} = {{ item.value }}' - with_items: - # Env - - { key: 'env[SYMFONY_ENV]', value: '{{ DOCKER.SYMFONY_ENV }}' } - - { key: 'env[SYMFONY_DEBUG]', value: '{{ DOCKER.SYMFONY_DEBUG }}' } - -- name: Configure php (docker php.ini) - lineinfile: - dest: /opt/docker/conf/php.ini - regexp: '^{{ item.key }}[\s]*=' - line: '{{ item.key }} = {{ item.value }}' - with_items: - - { key: 'date.timezone', value: '{{ DOCKER.PHP_TIMEZONE }}' } - -- name: Truncate log files - command: 'cp /dev/null {{ item }}' - with_items: - - '/tmp/php.slow.log' - - '/tmp/php.error.log' - - '/tmp/php.access.log' diff --git a/docker/main/ubuntu-hhvm/provision/roles/php/tasks/install.yml b/docker/main/ubuntu-hhvm/provision/roles/php/tasks/install.yml deleted file mode 100644 index 79aa278..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/php/tasks/install.yml +++ /dev/null @@ -1,83 +0,0 @@ -- name: Install php - apt: - name: '{{ item }}' - state: present - with_items: - - php5-cli - - php5-fpm - - php5-json - - php5-intl - - php5-curl - - php5-mysqlnd - - php5-xdebug - - php5-memcached - - php5-mcrypt - - php5-gd - - php5-sqlite - - php5-xmlrpc - - php5-xsl - - php5-geoip - - php5-ldap - - php5-memcache - - php5-memcached - - php5-imagick - -- name: Create /etc/php5/mods-available/ - file: - path: /etc/php5/mods-available/ - state: directory - mode: 0755 - -- name: Activate php config files (fpm) - file: - src: '{{ item.file }}' - dest: '/etc/php5/{{ item.category }}/conf.d/{{ item.target }}' - force: yes - state: link - with_items: - # PHP cli - - { category: 'cli', file: '/etc/php5/mods-available/mcrypt.ini', target: '20-mcrypt.ini' } - - { category: 'cli', file: '/opt/docker/conf/php.ini', target: '99-docker-boilerplate.ini' } - # PHP fpm - - { category: 'fpm', file: '/etc/php5/mods-available/mcrypt.ini', target: '20-mcrypt.ini' } - - { category: 'fpm', file: '/opt/docker/conf/php.ini', target: '99-docker-boilerplate.ini' } - -- name: Configure php-fpm (php-fpm.conf) - lineinfile: - dest: /etc/php5/fpm/php-fpm.conf - regexp: '^[\s;]*{{ item.key }}[\s]*=' - line: '{{ item.key }} = {{ item.value }}' - with_items: - - { key: 'daemonize', value: 'no' } - -- name: Configure php-fpm (pool www.conf) - lineinfile: - dest: /etc/php5/fpm/pool.d/www.conf - regexp: '^{{ item.key }}[\s]*=' - line: '{{ item.key }} = {{ item.value }}' - with_items: - # Networking - - { key: 'listen', value: '0.0.0.0:9000' } - # Process manager - - { key: 'pm.max_children', value: '15' } - - { key: 'pm.start_servers', value: '2' } - - { key: 'pm.min_spare_servers', value: '1' } - - { key: 'pm.max_spare_servers', value: '3' } - - { key: 'catch_workers_output', value: 'yes' } - # Logs - - { key: 'access.format', value: '"%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' } - - { key: 'access.log', value: '/tmp/php.access.log' } - - { key: 'slowlog', value: '/tmp/php.slow.log' } - - { key: 'request_slowlog_timeout', value: '30s' } - # PHP flags - - { key: 'php_admin_value[error_log]', value: '/tmp/php.error.log' } - - { key: 'php_admin_flag[log_errors]', value: 'on' } - -- name: Configure php-fpm (pool www.conf) - lineinfile: - dest: /etc/php-fpm.d/www.conf - regexp: '^{{ item.key }}[\s]*=' - state: absent - with_items: - # Networking - - { key: 'listen.allowed_clients' } \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/roles/php/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/php/tasks/main.yml deleted file mode 100644 index 35d0963..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/php/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ -- include: install.yml - tags: - - bootstrap - -- include: configuration.yml - tags: - - entrypoint diff --git a/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/configuration.yml b/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/configuration.yml deleted file mode 100644 index 44e39b8..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/configuration.yml +++ /dev/null @@ -1,8 +0,0 @@ -- name: Setup ssmtp - lineinfile: - dest: /etc/ssmtp/ssmtp.conf - regexp: '^[\s]*{{ item.key }}[\s]*=' - line: '{{ item.key }}={{ item.value }}' - with_items: - - { key: 'mailhub', value: '{{ DOCKER.MAIL_GATEWAY }}' } - - { key: 'FromLineOverride', value: 'YES' } diff --git a/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/install.yml b/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/install.yml deleted file mode 100644 index 9e20fc6..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/install.yml +++ /dev/null @@ -1,6 +0,0 @@ -- name: Install ssmtp - apt: - name: '{{ item }}' - state: present - with_items: - - ssmtp diff --git a/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/main.yml deleted file mode 100644 index 35d0963..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/ssmtp/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ -- include: install.yml - tags: - - bootstrap - -- include: configuration.yml - tags: - - entrypoint diff --git a/docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/install.yml b/docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/install.yml deleted file mode 100644 index 891a714..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/install.yml +++ /dev/null @@ -1,6 +0,0 @@ -- name: Install supervisor - apt: - name: '{{ item }}' - state: present - with_items: - - supervisor diff --git a/docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/main.yml deleted file mode 100644 index e3418cb..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/supervisord/tasks/main.yml +++ /dev/null @@ -1,3 +0,0 @@ -- include: install.yml - tags: - - bootstrap diff --git a/docker/main/ubuntu-hhvm/provision/roles/users/tasks/main.yml b/docker/main/ubuntu-hhvm/provision/roles/users/tasks/main.yml deleted file mode 100644 index f421097..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/users/tasks/main.yml +++ /dev/null @@ -1,3 +0,0 @@ -- include: www-data.yml - tags: - - entrypoint diff --git a/docker/main/ubuntu-hhvm/provision/roles/users/tasks/www-data.yml b/docker/main/ubuntu-hhvm/provision/roles/users/tasks/www-data.yml deleted file mode 100644 index 32b6405..0000000 --- a/docker/main/ubuntu-hhvm/provision/roles/users/tasks/www-data.yml +++ /dev/null @@ -1,19 +0,0 @@ -- group: - name: "www-data" - gid: "{{ DOCKER.EFFECTIVE_UID }}" - -- user: - name: "www-data" - uid: "{{ DOCKER.EFFECTIVE_GID }}" - group: "www-data" - shell: /bin/bash - home: /home - -# create a directory if it doesn't exist -- file: - path: /home/ - state: directory - mode: 0755 - owner: "www-data" - group: "www-data" - recurse: yes \ No newline at end of file diff --git a/docker/main/ubuntu-hhvm/provision/variables.yml b/docker/main/ubuntu-hhvm/provision/variables.yml deleted file mode 100644 index f987a3d..0000000 --- a/docker/main/ubuntu-hhvm/provision/variables.yml +++ /dev/null @@ -1,40 +0,0 @@ ---- - -DOCKER: - # System - EFFECTIVE_UID: "{{ lookup('env','EFFECTIVE_UID') }}" - EFFECTIVE_GID: "{{ lookup('env','EFFECTIVE_GID') }}" - CLI_USER: "{{ lookup('env','CLI_USER') }}" - CLI_SCRIPT: "{{ lookup('env','CLI_SCRIPT') }}" - - # http - DOCUMENT_ROOT: "{{ lookup('env','DOCUMENT_ROOT') }}" - DOCUMENT_INDEX: "{{ lookup('env','DOCUMENT_INDEX') }}" - - - # MySQL - MYSQL_ROOT_PASSWORD: "{{ lookup('env','MYSQL_ROOT_PASSWORD') }}" - MYSQL_USER: "{{ lookup('env','MYSQL_USER') }}" - MYSQL_PASSWORD: "{{ lookup('env','MYSQL_PASSWORD') }}" - MYSQL_DATABASE: "{{ lookup('env','MYSQL_DATABASE') }}" - - # PostgreSQL - POSTGRES_USER: "{{ lookup('env','POSTGRES_USER') }}" - POSTGRES_PASSWORD: "{{ lookup('env','POSTGRES_PASSWORD') }}" - - # FTP - FTP_USER: "{{ lookup('env','FTP_USER') }}" - FTP_PASSWORD: "{{ lookup('env','FTP_PASSWORD') }}" - FTP_PATH: "{{ lookup('env','FTP_PATH') }}" - - # Mail - MAIL_GATEWAY: "{{ lookup('env','MAIL_GATEWAY') }}" - - # DNS - DNS_DOMAIN: "{{ lookup('env','DNS_DOMAIN') }}" - - # Context - SYMFONY_ENV: "{{ lookup('env','SYMFONY_ENV') }}" - SYMFONY_DEBUG: "{{ lookup('env','SYMFONY_DEBUG') }}" - CAKE_ENV: "{{ lookup('env','CAKE_ENV') }}" - YII_ENVIRONMENT: "{{ lookup('env','YII_ENVIRONMENT') }}" diff --git a/docker/main/ubuntu/Centos-7 b/docker/main/ubuntu/Centos-7 index d52ebb5..a09f80c 100644 --- a/docker/main/ubuntu/Centos-7 +++ b/docker/main/ubuntu/Centos-7 @@ -15,6 +15,8 @@ FROM webdevops/php-boilerplate:centos-7 +ENV PROVISION_PHP_DISTRIBUTION php + ENV PATH /opt/ansible/bin:/bin:/usr/bin:/sbin:/usr/sbin ENV PYTHONPATH /opt/ansible/lib ENV ANSIBLE_LIBRARY /opt/ansible/library @@ -44,8 +46,8 @@ RUN bash /opt/docker/bin/customization.sh # Config ## -COPY entrypoint.sh /entrypoint.sh -COPY conf/centos /opt/docker/conf/ +COPY bin/entrypoint.sh /entrypoint.sh +COPY conf/centos /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/ubuntu/Ubuntu-12.04 b/docker/main/ubuntu/Ubuntu-12.04 index 607d49b..5371927 100644 --- a/docker/main/ubuntu/Ubuntu-12.04 +++ b/docker/main/ubuntu/Ubuntu-12.04 @@ -15,6 +15,8 @@ FROM webdevops/php-boilerplate:ubuntu-12.04 +ENV PROVISION_PHP_DISTRIBUTION php + # Ensure UTF-8 RUN locale-gen en_US.UTF-8 ENV LANG en_US.UTF-8 @@ -45,8 +47,8 @@ RUN bash /opt/docker/bin/customization.sh # Config ## -COPY entrypoint.sh /entrypoint.sh -COPY conf/ubuntu /opt/docker/conf/ +COPY bin/entrypoint.sh /entrypoint.sh +COPY conf/ubuntu /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/ubuntu/Ubuntu-14.04 b/docker/main/ubuntu/Ubuntu-14.04 index 09540eb..dc1f39b 100644 --- a/docker/main/ubuntu/Ubuntu-14.04 +++ b/docker/main/ubuntu/Ubuntu-14.04 @@ -15,6 +15,8 @@ FROM webdevops/php-boilerplate:ubuntu-14.04 +ENV PROVISION_PHP_DISTRIBUTION php + # Ensure UTF-8 RUN locale-gen en_US.UTF-8 ENV LANG en_US.UTF-8 @@ -45,8 +47,8 @@ RUN bash /opt/docker/bin/customization.sh # Config ## -COPY entrypoint.sh /entrypoint.sh -COPY conf/ubuntu /opt/docker/conf/ +COPY bin/entrypoint.sh /entrypoint.sh +COPY conf/ubuntu /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/ubuntu/Ubuntu-15.04 b/docker/main/ubuntu/Ubuntu-15.04 index 432d016..a4cb9a4 100644 --- a/docker/main/ubuntu/Ubuntu-15.04 +++ b/docker/main/ubuntu/Ubuntu-15.04 @@ -15,6 +15,8 @@ FROM webdevops/php-boilerplate:ubuntu-15.04 +ENV PROVISION_PHP_DISTRIBUTION php + # Ensure UTF-8 RUN locale-gen en_US.UTF-8 ENV LANG en_US.UTF-8 @@ -45,8 +47,8 @@ RUN bash /opt/docker/bin/customization.sh # Config ## -COPY entrypoint.sh /entrypoint.sh -COPY conf/ubuntu /opt/docker/conf/ +COPY bin/entrypoint.sh /entrypoint.sh +COPY conf/ubuntu /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/ubuntu/Ubuntu-15.10 b/docker/main/ubuntu/Ubuntu-15.10 index be103a9..e3840f3 100644 --- a/docker/main/ubuntu/Ubuntu-15.10 +++ b/docker/main/ubuntu/Ubuntu-15.10 @@ -15,6 +15,8 @@ FROM webdevops/php-boilerplate:ubuntu-15.10 +ENV PROVISION_PHP_DISTRIBUTION php + # Ensure UTF-8 RUN locale-gen en_US.UTF-8 ENV LANG en_US.UTF-8 @@ -24,7 +26,7 @@ ENV LC_ALL en_US.UTF-8 # Bootstrap ## -COPY conf/locale.conf /opt/docker/locale.conf +COPY conf/ubuntu/locale.conf /opt/docker/locale.conf COPY bin/ubuntu/bootstrap.sh /opt/docker/bin/bootstrap.sh COPY bin/provision.sh /opt/docker/bin/provision.sh COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh @@ -45,8 +47,8 @@ RUN bash /opt/docker/bin/customization.sh # Config ## -COPY entrypoint.sh /entrypoint.sh -COPY conf /opt/docker/conf/ +COPY bin/entrypoint.sh /entrypoint.sh +COPY conf/ubuntu /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/ubuntu-hhvm/Dockerfile b/docker/main/ubuntu/Ubuntu-HHVM similarity index 64% rename from docker/main/ubuntu-hhvm/Dockerfile rename to docker/main/ubuntu/Ubuntu-HHVM index 567b8fc..bc93e30 100644 --- a/docker/main/ubuntu-hhvm/Dockerfile +++ b/docker/main/ubuntu/Ubuntu-HHVM @@ -15,6 +15,8 @@ FROM webdevops/php-boilerplate:ubuntu-14.04 +ENV PROVISION_PHP_DISTRIBUTION hhvm + # Ensure UTF-8 RUN locale-gen en_US.UTF-8 ENV LANG en_US.UTF-8 @@ -24,12 +26,12 @@ ENV LC_ALL en_US.UTF-8 # Bootstrap ## -COPY conf/locale.conf /opt/docker/locale.conf -COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh -COPY bin/provision.sh /opt/docker/bin/provision.sh -COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh -COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh -COPY provision /opt/docker/provision/ +COPY conf/ubuntu/locale.conf /opt/docker/locale.conf +COPY bin/ubuntu/bootstrap.sh /opt/docker/bin/bootstrap.sh +COPY bin/provision.sh /opt/docker/bin/provision.sh +COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh +COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh +COPY provision /opt/docker/provision/ RUN bash /opt/docker/bin/bootstrap.sh RUN bash /opt/docker/bin/provision.sh bootstrap @@ -45,8 +47,8 @@ RUN bash /opt/docker/bin/customization.sh # Config ## -COPY entrypoint.sh /entrypoint.sh -COPY conf /opt/docker/conf/ +COPY bin/entrypoint.sh /entrypoint.sh +COPY conf/ubuntu-hhvm /opt/docker/conf/ EXPOSE 9000 diff --git a/docker/main/ubuntu-hhvm/entrypoint.sh b/docker/main/ubuntu/bin/entrypoint.sh similarity index 100% rename from docker/main/ubuntu-hhvm/entrypoint.sh rename to docker/main/ubuntu/bin/entrypoint.sh diff --git a/docker/main/ubuntu/bin/provision.sh b/docker/main/ubuntu/bin/provision.sh index a943865..94a46e9 100644 --- a/docker/main/ubuntu/bin/provision.sh +++ b/docker/main/ubuntu/bin/provision.sh @@ -9,10 +9,12 @@ export PYTHONUNBUFFERED=1 ANSIBLE_DIR='/opt/docker/provision' -ANSIBLE_TAG="$*" +ANSIBLE_TAG="$1" + +ANSIBLE_OPTS="" # workaround if windows chmod -x "$ANSIBLE_DIR/inventory" # run ansible -ansible-playbook "$ANSIBLE_DIR/playbook.yml" --inventory="$ANSIBLE_DIR/inventory" --tags="${ANSIBLE_TAG}" +ansible-playbook "${ANSIBLE_DIR}/playbook.yml" --inventory="${ANSIBLE_DIR}/inventory" --tags="${ANSIBLE_TAG}" $ANSIBLE_OPTS diff --git a/docker/main/ubuntu-hhvm/conf/locale.conf b/docker/main/ubuntu/conf/ubuntu-hhvm/locale.conf similarity index 100% rename from docker/main/ubuntu-hhvm/conf/locale.conf rename to docker/main/ubuntu/conf/ubuntu-hhvm/locale.conf diff --git a/docker/main/ubuntu-hhvm/conf/supervisord.conf b/docker/main/ubuntu/conf/ubuntu-hhvm/supervisord.conf similarity index 100% rename from docker/main/ubuntu-hhvm/conf/supervisord.conf rename to docker/main/ubuntu/conf/ubuntu-hhvm/supervisord.conf diff --git a/docker/main/ubuntu/entrypoint.sh b/docker/main/ubuntu/entrypoint.sh deleted file mode 100755 index aef20bc..0000000 --- a/docker/main/ubuntu/entrypoint.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -set -e - -bash /opt/docker/bin/provision.sh entrypoint - -############################# -## COMMAND -############################# - -case "$1" in - - ## Supervisord (start daemons) - supervisord) - ## Register IP - ETH0_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') - mkdir -p /data/dns/ - chmod 777 /data/dns/ - echo "${ETH0_IP}" > /data/dns/main.ip - echo "${ETH0_IP} main main_1" > /data/dns/main.hosts - - ## Start services - cd / - exec supervisord -c /opt/docker/conf/supervisord.conf --logfile /dev/null --pidfile /dev/null --user root - ;; - - ## Root shell - root) - if [ "$#" -eq 1 ]; then - ## No command, fall back to shell - exec bash - else - ## Exec root command - shift - exec "$@" - fi - ;; - - ## Defined cli script - cli) - if [ -n "${CLI_SCRIPT}" ]; then - shift - exec sudo -H -E -u "${CLI_USER}" ${CLI_SCRIPT} "$@" - else - echo "[ERROR] No CLI_SCRIPT in docker-env.yml defined" - exit 1 - fi - ;; - - ## All other commands - *) - ## Execute cmd - exec sudo -H -E -u "${CLI_USER}" "$@" - ;; -esac diff --git a/docker/main/ubuntu/provision/playbook.yml b/docker/main/ubuntu/provision/playbook.yml index ae9ae10..abc8d71 100755 --- a/docker/main/ubuntu/provision/playbook.yml +++ b/docker/main/ubuntu/provision/playbook.yml @@ -4,10 +4,11 @@ roles: - common - locales + - users - supervisord - dnsmasqd - ssmtp - - php + - { role: php, when: PROVISION.PHP.DISTRIBUTION == "php" } + - { role: hhvm, when: PROVISION.PHP.DISTRIBUTION == "hhvm" } - mysql - - users - finalize diff --git a/docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/configuration.yml b/docker/main/ubuntu/provision/roles/hhvm/tasks/configuration.yml similarity index 100% rename from docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/configuration.yml rename to docker/main/ubuntu/provision/roles/hhvm/tasks/configuration.yml diff --git a/docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/install.yml b/docker/main/ubuntu/provision/roles/hhvm/tasks/install.yml similarity index 100% rename from docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/install.yml rename to docker/main/ubuntu/provision/roles/hhvm/tasks/install.yml diff --git a/docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/main.yml b/docker/main/ubuntu/provision/roles/hhvm/tasks/main.yml similarity index 100% rename from docker/main/ubuntu-hhvm/provision/roles/hhvm/tasks/main.yml rename to docker/main/ubuntu/provision/roles/hhvm/tasks/main.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/main.yml b/docker/main/ubuntu/provision/roles/php/tasks/main.yml index 650c67c..966c6e5 100644 --- a/docker/main/ubuntu/provision/roles/php/tasks/main.yml +++ b/docker/main/ubuntu/provision/roles/php/tasks/main.yml @@ -13,10 +13,12 @@ - bootstrap - include: ubuntu/configuration.yml + when: ansible_distribution == 'Ubuntu' tags: - entrypoint - include: ubuntu/modules.yml + when: ansible_distribution == 'Ubuntu' tags: - entrypoint diff --git a/docker/main/ubuntu/provision/variables.yml b/docker/main/ubuntu/provision/variables.yml index f5cf6ec..903857b 100644 --- a/docker/main/ubuntu/provision/variables.yml +++ b/docker/main/ubuntu/provision/variables.yml @@ -4,6 +4,8 @@ PROVISION: CONTEXT: "{{ lookup('env','PROVISION_CONTEXT') }}" PHP: + DISTRIBUTION: "{{ lookup('env','PROVISION_PHP_DISTRIBUTION') }}" + BLACKFIRE: "{{ lookup('env','PROVISION_PHP_BLACKFIRE') }}" XDEBUG: "{{ lookup('env','PROVISION_PHP_XDEBUG') }}" From 2394626f20914942a9d3eb4e5c7df9af107a3e25 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Thu, 30 Jul 2015 22:42:01 +0200 Subject: [PATCH 59/66] Moved main container to docker/main --- docker-compose.yml | 2 +- docker/main/{ubuntu => }/Centos-7 | 0 docker/main/{ubuntu => }/Ubuntu-12.04 | 0 docker/main/{ubuntu => }/Ubuntu-14.04 | 0 docker/main/{ubuntu => }/Ubuntu-15.04 | 0 docker/main/{ubuntu => }/Ubuntu-15.10 | 0 docker/main/{ubuntu => }/Ubuntu-HHVM | 0 docker/main/{ubuntu => }/bin/centos/bootstrap.sh | 0 docker/main/{ubuntu => }/bin/customization.sh | 0 docker/main/{ubuntu => }/bin/dnsmasq.sh | 0 docker/main/{ubuntu => }/bin/entrypoint.sh | 0 docker/main/{ubuntu => }/bin/logwatch.sh | 0 docker/main/{ubuntu => }/bin/provision.sh | 0 docker/main/{ubuntu => }/bin/ubuntu/bootstrap.sh | 0 docker/main/{ubuntu => }/conf/centos/locale.conf | 0 docker/main/{ubuntu => }/conf/centos/supervisord.conf | 0 docker/main/{ubuntu => }/conf/ubuntu-hhvm/locale.conf | 0 docker/main/{ubuntu => }/conf/ubuntu-hhvm/supervisord.conf | 0 docker/main/{ubuntu => }/conf/ubuntu/locale.conf | 0 docker/main/{ubuntu => }/conf/ubuntu/supervisord.conf | 0 docker/main/{ubuntu => }/htdocs/.gitkeep | 0 docker/main/{ubuntu => }/provision/ansible.cfg | 0 docker/main/{ubuntu => }/provision/inventory | 0 docker/main/{ubuntu => }/provision/playbook.yml | 0 docker/main/{ubuntu => }/provision/roles/common/tasks/main.yml | 0 .../provision/roles/common/tasks/packages-centos.yml | 0 .../provision/roles/common/tasks/packages-ubuntu.yml | 0 .../{ubuntu => }/provision/roles/common/tasks/update-centos.yml | 0 .../{ubuntu => }/provision/roles/common/tasks/update-ubuntu.yml | 0 .../{ubuntu => }/provision/roles/dnsmasqd/tasks/install.yml | 0 .../main/{ubuntu => }/provision/roles/dnsmasqd/tasks/main.yml | 0 .../{ubuntu => }/provision/roles/finalize/tasks/cleanup.yml | 0 .../main/{ubuntu => }/provision/roles/finalize/tasks/main.yml | 0 .../{ubuntu => }/provision/roles/hhvm/tasks/configuration.yml | 0 docker/main/{ubuntu => }/provision/roles/hhvm/tasks/install.yml | 0 docker/main/{ubuntu => }/provision/roles/hhvm/tasks/main.yml | 0 .../{ubuntu => }/provision/roles/locales/tasks/generate.yml | 0 docker/main/{ubuntu => }/provision/roles/locales/tasks/main.yml | 0 .../{ubuntu => }/provision/roles/mysql/tasks/configuration.yml | 0 .../main/{ubuntu => }/provision/roles/mysql/tasks/install.yml | 0 docker/main/{ubuntu => }/provision/roles/mysql/tasks/main.yml | 0 .../main/{ubuntu => }/provision/roles/mysql/templates/my.cnf.j2 | 0 .../{ubuntu => }/provision/roles/php/tasks/centos/blackfire.yml | 0 .../provision/roles/php/tasks/centos/configuration.yml | 0 .../{ubuntu => }/provision/roles/php/tasks/centos/install.yml | 0 .../{ubuntu => }/provision/roles/php/tasks/centos/modules.yml | 0 docker/main/{ubuntu => }/provision/roles/php/tasks/main.yml | 0 .../{ubuntu => }/provision/roles/php/tasks/ubuntu/blackfire.yml | 0 .../provision/roles/php/tasks/ubuntu/configuration.yml | 0 .../{ubuntu => }/provision/roles/php/tasks/ubuntu/install.yml | 0 .../{ubuntu => }/provision/roles/php/tasks/ubuntu/modules.yml | 0 .../{ubuntu => }/provision/roles/ssmtp/tasks/configuration.yml | 0 .../main/{ubuntu => }/provision/roles/ssmtp/tasks/install.yml | 0 docker/main/{ubuntu => }/provision/roles/ssmtp/tasks/main.yml | 0 .../{ubuntu => }/provision/roles/supervisord/tasks/install.yml | 0 .../{ubuntu => }/provision/roles/supervisord/tasks/main.yml | 0 .../main/{ubuntu => }/provision/roles/users/tasks/home-ssh.yml | 0 docker/main/{ubuntu => }/provision/roles/users/tasks/main.yml | 0 docker/main/{ubuntu => }/provision/roles/users/tasks/user.yml | 0 docker/main/{ubuntu => }/provision/variables.yml | 0 60 files changed, 1 insertion(+), 1 deletion(-) rename docker/main/{ubuntu => }/Centos-7 (100%) rename docker/main/{ubuntu => }/Ubuntu-12.04 (100%) rename docker/main/{ubuntu => }/Ubuntu-14.04 (100%) rename docker/main/{ubuntu => }/Ubuntu-15.04 (100%) rename docker/main/{ubuntu => }/Ubuntu-15.10 (100%) rename docker/main/{ubuntu => }/Ubuntu-HHVM (100%) rename docker/main/{ubuntu => }/bin/centos/bootstrap.sh (100%) rename docker/main/{ubuntu => }/bin/customization.sh (100%) rename docker/main/{ubuntu => }/bin/dnsmasq.sh (100%) rename docker/main/{ubuntu => }/bin/entrypoint.sh (100%) rename docker/main/{ubuntu => }/bin/logwatch.sh (100%) rename docker/main/{ubuntu => }/bin/provision.sh (100%) rename docker/main/{ubuntu => }/bin/ubuntu/bootstrap.sh (100%) rename docker/main/{ubuntu => }/conf/centos/locale.conf (100%) rename docker/main/{ubuntu => }/conf/centos/supervisord.conf (100%) rename docker/main/{ubuntu => }/conf/ubuntu-hhvm/locale.conf (100%) rename docker/main/{ubuntu => }/conf/ubuntu-hhvm/supervisord.conf (100%) rename docker/main/{ubuntu => }/conf/ubuntu/locale.conf (100%) rename docker/main/{ubuntu => }/conf/ubuntu/supervisord.conf (100%) rename docker/main/{ubuntu => }/htdocs/.gitkeep (100%) rename docker/main/{ubuntu => }/provision/ansible.cfg (100%) rename docker/main/{ubuntu => }/provision/inventory (100%) rename docker/main/{ubuntu => }/provision/playbook.yml (100%) rename docker/main/{ubuntu => }/provision/roles/common/tasks/main.yml (100%) rename docker/main/{ubuntu => }/provision/roles/common/tasks/packages-centos.yml (100%) rename docker/main/{ubuntu => }/provision/roles/common/tasks/packages-ubuntu.yml (100%) rename docker/main/{ubuntu => }/provision/roles/common/tasks/update-centos.yml (100%) rename docker/main/{ubuntu => }/provision/roles/common/tasks/update-ubuntu.yml (100%) rename docker/main/{ubuntu => }/provision/roles/dnsmasqd/tasks/install.yml (100%) rename docker/main/{ubuntu => }/provision/roles/dnsmasqd/tasks/main.yml (100%) rename docker/main/{ubuntu => }/provision/roles/finalize/tasks/cleanup.yml (100%) rename docker/main/{ubuntu => }/provision/roles/finalize/tasks/main.yml (100%) rename docker/main/{ubuntu => }/provision/roles/hhvm/tasks/configuration.yml (100%) rename docker/main/{ubuntu => }/provision/roles/hhvm/tasks/install.yml (100%) rename docker/main/{ubuntu => }/provision/roles/hhvm/tasks/main.yml (100%) rename docker/main/{ubuntu => }/provision/roles/locales/tasks/generate.yml (100%) rename docker/main/{ubuntu => }/provision/roles/locales/tasks/main.yml (100%) rename docker/main/{ubuntu => }/provision/roles/mysql/tasks/configuration.yml (100%) rename docker/main/{ubuntu => }/provision/roles/mysql/tasks/install.yml (100%) rename docker/main/{ubuntu => }/provision/roles/mysql/tasks/main.yml (100%) rename docker/main/{ubuntu => }/provision/roles/mysql/templates/my.cnf.j2 (100%) rename docker/main/{ubuntu => }/provision/roles/php/tasks/centos/blackfire.yml (100%) rename docker/main/{ubuntu => }/provision/roles/php/tasks/centos/configuration.yml (100%) rename docker/main/{ubuntu => }/provision/roles/php/tasks/centos/install.yml (100%) rename docker/main/{ubuntu => }/provision/roles/php/tasks/centos/modules.yml (100%) rename docker/main/{ubuntu => }/provision/roles/php/tasks/main.yml (100%) rename docker/main/{ubuntu => }/provision/roles/php/tasks/ubuntu/blackfire.yml (100%) rename docker/main/{ubuntu => }/provision/roles/php/tasks/ubuntu/configuration.yml (100%) rename docker/main/{ubuntu => }/provision/roles/php/tasks/ubuntu/install.yml (100%) rename docker/main/{ubuntu => }/provision/roles/php/tasks/ubuntu/modules.yml (100%) rename docker/main/{ubuntu => }/provision/roles/ssmtp/tasks/configuration.yml (100%) rename docker/main/{ubuntu => }/provision/roles/ssmtp/tasks/install.yml (100%) rename docker/main/{ubuntu => }/provision/roles/ssmtp/tasks/main.yml (100%) rename docker/main/{ubuntu => }/provision/roles/supervisord/tasks/install.yml (100%) rename docker/main/{ubuntu => }/provision/roles/supervisord/tasks/main.yml (100%) rename docker/main/{ubuntu => }/provision/roles/users/tasks/home-ssh.yml (100%) rename docker/main/{ubuntu => }/provision/roles/users/tasks/main.yml (100%) rename docker/main/{ubuntu => }/provision/roles/users/tasks/user.yml (100%) rename docker/main/{ubuntu => }/provision/variables.yml (100%) diff --git a/docker-compose.yml b/docker-compose.yml index 879e26e..a15fbfd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ ####################################### main: ## Ubuntu - build: docker/main/ubuntu + build: docker/main #dockerfile: Ubuntu-12.04 # Ubuntu 12.04 - PHP 5.3, LTS (precise) dockerfile: Ubuntu-14.04 # Ubuntu 14.04 - PHP 5.5, LTS (trusty) #dockerfile: Ubuntu-15.04 # Ubuntu 15.04 - PHP 5.6 (vivid) diff --git a/docker/main/ubuntu/Centos-7 b/docker/main/Centos-7 similarity index 100% rename from docker/main/ubuntu/Centos-7 rename to docker/main/Centos-7 diff --git a/docker/main/ubuntu/Ubuntu-12.04 b/docker/main/Ubuntu-12.04 similarity index 100% rename from docker/main/ubuntu/Ubuntu-12.04 rename to docker/main/Ubuntu-12.04 diff --git a/docker/main/ubuntu/Ubuntu-14.04 b/docker/main/Ubuntu-14.04 similarity index 100% rename from docker/main/ubuntu/Ubuntu-14.04 rename to docker/main/Ubuntu-14.04 diff --git a/docker/main/ubuntu/Ubuntu-15.04 b/docker/main/Ubuntu-15.04 similarity index 100% rename from docker/main/ubuntu/Ubuntu-15.04 rename to docker/main/Ubuntu-15.04 diff --git a/docker/main/ubuntu/Ubuntu-15.10 b/docker/main/Ubuntu-15.10 similarity index 100% rename from docker/main/ubuntu/Ubuntu-15.10 rename to docker/main/Ubuntu-15.10 diff --git a/docker/main/ubuntu/Ubuntu-HHVM b/docker/main/Ubuntu-HHVM similarity index 100% rename from docker/main/ubuntu/Ubuntu-HHVM rename to docker/main/Ubuntu-HHVM diff --git a/docker/main/ubuntu/bin/centos/bootstrap.sh b/docker/main/bin/centos/bootstrap.sh similarity index 100% rename from docker/main/ubuntu/bin/centos/bootstrap.sh rename to docker/main/bin/centos/bootstrap.sh diff --git a/docker/main/ubuntu/bin/customization.sh b/docker/main/bin/customization.sh similarity index 100% rename from docker/main/ubuntu/bin/customization.sh rename to docker/main/bin/customization.sh diff --git a/docker/main/ubuntu/bin/dnsmasq.sh b/docker/main/bin/dnsmasq.sh similarity index 100% rename from docker/main/ubuntu/bin/dnsmasq.sh rename to docker/main/bin/dnsmasq.sh diff --git a/docker/main/ubuntu/bin/entrypoint.sh b/docker/main/bin/entrypoint.sh similarity index 100% rename from docker/main/ubuntu/bin/entrypoint.sh rename to docker/main/bin/entrypoint.sh diff --git a/docker/main/ubuntu/bin/logwatch.sh b/docker/main/bin/logwatch.sh similarity index 100% rename from docker/main/ubuntu/bin/logwatch.sh rename to docker/main/bin/logwatch.sh diff --git a/docker/main/ubuntu/bin/provision.sh b/docker/main/bin/provision.sh similarity index 100% rename from docker/main/ubuntu/bin/provision.sh rename to docker/main/bin/provision.sh diff --git a/docker/main/ubuntu/bin/ubuntu/bootstrap.sh b/docker/main/bin/ubuntu/bootstrap.sh similarity index 100% rename from docker/main/ubuntu/bin/ubuntu/bootstrap.sh rename to docker/main/bin/ubuntu/bootstrap.sh diff --git a/docker/main/ubuntu/conf/centos/locale.conf b/docker/main/conf/centos/locale.conf similarity index 100% rename from docker/main/ubuntu/conf/centos/locale.conf rename to docker/main/conf/centos/locale.conf diff --git a/docker/main/ubuntu/conf/centos/supervisord.conf b/docker/main/conf/centos/supervisord.conf similarity index 100% rename from docker/main/ubuntu/conf/centos/supervisord.conf rename to docker/main/conf/centos/supervisord.conf diff --git a/docker/main/ubuntu/conf/ubuntu-hhvm/locale.conf b/docker/main/conf/ubuntu-hhvm/locale.conf similarity index 100% rename from docker/main/ubuntu/conf/ubuntu-hhvm/locale.conf rename to docker/main/conf/ubuntu-hhvm/locale.conf diff --git a/docker/main/ubuntu/conf/ubuntu-hhvm/supervisord.conf b/docker/main/conf/ubuntu-hhvm/supervisord.conf similarity index 100% rename from docker/main/ubuntu/conf/ubuntu-hhvm/supervisord.conf rename to docker/main/conf/ubuntu-hhvm/supervisord.conf diff --git a/docker/main/ubuntu/conf/ubuntu/locale.conf b/docker/main/conf/ubuntu/locale.conf similarity index 100% rename from docker/main/ubuntu/conf/ubuntu/locale.conf rename to docker/main/conf/ubuntu/locale.conf diff --git a/docker/main/ubuntu/conf/ubuntu/supervisord.conf b/docker/main/conf/ubuntu/supervisord.conf similarity index 100% rename from docker/main/ubuntu/conf/ubuntu/supervisord.conf rename to docker/main/conf/ubuntu/supervisord.conf diff --git a/docker/main/ubuntu/htdocs/.gitkeep b/docker/main/htdocs/.gitkeep similarity index 100% rename from docker/main/ubuntu/htdocs/.gitkeep rename to docker/main/htdocs/.gitkeep diff --git a/docker/main/ubuntu/provision/ansible.cfg b/docker/main/provision/ansible.cfg similarity index 100% rename from docker/main/ubuntu/provision/ansible.cfg rename to docker/main/provision/ansible.cfg diff --git a/docker/main/ubuntu/provision/inventory b/docker/main/provision/inventory similarity index 100% rename from docker/main/ubuntu/provision/inventory rename to docker/main/provision/inventory diff --git a/docker/main/ubuntu/provision/playbook.yml b/docker/main/provision/playbook.yml similarity index 100% rename from docker/main/ubuntu/provision/playbook.yml rename to docker/main/provision/playbook.yml diff --git a/docker/main/ubuntu/provision/roles/common/tasks/main.yml b/docker/main/provision/roles/common/tasks/main.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/common/tasks/main.yml rename to docker/main/provision/roles/common/tasks/main.yml diff --git a/docker/main/ubuntu/provision/roles/common/tasks/packages-centos.yml b/docker/main/provision/roles/common/tasks/packages-centos.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/common/tasks/packages-centos.yml rename to docker/main/provision/roles/common/tasks/packages-centos.yml diff --git a/docker/main/ubuntu/provision/roles/common/tasks/packages-ubuntu.yml b/docker/main/provision/roles/common/tasks/packages-ubuntu.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/common/tasks/packages-ubuntu.yml rename to docker/main/provision/roles/common/tasks/packages-ubuntu.yml diff --git a/docker/main/ubuntu/provision/roles/common/tasks/update-centos.yml b/docker/main/provision/roles/common/tasks/update-centos.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/common/tasks/update-centos.yml rename to docker/main/provision/roles/common/tasks/update-centos.yml diff --git a/docker/main/ubuntu/provision/roles/common/tasks/update-ubuntu.yml b/docker/main/provision/roles/common/tasks/update-ubuntu.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/common/tasks/update-ubuntu.yml rename to docker/main/provision/roles/common/tasks/update-ubuntu.yml diff --git a/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml b/docker/main/provision/roles/dnsmasqd/tasks/install.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/dnsmasqd/tasks/install.yml rename to docker/main/provision/roles/dnsmasqd/tasks/install.yml diff --git a/docker/main/ubuntu/provision/roles/dnsmasqd/tasks/main.yml b/docker/main/provision/roles/dnsmasqd/tasks/main.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/dnsmasqd/tasks/main.yml rename to docker/main/provision/roles/dnsmasqd/tasks/main.yml diff --git a/docker/main/ubuntu/provision/roles/finalize/tasks/cleanup.yml b/docker/main/provision/roles/finalize/tasks/cleanup.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/finalize/tasks/cleanup.yml rename to docker/main/provision/roles/finalize/tasks/cleanup.yml diff --git a/docker/main/ubuntu/provision/roles/finalize/tasks/main.yml b/docker/main/provision/roles/finalize/tasks/main.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/finalize/tasks/main.yml rename to docker/main/provision/roles/finalize/tasks/main.yml diff --git a/docker/main/ubuntu/provision/roles/hhvm/tasks/configuration.yml b/docker/main/provision/roles/hhvm/tasks/configuration.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/hhvm/tasks/configuration.yml rename to docker/main/provision/roles/hhvm/tasks/configuration.yml diff --git a/docker/main/ubuntu/provision/roles/hhvm/tasks/install.yml b/docker/main/provision/roles/hhvm/tasks/install.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/hhvm/tasks/install.yml rename to docker/main/provision/roles/hhvm/tasks/install.yml diff --git a/docker/main/ubuntu/provision/roles/hhvm/tasks/main.yml b/docker/main/provision/roles/hhvm/tasks/main.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/hhvm/tasks/main.yml rename to docker/main/provision/roles/hhvm/tasks/main.yml diff --git a/docker/main/ubuntu/provision/roles/locales/tasks/generate.yml b/docker/main/provision/roles/locales/tasks/generate.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/locales/tasks/generate.yml rename to docker/main/provision/roles/locales/tasks/generate.yml diff --git a/docker/main/ubuntu/provision/roles/locales/tasks/main.yml b/docker/main/provision/roles/locales/tasks/main.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/locales/tasks/main.yml rename to docker/main/provision/roles/locales/tasks/main.yml diff --git a/docker/main/ubuntu/provision/roles/mysql/tasks/configuration.yml b/docker/main/provision/roles/mysql/tasks/configuration.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/mysql/tasks/configuration.yml rename to docker/main/provision/roles/mysql/tasks/configuration.yml diff --git a/docker/main/ubuntu/provision/roles/mysql/tasks/install.yml b/docker/main/provision/roles/mysql/tasks/install.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/mysql/tasks/install.yml rename to docker/main/provision/roles/mysql/tasks/install.yml diff --git a/docker/main/ubuntu/provision/roles/mysql/tasks/main.yml b/docker/main/provision/roles/mysql/tasks/main.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/mysql/tasks/main.yml rename to docker/main/provision/roles/mysql/tasks/main.yml diff --git a/docker/main/ubuntu/provision/roles/mysql/templates/my.cnf.j2 b/docker/main/provision/roles/mysql/templates/my.cnf.j2 similarity index 100% rename from docker/main/ubuntu/provision/roles/mysql/templates/my.cnf.j2 rename to docker/main/provision/roles/mysql/templates/my.cnf.j2 diff --git a/docker/main/ubuntu/provision/roles/php/tasks/centos/blackfire.yml b/docker/main/provision/roles/php/tasks/centos/blackfire.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/php/tasks/centos/blackfire.yml rename to docker/main/provision/roles/php/tasks/centos/blackfire.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/centos/configuration.yml b/docker/main/provision/roles/php/tasks/centos/configuration.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/php/tasks/centos/configuration.yml rename to docker/main/provision/roles/php/tasks/centos/configuration.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/centos/install.yml b/docker/main/provision/roles/php/tasks/centos/install.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/php/tasks/centos/install.yml rename to docker/main/provision/roles/php/tasks/centos/install.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/centos/modules.yml b/docker/main/provision/roles/php/tasks/centos/modules.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/php/tasks/centos/modules.yml rename to docker/main/provision/roles/php/tasks/centos/modules.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/main.yml b/docker/main/provision/roles/php/tasks/main.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/php/tasks/main.yml rename to docker/main/provision/roles/php/tasks/main.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/ubuntu/blackfire.yml b/docker/main/provision/roles/php/tasks/ubuntu/blackfire.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/php/tasks/ubuntu/blackfire.yml rename to docker/main/provision/roles/php/tasks/ubuntu/blackfire.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/ubuntu/configuration.yml b/docker/main/provision/roles/php/tasks/ubuntu/configuration.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/php/tasks/ubuntu/configuration.yml rename to docker/main/provision/roles/php/tasks/ubuntu/configuration.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/ubuntu/install.yml b/docker/main/provision/roles/php/tasks/ubuntu/install.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/php/tasks/ubuntu/install.yml rename to docker/main/provision/roles/php/tasks/ubuntu/install.yml diff --git a/docker/main/ubuntu/provision/roles/php/tasks/ubuntu/modules.yml b/docker/main/provision/roles/php/tasks/ubuntu/modules.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/php/tasks/ubuntu/modules.yml rename to docker/main/provision/roles/php/tasks/ubuntu/modules.yml diff --git a/docker/main/ubuntu/provision/roles/ssmtp/tasks/configuration.yml b/docker/main/provision/roles/ssmtp/tasks/configuration.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/ssmtp/tasks/configuration.yml rename to docker/main/provision/roles/ssmtp/tasks/configuration.yml diff --git a/docker/main/ubuntu/provision/roles/ssmtp/tasks/install.yml b/docker/main/provision/roles/ssmtp/tasks/install.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/ssmtp/tasks/install.yml rename to docker/main/provision/roles/ssmtp/tasks/install.yml diff --git a/docker/main/ubuntu/provision/roles/ssmtp/tasks/main.yml b/docker/main/provision/roles/ssmtp/tasks/main.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/ssmtp/tasks/main.yml rename to docker/main/provision/roles/ssmtp/tasks/main.yml diff --git a/docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml b/docker/main/provision/roles/supervisord/tasks/install.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/supervisord/tasks/install.yml rename to docker/main/provision/roles/supervisord/tasks/install.yml diff --git a/docker/main/ubuntu/provision/roles/supervisord/tasks/main.yml b/docker/main/provision/roles/supervisord/tasks/main.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/supervisord/tasks/main.yml rename to docker/main/provision/roles/supervisord/tasks/main.yml diff --git a/docker/main/ubuntu/provision/roles/users/tasks/home-ssh.yml b/docker/main/provision/roles/users/tasks/home-ssh.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/users/tasks/home-ssh.yml rename to docker/main/provision/roles/users/tasks/home-ssh.yml diff --git a/docker/main/ubuntu/provision/roles/users/tasks/main.yml b/docker/main/provision/roles/users/tasks/main.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/users/tasks/main.yml rename to docker/main/provision/roles/users/tasks/main.yml diff --git a/docker/main/ubuntu/provision/roles/users/tasks/user.yml b/docker/main/provision/roles/users/tasks/user.yml similarity index 100% rename from docker/main/ubuntu/provision/roles/users/tasks/user.yml rename to docker/main/provision/roles/users/tasks/user.yml diff --git a/docker/main/ubuntu/provision/variables.yml b/docker/main/provision/variables.yml similarity index 100% rename from docker/main/ubuntu/provision/variables.yml rename to docker/main/provision/variables.yml From 0a29d9ab5ab7b49da6ed62c7e71ff21a72e5451a Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Wed, 5 Aug 2015 22:19:31 +0200 Subject: [PATCH 60/66] Implemented packages distrubution update switch --- docker/main/Centos-7 | 1 + docker/main/Ubuntu-12.04 | 1 + docker/main/Ubuntu-14.04 | 1 + docker/main/Ubuntu-15.04 | 1 + docker/main/Ubuntu-15.10 | 1 + docker/main/Ubuntu-HHVM | 1 + docker/main/provision/playbook.yml | 4 +++- .../provision/roles/common/tasks/update-centos.yml | 2 -- .../provision/roles/common/tasks/update-ubuntu.yml | 5 ----- docker/main/provision/roles/init/tasks/main.yml | 5 +++++ .../roles/{common => packages}/tasks/main.yml | 10 ---------- .../{common => packages}/tasks/packages-centos.yml | 0 .../{common => packages}/tasks/packages-ubuntu.yml | 0 docker/main/provision/roles/update/tasks/main.yml | 9 +++++++++ .../provision/roles/update/tasks/update-centos.yml | 2 ++ .../provision/roles/update/tasks/update-ubuntu.yml | 2 ++ docker/main/provision/variables.yml | 3 +++ 17 files changed, 30 insertions(+), 18 deletions(-) delete mode 100644 docker/main/provision/roles/common/tasks/update-centos.yml delete mode 100644 docker/main/provision/roles/common/tasks/update-ubuntu.yml create mode 100644 docker/main/provision/roles/init/tasks/main.yml rename docker/main/provision/roles/{common => packages}/tasks/main.yml (50%) rename docker/main/provision/roles/{common => packages}/tasks/packages-centos.yml (100%) rename docker/main/provision/roles/{common => packages}/tasks/packages-ubuntu.yml (100%) create mode 100644 docker/main/provision/roles/update/tasks/main.yml create mode 100644 docker/main/provision/roles/update/tasks/update-centos.yml create mode 100644 docker/main/provision/roles/update/tasks/update-ubuntu.yml diff --git a/docker/main/Centos-7 b/docker/main/Centos-7 index a09f80c..ad9fac0 100644 --- a/docker/main/Centos-7 +++ b/docker/main/Centos-7 @@ -15,6 +15,7 @@ FROM webdevops/php-boilerplate:centos-7 +ENV PROVISION_SYS_UPDATE 0 ENV PROVISION_PHP_DISTRIBUTION php ENV PATH /opt/ansible/bin:/bin:/usr/bin:/sbin:/usr/sbin diff --git a/docker/main/Ubuntu-12.04 b/docker/main/Ubuntu-12.04 index 5371927..8965703 100644 --- a/docker/main/Ubuntu-12.04 +++ b/docker/main/Ubuntu-12.04 @@ -15,6 +15,7 @@ FROM webdevops/php-boilerplate:ubuntu-12.04 +ENV PROVISION_SYS_UPDATE 0 ENV PROVISION_PHP_DISTRIBUTION php # Ensure UTF-8 diff --git a/docker/main/Ubuntu-14.04 b/docker/main/Ubuntu-14.04 index dc1f39b..5ae4ed5 100644 --- a/docker/main/Ubuntu-14.04 +++ b/docker/main/Ubuntu-14.04 @@ -15,6 +15,7 @@ FROM webdevops/php-boilerplate:ubuntu-14.04 +ENV PROVISION_SYS_UPDATE 0 ENV PROVISION_PHP_DISTRIBUTION php # Ensure UTF-8 diff --git a/docker/main/Ubuntu-15.04 b/docker/main/Ubuntu-15.04 index a4cb9a4..8778b29 100644 --- a/docker/main/Ubuntu-15.04 +++ b/docker/main/Ubuntu-15.04 @@ -15,6 +15,7 @@ FROM webdevops/php-boilerplate:ubuntu-15.04 +ENV PROVISION_SYS_UPDATE 0 ENV PROVISION_PHP_DISTRIBUTION php # Ensure UTF-8 diff --git a/docker/main/Ubuntu-15.10 b/docker/main/Ubuntu-15.10 index e3840f3..f8a5642 100644 --- a/docker/main/Ubuntu-15.10 +++ b/docker/main/Ubuntu-15.10 @@ -15,6 +15,7 @@ FROM webdevops/php-boilerplate:ubuntu-15.10 +ENV PROVISION_SYS_UPDATE 0 ENV PROVISION_PHP_DISTRIBUTION php # Ensure UTF-8 diff --git a/docker/main/Ubuntu-HHVM b/docker/main/Ubuntu-HHVM index bc93e30..de14ec3 100644 --- a/docker/main/Ubuntu-HHVM +++ b/docker/main/Ubuntu-HHVM @@ -15,6 +15,7 @@ FROM webdevops/php-boilerplate:ubuntu-14.04 +ENV PROVISION_SYS_UPDATE 0 ENV PROVISION_PHP_DISTRIBUTION hhvm # Ensure UTF-8 diff --git a/docker/main/provision/playbook.yml b/docker/main/provision/playbook.yml index abc8d71..009343f 100755 --- a/docker/main/provision/playbook.yml +++ b/docker/main/provision/playbook.yml @@ -2,7 +2,9 @@ vars_files: - /opt/docker/provision/variables.yml roles: - - common + - init + - { role: update, when: PROVISION.SYS.UPDATE == "1" } + - packages - locales - users - supervisord diff --git a/docker/main/provision/roles/common/tasks/update-centos.yml b/docker/main/provision/roles/common/tasks/update-centos.yml deleted file mode 100644 index be21a80..0000000 --- a/docker/main/provision/roles/common/tasks/update-centos.yml +++ /dev/null @@ -1,2 +0,0 @@ -- name: Update system ... will take some time - yum: name=* state=latest diff --git a/docker/main/provision/roles/common/tasks/update-ubuntu.yml b/docker/main/provision/roles/common/tasks/update-ubuntu.yml deleted file mode 100644 index 6588c26..0000000 --- a/docker/main/provision/roles/common/tasks/update-ubuntu.yml +++ /dev/null @@ -1,5 +0,0 @@ -- name: Update system (apt-get update) ... will take some time - apt: update_cache=yes - -- name: Upgrade system (apt-get dist-upgrade) ... will take some time - apt: upgrade=dist diff --git a/docker/main/provision/roles/init/tasks/main.yml b/docker/main/provision/roles/init/tasks/main.yml new file mode 100644 index 0000000..ab9af8c --- /dev/null +++ b/docker/main/provision/roles/init/tasks/main.yml @@ -0,0 +1,5 @@ +- name: Update package cache (apt-get update) ... will take some time + apt: update_cache=yes + when: ansible_distribution == 'Ubuntu' + tags: + - bootstrap diff --git a/docker/main/provision/roles/common/tasks/main.yml b/docker/main/provision/roles/packages/tasks/main.yml similarity index 50% rename from docker/main/provision/roles/common/tasks/main.yml rename to docker/main/provision/roles/packages/tasks/main.yml index 3f59e1d..476059b 100644 --- a/docker/main/provision/roles/common/tasks/main.yml +++ b/docker/main/provision/roles/packages/tasks/main.yml @@ -1,13 +1,3 @@ -- include: update-centos.yml - when: ansible_distribution == 'CentOS' - tags: - - bootstrap - -- include: update-ubuntu.yml - when: ansible_distribution == 'Ubuntu' - tags: - - bootstrap - - include: packages-centos.yml when: ansible_distribution == 'CentOS' tags: diff --git a/docker/main/provision/roles/common/tasks/packages-centos.yml b/docker/main/provision/roles/packages/tasks/packages-centos.yml similarity index 100% rename from docker/main/provision/roles/common/tasks/packages-centos.yml rename to docker/main/provision/roles/packages/tasks/packages-centos.yml diff --git a/docker/main/provision/roles/common/tasks/packages-ubuntu.yml b/docker/main/provision/roles/packages/tasks/packages-ubuntu.yml similarity index 100% rename from docker/main/provision/roles/common/tasks/packages-ubuntu.yml rename to docker/main/provision/roles/packages/tasks/packages-ubuntu.yml diff --git a/docker/main/provision/roles/update/tasks/main.yml b/docker/main/provision/roles/update/tasks/main.yml new file mode 100644 index 0000000..a7592f7 --- /dev/null +++ b/docker/main/provision/roles/update/tasks/main.yml @@ -0,0 +1,9 @@ +- include: update-centos.yml + when: ansible_distribution == 'CentOS' + tags: + - bootstrap + +- include: update-ubuntu.yml + when: ansible_distribution == 'Ubuntu' + tags: + - bootstrap diff --git a/docker/main/provision/roles/update/tasks/update-centos.yml b/docker/main/provision/roles/update/tasks/update-centos.yml new file mode 100644 index 0000000..0864c5b --- /dev/null +++ b/docker/main/provision/roles/update/tasks/update-centos.yml @@ -0,0 +1,2 @@ +- name: Update distribution packages (yum) ... will take some time + yum: name=* state=latest diff --git a/docker/main/provision/roles/update/tasks/update-ubuntu.yml b/docker/main/provision/roles/update/tasks/update-ubuntu.yml new file mode 100644 index 0000000..f2eecf3 --- /dev/null +++ b/docker/main/provision/roles/update/tasks/update-ubuntu.yml @@ -0,0 +1,2 @@ +- name: Upgrade distribution packages (apt-get dist-upgrade) ... will take some time + apt: upgrade=dist diff --git a/docker/main/provision/variables.yml b/docker/main/provision/variables.yml index 903857b..cef0cda 100644 --- a/docker/main/provision/variables.yml +++ b/docker/main/provision/variables.yml @@ -3,6 +3,9 @@ PROVISION: CONTEXT: "{{ lookup('env','PROVISION_CONTEXT') }}" + SYS: + UPDATE: "{{ lookup('env','PROVISION_SYS_UPDATE') }}" + PHP: DISTRIBUTION: "{{ lookup('env','PROVISION_PHP_DISTRIBUTION') }}" From e6bc7a81c87df97f65562c9c56c2c9c6f217fe80 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Wed, 5 Aug 2015 22:20:45 +0200 Subject: [PATCH 61/66] Hide provisioning if no supervisor is requested Fixes #5 --- docker/main/bin/entrypoint.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docker/main/bin/entrypoint.sh b/docker/main/bin/entrypoint.sh index aef20bc..4bd8471 100755 --- a/docker/main/bin/entrypoint.sh +++ b/docker/main/bin/entrypoint.sh @@ -1,7 +1,14 @@ #!/bin/bash set -e -bash /opt/docker/bin/provision.sh entrypoint + +if [ "$1" == "supervisord" ]; then + # Visible provisioning + bash /opt/docker/bin/provision.sh entrypoint +else + # Hidden provisioning + bash /opt/docker/bin/provision.sh entrypoint > /dev/null +fi ############################# ## COMMAND From 01c8aadac2e6ba7749c40bafb04f23f92af493b5 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Mon, 10 Aug 2015 21:15:59 +0200 Subject: [PATCH 62/66] Refactored web container --- docker-compose.yml | 8 +-- docker/web/{httpd/Dockerfile => Apache-Httpd} | 6 +-- docker/web/{nginx/Dockerfile => Nginx} | 6 +-- docker/web/{ => bin}/httpd/entrypoint.sh | 0 docker/web/{ => bin}/nginx/entrypoint.sh | 0 .../web/{httpd/conf => conf/httpd}/vhost.conf | 0 .../web/{nginx/conf => conf/nginx}/vhost.conf | 0 docker/web/nginx/ssl/server.crt | 28 ---------- docker/web/nginx/ssl/server.csr | 26 ---------- docker/web/nginx/ssl/server.key | 51 ------------------- docker/web/{httpd => }/ssl/server.crt | 0 docker/web/{httpd => }/ssl/server.csr | 0 docker/web/{httpd => }/ssl/server.key | 0 13 files changed, 10 insertions(+), 115 deletions(-) rename docker/web/{httpd/Dockerfile => Apache-Httpd} (70%) rename docker/web/{nginx/Dockerfile => Nginx} (73%) rename docker/web/{ => bin}/httpd/entrypoint.sh (100%) rename docker/web/{ => bin}/nginx/entrypoint.sh (100%) rename docker/web/{httpd/conf => conf/httpd}/vhost.conf (100%) rename docker/web/{nginx/conf => conf/nginx}/vhost.conf (100%) delete mode 100644 docker/web/nginx/ssl/server.crt delete mode 100644 docker/web/nginx/ssl/server.csr delete mode 100644 docker/web/nginx/ssl/server.key rename docker/web/{httpd => }/ssl/server.crt (100%) rename docker/web/{httpd => }/ssl/server.csr (100%) rename docker/web/{httpd => }/ssl/server.key (100%) diff --git a/docker-compose.yml b/docker-compose.yml index a15fbfd..341261a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,10 +2,9 @@ # Main php container ####################################### main: - ## Ubuntu build: docker/main #dockerfile: Ubuntu-12.04 # Ubuntu 12.04 - PHP 5.3, LTS (precise) - dockerfile: Ubuntu-14.04 # Ubuntu 14.04 - PHP 5.5, LTS (trusty) + dockerfile: Ubuntu-14.04 # Ubuntu 14.04 - PHP 5.5, LTS (trusty) #dockerfile: Ubuntu-15.04 # Ubuntu 15.04 - PHP 5.6 (vivid) #dockerfile: Ubuntu-15.10 # Ubuntu 15.10 - PHP 5.6 (wily) #dockerfile: Ubuntu-HHVM # Ubuntu 14.04 - HHVM (trusty) @@ -35,8 +34,9 @@ main: # Webserver ####################################### web: - build: docker/web/httpd/ # Apache HTTPD webserver - #build: docker/web/nginx/ # Nginx + build: docker/web + dockerfile: Apache-Httpd # Apache HTTPd + #dockerfile: Nginx # Nginx ports: - 8000:80 - 8443:443 diff --git a/docker/web/httpd/Dockerfile b/docker/web/Apache-Httpd similarity index 70% rename from docker/web/httpd/Dockerfile rename to docker/web/Apache-Httpd index 90193c1..1833945 100644 --- a/docker/web/httpd/Dockerfile +++ b/docker/web/Apache-Httpd @@ -13,9 +13,9 @@ FROM httpd:2.4 RUN apt-get update && apt-get install -y net-tools -ADD conf/vhost.conf /usr/local/apache2/conf/.docker-vhost.conf.original -ADD ssl/* /usr/local/apache2/ssl/ -ADD entrypoint.sh /entrypoint.sh +ADD conf/httpd/vhost.conf /usr/local/apache2/conf/.docker-vhost.conf.original +ADD ssl/* /usr/local/apache2/ssl/ +ADD bin/httpd/entrypoint.sh /entrypoint.sh EXPOSE 80 EXPOSE 443 diff --git a/docker/web/nginx/Dockerfile b/docker/web/Nginx similarity index 73% rename from docker/web/nginx/Dockerfile rename to docker/web/Nginx index 9926119..ab33f2f 100644 --- a/docker/web/nginx/Dockerfile +++ b/docker/web/Nginx @@ -13,9 +13,9 @@ FROM nginx RUN apt-get update && apt-get install -y net-tools -ADD conf/vhost.conf /opt/docker/vhost.conf -ADD ssl/* /etc/nginx/ssl/ -ADD entrypoint.sh /entrypoint.sh +ADD conf/nginx/vhost.conf /opt/docker/vhost.conf +ADD ssl/* /etc/nginx/ssl/ +ADD bin/nginx/entrypoint.sh /entrypoint.sh EXPOSE 80 EXPOSE 8000 diff --git a/docker/web/httpd/entrypoint.sh b/docker/web/bin/httpd/entrypoint.sh similarity index 100% rename from docker/web/httpd/entrypoint.sh rename to docker/web/bin/httpd/entrypoint.sh diff --git a/docker/web/nginx/entrypoint.sh b/docker/web/bin/nginx/entrypoint.sh similarity index 100% rename from docker/web/nginx/entrypoint.sh rename to docker/web/bin/nginx/entrypoint.sh diff --git a/docker/web/httpd/conf/vhost.conf b/docker/web/conf/httpd/vhost.conf similarity index 100% rename from docker/web/httpd/conf/vhost.conf rename to docker/web/conf/httpd/vhost.conf diff --git a/docker/web/nginx/conf/vhost.conf b/docker/web/conf/nginx/vhost.conf similarity index 100% rename from docker/web/nginx/conf/vhost.conf rename to docker/web/conf/nginx/vhost.conf diff --git a/docker/web/nginx/ssl/server.crt b/docker/web/nginx/ssl/server.crt deleted file mode 100644 index 6b06949..0000000 --- a/docker/web/nginx/ssl/server.crt +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIE1DCCArwCCQDMMwGnSuK0tTANBgkqhkiG9w0BAQsFADAsMRswGQYDVQQKExJE -b2NrZXIgQm9pbGVycGxhdGUxDTALBgNVBAMUBCoudm0wHhcNMTUwNTA0MTcxNDQw -WhcNMjUwNTAxMTcxNDQwWjAsMRswGQYDVQQKExJEb2NrZXIgQm9pbGVycGxhdGUx -DTALBgNVBAMUBCoudm0wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDK -3TIUiyDvXelWeY9VXMrpjuZtYpVSDsACLpjFUhMnsP5/iKT0VbeZyqHvmwZjAg4G -Y10d+yZDdgv/xeu0HPOFbtR6pCp10d1tdLHZto5Cyuxu7IQsAVjnD6Ko7XFwtNk7 -9o6JZfAFaGL4w5MokrVmCtspnsMZH7/7zU4f96cbF39zLopnpuXGD6t6DA8Qj3gy -0duaTjs42bYRN+rwLzVKAev99iQ4kPMJn4vV6/Xk6rtoSzC67GQyVZYaFypicD1S -NtsRmgEVvjCBDbrLOneUiRwff6qxEsZi7Hxv7BKFj4iUWnII7K/nP7T6uBHQjHO+ -FpsGkU9lCMrCeVFBe8kKz/cbhd+yLUxXwAPr6gSOPmwn232Gy4tozvqZHpbUxsgx -7sT3ej9K66h1D7J+BjNFWYM1hbnC1r7H/xS7EBzBV8qRoQCVe08Juf5xsouXFakD -clLV4+L+1cxkpwsCQDly5g3tm/TBqA2O+ZJ+YHQDHKkzMyhLs6i0X/M5qvJBiLg1 -GLTCS20rpQ5gXTEGuINqHgwXQWkUO6bhgSYqdHGX3zbZ5+qWpI4eui3dHZ1Ll0VH -6Icpb7ORTQwhc6W8KBlybssYPSlGOEBGUjYGNheoz9FpoSkxCis+P8ZNKtrmpPoq -Su0eOOGFOFHG02eOgPVxSwrDeN9MVJo7BPysGMHJmQIDAQABMA0GCSqGSIb3DQEB -CwUAA4ICAQC63g6NHmQKbiy3G6iaDkpUSbr5Mq2YgU61XnvWVyREqDcy/BXCw9oY -SJ/KUvCpqPnACNOFqjadRAmPiA9nf2WduoCgwQGV/YRFGswSuVvh/3X2TX5NWvbS -t8MQDttQg1dxpiMUjlu3rqhfohBdWJvp2lVSdpDb/MOlXBc/+p7HfOHwhqB7wwPN -NNbSKUbZqZxmD8cOf1X0hASr1yfFPj+2vST3ESaON8S0T2p63YX/sD5jvOUiEuyw -I5WcvLmiRZA07SH8nWyckLY3qWL+OlhSZrlAnolWS00b+7h5LNuRYEjKzwVgntoA -aCopyQih6wIk0+AfJO4sfhJBmQhnIrAaP/zwBH5g9zVizLf5H7U+hNXrMwgw55Sq -vjMdkZHvPKUXTvVit/rYE9H+PY3brkRWzOl4V/i/ZLJJm5805H/NyTbz9kPMJw2Q -nn+KOpfXXySD39f8iuRgSKXsYNul38hxWgcZZ6g+sOOp2n/VUmf0eZUWNnJ8i7AP -4Qif7aDKMcibOwSwsB+DKZXDvZ5XSdnMphtuLS5rPSL81rVRmWC2DMfQ2eP8j0WN -VTroSk0xedQ7Qr+9TNooi9IyzX6n1a2S1UiciEZ3ZcDbXPl/P01m+IYZyPnLv0+9 -ZeioZYh1JLv3/OKsMrMLTfh2ZCj3aXwmc2Owi/wU2LS5QUOMcHH7CQ== ------END CERTIFICATE----- \ No newline at end of file diff --git a/docker/web/nginx/ssl/server.csr b/docker/web/nginx/ssl/server.csr deleted file mode 100644 index 8a9909f..0000000 --- a/docker/web/nginx/ssl/server.csr +++ /dev/null @@ -1,26 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIEcTCCAlkCAQAwLDEbMBkGA1UEChMSRG9ja2VyIEJvaWxlcnBsYXRlMQ0wCwYD -VQQDFAQqLnZtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAyt0yFIsg -713pVnmPVVzK6Y7mbWKVUg7AAi6YxVITJ7D+f4ik9FW3mcqh75sGYwIOBmNdHfsm -Q3YL/8XrtBzzhW7UeqQqddHdbXSx2baOQsrsbuyELAFY5w+iqO1xcLTZO/aOiWXw -BWhi+MOTKJK1ZgrbKZ7DGR+/+81OH/enGxd/cy6KZ6blxg+regwPEI94MtHbmk47 -ONm2ETfq8C81SgHr/fYkOJDzCZ+L1ev15Oq7aEswuuxkMlWWGhcqYnA9UjbbEZoB -Fb4wgQ26yzp3lIkcH3+qsRLGYux8b+wShY+IlFpyCOyv5z+0+rgR0IxzvhabBpFP -ZQjKwnlRQXvJCs/3G4Xfsi1MV8AD6+oEjj5sJ9t9hsuLaM76mR6W1MbIMe7E93o/ -SuuodQ+yfgYzRVmDNYW5wta+x/8UuxAcwVfKkaEAlXtPCbn+cbKLlxWpA3JS1ePi -/tXMZKcLAkA5cuYN7Zv0wagNjvmSfmB0AxypMzMoS7OotF/zOaryQYi4NRi0wktt -K6UOYF0xBriDah4MF0FpFDum4YEmKnRxl9822efqlqSOHrot3R2dS5dFR+iHKW+z -kU0MIXOlvCgZcm7LGD0pRjhARlI2BjYXqM/RaaEpMQorPj/GTSra5qT6KkrtHjjh -hThRxtNnjoD1cUsKw3jfTFSaOwT8rBjByZkCAwEAAaAAMA0GCSqGSIb3DQEBCwUA -A4ICAQBsEBgC2YepuZq/8UqvKMZKVy/etDKXj7BB+QPb+leNiKD7p4LDxHJsZSH8 -Ku9uMPeLfiQDn5jA41k5SlGttzvObd65RdEbO3yHpqsg05EGSDDLfaE1k2Al/qmX -/o8roPZF7+2kZthgMAgkcokS54LYqEYTGqOf3J9Ss0yRIZwhaOVebfFIbIOdpw0B -JNMIJPHTMdZrcuRVI+wR1uPLIlEJzBvxTGbTrvPU25WJFtu+EajKqXO0SHdy0yx8 -uH4ykRBJRc36+oYo7nZ5D56dh7pZn3+9J64FKAOV0Q3KqMFieGy053ezuhJd70eZ -UozTgfjs3WpMzoYmKETSyl3XZSdInRe+sUlKPruTsKyg69oYxjPlrGfAmmGcCFca -TnZinT18dI92zK7OtOVkmYeYKC1lwuhftVrNMXzZuHOGpS9NNYtc4nDqDMIEOfV3 -6rCdu03WjEgJ+Z67tJs16xOx9du4/EHxS2Ijn9DPfVJvYy0TgzDi1BUpjWx0KTLx -C4OQbEZ/QTWmHVbSch/hcZhzbf7SNh5RpnW4EtmcpDFjIKMfxJmoKeiTf7qnilx0 -7uRvsZFKoDKRDOFiPfgMg5AOtLHziYsd9m0tJjC2GHvFuPjzOtzhnUUjmmvht170 -2aqKakjST4amg7jzLcs871HX0/WjOtt29NpOz140blkKf1bisg== ------END CERTIFICATE REQUEST----- \ No newline at end of file diff --git a/docker/web/nginx/ssl/server.key b/docker/web/nginx/ssl/server.key deleted file mode 100644 index 42b3839..0000000 --- a/docker/web/nginx/ssl/server.key +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIJKAIBAAKCAgEAyt0yFIsg713pVnmPVVzK6Y7mbWKVUg7AAi6YxVITJ7D+f4ik -9FW3mcqh75sGYwIOBmNdHfsmQ3YL/8XrtBzzhW7UeqQqddHdbXSx2baOQsrsbuyE -LAFY5w+iqO1xcLTZO/aOiWXwBWhi+MOTKJK1ZgrbKZ7DGR+/+81OH/enGxd/cy6K -Z6blxg+regwPEI94MtHbmk47ONm2ETfq8C81SgHr/fYkOJDzCZ+L1ev15Oq7aEsw -uuxkMlWWGhcqYnA9UjbbEZoBFb4wgQ26yzp3lIkcH3+qsRLGYux8b+wShY+IlFpy -COyv5z+0+rgR0IxzvhabBpFPZQjKwnlRQXvJCs/3G4Xfsi1MV8AD6+oEjj5sJ9t9 -hsuLaM76mR6W1MbIMe7E93o/SuuodQ+yfgYzRVmDNYW5wta+x/8UuxAcwVfKkaEA -lXtPCbn+cbKLlxWpA3JS1ePi/tXMZKcLAkA5cuYN7Zv0wagNjvmSfmB0AxypMzMo -S7OotF/zOaryQYi4NRi0wkttK6UOYF0xBriDah4MF0FpFDum4YEmKnRxl9822efq -lqSOHrot3R2dS5dFR+iHKW+zkU0MIXOlvCgZcm7LGD0pRjhARlI2BjYXqM/RaaEp -MQorPj/GTSra5qT6KkrtHjjhhThRxtNnjoD1cUsKw3jfTFSaOwT8rBjByZkCAwEA -AQKCAgAbZPdoUsllyZbC+LNkYZ19ILD5QIDNjfRb1xMGQmkXyQz1B+zOmeyrNfPc -OWEJabOfJTfj3pByN7SzG3US4333HNpQnW6mbmqqZ0HFFqPrXR/Ecuf+UUhCG5hp -m3bgM2vKbyccYsmg0VHcKfzrU7RvTTP/UNMjx2fThwvvwS+ttuSdF0HVcXJB5sfP -OWWnZNhkdHZlRf81VCED/jsZqCZYEh5eMyj9AoXvXL4zayPPf+tC0DSKaXW2Xlxg -tZQhqup8+a9nlxZia0Z9hu8clo6jXkiP8FuKgfCMV0cOjiCKLLHS5svTbLLsVWwJ -F2ZAdVcD6mWQ43qHOEK5NEzGvQKO14CaOLnVT2yAkMcyNohsEgoDP9oCBGDJQbBH -NmtZfpVjjtuTr9P9TEkU1FcBRo0x6Il/DkzamGbOeFAmgnaGElhJ5c/CAG7whaIf -mUfFOBGPH/wESY3gBOACDofeSh27RrlvbLaPiCGKivDUTBmhBsIuso6XqOKbvtfV -/HhhndpdRVfIj4DdE7gIrLIGN977JMVAXFCNz7KrvAWwcOXrCHCoWpklJ9repq8l -26ICY8K7VXktzDHQUmhd88ZWR+9ASURsJghUgZUOcMrEGyvci6Y8hpLhHiNVPHuQ -+ps7tpPsXSntBUqWBzhRZh74+nJlOOV6oYykl30JT2JzB6lwiQKCAQEA9ecn8N2z -20tR2UEiTv/MjVSepQtAAajegvcd1iasvvQKXnh3XLmoZHzH2tTa0lp5RIZpUQPl -lOTwko0lYTBnYblt65AJQ3FTgisNobIpoqE8BFXLm6wggz7CbabjmPGDe173lPGR -sI0YSKYvzrdn4zw8Fh6WULJyZHLi58zJYL3r0WBDiOoxpGaGA1GlmkuIWjhKHaX2 -OvF1vOuQDJ2eDyTc5TYFC0NKG76Mvanov5L/yrhNM/umbmp0SPspzHGZobAKUr20 -OazFT8S+2TA1OTxWNbiPbSimFoaZbEdqsNACGfVJWO8Sh8iqlt5RmEcSiSvGBj6L -QKprRO9Fsp2GawKCAQEA0zGhRsnux4JTNsdUSYsEJtITMj6eE+nl7CoZ9DAOwC5X -6/aSpUE4TT+pWNrt9iluXiGL0j89UJ7r/L1OcsiyzGb8ig9NU4zr1NIGTZ0DstHi -HPYINjeiBJEFIy17kOQn+9/I5c4hBUwz6ihwNoEomymVB/EsLJKAML0AudJGKg+Z -/f/qrS40eab5SAiaKgsh0MZnj+vIxyGBydt6r2HGmjfNITVbXIu6IpO+6NXDwM/e -7v10AAZ3j9+gb1RedLg2ghuIuYU90hmMhtVWsh9nVmaOkMW9/WFgOPYvt/mHH/hR -d4pePZ9kACGmqo/b9sHvHw1YEubtCt1VUiNuFxnJCwKCAQBWnxz0vkRTJY8phsY9 -KeK2jm5sGTBs5T2syLwb6ffENFdKvAjgAw6Mh2And/+1ReWd+/MxdLv03UjZdxsJ -x3FDfXx5FH4O4ebW3a+pnAcKoN1xcX+N0O6LDRqUYcue3sTAOs3gC9CUbr91KAWD -Phw8ccWAzTmKJ7IgLFA982ekyoI9eTmRC159WRgwJxy844qerWF+XC4GyXP+HsTZ -jNRW5Vdi7sqMEyIR7+fIEAhLI88zbATWIPmZv6pC4ybwO7wwtsCMMQNBpdjDprzL -6S12ggikV+U+QKlxGe0FtYqhykRTPJKf32eZqVheWOZJTA/9fgv9ux52oxGycM8O -gmsNAoIBAQC60m5uZnd5uYnPLWkcXYNgq/kbO1UvHHut/FhVMKX7z4MrU0XKNfWO -MECoP5K9bU0aq+Y6KIMe7FapjvT0iSHRu1Cu+HZY8JI2A0xcIAeDijLRl7sP6wrB -q1+2DKgANjRAlWfsEfoX658JBpitPngjOheBnRCMpVQMyUT5HE/BKWf5zwdUB0mY -S+K8nA90HcDeJIS8RcGolbVwUV0oBABhr/cf50lYhqozqCr7YQ33ZGs7Uq3oz8+4 -UARmN2YPLl3Znm3GX12em8c6B0LX8vvA7Jw06Rf2Ksup1+3Ce1PTLiEy9A4FyRf3 -Hc2HmBbnJAtZlr5QikMqlzzAmmLqwH6dAoIBAC+ryaQGJFsijCSuaDfRp/uy9xnd -DjgMdTwjl5WLBmyudChVMANl8eqCbvVO41CN84yORk03oQ4cx0eKxAZaLaSzgkb3 -W0X2nFQe7VJSYMQswCQ+1WfJvEFrIdkEKIa//uQdhqNrgUKSNVhhSTMbNEkDTIWn -ssbv2H9hvUaFt/J/vP9zCKuU5oYvNU7Oi6ZXRYezRn9atlJYanLFoJnHUBRzGms5 -K0vhdCPDXQq87z5Yudoh0jLUQF9Nx0GTWeBceQ9n5hZeRUNQWxP4AJThQX9KSPTS -mbL3Kh4XNRmAUJ2N+Njh+3dg91s+JkKvC1wcspLsmLPQe+9AxBSH9y5JE/8= ------END RSA PRIVATE KEY----- diff --git a/docker/web/httpd/ssl/server.crt b/docker/web/ssl/server.crt similarity index 100% rename from docker/web/httpd/ssl/server.crt rename to docker/web/ssl/server.crt diff --git a/docker/web/httpd/ssl/server.csr b/docker/web/ssl/server.csr similarity index 100% rename from docker/web/httpd/ssl/server.csr rename to docker/web/ssl/server.csr diff --git a/docker/web/httpd/ssl/server.key b/docker/web/ssl/server.key similarity index 100% rename from docker/web/httpd/ssl/server.key rename to docker/web/ssl/server.key From be2b2383a1d96f64e268dc8023555ef60a545750 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Mon, 10 Aug 2015 21:16:09 +0200 Subject: [PATCH 63/66] Added composer to main container --- docker/main/provision/playbook.yml | 1 + docker/main/provision/roles/composer/tasks/install.yml | 2 ++ docker/main/provision/roles/composer/tasks/main.yml | 3 +++ 3 files changed, 6 insertions(+) create mode 100644 docker/main/provision/roles/composer/tasks/install.yml create mode 100644 docker/main/provision/roles/composer/tasks/main.yml diff --git a/docker/main/provision/playbook.yml b/docker/main/provision/playbook.yml index 009343f..19ac3b0 100755 --- a/docker/main/provision/playbook.yml +++ b/docker/main/provision/playbook.yml @@ -13,4 +13,5 @@ - { role: php, when: PROVISION.PHP.DISTRIBUTION == "php" } - { role: hhvm, when: PROVISION.PHP.DISTRIBUTION == "hhvm" } - mysql + - composer - finalize diff --git a/docker/main/provision/roles/composer/tasks/install.yml b/docker/main/provision/roles/composer/tasks/install.yml new file mode 100644 index 0000000..c1127e4 --- /dev/null +++ b/docker/main/provision/roles/composer/tasks/install.yml @@ -0,0 +1,2 @@ +- name: Install composer (phar) + raw: 'curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer' diff --git a/docker/main/provision/roles/composer/tasks/main.yml b/docker/main/provision/roles/composer/tasks/main.yml new file mode 100644 index 0000000..e3418cb --- /dev/null +++ b/docker/main/provision/roles/composer/tasks/main.yml @@ -0,0 +1,3 @@ +- include: install.yml + tags: + - bootstrap From 48c1e99762948ae4a997badb860c1cdcc028703d Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Mon, 10 Aug 2015 21:16:46 +0200 Subject: [PATCH 64/66] Improved documentation Fixes webdevops/TYPO3-docker-boilerplate#74 # Conflicts: # documentation/DOCKER-INFO.md --- README.md | 1 + documentation/DOCKER-INFO.md | 88 +----------------------------------- documentation/SERVICES.md | 83 ++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 86 deletions(-) create mode 100644 documentation/SERVICES.md diff --git a/README.md b/README.md index d2fd62e..566d7ac 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ You can use my [Vagrant Development VM](https://github.com/mblaschke/vagrant-dev - [Installation and requirements](/documentation/INSTALL.md) - [Updating docker boilerplate](/documentation/UPDATE.md) - [Customizing](/documentation/CUSTOMIZE.md) +- [Services (Webserver, MySQL... Ports, Users, Passwords)](/documentation/SERVICES.md) - [Docker Quickstart](/documentation/DOCKER-QUICKSTART.md) - [Run your project](/documentation/DOCKER-STARTUP.md) - [Container detail info](/documentation/DOCKER-INFO.md) diff --git a/documentation/DOCKER-INFO.md b/documentation/DOCKER-INFO.md index 5c5178c..17be0f6 100644 --- a/documentation/DOCKER-INFO.md +++ b/documentation/DOCKER-INFO.md @@ -23,8 +23,8 @@ This directory will be mounted under `/docker` in `main` and `web` container. ## Docker images Container | Source ------------------------- | ------------------------------- -main/ubuntu | [Ubuntu](https://registry.hub.docker.com/_/ubuntu/) *official* (prebuild available from https://registry.hub.docker.com/u/mblaschke/php-boilerplate/) -main/centos | [CentOS](https://registry.hub.docker.com/_/centos/) *official* (prebuild available from https://registry.hub.docker.com/u/mblaschke/php-boilerplate/) +main/ubuntu | [Ubuntu](https://registry.hub.docker.com/_/ubuntu/) *official* (prebuilt available from https://registry.hub.docker.com/u/mblaschke/php-boilerplate/) +main/centos | [CentOS](https://registry.hub.docker.com/_/centos/) *official* (prebuilt available from https://registry.hub.docker.com/u/mblaschke/php-boilerplate/) storage | [Ubuntu](https://registry.hub.docker.com/_/ubuntu/) *official* web | [Apache](https://registry.hub.docker.com/_/httpd/) *official* or [Nginx](https://registry.hub.docker.com/_/nginx/) *official* mysql | [MySQL](https://registry.hub.docker.com/_/mysql/) *official* @@ -58,90 +58,6 @@ make create-cms-project | Create new TYPO3 project (based on typo3/cms-base-di make create-neos-project | Create new NEOS project (based on typo3/neos-base-distribution)
| make build | Run building (composer, gulp, bower) -make scheduler | Run TYPO3 scheduler -make clean | Clear TYPO3 configuration cache - -## Docker containers - -### Web (Nginx or Apache HTTPd) - -Setting | Value -------------- | ------------- -Host | web:80 and web:443 (ssl) -External Port | 8000 and 8443 (ssl) - -### MySQL - -You can choose between [MySQL](https://www.mysql.com/) (default), [MariaDB](https://www.mariadb.org/) -and [PerconaDB](http://www.percona.com/software) in `docker/mysql/Dockerfile` - -Setting | Value -------------- | ------------- -User | dev (if not changed in env) -Password | dev (if not changed in env) -Database | typo3 (if not changed in env) -Host | mysql:3306 -External Port | 13306 - -Access fo MySQL user "root" and "dev" will be allowed from external hosts (eg. for debugging, dumps and other stuff). - - -### PostgreSQL - -Setting | Value -------------- | ------------- -User | dev (if not changed in env) -Password | dev (if not changed in env) -Host | postgres:5432 -External Port | 15432 - - -### Solr - -Setting | Value -------------- | ------------- -Host | solr:8983 -External Port | 18983 -Cores | docker/solr/conf/solr.xml (data dirs are created automatically) - -### Elasticsearch (disabled by default) - -Setting | Value -------------- | ------------- -Host | elasticsearch:9200 and :9300 -External Port | 19200 and 19300 - -### Redis - -Setting | Value -------------- | ------------- -Host | redis -Port | 6379 - -### Memcached - -Setting | Value -------------- | ------------- -Host | memcached -Port | 11211 - -### Mailcatcher - -Setting | Value -------------- | ------------- -Host | mail -SMTP port | 1025 -Web port | 1080 - -### FTP - -Setting | Value -------------- | ------------- -Host | ftp -Ports | 20,21 -User | dev (if not changed in env) -Password | dev (if not changed in env) -Path | /data/ftp (if not changed in env) ## Environment settings diff --git a/documentation/SERVICES.md b/documentation/SERVICES.md new file mode 100644 index 0000000..eed775e --- /dev/null +++ b/documentation/SERVICES.md @@ -0,0 +1,83 @@ +[<-- Back to main section](../README.md) + +# Services + +### Web (Nginx or Apache HTTPd) + +Setting | Value +------------- | ------------- +Host | web:80 and web:443 (ssl) +External Port | 8000 and 8443 (ssl) + +### MySQL + +You can choose between [MySQL](https://www.mysql.com/) (default), [MariaDB](https://www.mariadb.org/) +and [PerconaDB](http://www.percona.com/software) in `docker/mysql/Dockerfile` + +Setting | Value +------------- | ------------- +User | dev (if not changed in env) +Password | dev (if not changed in env) +Database | database (if not changed in env) +Host | mysql:3306 +External Port | 13306 + +Access fo MySQL user "root" and "dev" will be allowed from external hosts (eg. for debugging, dumps and other stuff). + + +### PostgreSQL + +Setting | Value +------------- | ------------- +User | dev (if not changed in env) +Password | dev (if not changed in env) +Host | postgres:5432 +External Port | 15432 + + +### Solr + +Setting | Value +------------- | ------------- +Host | solr:8983 +External Port | 18983 +Cores | docker/solr/conf/solr.xml (data dirs are created automatically) + +### Elasticsearch (disabled by default) + +Setting | Value +------------- | ------------- +Host | elasticsearch:9200 and :9300 +External Port | 19200 and 19300 + +### Redis + +Setting | Value +------------- | ------------- +Host | redis +Port | 6379 + +### Memcached + +Setting | Value +------------- | ------------- +Host | memcached +Port | 11211 + +### Mailcatcher + +Setting | Value +------------- | ------------- +Host | mail +SMTP port | 1025 +Web port | 1080 + +### FTP + +Setting | Value +------------- | ------------- +Host | ftp +Ports | 20,21 +User | dev (if not changed in env) +Password | dev (if not changed in env) +Path | /data/ftp (if not changed in env) From 69e12dda7a930d75bf755e10136d1699ca6f9a59 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Mon, 10 Aug 2015 21:33:22 +0200 Subject: [PATCH 65/66] Added git Fixes webdevops/TYPO3-docker-boilerplate#76 --- .../provision/roles/packages/tasks/packages-centos.yml | 7 +++++++ .../provision/roles/packages/tasks/packages-ubuntu.yml | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/docker/main/provision/roles/packages/tasks/packages-centos.yml b/docker/main/provision/roles/packages/tasks/packages-centos.yml index 9529dc9..92b50bb 100644 --- a/docker/main/provision/roles/packages/tasks/packages-centos.yml +++ b/docker/main/provision/roles/packages/tasks/packages-centos.yml @@ -31,6 +31,13 @@ - net-tools - rsync +- name: Install packages (development tools) + yum: + name: '{{ item }}' + state: present + with_items: + - git + - name: Install packages (general tools) yum: name: '{{ item }}' diff --git a/docker/main/provision/roles/packages/tasks/packages-ubuntu.yml b/docker/main/provision/roles/packages/tasks/packages-ubuntu.yml index 2970716..b6f95d5 100644 --- a/docker/main/provision/roles/packages/tasks/packages-ubuntu.yml +++ b/docker/main/provision/roles/packages/tasks/packages-ubuntu.yml @@ -32,6 +32,13 @@ - net-tools - rsync +- name: Install packages (development tools) + apt: + name: '{{ item }}' + state: present + with_items: + - git + - name: Install packages (general tools) apt: name: '{{ item }}' From 69ec2f0bacaf74ee326e55a35f33d5c541c777d7 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Thu, 13 Aug 2015 18:54:18 +0200 Subject: [PATCH 66/66] Release 4.0.0 --- CHANGELOG.md | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a29f8b..118a5d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ TYPO3 Docker Boilerplate Changelog ================================== -4.0.0 - UPCOMING ------------------------ +4.0.0 - 2015-08-13 - t3ugs @jweilandnet +--------------------------------------- - Seperated TYPO3 Docker Boilerplate and PHP Docker Boilerplate - Switched to Ansible provisioning (playbook) - Added multiple Ubuntu versions diff --git a/README.md b/README.md index 566d7ac..edf494d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Dockerized TYPO3 project boilerplate -![latest v3.5.0](https://img.shields.io/badge/latest-v3.5.0-green.svg?style=flat) +[![latest v4.0.0](https://img.shields.io/badge/latest-v4.0.0-green.svg?style=flat)](https://github.com/webdevops/TYPO3-docker-boilerplate/releases/tag/4.0.0) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/mblaschke/typo3-docker-boilerplate.svg)](http://isitmaintained.com/project/mblaschke/typo3-docker-boilerplate "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/mblaschke/typo3-docker-boilerplate.svg)](http://isitmaintained.com/project/mblaschke/typo3-docker-boilerplate "Percentage of issues still open")