Skip to content

Commit ccc8bb3

Browse files
committed
Added ubuntu hhvm
1 parent c160ae3 commit ccc8bb3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+709
-2
lines changed

docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
# Main php container
33
#######################################
44
main:
5-
build: docker/main/ubuntu # dynamic ubuntu version (ansible provisioning)
6-
#build: docker/main/centos # dynamic centos version (ansible provisioning)
5+
build: docker/main/ubuntu # dynamic ubuntu version (ansible provisioning)
6+
#build: docker/main/centos # dynamic centos version (ansible provisioning)
7+
#build: docker/main/ubuntu-hhvm # ubuntu lts with HHVM (ansible provisioning)
78
links:
89
- mysql
910
#- postgres

docker/main/ubuntu-hhvm/Dockerfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#++++++++++++++++++++++++++++++++++++++
2+
# Ubuntu PHP Docker container
3+
#++++++++++++++++++++++++++++++++++++++
4+
#
5+
# Prebuild images:
6+
#
7+
# mblaschke/php-boilerplate:ubuntu-14.04
8+
#
9+
# Official images:
10+
#
11+
# ubuntu:14.04 - PHP 5.5, LTS (trusty)
12+
# https://registry.hub.docker.com/u/library/ubuntu/
13+
#
14+
#++++++++++++++++++++++++++++++++++++++
15+
16+
FROM mblaschke/php-boilerplate:ubuntu-14.04
17+
18+
# Ensure UTF-8
19+
RUN locale-gen en_US.UTF-8
20+
ENV LANG en_US.UTF-8
21+
ENV LC_ALL en_US.UTF-8
22+
23+
##
24+
# Bootstrap
25+
##
26+
27+
COPY conf/locale.conf /opt/docker/locale.conf
28+
COPY bin/bootstrap.sh /opt/docker/bin/bootstrap.sh
29+
COPY bin/provision.sh /opt/docker/bin/provision.sh
30+
COPY bin/logwatch.sh /opt/docker/bin/logwatch.sh
31+
COPY bin/dnsmasq.sh /opt/docker/bin/dnsmasq.sh
32+
COPY provision /opt/docker/provision/
33+
34+
RUN bash /opt/docker/bin/bootstrap.sh
35+
RUN bash /opt/docker/bin/provision.sh bootstrap
36+
37+
##
38+
# Customization
39+
##
40+
41+
COPY bin/customization.sh /opt/docker/bin/customization.sh
42+
RUN bash /opt/docker/bin/customization.sh
43+
44+
##
45+
# Config
46+
##
47+
48+
COPY entrypoint.sh /entrypoint.sh
49+
COPY conf /opt/docker/conf/
50+
51+
EXPOSE 9000
52+
53+
VOLUME /docker/
54+
WORKDIR /docker/code/
55+
56+
ENTRYPOINT ["/entrypoint.sh"]
57+
CMD ["supervisord"]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
set -o pipefail # trace ERR through pipes
4+
set -o errtrace # trace ERR through 'time command' and other functions
5+
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
6+
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
7+
8+
export DEBIAN_FRONTEND="noninteractive"
9+
10+
# workaround for slow/freezing apt inside docker(?)
11+
echo 'Acquire::http::Pipeline-Depth "0";' >> /etc/apt/apt.conf.d/00no-pipeline
12+
13+
if [ -z "`which ansible`" ]; then
14+
# install apt-add-repository if needed
15+
if [ -z "`which apt-add-repository`" ]; then
16+
17+
apt-get update -q
18+
apt-get install -y --no-install-recommends lsb-release
19+
20+
21+
if [ "`lsb_release -r -s`" = '12.04' ]; then
22+
apt-get install -y python-software-properties
23+
else
24+
apt-get install -y software-properties-common
25+
fi
26+
fi
27+
28+
# Register and install ansible
29+
apt-add-repository ppa:ansible/ansible
30+
apt-get update -q
31+
apt-get install -y ansible python-apt aptitude
32+
fi
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -o pipefail # trace ERR through pipes
4+
set -o errtrace # trace ERR through 'time command' and other functions
5+
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
6+
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
7+
8+
export DEBIAN_FRONTEND="noninteractive"
9+
10+
## add your custom stuff here
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
3+
sleep 5
4+
5+
## backup original resolv.conf
6+
if [ ! -f "/opt/docker/.resolv.conf" ]; then
7+
## backup original file
8+
cp /etc/resolv.conf /opt/docker/.resolv.conf
9+
10+
## Copy resolv.conf for dnsmasq (default resolver)
11+
cp /etc/resolv.conf /var/run/dnsmasq/resolv.conf
12+
fi
13+
14+
## Restore original resolvconf
15+
function restore_resolvconf() {
16+
## restore original resolv.conf
17+
cp /opt/docker/.resolv.conf /etc/resolv.conf
18+
}
19+
20+
## Start and configure dnsmasq
21+
function dnsmasq_start() {
22+
echo "[dnsmasq] Found Webserver IP: $1"
23+
24+
restore_resolvconf
25+
26+
## clear dns file
27+
echo > /etc/dnsmasq.d/development
28+
29+
## add IP for each domain (wildcard!)
30+
for DOMAIN in $DNS_DOMAIN; do
31+
echo "address=/${DOMAIN}/${1}" >> /etc/dnsmasq.d/development
32+
done
33+
34+
## set forward servers
35+
cat /opt/docker/.resolv.conf | grep nameserver | sed 's/nameserver /server=/' > /etc/dnsmasq.d/forward
36+
37+
## (re)start dnsmasq as DNS server
38+
service dnsmasq restart
39+
40+
## set dnsmasq to main nameserver
41+
echo "nameserver 127.0.0.1" > /etc/resolv.conf
42+
43+
## wait for 10 hours
44+
sleep 10h
45+
}
46+
47+
## Fetch IP from services
48+
if [ -f "/data/dns/web.ip" ]; then
49+
## Found WEB
50+
dnsmasq_start "$(cat /data/dns/web.ip)"
51+
elif [ -f "/data/dns/httpd.ip" ]; then
52+
## Found HTTPD (fallback)
53+
dnsmasq_start "$(cat /data/dns/httpd.ip)"
54+
elif [ -f "/data/dns/nginx.ip" ]; then
55+
## Found NGINX (fallback)
56+
dnsmasq_start "$(cat /data/dns/nginx.ip)"
57+
else
58+
## Found nothing, restore original resolvconf
59+
restore_resolvconf
60+
sleep 15
61+
fi
62+
63+
exit 0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -o pipefail # trace ERR through pipes
4+
set -o errtrace # trace ERR through 'time command' and other functions
5+
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
6+
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
7+
8+
tail -F --quiet $2 | sed --unbuffered -e "s/^/\[$1\] /"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
set -o pipefail # trace ERR through pipes
4+
set -o errtrace # trace ERR through 'time command' and other functions
5+
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
6+
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
7+
8+
export DEBIAN_FRONTEND="noninteractive"
9+
export PYTHONUNBUFFERED=1
10+
11+
ANSIBLE_DIR='/opt/docker/provision'
12+
13+
ANSIBLE_TAG="$1"
14+
15+
# workaround if windows
16+
chmod -x "$ANSIBLE_DIR/inventory"
17+
18+
# run ansible
19+
ansible-playbook "$ANSIBLE_DIR/playbook.yml" --inventory="$ANSIBLE_DIR/inventory" --tags="${ANSIBLE_TAG}"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
en_GB.UTF-8 UTF-8
2+
en_GB ISO-8859-1
3+
en_GB.ISO-8859-15 ISO-8859-15
4+
5+
en_US.UTF-8 UTF-8
6+
en_US ISO-8859-1
7+
en_US.ISO-8859-15 ISO-8859-15
8+
9+
de_DE.UTF-8 UTF-8
10+
de_DE ISO-8859-1
11+
de_DE@euro ISO-8859-15
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
; this file will overwrite default php.ini settings
2+
3+
short_open_tag = On
4+
variables_order = 'GPCS'
5+
request_order = 'GP'
6+
7+
allow_url_fopen = On
8+
allow_url_include = Off
9+
10+
memory_limit = 512M
11+
max_execution_time = 900
12+
max_input_time = 300
13+
post_max_size = 50M
14+
upload_max_filesize = 50M
15+
16+
; timezone will be overwritten in startup, use docker-env.yml
17+
date.timezone = Europe/Berlin
18+
19+
mysql.default_host = mysql
20+
mysqli.default_host = mysql
21+
22+
; Zend OPCache
23+
opcache.enable = 1
24+
opcache.memory_consumption = 128
25+
opcache.interned_strings_buffer = 8
26+
opcache.max_accelerated_files = 4000
27+
opcache.fast_shutdown = 1
28+
opcache.enable_cli = 1
29+
30+
; XDebug
31+
xdebug.remote_enable = 1
32+
xdebug.remote_connect_back = on
33+
xdebug.idekey = "docker"
34+
xdebug.cli_color = 1
35+
xdebug.max_nesting_level = 1000
36+
xdebug.profiler_enable_trigger = 1
37+
xdebug.profiler_output_dir = '/tmp/debug/'
38+
xhprof.output_dir = '/tmp/debug/'
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[supervisord]
2+
nodaemon=true
3+
4+
[program:php-fpm]
5+
command = /usr/bin/hhvm --mode server -vServer.Type=fastcgi -vServer.Port=9000
6+
autostart = true
7+
autorestart = true
8+
stdout_logfile=/dev/stdout
9+
stdout_logfile_maxbytes=0
10+
stderr_logfile=/dev/stderr
11+
stderr_logfile_maxbytes=0
12+
13+
[program:dnsmasq]
14+
command = bash /opt/docker/bin/dnsmasq.sh
15+
autostart = true
16+
autorestart = true
17+
stdout_logfile=/dev/stdout
18+
stdout_logfile_maxbytes=0
19+
stderr_logfile=/dev/stderr
20+
stderr_logfile_maxbytes=0
21+
22+
[program:php-log-access]
23+
command = bash /opt/docker/bin/logwatch.sh php:access /tmp/php.access.log
24+
autostart = true
25+
autorestart = true
26+
stdout_logfile=/dev/stdout
27+
stdout_logfile_maxbytes=0
28+
stderr_logfile=/dev/stderr
29+
stderr_logfile_maxbytes=0
30+
31+
[program:php-log-slow]
32+
command = bash /opt/docker/bin/logwatch.sh php:slow /tmp/php.slow.log
33+
autostart = true
34+
autorestart = true
35+
stdout_logfile=/dev/stdout
36+
stdout_logfile_maxbytes=0
37+
stderr_logfile=/dev/stderr
38+
stderr_logfile_maxbytes=0
39+
40+
[program:php-log-error]
41+
command = bash /opt/docker/bin/logwatch.sh php:error /tmp/php.error.log
42+
autostart = true
43+
autorestart = true
44+
stdout_logfile=/dev/stdout
45+
stdout_logfile_maxbytes=0
46+
stderr_logfile=/dev/stderr
47+
stderr_logfile_maxbytes=0

0 commit comments

Comments
 (0)