Add all files needed to bring up VM and run agaric.com locally

This commit is contained in:
benjamin melançon 2018-08-20 10:45:20 -04:00
parent 52c8b60bac
commit 4d2bc0ee24
742 changed files with 24037 additions and 0 deletions

View file

@ -0,0 +1 @@
.DS_Store

View file

@ -0,0 +1,46 @@
---
services: docker
env:
- distro: centos7
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- distro: ubuntu1604
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- distro: debian8
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
before_install:
# Pull container.
- 'docker pull geerlingguy/docker-${distro}-ansible:latest'
script:
- container_id=$(mktemp)
# Run container in detached state.
- 'docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'
# Install dependencies.
- 'docker exec "$(cat ${container_id})" ansible-galaxy install -r /etc/ansible/roles/role_under_test/tests/requirements.yml'
# Ansible syntax check.
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check'
# Test role.
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml'
# Test role idempotence.
- idempotence=$(mktemp)
- docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml | tee -a ${idempotence}
- >
tail ${idempotence}
| 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.
- 'docker exec "$(cat ${container_id})" env TERM=xterm php /etc/ansible/roles/role_under_test/tests/xhprof-test.php'
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View file

@ -0,0 +1,54 @@
# Ansible Role: PHP-XHProf
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-php-xhprof.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-php-xhprof)
Installs PHP [XHProf](http://php.net/manual/en/book.xhprof.php) on Linux servers.
> **Note**: The XHProf extension has been on life support since Facebook abandoned active development around 2015. There is a better-maintained fork that works on the latest PHP versions called Tideways, and there's an Ansible role for it—please check out [`geerlingguy.php-tideways`](https://github.com/geerlingguy/ansible-role-php-tideways) if you need to support PHP versions later than 7.0.
## Requirements
None.
## Role Variables
Available variables are listed below, along with default values (see `defaults/main.yml`):
workspace: /root
Where XHProf setup files will be downloaded and built.
xhprof_download_url: https://github.com/RustJason/xhprof/archive/php7.zip
xhprof_download_folder_name: xhprof-php7
The URL from which XHProf will be downloaded. Note that this default is for the PHP 7-compatible version of XHProf. If you're using PHP 5.x, you should probably switch to the 'official' upstream source: `https://github.com/phacility/xhprof/archive/master.tar.gz`.
xhprof_output_dir: /tmp
Directory where XHProf runs are stored.
php_xhprof_lib_dir: /usr/share/php/xhprof_lib
Directory where the XHProf PHP library is stored.
php_xhprof_html_dir: /usr/share/php/xhprof_html
Directory where the XHProf UI is stored.
## Dependencies
- geerlingguy.php
## Example Playbook
- hosts: webservers
roles:
- { role: geerlingguy.php-xhprof }
## License
MIT / BSD
## Author Information
This role was created in 2014 by [Jeff Geerling](http://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).

View file

@ -0,0 +1,14 @@
---
workspace: /root
# Use the commented URL and folder below if you want to use the 'official'
# XHProf project.
xhprof_download_url: https://github.com/RustJason/xhprof/archive/php7.zip
#xhprof_download_url: https://github.com/phacility/xhprof/archive/master.tar.gz
xhprof_download_folder_name: xhprof-php7
# xhprof_download_folder_name: xhprof-master
xhprof_output_dir: /tmp
php_xhprof_lib_dir: /usr/share/php/xhprof_lib
php_xhprof_html_dir: /usr/share/php/xhprof_html

View file

@ -0,0 +1,44 @@
---
dependencies:
- geerlingguy.php
galaxy_info:
author: geerlingguy
description: PHP XHProf for Linux
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 2.0
platforms:
- name: EL
versions:
- all
- name: GenericUNIX
versions:
- all
- name: Fedora
versions:
- all
- name: opensuse
versions:
- all
- name: GenericBSD
versions:
- all
- name: FreeBSD
versions:
- all
- name: Ubuntu
versions:
- all
- name: SLES
versions:
- all
- name: GenericLinux
versions:
- all
- name: Debian
versions:
- all
galaxy_tags:
- development
- web

View file

@ -0,0 +1,18 @@
---
- name: Ensure PHP configuration directories exist.
file:
path: "{{ item }}"
state: directory
mode: 0755
follow: true
with_items: "{{ php_extension_conf_paths }}"
- 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_extension_conf_paths }}"
notify: restart webserver

View file

@ -0,0 +1,72 @@
---
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
- name: Define php_xhprof_module_path.
set_fact:
php_xhprof_module_path: "{{ __php_xhprof_module_path }}"
when: php_xhprof_module_path is not defined
- name: Define php_xhprof_config_filename.
set_fact:
php_xhprof_config_filename: "{{ __php_xhprof_config_filename }}"
when: php_xhprof_config_filename is not defined
# Setup/install tasks.
- name: Ensure dependencies for installing XHProf are present.
package: "name={{ item }} state=installed"
with_items:
- make
- gcc
- unzip
- graphviz
- name: Download and untar XHProf.
unarchive:
src: "{{ xhprof_download_url }}"
dest: "{{ workspace }}"
copy: no
creates: "{{ workspace }}/{{ xhprof_download_folder_name }}"
- name: Build XHProf.
shell: >
{{ item }}
chdir={{ workspace }}/{{ xhprof_download_folder_name }}/extension
creates={{ workspace }}/{{ xhprof_download_folder_name }}/extension/modules/xhprof.so
with_items:
- phpize
- ./configure
- make
notify: restart webserver
- name: Ensure XHProf module path exists.
file:
path: "{{ php_xhprof_module_path }}"
state: directory
owner: root
group: root
mode: 0755
- name: Move XHProf module into place.
shell: >
cp {{ workspace }}/{{ xhprof_download_folder_name }}/extension/modules/xhprof.so {{ php_xhprof_module_path }}/xhprof.so
creates={{ php_xhprof_module_path }}/xhprof.so
notify: restart webserver
- name: Move XHProf PHP library into place.
shell: >
cp -r {{ workspace }}/{{ xhprof_download_folder_name }}/xhprof_lib {{ php_xhprof_lib_dir }}
creates={{ php_xhprof_lib_dir }}/utils/xhprof_lib.php
- name: Move XHProf UI into place.
shell: >
cp -r {{ workspace }}/{{ xhprof_download_folder_name }}/xhprof_html {{ php_xhprof_html_dir }}
creates={{ php_xhprof_html_dir }}/index.php
- include: configure.yml
- name: Ensure XHProf output directory exists.
file:
path: "{{ xhprof_output_dir }}"
state: directory
mode: 0777

View file

@ -0,0 +1,3 @@
[xhprof]
extension="{{ php_xhprof_module_path }}/xhprof.so"
xhprof.output_dir="{{ xhprof_output_dir }}"

View file

@ -0,0 +1,4 @@
---
- src: geerlingguy.repo-remi
- src: geerlingguy.repo-dotdeb
- src: geerlingguy.php

View file

@ -0,0 +1,31 @@
---
- hosts: all
vars:
php_enable_webserver: false
php_enablerepo: "remi,remi-php70"
pre_tasks:
- name: Update apt cache.
apt: update_cache=yes cache_valid_time=600
when: ansible_os_family == 'Debian'
- name: Set php_packages for PHP 7.0 Debian 8 install.
set_fact:
php_packages:
- php7.0-common
- php7.0-cli
- php7.0-dev
- php7.0-fpm
- libpcre3-dev
- php7.0-opcache
- php7.0-apcu
when: ansible_distribution == 'Debian'
roles:
- role: geerlingguy.repo-remi
when: ansible_os_family == 'RedHat'
- role: geerlingguy.repo-dotdeb
when: ansible_distribution == 'Debian'
- geerlingguy.php
- role_under_test

View file

@ -0,0 +1,51 @@
<?php
/**
* @file
* Test if XHProf is available and working.
*/
$xhprof_root_dir = '/usr/share/php';
$success = TRUE;
xhprof_enable();
$data = xhprof_disable();
if (isset($data['main()==>xhprof_disable'])) {
print "XHProf profiling working.\r\n";
}
else {
print "XHProf profiling not working.\r\n";
$success = FALSE;
}
include $xhprof_root_dir . '/xhprof_lib/utils/xhprof_lib.php';
include $xhprof_root_dir . '/xhprof_lib/utils/xhprof_runs.php';
$xhprof_runs = new XHProfRuns_Default();
$run_id = $xhprof_runs->save_run($data, "xhprof_testing");
$output_dir = ini_get("xhprof.output_dir");
$filename = "$output_dir/$run_id.xhprof_testing.xhprof";
if (file_exists($filename)) {
print "XHProf PHP library writing to output directory.\r\n";
}
else {
print "XHProf PHP library not working.\r\n";
$success = FALSE;
}
ob_start();
include $xhprof_root_dir . '/xhprof_html/index.php';
$html = ob_get_clean();
if (strpos($html, "?run=$run_id") !== FALSE) {
print "XHProf UI working.\r\n";
}
else {
print "XHProf UI not working.\r\n";
$success = FALSE;
}
if (!$success) {
exit(1);
}

View file

@ -0,0 +1,3 @@
---
__php_xhprof_module_path: /usr/lib/php5/modules
__php_xhprof_config_filename: 20-xhprof.ini

View file

@ -0,0 +1,3 @@
---
__php_xhprof_module_path: /usr/lib64/php/modules
__php_xhprof_config_filename: xhprof.ini