Skip to content

Commit c9effc7

Browse files
committed
Added development/production context
Fixes webdevops/TYPO3-docker-boilerplate#70
1 parent 56b2245 commit c9effc7

File tree

16 files changed

+206
-3
lines changed

16 files changed

+206
-3
lines changed

docker-env.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ CAKE_ENV=dev
3232
# yii
3333
YII_ENVIRONMENT=Development
3434

35+
#######################################
36+
# PROVISION environment
37+
38+
# Context for provision [development|production]
39+
PROVISION_CONTEXT=development
40+
41+
# PHP Modules
42+
PROVISION_PHP_BLACKFIRE=1
43+
PROVISION_PHP_XDEBUG=1
44+
3545
#######################################
3646
# Mail
3747

docker/main/centos/conf/php.ini renamed to docker/main/centos/conf/php.development.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; this file will overwrite default php.ini settings
22

3+
display_errors = 1
4+
35
short_open_tag = On
46
variables_order = 'GPCS'
57
request_order = 'GP'
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
; this file will overwrite default php.ini settings
2+
3+
display_errors = 0
4+
5+
short_open_tag = On
6+
variables_order = 'GPCS'
7+
request_order = 'GP'
8+
9+
allow_url_fopen = On
10+
allow_url_include = Off
11+
12+
memory_limit = 512M
13+
max_execution_time = 900
14+
max_input_time = 300
15+
post_max_size = 50M
16+
upload_max_filesize = 50M
17+
max_input_vars = 5000
18+
19+
; timezone will be overwritten in startup, use docker-env.yml
20+
date.timezone = Europe/Berlin
21+
22+
mysql.default_host = mysql
23+
mysqli.default_host = mysql
24+
25+
; Zend OPCache
26+
opcache.enable = 1
27+
opcache.memory_consumption = 256
28+
opcache.interned_strings_buffer = 16
29+
opcache.max_accelerated_files = 10000
30+
opcache.fast_shutdown = 1
31+
opcache.enable_cli = 1
32+
opcache.revalidate_freq = 2
33+
opcache.validate_timestamps = 1
34+
35+
; XDebug
36+
xdebug.remote_enable = 0
37+
xdebug.remote_connect_back = off

docker/main/centos/provision/roles/common/tasks/packages.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
- net-tools
1818
# Utils
1919
- moreutils
20-
- bind-utils
20+
- bind-utils
21+
- pygpgme
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
- name: Add blackfire.io key
2+
rpm_key:
3+
key: https://packagecloud.io/gpg.key
4+
state: present
5+
6+
- name: Add blackfire.io repository
7+
get_url:
8+
url: http://packages.blackfire.io/fedora/blackfire.repo
9+
dest: /etc/yum.repos.d/blackfire.repo
10+
mode: 0644
11+
12+
- name: Disable gpg check for blackfire (CentOS 7 workaround)
13+
lineinfile:
14+
dest: /etc/yum.repos.d/blackfire.repo
15+
regexp: '^repo_gpgcheck=1'
16+
line: 'repo_gpgcheck=0'
17+
# when: ansible_distribution == 'CentOS' and ansible_distribution_version == "7"
18+
19+
- name: Install blackfire-php
20+
yum:
21+
name: '{{ item }}'
22+
state: present
23+
with_items:
24+
- blackfire-php

docker/main/centos/provision/roles/php/tasks/configuration.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@
1111
- { key: 'env[SYMFONY_ENV]', value: '{{ DOCKER.SYMFONY_ENV }}' }
1212
- { key: 'env[SYMFONY_DEBUG]', value: '{{ DOCKER.SYMFONY_DEBUG }}' }
1313

14+
- name: Set development environment php.ini
15+
file:
16+
src: '/opt/docker/conf/php.development.ini'
17+
dest: '/opt/docker/conf/php.ini'
18+
force: yes
19+
state: link
20+
when: PROVISION.CONTEXT == "development" or PROVISION.CONTEXT == ""
21+
22+
- name: Enable production environment php.ini
23+
file:
24+
src: '/opt/docker/conf/php.production.ini'
25+
dest: '/opt/docker/conf/php.ini'
26+
force: yes
27+
state: link
28+
when: PROVISION.CONTEXT == "production"
29+
1430
- name: Configure php (docker php.ini)
1531
lineinfile:
1632
dest: /opt/docker/conf/php.ini

docker/main/centos/provision/roles/php/tasks/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
tags:
33
- bootstrap
44

5+
- include: blackfire.yml
6+
tags:
7+
- bootstrap
8+
59
- include: configuration.yml
610
tags:
711
- entrypoint
12+
13+
- include: modules.yml
14+
tags:
15+
- entrypoint
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
- name: Disable XDebug
2+
file:
3+
path: "{{ item }}"
4+
state: absent
5+
with_fileglob:
6+
- /etc/php.d/*xdebug*.ini
7+
when: PROVISION.PHP.XDEBUG == "" or PROVISION.PHP.XDEBUG == "0"
8+
9+
- name: Disable Blackfire
10+
file:
11+
path: "{{ item }}"
12+
state: absent
13+
with_fileglob:
14+
- /etc/php.d/*blackfire*.ini
15+
when: PROVISION.PHP.XDEBUG == "" or PROVISION.PHP.BLACKFIRE == "0"

docker/main/centos/provision/variables.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
---
22

3+
PROVISION:
4+
CONTEXT: "{{ lookup('env','PROVISION_CONTEXT') }}"
5+
6+
PHP:
7+
BLACKFIRE: "{{ lookup('env','PROVISION_PHP_BLACKFIRE') }}"
8+
XDEBUG: "{{ lookup('env','PROVISION_PHP_XDEBUG') }}"
9+
310
DOCKER:
411
# System
512
EFFECTIVE_UID: "{{ lookup('env','EFFECTIVE_UID') }}"

docker/main/ubuntu/conf/php.ini renamed to docker/main/ubuntu/conf/php.development.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; this file will overwrite default php.ini settings
22

3+
display_errors = 1
4+
35
short_open_tag = On
46
variables_order = 'GPCS'
57
request_order = 'GP'

0 commit comments

Comments
 (0)