Skip to content

Commit

Permalink
Merge pull request #15 from alachaum/develop
Browse files Browse the repository at this point in the history
Tune apache mpm preforx configuration
  • Loading branch information
Arnaud committed Feb 14, 2016
2 parents 6830c4e + 2824f35 commit 3da6703
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 48 deletions.
48 changes: 19 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@

language: python
python: "2.7"
sudo: required
dist: trusty

env:
- SITE=test.yml
services:
- docker

before_install:
- sudo apt-get update -qq
- sudo apt-get remove --purge 'mysql*'
- sudo apt-get autoremove
- sudo apt-get autoclean
- sudo rm -rf /var/lib/mysql
- sudo truncate -s 0 /var/log/mysql/error.log
- sudo apt-get install -y curl

install:
Expand All @@ -24,31 +20,25 @@ install:

script:
# Check the role/playbook's syntax.
- "ansible-playbook test/$SITE --syntax-check"
- "ansible-playbook ansible/site.yml --syntax-check"

# Run the role/playbook with ansible-playbook.
- "ansible-playbook test/$SITE --connection=local --sudo"
# Build docker image
- docker build -t maestrano/docker-lamp:travis .

# Run the role/playbook again, checking to make sure it's idempotent.
# - >
# ansible-playbook test/$SITE --connection=local --sudo
# | grep -q 'changed=0.*failed=0'
# && (echo 'Idempotence test: pass' && exit 0)
# || (echo 'Idempotence test: fail' && exit 1)
# Run image
- docker run -td --name travis-test maestrano/docker-lamp:travis

# Request a page via Apache, to make sure Apache is running and responds.
- "curl http://localhost/"
# Get ip address
- "container_ip=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' travis-test`"

# Wait for ansible to finish running
- sleep 10

# Check that apache is up
- "curl http://${container_ip}:80/"

# Check to make sure we can connect to MySQL via Unix socket.
- >
mysql -u root -proot -e 'show databases;'
| grep -q 'performance_schema'
&& (echo 'MySQL running normally' && exit 0)
|| (echo 'MySQL not running' && exit 1)
- docker exec -i travis-test mysql -u root -e 'show databases;' | grep -q 'performance_schema' && (echo 'MySQL running normally' && exit 0) || (echo 'MySQL not running' && exit 1)

# Check to make sure we can connect to MySQL via TCP.
- >
mysql -u root -proot -h 127.0.0.1 -e 'show databases;'
| grep -q 'performance_schema'
&& (echo 'MySQL running normally' && exit 0)
|| (echo 'MySQL not running' && exit 1)
- docker exec -i travis-test mysql -u root -h 127.0.0.1 -e 'show databases;' | grep -q 'performance_schema' && (echo 'MySQL running normally' && exit 0) || (echo 'MySQL not running' && exit 1)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Build Maestrano LAMP stack based on Ubuntu 14.04

[![Build Status](https://travis-ci.org/maestrano/docker-lamp.svg?branch=develop)](https://travis-ci.org/maestrano/docker-lamp)

## Build Docker container locally
`sudo docker build -t local/docker-lamp .`

Expand Down
8 changes: 3 additions & 5 deletions ansible/group_vars/all
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
power_units: 2

# apache
apache_start_servers: '{{ 1 * (power_units|int) }}'
apache_start_servers: '1'
apache_max_request_workers: '{{ 2 * (power_units|int) }}'
apache_max_connections_per_child: '1000'
apache_thread_limit: '{{ 2 * (power_units|int) }}'
apache_threads_per_child: '{{ 2 * (power_units|int) }}'
apache_max_request_workers: '{{ 10 * (power_units|int) }}'
apache_max_connections_per_child: '{{ 25 * (power_units|int) }}'
apache_min_spare_threads: '{{ 1 * (power_units|int) }}'
apache_max_spare_threads: '{{ 2 * (power_units|int) }}'
apache_min_spare_servers: '{{ 1 * (power_units|int) }}'
apache_max_spare_servers: '{{ 2 * (power_units|int) }}'

# php.ini
php_error_reporting: E_ALL & ~E_DEPRECATED & ~E_STRICT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

<IfModule mpm_prefork_module>
StartServers {{ apache_start_servers }}
MinSpareServers {{ apache_min_spare_servers }}
MaxSpareServers {{ apache_max_spare_servers }}
MaxRequestWorkers {{ apache_max_request_workers }}
MaxConnectionsPerChild {{ apache_max_connections_per_child }}
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
2 changes: 1 addition & 1 deletion ansible/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
roles:
- mysql
- ssmtp
- apache
- apache
10 changes: 0 additions & 10 deletions test/test.yml

This file was deleted.

0 comments on commit 3da6703

Please sign in to comment.