diff --git a/README.md b/README.md
index ce3a65d..34060b1 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,10 @@ permission-hassle free :tm: [» More](/Resources/doc/permissions.md)
git clone https://github.com/nerdpress-org/docker-sf3.git docker-sf3
cp -r docker-sf3/docker /path/to/your/symfony-project/
+## Please Notice
+
+This software compilation is ment for local development purpose only.
+
## Usage
cd /path/to/your/symfony-project/docker
@@ -32,34 +36,63 @@ Open the browser: [http://[docker-host]:8080](http://[docker-host]:8080)

-### PHP
-PHP7 is used.
+## Development Webserver (sf_web)
+
+### PHP7 on Apache 2.4 (http2 enabled)
+from the [Ondřej Surý PPA](https://launchpad.net/~ondrej)
+running on [Ubuntu:Xenial](https://hub.docker.com/_/ubuntu/) Docker Image.
+
+### Debugging
Xdebug and Blackfire.io support are included by default.
[» How to configure](Resources/doc/debug.md)
-### DB
+### zsh default shell
+[oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) is the default shell.
+
+The Dockerfile can be found here:
+(/docker/sf_web Docker
-MySql is used.
+## DB (sf_db)
+Official [MySQL:5](https://hub.docker.com/r/mysql/mysql-server/) Docker is used.
Use the name of the service as the database host in your connection settings:
```yml
-database_driver: pdo_mysql
-database_host: db
-database_port: 3306
-database_name: sf3
-database_user: sf3
-database_password: sf3
+ database_driver: pdo_mysql
+ database_host: db
+ database_port: 3306
+ database_name: sf3
+ database_user: sf3
+ database_password: sf3
```
Its configured to be open for access from outside,
so if you prefer to use MySql Workbench on the host, use the containers IP as host.
-Find the IP with: `docker inspect --format '{{ .NetworkSettings.IPAddress }} {{ .Name }}' $(docker ps -q)`
+Find the IP with:
+ `docker inspect --format '{{ .NetworkSettings.IPAddress }} {{ .Name }}' $(docker ps -q)`
-Otherwise use phpmyadmin on [http://[docker-host]:8081](http://[docker-host]:8081)
+### Otherwise use official phpmyadmin docker on [http://[docker-host]:8081](http://[docker-host]:8081)
-### Other Services
+## Other Services
* [Elasticsearch](Resources/doc/services.md)
* [Mailcatcher SMTP](Resources/doc/services.md)
+
+
+## Customizing Environment
+* Locale is en_US.UTF-8
+* Timezone is set to Europe/Berlin
+
+## ToDos
+
+* Create a _.htaccess_ file in the docker folder, to prevent funny things.
+* Make docker_sf3 directly _installable_ into a Symfony project.
+* Add more tests for the additional services.
+* Tweak Nerdpress zsh theme
+* Dynamically add php version to sf_web env.
+* Dynamically populate db credentials for sf3 via environment.
+* Set up names to enable service discovery.
+* Set up automated certificate creation and clarify to make it persist.
+* Create an image (e.g. on quay.io) to speed up installation.
+* Set up continous image builds. (e.g. on cve or othe source images changes)
diff --git a/Resources/doc/debug.md b/Resources/doc/debug.md
index 5c2d585..f9b3991 100644
--- a/Resources/doc/debug.md
+++ b/Resources/doc/debug.md
@@ -22,4 +22,14 @@ Blackfire client and agent are provided by the official Docker image.
The probe is integrated in the PHP container.
Get the Blackfire Bookmarklet and enter your credentials in *docker-env* and thats it.
-Happy Profiling :)
\ No newline at end of file
+Happy Profiling :)
+
+## Switching between Blackfire and Xdebug
+
+Do not run xdebug and blackfire simoultanously.
+In order ot enable or disable xdebug / blackfire, please run
+
+```yml
+sudo phpdismod xdebug
+sudo phpenmod blackfire
+```
diff --git a/Resources/doc/permissions.md b/Resources/doc/permissions.md
index 2cf762b..b2d60af 100644
--- a/Resources/doc/permissions.md
+++ b/Resources/doc/permissions.md
@@ -5,4 +5,10 @@ by changing the user id of the _www-data_ user to the current host user id.
This should work on linux, mac or windows systems.
-For running symfony commands via cli, log into the _sf_web_ container as _www-data_
\ No newline at end of file
+For running symfony commands via cli, log into the _sf_web_ container as _www-data_
+
+## Warning
+The user www-data is member of the sudo group as well as adm.
+Furthermore sudo does not require a password for the sudo action. (See sf_web/Dockerfile.dist)
+This is only to simplify local development.
+Do not run this on a server, please.
diff --git a/Resources/doc/services.md b/Resources/doc/services.md
index 705d6e6..603ceea 100644
--- a/Resources/doc/services.md
+++ b/Resources/doc/services.md
@@ -1,16 +1,18 @@
-#### Elasticsearch
-
+### Elasticsearch
+Uses the official [Elasticsearch Alpine](https://hub.docker.com/_/elasticsearch) image.
```yml
host: elasticsearch
port: 9200
```
-#### Mailcatcher SMTP
-
+### Mailcatcher SMTP
+[mailcatcher](https://rubygems.org/gems/mailcatcher/) helps to deal with inbound and outbound email.
```yml
host: mailcatcher
port: 1025
```
-Webinterface on http://[yourhost*]:1080
\ No newline at end of file
+Webinterface on http://[yourhost*]:1080
+
+It uses the [tiny-mailcatcher](https://github.com/datadarius/tiny-mailcatcher) Docker Image.
diff --git a/Resources/doc/zsh.md b/Resources/doc/zsh.md
new file mode 100644
index 0000000..d18d380
--- /dev/null
+++ b/Resources/doc/zsh.md
@@ -0,0 +1,11 @@
+## Nerdpress loves oh-my-zsh with rubyrussell Theme
+
+_zsh_ is set as the default shell.
+The [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) Framework is enabled be default.
+robyrussell is our favorite theme but we needed a hostname at the prompt.
+Therefore whe modified the [» Theme](/sf_web/nerdpress.zsh-theme)
+A few Aliases to simplify web development are configured in [» zshrc.dist](/sf_web/zshrc.dist)
+
+
+## Enable bash
+If you prefer bash, you need to edit the docker.sh and replace zsh with bash
\ No newline at end of file
diff --git a/docker/.htaccess b/docker/.htaccess
new file mode 100644
index 0000000..a7a56f7
--- /dev/null
+++ b/docker/.htaccess
@@ -0,0 +1 @@
+Require all denied
\ No newline at end of file
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 5ead7ff..1ab727f 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -11,11 +11,13 @@ services:
container_name: "sf_web"
ports:
- 8080:80 #apache
- - 9001:9000 #xdebug
+ - 8081:443 #apache secure
+
volumes:
- "../:/var/www/html"
- "~/.composer:/var/www/.composer"
- ./sf_web/zshrc.dist:/var/www/.zshrc:ro
+ - ./sf_web/nerdpress.zsh-theme:/var/www/.oh-my-zsh/themes/nerdpress.zsh-theme:ro
links:
- db
- elasticsearch
@@ -57,7 +59,6 @@ services:
- PMA_USER=root
- PMA_PASSWORD=root
-
#elasticsearch
elasticsearch:
image: "elasticsearch:1.3"
@@ -67,11 +68,10 @@ services:
ports:
- 9201:9200
-
#mailcatcher
mailcatcher:
container_name: "sf_mailcatcher"
- image: yappabe/mailcatcher
+ image: schickling/mailcatcher
ports:
- 1025:1025
- 1080:1080
diff --git a/docker/sf_web/000-default.conf b/docker/sf_web/000-default.conf
index 79782c3..f24ce15 100644
--- a/docker/sf_web/000-default.conf
+++ b/docker/sf_web/000-default.conf
@@ -1,3 +1,6 @@
+#This enables http2 support. h2 ist http2 via TLS, h2c is http2 via TCP,...
+#The sorting order decides on the connection (left first)
+Protocols h2c http/1.1
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
diff --git a/docker/sf_web/Dockerfile.dist b/docker/sf_web/Dockerfile.dist
index a57dafe..be34714 100644
--- a/docker/sf_web/Dockerfile.dist
+++ b/docker/sf_web/Dockerfile.dist
@@ -1,61 +1,55 @@
-FROM php:7-apache
+FROM ubuntu:xenial
-#Enable necessary Apache modules
-RUN a2enmod rewrite
+LABEL org.nerdpress.version="1-beta"
+LABEL vendor="nerdpress.org"
+LABEL org.nerdpress.release-date="2017-02-14"
+LABEL org.nerdpress.version.is-production="false"
-#Change your timezone below. Full list of timezones: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
-RUN echo Europe/Berlin > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
+ENV DEBIAN_FRONTEND noninteractive
+# Todo, set PHP_VERSION ENV through a php query.
#Append software required during runtime here.
-RUN RUNTIME_PKGS="locales zsh curl vim git zip mcrypt mysql-client htop ssh-client libicu52 libjpeg62-turbo libpng12-0 libfreetype6" \
- && apt-get update && apt-get install -y --no-install-recommends $RUNTIME_PKGS \
+RUN BASE_PKGS="ca-certificates locales zsh bash curl vim git zip mcrypt htop ssh-client sudo" \
+ && apt-get update && apt-get install -y --no-install-recommends $BASE_PKGS \
&& apt-get autoremove -y && apt-get clean -y \
&& locale-gen en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
-
-#PECL
-ADD docker-php-pecl-install /usr/local/bin/
-RUN chmod u+x /usr/local/bin/docker-php-pecl-install
-#Append software required during build here.
-RUN BUILD_PKGS="zlib1g-dev libicu-dev g++ libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng12-dev make" \
- && apt-get update && apt-get install -y --no-install-recommends $BUILD_PKGS \
- && docker-php-ext-install -j$(nproc) iconv mcrypt mbstring exif zip opcache pdo_mysql pcntl \
- && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
- && docker-php-ext-install -j$(nproc) gd \
- && docker-php-ext-configure intl \
- && docker-php-ext-install intl \
- && docker-php-pecl-install xdebug \
- && apt-get autoremove -y $BUILD_PKGS \
- && apt-get clean -y \
+#Change your timezone below. Full list of timezones: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
+RUN echo Europe/Berlin > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
+
+#Add Ondrej Sury PPAs (https://launchpad.net/~ondrej) and install Apache+PHP
+RUN WEB_PKGS="apache2 nghttp2 php7.1 php7.1-mysql php7.1-sqlite php7.1-intl php-zip php-json php-curl php-xml libapache2-mod-php7.1" \
+ && echo deb http://ppa.launchpad.net/ondrej/apache2/ubuntu xenial main > /etc/apt/sources.list.d/ondrej-apache2.list \
+ && echo deb http://ppa.launchpad.net/ondrej/php/ubuntu xenial main > /etc/apt/sources.list.d/ondrej-php.list \
+ && apt-key adv --keyserver keyserver.ubuntu.com --recv-key E5267A6C \
+ && apt-get update && apt-get install -y --no-install-recommends $WEB_PKGS \
+ && apt-get autoremove -y && apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
-#Configure xdebug.
-RUN sed -i '1 a xdebug.remote_autostart=true' /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini
-RUN sed -i '1 a xdebug.remote_connect_back=1 ' /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini
-RUN sed -i '1 a xdebug.remote_enable=1' /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini
-RUN sed -i '1 a xdebug.max_nesting_level = 1200' /usr/local/etc/php/conf.d/docker-php-pecl-xdebug.ini
+#Enable necessary Apache modules
+RUN a2enmod rewrite http2
#Install blackfire.
RUN export VERSION=`php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;"` \
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/${VERSION} \
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \
&& mv /tmp/blackfire-*.so `php -r "echo ini_get('extension_dir');"`/blackfire.so \
- && echo "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707" > /usr/local/etc/php/conf.d/blackfire.ini \
+ && echo "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707" > /etc/php/7.1/mods-available/blackfire.ini \
&& rm -rf /tmp/* /var/tmp/*
#Install composer.
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
- && composer global require hirak/prestissimo \
- && rm -rf /tmp/* /var/tmp/*
+ && composer global require hirak/prestissimo \
+ && rm -rf /tmp/* /var/tmp/*
-#Populate Environment
+##Populate Environment
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
-COPY php.ini /usr/local/etc/php/
-COPY zshrc.dist /var/www/.zshrc
+#COPY php.ini /usr/local/etc/php/
-#Overtake www-data
-RUN usermod -u $USER_ID www-data -s /bin/zsh
+#Overtake www-data, set zsh shell, append (!) groups sudo and adm
+RUN usermod -u $USER_ID www-data -s /bin/zsh -a -G sudo,adm
+RUN echo "www-data ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
#Install oh-my-zsh
ENV TERM=xterm
@@ -66,4 +60,6 @@ RUN chgrp -R www-data /var/www
RUN chmod -R g+rwx /var/www
RUN umask 0007
-WORKDIR /var/www/html
\ No newline at end of file
+EXPOSE 80 443
+WORKDIR /var/www/html
+ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
\ No newline at end of file
diff --git a/docker/sf_web/docker-php-pecl-install b/docker/sf_web/docker-php-pecl-install
deleted file mode 100644
index 1062439..0000000
--- a/docker/sf_web/docker-php-pecl-install
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-set -e
-
-usage() {
- echo "usage: $0 [channel/] ..."
- echo " ie: $0 uploadprogress oauth-1.2.3"
-}
-
-if [ $# -eq 0 ]; then
- usage >&2
- exit 1
-fi
-
-pecl install "$@"
-
-while [ $# -gt 0 ]; do
- ext="$1"
- ext=$(echo "$ext" | cut -d- -f1)
- ext=$(echo "$ext" | cut -d\/ -f2)
- shift
-
- for module in $(find /usr/local/lib/php/extensions -name "$ext.so"); do
- ini="/usr/local/etc/php/conf.d/docker-php-pecl-$ext.ini"
- if grep -q zend_extension_entry "$module"; then
- # https://wiki.php.net/internals/extensions#loading_zend_extensions
- line="zend_extension=$(basename "$module")"
- else
- line="extension=$(basename "$module")"
- fi
- if ! grep -q "$line" "$ini" 2>/dev/null; then
- echo "$line" >> "$ini"
- fi
- done
-done
-
-rm -rf /tmp/*
diff --git a/docker/sf_web/nerdpress.zsh-theme b/docker/sf_web/nerdpress.zsh-theme
new file mode 100644
index 0000000..8854b6c
--- /dev/null
+++ b/docker/sf_web/nerdpress.zsh-theme
@@ -0,0 +1,7 @@
+local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
+PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)@$HOST# '
+
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
\ No newline at end of file
diff --git a/docker/sf_web/php.ini b/docker/sf_web/php.ini
index 7e13a7d..4539188 100644
--- a/docker/sf_web/php.ini
+++ b/docker/sf_web/php.ini
@@ -1932,11 +1932,11 @@ opcache.fast_shutdown=1
; tab-width: 4
; End:
-[Xdebug]
+#[Xdebug]
;zend_extension=""
-xdebug.remote_enable=1
-xdebug.remote_port=9000
-xdebug.remote_host=192.168.2.165
-xdebug.profiler_enable=1
-xdebug.profiler_output_dir="/tmp/xdebug"
-xdebug.var_display_max_depth = 5;
+#xdebug.remote_enable=1
+#xdebug.remote_port=9000
+#xdebug.remote_host=192.168.2.165
+#xdebug.profiler_enable=1
+#xdebug.profiler_output_dir="/tmp/xdebug"
+#xdebug.var_display_max_depth = 5;
diff --git a/docker/sf_web/zshrc.dist b/docker/sf_web/zshrc.dist
index 1841782..7e6fb6e 100644
--- a/docker/sf_web/zshrc.dist
+++ b/docker/sf_web/zshrc.dist
@@ -10,7 +10,7 @@ export ZSH=/var/www/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
-ZSH_THEME="robbyrussell"
+ZSH_THEME="nerdpress"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
@@ -20,7 +20,7 @@ ZSH_THEME="robbyrussell"
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
-# DISABLE_AUTO_UPDATE="true"
+DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13