-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from oxyc/source
Issue #11: Install XHProf from source
- Loading branch information
Showing
18 changed files
with
246 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,63 @@ | ||
--- | ||
language: python | ||
python: "2.7" | ||
sudo: required | ||
|
||
env: | ||
- SITE=test.yml | ||
- distribution: centos | ||
version: 6 | ||
init: /sbin/init | ||
run_opts: "" | ||
SITE: source | ||
- distribution: centos | ||
version: 7 | ||
init: /usr/lib/systemd/systemd | ||
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" | ||
SITE: source | ||
- distribution: ubuntu | ||
version: 14.04 | ||
init: /sbin/init | ||
run_opts: "" | ||
SITE: source | ||
- distribution: ubuntu | ||
version: 12.04 | ||
init: /sbin/init | ||
run_opts: "" | ||
SITE: source | ||
|
||
services: | ||
- docker | ||
|
||
before_install: | ||
- sudo apt-get update -qq | ||
# Pull container | ||
- 'sudo docker pull ${distribution}:${version}' | ||
# Customize container | ||
- 'sudo docker build --rm=true --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests' | ||
|
||
install: | ||
# Install Ansible. | ||
- pip install ansible | ||
|
||
# Add ansible.cfg to pick up roles path. | ||
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg" | ||
script: | ||
- container_id=$(mktemp) | ||
# Run container in detached state | ||
- 'sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ${distribution}-${version}:ansible "${init}" > "${container_id}"' | ||
|
||
# Install dependencies. | ||
- ansible-galaxy install geerlingguy.php geerlingguy.php-pecl | ||
- 'sudo docker exec "$(cat ${container_id})" ansible-galaxy install geerlingguy.php geerlingguy.repo-remi' | ||
|
||
script: | ||
# Check the role/playbook's syntax. | ||
- "ansible-playbook -i tests/inventory tests/$SITE --syntax-check" | ||
# Ansible syntax check. | ||
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test-${SITE}.yml --syntax-check' | ||
|
||
# Run the role/playbook with ansible-playbook. | ||
- "ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo" | ||
# Test role. | ||
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test-${SITE}.yml' | ||
|
||
# Run the role/playbook again, checking to make sure it's idempotent. | ||
# Test role idempotence. | ||
- > | ||
ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo | ||
sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test-${SITE}.yml | ||
| grep -q 'changed=0.*failed=0' | ||
&& (echo 'Idempotence test: pass' && exit 0) | ||
|| (echo 'Idempotence test: fail' && exit 1) | ||
# Run script to test if XHProf is available and working. | ||
- php tests/xhprof-test.php | ||
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm php /etc/ansible/roles/role_under_test/tests/xhprof-test.php' | ||
|
||
# Clean up | ||
- 'sudo docker stop "$(cat ${container_id})"' | ||
|
||
notifications: | ||
webhooks: https://galaxy.ansible.com/api/v1/notifications/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
--- | ||
workspace: /root | ||
|
||
xhprof_output_dir: /var/tmp/xhprof | ||
|
||
php_xhprof_lib_dir: /usr/share/php/xhprof_lib | ||
php_xhprof_html_dir: /usr/share/php/xhprof_html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
--- | ||
dependencies: | ||
- { role: geerlingguy.php } | ||
- { role: geerlingguy.php-pecl } | ||
|
||
galaxy_info: | ||
author: geerlingguy | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Ensure PHP configuration directories exist. | ||
file: | ||
path: "{{ item }}" | ||
state: directory | ||
mode: 0755 | ||
follow: true | ||
with_items: "{{ php_xhprof_config_dirs }}" | ||
|
||
- name: Copy XHProf INI into various other conf folders. | ||
template: | ||
src: xhprof.ini.j2 | ||
dest: "{{ item }}/{{ php_xhprof_config_filename }}" | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
with_items: "{{ php_xhprof_config_dirs }}" | ||
notify: restart webserver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
--- | ||
- name: Ensure dependencies for installing from source are installed. | ||
apt: "pkg={{ item }} state=installed" | ||
with_items: | ||
- make | ||
|
||
- name: Ensure GraphViz is installed. | ||
apt: pkg=graphviz state=installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
--- | ||
- name: Ensure dependencies for installing from source are installed. | ||
yum: "pkg={{ item }} state=installed" | ||
with_items: | ||
- make | ||
|
||
- name: Ensure GraphViz is installed. | ||
yum: pkg=graphviz state=installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[xhprof] | ||
extension=xhprof.so | ||
extension="{{ php_xhprof_module_path }}/xhprof.so" | ||
xhprof.output_dir="{{ xhprof_output_dir }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM centos:6 | ||
|
||
# Install Ansible | ||
RUN yum -y update; yum clean all; | ||
RUN yum -y install epel-release | ||
RUN yum update openssl | ||
RUN yum -y install git python-setuptools gcc sudo libffi-devel python-devel openssl-devel | ||
RUN yum clean all | ||
RUN easy_install pip | ||
RUN pip install ansible | ||
|
||
# Disable requiretty | ||
RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers | ||
|
||
# Install Ansible inventory file | ||
RUN mkdir - p /etc/ansible | ||
RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts | ||
|
||
CMD ["/usr/sbin/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM centos:7 | ||
|
||
# Install systemd -- See https://hub.docker.com/_/centos/ | ||
RUN yum -y swap -- remove fakesystemd -- install systemd systemd-libs | ||
RUN yum -y update; yum clean all; \ | ||
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ | ||
rm -f /lib/systemd/system/multi-user.target.wants/*; \ | ||
rm -f /etc/systemd/system/*.wants/*; \ | ||
rm -f /lib/systemd/system/local-fs.target.wants/*; \ | ||
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ | ||
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ | ||
rm -f /lib/systemd/system/basic.target.wants/*; \ | ||
rm -f /lib/systemd/system/anaconda.target.wants/*; | ||
|
||
# Install Ansible | ||
RUN yum -y install git python-setuptools gcc sudo libffi-devel python-devel openssl-devel | ||
RUN yum clean all | ||
RUN easy_install pip | ||
RUN pip install ansible | ||
|
||
# Disable requiretty | ||
RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers | ||
|
||
# Install Ansible inventory file | ||
RUN mkdir - p /etc/ansible | ||
RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts | ||
|
||
VOLUME ["/sys/fs/cgroup"] | ||
CMD ["/usr/sbin/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM ubuntu:12.04 | ||
RUN apt-get update | ||
|
||
# Install Ansible | ||
RUN apt-get install -y software-properties-common python-software-properties git | ||
RUN apt-add-repository -y ppa:ansible/ansible | ||
RUN apt-get update | ||
RUN apt-get install -y ansible | ||
|
||
# Install Ansible inventory file | ||
RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM ubuntu:14.04 | ||
RUN apt-get update | ||
|
||
# Install Ansible | ||
RUN apt-get install -y software-properties-common git | ||
RUN apt-add-repository -y ppa:ansible/ansible | ||
RUN apt-get update | ||
RUN apt-get install -y ansible | ||
|
||
# Install Ansible inventory file | ||
RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
- hosts: all | ||
|
||
vars: | ||
php_enable_webserver: false | ||
php_version: 5.6 | ||
php_enablerepo: "remi,remi-php56" | ||
|
||
pre_tasks: | ||
- name: Ensure build dependencies are installed (RedHat). | ||
yum: name=which state=present | ||
when: ansible_os_family == 'RedHat' | ||
|
||
- name: Add repository for PHP 5.6. | ||
apt_repository: repo='ppa:ondrej/php5-5.6' | ||
when: ansible_os_family == 'Debian' | ||
|
||
roles: | ||
- { role: geerlingguy.repo-remi, when: ansible_os_family == 'RedHat' } | ||
- geerlingguy.php | ||
- role_under_test |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.