diff --git a/site.yml b/site.yml index 35793eb..e6d3ab0 100644 --- a/site.yml +++ b/site.yml @@ -13,3 +13,6 @@ - include: web/deploy.yml - include: web/git.yml - include: web/ruby.yml + - include: web/php.yml + - include: web/fastcgi.yml + - include: web/php-fastcgi.yml diff --git a/web/fastcgi.yml b/web/fastcgi.yml new file mode 100644 index 0000000..cd529a0 --- /dev/null +++ b/web/fastcgi.yml @@ -0,0 +1,7 @@ +--- + +- name: Install fastcgi packages + apt: name={{ item }} update_cache=yes + with_items: + - spawn-fcgi + - psmisc diff --git a/web/php-fastcgi.yml b/web/php-fastcgi.yml new file mode 100644 index 0000000..521d7c2 --- /dev/null +++ b/web/php-fastcgi.yml @@ -0,0 +1,12 @@ +--- + +- name: Create script for php-fastcgi + copy: src=web/php-fastcgi/php-fastcgi + dest=/usr/local/bin/php-fastcgi mode=0751 + +- name: Create php-fastcgi configuration + copy: src=web/php-fastcgi/php-fastcgi.conf + dest=/etc/init/php-fastcgi.conf + +- name: Ensure that php-fastcgi service is enabled and running + service: name=php-fastcgi state=running enabled=yes diff --git a/web/php-fastcgi/php-fastcgi b/web/php-fastcgi/php-fastcgi new file mode 100644 index 0000000..772417a --- /dev/null +++ b/web/php-fastcgi/php-fastcgi @@ -0,0 +1,11 @@ +#!/bin/bash + +FASTCGI_USER=deploy +FASTCGI_GROUP=deploy +ADDRESS=127.0.0.1 +PORT=9000 +PIDFILE=/var/run/php-fastcgi.pid +CHILDREN=6 +PHP5=/usr/bin/php5-cgi + +/usr/bin/spawn-fcgi -a $ADDRESS -p $PORT -P $PIDFILE -C $CHILDREN -u $FASTCGI_USER -g $FASTCGI_GROUP -f $PHP5 diff --git a/web/php-fastcgi/php-fastcgi.conf b/web/php-fastcgi/php-fastcgi.conf new file mode 100644 index 0000000..aaa887e --- /dev/null +++ b/web/php-fastcgi/php-fastcgi.conf @@ -0,0 +1,9 @@ +description "PHP Fastcgi daemon" + +start on (local-filesystems and net-device-up) +stop on runlevel [!2345] + +expect daemon +respawn + +exec /usr/local/bin/php-fastcgi diff --git a/web/php.yml b/web/php.yml new file mode 100644 index 0000000..5858909 --- /dev/null +++ b/web/php.yml @@ -0,0 +1,8 @@ +--- + +- name: Install PHP core packages + apt: name={{ item }} update_cache=yes + with_items: + - php5-cli + - php5-cgi + - php5-dev