Skip to content

Commit

Permalink
eAccelerator opcode cache
Browse files Browse the repository at this point in the history
  • Loading branch information
marktheunissen committed Aug 22, 2012
1 parent cbd5a6e commit 3762a1a
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 23 deletions.
18 changes: 9 additions & 9 deletions common-tasks/mysql-secure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,38 @@
#
# Distribution independent.
#
- name: Set the root password.
- name: MySQL | Set the root password.
action: mysql_user user=root password=$mysql_root_password host=localhost
tags: common

- name: MySQL config for easy access as root user
- name: MySQL | Config for easy access as root user
action: template src=templates/root-my-cnf.j2 dest=/root/.my.cnf
tags: common

- name: Delete anonymous MySQL server user for $server_hostname
- name: MySQL | Delete anonymous MySQL server user for $server_hostname
action: mysql_user user="" host="$server_hostname" state="absent"
tags: common

- name: Delete anonymous MySQL server user for localhost
- name: MySQL | Delete anonymous MySQL server user for localhost
action: mysql_user user="" state="absent"
tags: common

- name: Secure the MySQL root user for IPV6 localhost (::1)
- name: MySQL | Secure the MySQL root user for IPV6 localhost (::1)
action: mysql_user user="root" password="$mysql_root_password" host="::1"
tags: common

- name: Secure the MySQL root user for IPV4 localhost (127.0.0.1)
- name: MySQL | Secure the MySQL root user for IPV4 localhost (127.0.0.1)
action: mysql_user user="root" password="$mysql_root_password" host="127.0.0.1"
tags: common

- name: Secure the MySQL root user for localhost domain (localhost)
- name: MySQL | Secure the MySQL root user for localhost domain (localhost)
action: mysql_user user="root" password="$mysql_root_password" host="localhost"
tags: common

- name: Secure the MySQL root user for $server_hostname domain
- name: MySQL | Secure the MySQL root user for $server_hostname domain
action: mysql_user user="root" password="$mysql_root_password" host="$server_hostname"
tags: common

- name: Remove the MySQL test database
- name: MySQL | Remove the MySQL test database
action: mysql_db db=test state=absent
tags: common
10 changes: 5 additions & 5 deletions common-tasks/ubuntu-drush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
#
# Ubuntu only due to using apt.
#
- name: PEAR for obtaining drush.
- name: Drush | Install PHP PEAR
action: apt pkg=php-pear state=installed
tags: drush

- name: Update PEAR.
- name: Drush | Update PEAR
action: command pear upgrade-all
tags: drush

- name: Setup PEAR channel for drush
- name: Drush | Setup PEAR channel
action: command pear channel-discover pear.drush.org creates=/usr/share/php/.channels/pear.drush.org.reg
tags: drush

- name: Install drush for Drupal
- name: Drush | Install drush
action: command pear install drush/drush creates=/usr/bin/drush
tags: drush

- name: Run drush once so it downloads it's dependencies.
- name: Drush | Run drush once so it downloads it's dependencies
action: command drush
tags: drush

46 changes: 46 additions & 0 deletions common-tasks/ubuntu-eaccelerator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
##
# eAccelerator for PHP, an opcode cache. If you change this to a new version,
# remember to change the paths all the way through.
#
# Ubuntu only.
#
- name: eAccelerator | Grab php development package
action: apt pkg=php5-dev state=installed
tags: eaccel

- name: eAccelerator | Download the zip
action: get_url url=http:https://downloads.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.zip dest=/root/eaccelerator-0.9.6.1.zip
tags: eaccel

- name: eAccelerator | Unarchive the zip
action: command unzip /root/eaccelerator-0.9.6.1.zip chdir=/root creates=/root/eaccelerator-0.9.6.1
tags: eaccel

- name: eAccelerator | PHPize
action: command phpize chdir=/root/eaccelerator-0.9.6.1 creates=/root/eaccelerator-0.9.6.1/configure
tags: eaccel

- name: eAccelerator | Configure
action: command ./configure chdir=/root/eaccelerator-0.9.6.1 creates=/root/eaccelerator-0.9.6.1/config.status
tags: eaccel

- name: eAccelerator | Make
action: command make chdir=/root/eaccelerator-0.9.6.1 creates=/root/eaccelerator-0.9.6.1/modules/eaccelerator.so
tags: eaccel

- name: eAccelerator | Install
action: command make install chdir=/root/eaccelerator-0.9.6.1 creates=/usr/lib/php5/20090626/eaccelerator.so
tags: eaccel

- name: eAccelerator | Copy config for PHP
action: template src=templates/etc-php5-conf-d-eaccelerator-ini.j2 dest=/etc/php5/conf.d/eaccelerator.ini
tags: eaccel

- name: eAccelerator | Make a cache directory
action: file path=/var/cache/eaccelerator state=directory owner=www-data mode=700
tags: eaccel

- name: eAccelerator | And a log file
action: file path=/var/log/eaccelerator.log state=file owner=www-data mode=666
tags: eaccel
2 changes: 1 addition & 1 deletion ubuntu-10.04-lamp-dev/run-local-all
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

# Script for running the play on the localhost, everything included.
ansible-playbook -c local --tags="common,drush" ./setup.yml
ansible-playbook -c local --tags="common,drush,eaccel" ./setup.yml
21 changes: 13 additions & 8 deletions ubuntu-10.04-lamp-dev/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
##
# Apt package installation of required software.
#
- name: Install required packages.
- name: General | Install required packages.
action: apt pkg=$item state=installed
tags: common
with_items:
Expand All @@ -32,21 +32,21 @@
##
# Message of the day explaining server is under Ansible control.
#
- name: Message of the day explaining server is under Ansible control.
- name: General | Message of the day explaining server is under Ansible control.
action: copy src=files/etc-update-motd-d-95-ansible dest=/etc/update-motd.d/95-ansible mode=755
tags: common

##
# PHP Setup.
#
- name: PHP configuration file, php.ini
- name: PHP | Configuration file, php.ini
action: template src=templates/etc-php5-apache2-php-ini.j2 dest=/etc/php5/apache2/php.ini
tags: common

##
# MySQL database setup.
#
- name: MySQL configuration file, my.cnf
- name: MySQL | Configuration file, my.cnf
action: template src=templates/etc-mysql-my-cnf.j2 dest=/etc/mysql/my.cnf
tags: common

Expand All @@ -55,19 +55,19 @@
##
# Apache2 setup.
#
- name: Enable some required modules
- name: Apache | Enable some required modules
action: command a2enmod rewrite vhost_alias
tags: common

- name: Apache configuration file for our site
- name: Apache | Configuration file for our site
action: template src=templates/etc-apache2-sites-available-devserver.j2 dest=/etc/apache2/sites-available/devserver
tags: common

- name: Disable the default site
- name: Apache | Disable the default site
action: command a2dissite default
tags: common

- name: Enable our new site
- name: Apache | Enable our new site
action: command a2ensite devserver
tags: common

Expand All @@ -76,6 +76,11 @@
#
- include: ../common-tasks/ubuntu-drush.yml

##
# eAccelerator opcode cache.
#
- include: ../common-tasks/ubuntu-eaccelerator.yml

##
# Restart services
#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
; eAccelerator configuration
extension = "/usr/lib/php5/20090626/eaccelerator.so"
eaccelerator.shm_size = "{{ eaccel_shm_size }}"
eaccelerator.cache_dir = "/var/cache/eaccelerator"
eaccelerator.log_file = "/var/log/eaccelerator.log"
eaccelerator.enable = "1"
eaccelerator.optimizer = "1"
eaccelerator.check_mtime = "1"
eaccelerator.debug = "0"
eaccelerator.filter = ""
eaccelerator.shm_max = "0"
eaccelerator.shm_ttl = "30"
eaccelerator.shm_prune_period = "0"
eaccelerator.shm_only = "0"
eaccelerator.compress = "1"
eaccelerator.compress_level = "9"
3 changes: 3 additions & 0 deletions ubuntu-10.04-lamp-dev/vars/default-settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ php_post_max_size: '32M'
php_upload_max_filesize: '32M'
php_date_timezone: 'US/Central'

# eaccelerator.ini
eaccel_shm_size: '32'

# my.cnf
mysql_max_allowed_packet: '128M'
mysql_character_set_server: 'utf8'
Expand Down

0 comments on commit 3762a1a

Please sign in to comment.