From 531e31c48354fc0b202f9709f674de5e291de468 Mon Sep 17 00:00:00 2001 From: Florian Tatzel Date: Thu, 9 Jun 2016 08:59:19 -0700 Subject: [PATCH 1/6] Adds Backlink to Main Documentation (#40) --- documentation/docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/index.rst b/documentation/docs/index.rst index 23a4371..3742049 100644 --- a/documentation/docs/index.rst +++ b/documentation/docs/index.rst @@ -18,7 +18,7 @@ Overview .. toctree:: - Back to Project Overview + Back to Project Overview content/introduction .. toctree:: From d43be5c61105336bc4b5e9d75b53cfbdcd633baa Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Thu, 16 Jun 2016 19:04:20 +0200 Subject: [PATCH 2/6] Cleanup provision files Remove old and deprecated stuff Also fixes hhvm support --- Dockerfile.cloud | 2 +- Dockerfile.development | 2 +- Dockerfile.production | 2 +- etc/application.development.yml | 2 -- etc/application.environment.yml | 31 ------------------- etc/application.production.yml | 2 -- .../boilerplate-main/tasks/bootstrap.yml | 9 ------ .../tasks/bootstrap/composer.yml | 14 --------- .../boilerplate-main/tasks/bootstrap/php.yml | 20 +++++++++++- .../tasks/bootstrap/systemUpdate.centos.yml | 4 --- .../tasks/bootstrap/systemUpdate.ubuntu.yml | 6 ---- .../boilerplate-main/tasks/entrypoint.yml | 4 --- .../tasks/entrypoint/mysql.yml | 17 ---------- .../boilerplate-main/tasks/entrypoint/php.yml | 12 ------- .../roles/boilerplate-main/tasks/main.yml | 4 --- 15 files changed, 22 insertions(+), 109 deletions(-) delete mode 100644 etc/application.environment.yml delete mode 100644 provision/roles/boilerplate-main/tasks/bootstrap/composer.yml delete mode 100644 provision/roles/boilerplate-main/tasks/bootstrap/systemUpdate.centos.yml delete mode 100644 provision/roles/boilerplate-main/tasks/bootstrap/systemUpdate.ubuntu.yml delete mode 100644 provision/roles/boilerplate-main/tasks/entrypoint.yml delete mode 100644 provision/roles/boilerplate-main/tasks/entrypoint/mysql.yml delete mode 100644 provision/roles/boilerplate-main/tasks/entrypoint/php.yml diff --git a/Dockerfile.cloud b/Dockerfile.cloud index d036d88..8f300f6 100644 --- a/Dockerfile.cloud +++ b/Dockerfile.cloud @@ -53,7 +53,7 @@ COPY provision/ /opt/docker/provision/ COPY app/ /app/ -RUN /opt/docker/bin/provision add --tag bootstrap --tag entrypoint boilerplate-main boilerplate-deployment \ +RUN /opt/docker/bin/provision run --tag bootstrap --role boilerplate-main --role boilerplate-deployment \ && /opt/docker/bin/bootstrap.sh # Configure volume/workdir diff --git a/Dockerfile.development b/Dockerfile.development index 5c1ce6e..3827cd0 100644 --- a/Dockerfile.development +++ b/Dockerfile.development @@ -51,7 +51,7 @@ ENV PROVISION_CONTEXT "development" COPY etc/ /opt/docker/etc/ COPY provision/ /opt/docker/provision/ -RUN /opt/docker/bin/provision add --tag bootstrap --tag entrypoint boilerplate-main boilerplate-main-development boilerplate-deployment \ +RUN /opt/docker/bin/provision run --tag bootstrap --role boilerplate-main --role boilerplate-main-development --role boilerplate-deployment \ && /opt/docker/bin/bootstrap.sh # Configure volume/workdir diff --git a/Dockerfile.production b/Dockerfile.production index 271bd3b..54d9f50 100644 --- a/Dockerfile.production +++ b/Dockerfile.production @@ -51,7 +51,7 @@ ENV PROVISION_CONTEXT "production" COPY etc/ /opt/docker/etc/ COPY provision/ /opt/docker/provision/ -RUN /opt/docker/bin/provision add --tag bootstrap --tag entrypoint boilerplate-main boilerplate-deployment \ +RUN /opt/docker/bin/provision run --tag bootstrap --role boilerplate-main --role boilerplate-deployment \ && /opt/docker/bin/bootstrap.sh # Configure volume/workdir diff --git a/etc/application.development.yml b/etc/application.development.yml index 20f6f47..16c1d36 100644 --- a/etc/application.development.yml +++ b/etc/application.development.yml @@ -1,8 +1,6 @@ --- PROVISION: - systemUpdate: false - install: apacheModPagespeed: false diff --git a/etc/application.environment.yml b/etc/application.environment.yml deleted file mode 100644 index 5de506a..0000000 --- a/etc/application.environment.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- - -DOCKER_ENVIRONMENT: - # Application - TYPO3_CONTEXT: "{{ lookup('env','TYPO3_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') }}" - - # General - CLI_SCRIPT: "{{ lookup('env','CLI_SCRIPT') }}" - MAIL_GATEWAY: "{{ lookup('env','MAIL_GATEWAY') }}" - - # 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') }}" - - # Postgres - 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') }}" diff --git a/etc/application.production.yml b/etc/application.production.yml index 00e29bd..4e3f07f 100644 --- a/etc/application.production.yml +++ b/etc/application.production.yml @@ -1,8 +1,6 @@ --- PROVISION: - systemUpdate: true - install: apacheModPagespeed: false diff --git a/provision/roles/boilerplate-main/tasks/bootstrap.yml b/provision/roles/boilerplate-main/tasks/bootstrap.yml index eb3f70a..9e29b8f 100644 --- a/provision/roles/boilerplate-main/tasks/bootstrap.yml +++ b/provision/roles/boilerplate-main/tasks/bootstrap.yml @@ -9,15 +9,6 @@ # Run tasks ############################# -- include: bootstrap/systemUpdate.centos.yml - when: PROVISION.systemUpdate is defined and PROVISION.systemUpdate and ansible_distribution == 'CentOS' - -- include: bootstrap/systemUpdate.ubuntu.yml - when: PROVISION.systemUpdate is defined and PROVISION.systemUpdate and ansible_distribution == 'Ubuntu' - -- include: bootstrap/composer.yml - when: PROVISION.install.phpComposer is defined and PROVISION.install.phpComposer - - include: bootstrap/services.yml - include: bootstrap/cron.yml diff --git a/provision/roles/boilerplate-main/tasks/bootstrap/composer.yml b/provision/roles/boilerplate-main/tasks/bootstrap/composer.yml deleted file mode 100644 index df8da1e..0000000 --- a/provision/roles/boilerplate-main/tasks/bootstrap/composer.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- - -- stat: path=/usr/local/bin/composer - register: composer_bin - -- name: Update composer (phar) - command: 'composer self-update' - when: composer_bin.stat.exists is defined and composer_bin.stat.exists - ignore_errors: yes - -- name: Install composer (phar) - raw: 'curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer' - when: composer_bin.stat.exists is defined and not composer_bin.stat.exists - diff --git a/provision/roles/boilerplate-main/tasks/bootstrap/php.yml b/provision/roles/boilerplate-main/tasks/bootstrap/php.yml index e0c09b9..8c21955 100644 --- a/provision/roles/boilerplate-main/tasks/bootstrap/php.yml +++ b/provision/roles/boilerplate-main/tasks/bootstrap/php.yml @@ -2,13 +2,30 @@ - include_vars: "/opt/docker/etc/application.{{ PROVISION_CONTEXT }}.yml" +############################# +# Stats +############################# + +- stat: + path: /opt/docker/etc/php/fpm/php-fpm.conf + register: phpFpmConf + +- stat: + path: /opt/docker/etc/php/fpm/pool.d/application.conf + register: phpFpmApplicationPool + +############################# +# Tasks +############################# + - name: Configure php-fpm (pool www.conf) lineinfile: dest: "/opt/docker/etc/php/fpm/pool.d/application.conf" regexp: '^[\s;]*{{ item.variable }}[\s]*=' line: '{{ item.variable }} = {{ item.value }}' with_items: "{{ PHP.fpm.conf }}" - when: PHP.fpm.conf is defined and item.value != "" + when: PHP.fpm.conf is defined and item.value != "" and + phpFpmApplicationPool.stat.exists is defined and phpFpmApplicationPool.stat.exists - name: Configure php-fpm (php-fpm.conf) lineinfile: @@ -17,6 +34,7 @@ line: '{{ item.key }} = {{ item.value }}' with_items: - { key: 'daemonize', value: 'no' } + when: phpFpmConf.stat.exists is defined and phpFpmConf.stat.exists - name: Set development environment php.ini file: diff --git a/provision/roles/boilerplate-main/tasks/bootstrap/systemUpdate.centos.yml b/provision/roles/boilerplate-main/tasks/bootstrap/systemUpdate.centos.yml deleted file mode 100644 index 15f1e0b..0000000 --- a/provision/roles/boilerplate-main/tasks/bootstrap/systemUpdate.centos.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -- name: Update system packages (yum) ... will take some time - yum: name=* state=latest diff --git a/provision/roles/boilerplate-main/tasks/bootstrap/systemUpdate.ubuntu.yml b/provision/roles/boilerplate-main/tasks/bootstrap/systemUpdate.ubuntu.yml deleted file mode 100644 index f2270d7..0000000 --- a/provision/roles/boilerplate-main/tasks/bootstrap/systemUpdate.ubuntu.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -- name: Upgrade system packages (apt-get dist-upgrade) ... will take some time - apt: - upgrade: dist - update_cache: true diff --git a/provision/roles/boilerplate-main/tasks/entrypoint.yml b/provision/roles/boilerplate-main/tasks/entrypoint.yml deleted file mode 100644 index e0224ca..0000000 --- a/provision/roles/boilerplate-main/tasks/entrypoint.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -- include: entrypoint/mysql.yml -- include: entrypoint/php.yml diff --git a/provision/roles/boilerplate-main/tasks/entrypoint/mysql.yml b/provision/roles/boilerplate-main/tasks/entrypoint/mysql.yml deleted file mode 100644 index 7072644..0000000 --- a/provision/roles/boilerplate-main/tasks/entrypoint/mysql.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- - -- name: Deploy root my.cnf - template: - src: templates/my.cnf.j2 - dest: /root/.my.cnf - owner: root - group: root - mode: 0644 - -- name: Deploy user my.cnf - template: - src: templates/my.cnf.j2 - dest: /home/.my.cnf - owner: "{{ lookup('env','APPLICATION_USER') }}" - group: "{{ lookup('env','APPLICATION_USER') }}" - mode: 0644 diff --git a/provision/roles/boilerplate-main/tasks/entrypoint/php.yml b/provision/roles/boilerplate-main/tasks/entrypoint/php.yml deleted file mode 100644 index b841d2c..0000000 --- a/provision/roles/boilerplate-main/tasks/entrypoint/php.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- - -- include_vars: "/opt/docker/etc/application.{{ PROVISION_CONTEXT }}.yml" -- include_vars: "/opt/docker/etc/application.environment.yml" - -- name: Configure environment variables from DOCKER_ENVIRONMENT for php-fpm (pool www.conf) - lineinfile: - dest: "/opt/docker/etc/php/fpm/pool.d/application.conf" - regexp: '^env\[{{ item.key }}\][\s]*=' - line: 'env[{{ item.key }}] = "{{ item.value }}"' - with_dict: "{{ DOCKER_ENVIRONMENT }}" - when: DOCKER_ENVIRONMENT is defined and item.value != '' diff --git a/provision/roles/boilerplate-main/tasks/main.yml b/provision/roles/boilerplate-main/tasks/main.yml index 7895a52..1806c1a 100644 --- a/provision/roles/boilerplate-main/tasks/main.yml +++ b/provision/roles/boilerplate-main/tasks/main.yml @@ -3,7 +3,3 @@ - include: bootstrap.yml tags: - bootstrap - -- include: entrypoint.yml - tags: - - entrypoint From 9afb7a1e3d2ff8e312c714d981d040ec156694c9 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Thu, 16 Jun 2016 19:12:48 +0200 Subject: [PATCH 3/6] Remove blackfire --- .../tasks/bootstrap.yml | 6 ----- .../tasks/bootstrap/php-blackfire/debian.yml | 19 -------------- .../tasks/bootstrap/php-blackfire/redhat.yml | 26 ------------------- 3 files changed, 51 deletions(-) delete mode 100644 provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml delete mode 100644 provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml diff --git a/provision/roles/boilerplate-main-development/tasks/bootstrap.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap.yml index eb4bee1..ed97d53 100644 --- a/provision/roles/boilerplate-main-development/tasks/bootstrap.yml +++ b/provision/roles/boilerplate-main-development/tasks/bootstrap.yml @@ -1,7 +1 @@ --- - -- include: bootstrap/php-blackfire/debian.yml - when: ansible_distribution == 'CentOS' and PROVISION.install.phpBlackfire is defined and PROVISION.install.phpBlackfire - -- include: bootstrap/php-blackfire/redhat.yml - when: ansible_os_family == 'Debian' and PROVISION.install.phpBlackfire is defined and PROVISION.install.phpBlackfire diff --git a/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml deleted file mode 100644 index 243bee6..0000000 --- a/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- - -- 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/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml deleted file mode 100644 index 56dcc76..0000000 --- a/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- - -- 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_major_version == '7' - -- name: Install blackfire-php - yum: - name: '{{ item }}' - state: present - with_items: - - blackfire-php From 212e61c43bbeb7da997a78196f8fbcb2a093cc69 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Thu, 16 Jun 2016 19:21:28 +0200 Subject: [PATCH 4/6] Revert "Remove blackfire" This reverts commit 9afb7a1e3d2ff8e312c714d981d040ec156694c9. --- .../tasks/bootstrap.yml | 6 +++++ .../tasks/bootstrap/php-blackfire/debian.yml | 19 ++++++++++++++ .../tasks/bootstrap/php-blackfire/redhat.yml | 26 +++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml create mode 100644 provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml diff --git a/provision/roles/boilerplate-main-development/tasks/bootstrap.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap.yml index ed97d53..eb4bee1 100644 --- a/provision/roles/boilerplate-main-development/tasks/bootstrap.yml +++ b/provision/roles/boilerplate-main-development/tasks/bootstrap.yml @@ -1 +1,7 @@ --- + +- include: bootstrap/php-blackfire/debian.yml + when: ansible_distribution == 'CentOS' and PROVISION.install.phpBlackfire is defined and PROVISION.install.phpBlackfire + +- include: bootstrap/php-blackfire/redhat.yml + when: ansible_os_family == 'Debian' and PROVISION.install.phpBlackfire is defined and PROVISION.install.phpBlackfire diff --git a/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml new file mode 100644 index 0000000..243bee6 --- /dev/null +++ b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml @@ -0,0 +1,19 @@ +--- + +- 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/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml new file mode 100644 index 0000000..56dcc76 --- /dev/null +++ b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml @@ -0,0 +1,26 @@ +--- + +- 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_major_version == '7' + +- name: Install blackfire-php + yum: + name: '{{ item }}' + state: present + with_items: + - blackfire-php From 2ff8a2e454064354823386fc44c3d3f4df264cbf Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Thu, 16 Jun 2016 19:31:10 +0200 Subject: [PATCH 5/6] Add switch for xdebug and blackfire --- etc/application.development.yml | 3 +++ .../tasks/bootstrap.yml | 8 ++++---- .../tasks/bootstrap/php-blackfire/debian.yml | 16 ++++++++++++++++ .../tasks/bootstrap/php-blackfire/redhat.yml | 5 +++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/etc/application.development.yml b/etc/application.development.yml index 16c1d36..f0f5431 100644 --- a/etc/application.development.yml +++ b/etc/application.development.yml @@ -26,6 +26,9 @@ MAIL: # - { variable: "relayhost", value: "foobar" } PHP: + # PHP debugger [xdebug or blackfire] + debugger: "blackfire" + fpm: conf: # PM diff --git a/provision/roles/boilerplate-main-development/tasks/bootstrap.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap.yml index eb4bee1..7b164c1 100644 --- a/provision/roles/boilerplate-main-development/tasks/bootstrap.yml +++ b/provision/roles/boilerplate-main-development/tasks/bootstrap.yml @@ -1,7 +1,7 @@ --- -- include: bootstrap/php-blackfire/debian.yml - when: ansible_distribution == 'CentOS' and PROVISION.install.phpBlackfire is defined and PROVISION.install.phpBlackfire - - include: bootstrap/php-blackfire/redhat.yml - when: ansible_os_family == 'Debian' and PROVISION.install.phpBlackfire is defined and PROVISION.install.phpBlackfire + when: ansible_distribution == 'CentOS' and PHP.debugger is defined and PHP.debugger == "blackfire" + +- include: bootstrap/php-blackfire/debian.yml + when: ansible_os_family == 'Debian' and PHP.debugger is defined and PHP.debugger == "blackfire" diff --git a/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml index 243bee6..29755eb 100644 --- a/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml +++ b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml @@ -1,5 +1,21 @@ --- +- name: Remove xdebug + file: + path: "{{ item }}" + state: absent + with_items: + # PHP 5.x + - "/etc/php5/mods-available/xdebug.ini" + - "/etc/php5/cli/conf.d/20-xdebug.ini" + - "/etc/php5/cli/conf.d/xdebug.ini" + - "/etc/php5/fpm/conf.d/20-xdebug.ini" + - "/etc/php5/fpm/conf.d/xdebug.ini" + # PHP 7.x + - "/etc/php/7.0/mods-available/xdebug.ini" + - "/etc/php/7.0/cli/conf.d/20-xdebug.ini" + - "/etc/php/7.0/fpm/conf.d/20-xdebug.ini" + - name: Add blackfire.io key apt_key: url: https://packagecloud.io/gpg.key diff --git a/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml index 56dcc76..ad593b4 100644 --- a/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml +++ b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml @@ -1,5 +1,10 @@ --- +- name: Remove xdebug + file: + path: "/etc/php.d/xdebug.ini" + state: absent + - name: Add blackfire.io key rpm_key: key: https://packagecloud.io/gpg.key From fb9f8cb85baa1f82f294884cdd2b02b100f9c909 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Thu, 16 Jun 2016 20:56:37 +0200 Subject: [PATCH 6/6] Add support for preinstalled blackfire Needs updated images --- etc/application.development.yml | 4 +- .../tasks/bootstrap.yml | 8 ++-- .../tasks/bootstrap/php-blackfire/debian.yml | 35 ---------------- .../tasks/bootstrap/php-blackfire/redhat.yml | 31 -------------- .../bootstrap/php-debugger.blackfire.yml | 41 +++++++++++++++++++ .../tasks/bootstrap/php-debugger.none.yml | 41 +++++++++++++++++++ 6 files changed, 88 insertions(+), 72 deletions(-) delete mode 100644 provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml delete mode 100644 provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml create mode 100644 provision/roles/boilerplate-main-development/tasks/bootstrap/php-debugger.blackfire.yml create mode 100644 provision/roles/boilerplate-main-development/tasks/bootstrap/php-debugger.none.yml diff --git a/etc/application.development.yml b/etc/application.development.yml index f0f5431..7e790d3 100644 --- a/etc/application.development.yml +++ b/etc/application.development.yml @@ -26,8 +26,8 @@ MAIL: # - { variable: "relayhost", value: "foobar" } PHP: - # PHP debugger [xdebug or blackfire] - debugger: "blackfire" + # PHP debugger [xdebug or blackfire or none] + debugger: "xdebug" fpm: conf: diff --git a/provision/roles/boilerplate-main-development/tasks/bootstrap.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap.yml index 7b164c1..2fdb9f9 100644 --- a/provision/roles/boilerplate-main-development/tasks/bootstrap.yml +++ b/provision/roles/boilerplate-main-development/tasks/bootstrap.yml @@ -1,7 +1,7 @@ --- -- include: bootstrap/php-blackfire/redhat.yml - when: ansible_distribution == 'CentOS' and PHP.debugger is defined and PHP.debugger == "blackfire" +- include: bootstrap/php-debugger.blackfire.yml + when: PHP.debugger is defined and PHP.debugger == "blackfire" -- include: bootstrap/php-blackfire/debian.yml - when: ansible_os_family == 'Debian' and PHP.debugger is defined and PHP.debugger == "blackfire" +- include: bootstrap/php-debugger.none.yml + when: PHP.debugger is not defined or PHP.debugger == "" or PHP.debugger == "none" diff --git a/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml deleted file mode 100644 index 29755eb..0000000 --- a/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/debian.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- - -- name: Remove xdebug - file: - path: "{{ item }}" - state: absent - with_items: - # PHP 5.x - - "/etc/php5/mods-available/xdebug.ini" - - "/etc/php5/cli/conf.d/20-xdebug.ini" - - "/etc/php5/cli/conf.d/xdebug.ini" - - "/etc/php5/fpm/conf.d/20-xdebug.ini" - - "/etc/php5/fpm/conf.d/xdebug.ini" - # PHP 7.x - - "/etc/php/7.0/mods-available/xdebug.ini" - - "/etc/php/7.0/cli/conf.d/20-xdebug.ini" - - "/etc/php/7.0/fpm/conf.d/20-xdebug.ini" - -- 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/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml deleted file mode 100644 index ad593b4..0000000 --- a/provision/roles/boilerplate-main-development/tasks/bootstrap/php-blackfire/redhat.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- - -- name: Remove xdebug - file: - path: "/etc/php.d/xdebug.ini" - state: absent - -- 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_major_version == '7' - -- name: Install blackfire-php - yum: - name: '{{ item }}' - state: present - with_items: - - blackfire-php diff --git a/provision/roles/boilerplate-main-development/tasks/bootstrap/php-debugger.blackfire.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-debugger.blackfire.yml new file mode 100644 index 0000000..51cf8df --- /dev/null +++ b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-debugger.blackfire.yml @@ -0,0 +1,41 @@ +--- + +- name: Disable xdebug + replace: + dest: '{{ item }}' + regexp: '^[;\s]*((zend_)?(extension=))' + replace: ';\1' + ignore_errors: yes + with_items: + # RedHat + - "/etc/php.d/xdebug.ini" + # Debian - PHP 5.x + - "/etc/php5/mods-available/xdebug.ini" + - "/etc/php5/cli/conf.d/20-xdebug.ini" + - "/etc/php5/cli/conf.d/xdebug.ini" + - "/etc/php5/fpm/conf.d/20-xdebug.ini" + - "/etc/php5/fpm/conf.d/xdebug.ini" + # Debian - PHP 7.x + - "/etc/php/7.0/mods-available/xdebug.ini" + - "/etc/php/7.0/cli/conf.d/20-xdebug.ini" + - "/etc/php/7.0/fpm/conf.d/20-xdebug.ini" + +- name: Enable blackfire + replace: + dest: '{{ item }}' + regexp: '^[;\s]*((zend_)?(extension=))' + replace: '\1' + ignore_errors: yes + with_items: + # RedHat + - "/etc/php.d/zz-blackfire.ini" + # Debian - PHP 5.x + - "/etc/php5/conf.d/90-blackfire.ini" + - "/etc/php5/conf.d/zz-blackfire.ini" + - "/etc/php5/cli/conf.d/90-blackfire.ini" + - "/etc/php5/cli/conf.d/zz-blackfire.ini" + - "/etc/php5/fpm/conf.d/90-blackfire.ini" + - "/etc/php5/fpm/conf.d/zz-blackfire.ini" + # Debian - PHP 7.x + - "/etc/php/7.0/cli/conf.d/90-blackfire.ini" + - "/etc/php/7.0/fpm/conf.d/90-blackfire.ini" diff --git a/provision/roles/boilerplate-main-development/tasks/bootstrap/php-debugger.none.yml b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-debugger.none.yml new file mode 100644 index 0000000..efa55a4 --- /dev/null +++ b/provision/roles/boilerplate-main-development/tasks/bootstrap/php-debugger.none.yml @@ -0,0 +1,41 @@ +--- + +- name: Disable xdebug + replace: + dest: '{{ item }}' + regexp: '^[;\s]*((zend_)?(extension=))' + replace: ';\1' + ignore_errors: yes + with_items: + # RedHat + - "/etc/php.d/xdebug.ini" + # Debian - PHP 5.x + - "/etc/php5/mods-available/xdebug.ini" + - "/etc/php5/cli/conf.d/20-xdebug.ini" + - "/etc/php5/cli/conf.d/xdebug.ini" + - "/etc/php5/fpm/conf.d/20-xdebug.ini" + - "/etc/php5/fpm/conf.d/xdebug.ini" + # Debian - PHP 7.x + - "/etc/php/7.0/mods-available/xdebug.ini" + - "/etc/php/7.0/cli/conf.d/20-xdebug.ini" + - "/etc/php/7.0/fpm/conf.d/20-xdebug.ini" + +- name: Disable blackfire + replace: + dest: '{{ item }}' + regexp: '^[;\s]*((zend_)?(extension=))' + replace: ';\1' + ignore_errors: yes + with_items: + # RedHat + - "/etc/php.d/zz-blackfire.ini" + # Debian - PHP 5.x + - "/etc/php5/conf.d/90-blackfire.ini" + - "/etc/php5/conf.d/zz-blackfire.ini" + - "/etc/php5/cli/conf.d/90-blackfire.ini" + - "/etc/php5/cli/conf.d/zz-blackfire.ini" + - "/etc/php5/fpm/conf.d/90-blackfire.ini" + - "/etc/php5/fpm/conf.d/zz-blackfire.ini" + # Debian - PHP 7.x + - "/etc/php/7.0/cli/conf.d/90-blackfire.ini" + - "/etc/php/7.0/fpm/conf.d/90-blackfire.ini"