Skip to content

Commit

Permalink
Merge branch 'release/3.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mblaschke committed Jun 23, 2015
2 parents a87e7c6 + eeaeaa0 commit 4c62ecd
Show file tree
Hide file tree
Showing 19 changed files with 278 additions and 16 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
TYPO3 Docker Boilerplate Changelog
==================================

3.5.0 - 2015-06-23
-----------------------
- Added `ftp` container (with vsftpd)
- Added `postgres` container (with PostgreSQL)
- Enabled php module `mcrypt` by default
- Improved documentation

3.4.0 - 2015-06-15
-------------------------------------
- Renamed `PHP_UID` and `PHP_GID` to `EFFECTIVE_UID` and `EFFECTIVE_GID`
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# Dockerized PHP web project boilerplate

![latest v3.4.0](https://img.shields.io/badge/latest-v3.4.0-green.svg?style=flat)
![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)
[![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_, _TYPO3 NEOS_, _TYPO3 FLOW_, _Symfony Framework_ and many other.
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.

Supports:

- Nginx or Apache HTTPd
- PHP-FPM (with Xdebug)
- MySQL, MariaDB or PerconaDB
- PostgreSQL
- Solr (disabled, with TYPO3 CMS EXT:solr configuration as example)
- Elasticsearch (disabled, without configuration)
- Redis (disabled)
- Memcached (disabled)
- Mailcatcher (if no mail sandbox is used, eg. [Vagrant Development VM](https://github.com/mblaschke/vagrant-development))
- FTP server (vsftpd)
- Support for `TYPO3_CONTEXT` and `FLOW_CONTEXT` for TYPO3, FLOW, NEOS.
- maybe more later...

Expand All @@ -34,6 +36,7 @@ Use 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)
- [Docker Quickstart](/documentation/DOCKER-QUICKSTART.md)
- [Run your project](/documentation/DOCKER-STARTUP.md)
- [Container detail info](/documentation/DOCKER-INFO.md)
Expand Down
27 changes: 27 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ main:
build: docker/main/
links:
- mysql
#- postgres
#- mail
#- solr
#- elasticsearch
#- redis
#- memcached
#- ftp
volumes:
- ./:/docker/
- /tmp/debug/:/tmp/debug/
Expand Down Expand Up @@ -53,6 +55,18 @@ mysql:
env_file:
- docker-env.yml

#######################################
# PostgreSQL server
#######################################
#postgres:
# build: docker/postgres/
# ports:
# - 15432:5432
# volumes_from:
# - storage
# env_file:
# - docker-env.yml

#######################################
# Solr server
#######################################
Expand Down Expand Up @@ -110,6 +124,19 @@ mysql:
# env_file:
# - docker-env.yml

#######################################
# FTP (vsftpd)
#######################################
#ftp:
# build: docker/vsftpd/
# volumes_from:
# - storage
# volumes:
# - ./:/docker/
# - /tmp/debug/:/tmp/debug/
# env_file:
# - docker-env.yml

#######################################
# Storage
#######################################
Expand Down
60 changes: 49 additions & 11 deletions docker-env.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,84 @@
# Settings: TYPO3 CMS
#######################################
# Environment Configuration
# - feel free to edit -
# -> for most changes you only have to
# docker-compose up -d
# to apply them
#######################################

#######################################
# Webserver

# TYPO3 CMS
DOCUMENT_ROOT=code/
DOCUMENT_INDEX=index.php
CLI_SCRIPT=php typo3/cli_dispatch.phpsh

# Settings: NEOS or FLOW
#DOCUMENT_ROOT=code/Web/
#DOCUMENT_INDEX=index.php
#CLI_SCRIPT=php flow

# Settings: SYMFONY FRAMEWORK
# SYMFONY FRAMEWORK
#DOCUMENT_ROOT=code/web/
#DOCUMENT_INDEX=app_dev.php
#CLI_SCRIPT=php app/console

# Contexts environment
# NEOS or FLOW
#DOCUMENT_ROOT=code/Web/
#DOCUMENT_INDEX=index.php
#CLI_SCRIPT=php flow

#######################################
# Context environment
TYPO3_CONTEXT=Development/Docker
FLOW_CONTEXT=Development/Docker
FLOW_REWRITEURLS=1
SYMFONY_ENV=dev
SYMFONY_DEBUG=0

# Mail - Vagrant mail sandbox
#######################################
# Mail

# Vagrant mail sandbox
MAIL_GATEWAY=192.168.56.2

# Mail - Mailcatcher
# Mailcatcher (container)
#MAIL_GATEWAY=mail:1025

# Service settings
#######################################
# Internal dns routing
DNS_DOMAIN=vm vm.dev

#######################################
# MySQL settings
# -> if you change these settings
# you have to remove the database:
# docker-compose rm mysql
# because it's stored database in
# volume and provisioning is only
# done once.
MYSQL_ROOT_PASSWORD=dev
MYSQL_USER=dev
MYSQL_PASSWORD=dev
MYSQL_DATABASE=typo3

#######################################
# PostgreSQL settings
POSTGRES_USER=dev
POSTGRES_PASSWORD=dev

#######################################
# FTP settings
FTP_USER=dev
FTP_PASSWORD=dev
FTP_PATH=/data/ftp/
#FTP_PATH=/docker/code/

#######################################
# PHP Settings
PHP_TIMEZONE=UTC

#######################################
# Permission settings
EFFECTIVE_UID=1000
EFFECTIVE_GID=1000

#######################################
# Default cli user (should be www-data)
CLI_USER=www-data
3 changes: 1 addition & 2 deletions docker/elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
FROM dockerfile/elasticsearch

FROM elasticsearch
3 changes: 3 additions & 0 deletions docker/httpd/conf/vhost.conf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ SetEnv MYSQL_ROOT_USER "root"
SetEnv MYSQL_ROOT_PASSWORD "<MYSQL_ROOT_PASSWORD>"
SetEnv MYSQL_DATABASE "<MYSQL_DATABASE>"

SetEnv POSTGRES_USER "<POSTGRES_USER>"
SetEnv POSTGRES_PASSWORD "<POSTGRES_PASSWORD>"

DirectoryIndex <DOCUMENT_INDEX> index.html index.htm

DocumentRoot "<DOCUMENT_ROOT>"
Expand Down
3 changes: 3 additions & 0 deletions docker/httpd/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ cp /usr/local/apache2/conf/.docker-vhost.conf.original /usr/local/apache
/bin/sed -i "s@<MYSQL_ROOT_PASSWORD>@${MYSQL_ROOT_PASSWORD}@" /usr/local/apache2/conf/docker-vhost.conf
/bin/sed -i "s@<MYSQL_DATABASE>@${MYSQL_DATABASE}@" /usr/local/apache2/conf/docker-vhost.conf

/bin/sed -i "s@<POSTGRES_USER>@${POSTGRES_USER}@" /usr/local/apache2/conf/docker-vhost.conf
/bin/sed -i "s@<POSTGRES_PASSWORD>@${POSTGRES_PASSWORD}@" /usr/local/apache2/conf/docker-vhost.conf

#############################
## COMMAND
#############################
Expand Down
3 changes: 3 additions & 0 deletions docker/main/bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ locale-gen
touch /etc/php5/mods-available/docker-boilerplate.ini
php5enmod docker-boilerplate

# enable ext mcrypt
php5enmod mcrypt

#############################
# Composer
#############################
Expand Down
6 changes: 6 additions & 0 deletions docker/nginx/conf/vhost.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ server {
fastcgi_param MYSQL_ROOT_PASSWORD "<MYSQL_ROOT_PASSWORD>";
fastcgi_param MYSQL_DATABASE "<MYSQL_DATABASE>";

fastcgi_param POSTGRES_USER "<POSTGRES_USER>";
fastcgi_param POSTGRES_PASSWORD "<POSTGRES_PASSWORD>";

fastcgi_read_timeout 1000;
}
}
Expand Down Expand Up @@ -78,6 +81,9 @@ server {
fastcgi_param MYSQL_ROOT_PASSWORD "<MYSQL_ROOT_PASSWORD>";
fastcgi_param MYSQL_DATABASE "<MYSQL_DATABASE>";

fastcgi_param POSTGRES_USER "<POSTGRES_USER>";
fastcgi_param POSTGRES_PASSWORD "<POSTGRES_PASSWORD>";

fastcgi_read_timeout 1000;
}
}
3 changes: 3 additions & 0 deletions docker/nginx/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ cp /opt/docker/vhost.conf /etc/nginx/conf.d/vhost.conf
/bin/sed -i "s@<MYSQL_ROOT_PASSWORD>@${MYSQL_ROOT_PASSWORD}@" /etc/nginx/conf.d/vhost.conf
/bin/sed -i "s@<MYSQL_DATABASE>@${MYSQL_DATABASE}@" /etc/nginx/conf.d/vhost.conf

/bin/sed -i "s@<POSTGRES_USER>@${POSTGRES_USER}@" /etc/nginx/conf.d/vhost.conf
/bin/sed -i "s@<POSTGRES_PASSWORD>@${POSTGRES_PASSWORD}@" /etc/nginx/conf.d/vhost.conf

#############################
## COMMAND
#############################
Expand Down
1 change: 1 addition & 0 deletions docker/postgres/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM postgres:9.4
1 change: 1 addition & 0 deletions docker/storage/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

mkdir -p /data/solr/
mkdir -p /data/dns/
mkdir -p /data/ftp/
mkdir -p /data/cache/

find /data/ -type d -print0 | xargs -0 --no-run-if-empty chmod 777
Expand Down
32 changes: 32 additions & 0 deletions docker/vsftpd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM ubuntu:14.04

ENV VSFTP_USER dev
ENV VSFTP_PASSWORD dev
ENV VSFTP_PATH /data/ftp/

RUN apt-get update && \
apt-get install -y vsftpd supervisor net-tools

RUN mkdir -p /var/run/vsftpd/empty
RUN mkdir -p /var/log/supervisor

COPY entrypoint.sh /entrypoint.sh
COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY conf/vsftpd.conf /etc/vsftpd.conf

RUN mkdir -p /data/ftp/

VOLUME "/data/ftp/"

EXPOSE 20
EXPOSE 21
EXPOSE 12020
EXPOSE 12021
EXPOSE 12022
EXPOSE 12023
EXPOSE 12024
EXPOSE 12025

ENTRYPOINT ["/entrypoint.sh"]

CMD ["supervisord"]
5 changes: 5 additions & 0 deletions docker/vsftpd/conf/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[supervisord]
nodaemon=true

[program:vsftpd]
command=vsftpd
25 changes: 25 additions & 0 deletions docker/vsftpd/conf/vsftpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
anon_upload_enable=NO
anon_mkdir_write_enable=NO
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem
max_per_ip=100
max_clients=100

pasv_min_port=12020
pasv_max_port=12025

file_open_mode=0666
local_umask=000

allow_writeable_chroot=YES
vsftpd_log_file=/var/log/vsftpd.log
background=NO
42 changes: 42 additions & 0 deletions docker/vsftpd/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
set -e

#############################
## USER
#############################

mkdir -p "${FTP_PATH}"

if ( id "${FTP_USER}" ); then
echo "User ${FTP_USER} already exists"
else
echo "Creating user and group ${FTP_USER}"
ENC_PASS=$(perl -e 'print crypt($ARGV[0], "password")' "${FTP_PASSWORD}")
groupadd -g "${EFFECTIVE_GID}" "${FTP_USER}"
useradd -d "${FTP_PATH}" -m -p "${ENC_PASS}" -u "${EFFECTIVE_UID}" --gid "${FTP_USER}" -s /bin/sh "${FTP_USER}"
fi

#############################
## 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/ftp.ip
echo "${ETH0_IP} ftp ftp_1" > /data/dns/ftp.hosts

## Start services
exec supervisord
;;

## All other commands
*)
exec "$@"
;;
esac
Loading

0 comments on commit 4c62ecd

Please sign in to comment.