-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
179 additions
and
2 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
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 |
---|---|---|
|
@@ -100,3 +100,9 @@ disable_vccw_cookbook: false | |
# | ||
user: vagrant | ||
group: vagrant | ||
|
||
|
||
# | ||
# phpenv | ||
# | ||
php_version: default |
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
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,122 @@ | ||
# encoding: utf-8 | ||
# vim: ft=ruby expandtab shiftwidth=2 tabstop=2 | ||
|
||
require 'shellwords' | ||
|
||
if /^[0-9]/ =~ node[:vccw][:phpenv][:php_version].to_s | ||
|
||
packages = %w{httpd-devel libxml2-devel libcurl-devel libjpeg-turbo-devel libpng-devel giflib-devel gd-devel libmcrypt-devel sqlite-devel libtidy-devel libxslt-devel} | ||
|
||
packages.each do |pkg| | ||
package pkg do | ||
action [:install, :upgrade] | ||
end | ||
end | ||
|
||
execute node[:vccw][:phpenv][:install] do | ||
user "root" | ||
group "root" | ||
environment ({ | ||
'PHPENV_ROOT' => node[:vccw][:phpenv][:phpenv_root] | ||
}) | ||
not_if { ::File.exists?(node[:vccw][:phpenv][:phpenv_root]) } | ||
end | ||
|
||
execute node[:vccw][:phpenv][:install] do | ||
user "root" | ||
group "root" | ||
environment ({ | ||
'PHPENV_ROOT' => node[:vccw][:phpenv][:phpenv_root], | ||
'UPDATE' => 'yes' | ||
}) | ||
only_if { ::File.exists?(node[:vccw][:phpenv][:phpenv_root]) } | ||
end | ||
|
||
template "/etc/profile.d/phpenv.sh" do | ||
source "phpenv.sh.erb" | ||
owner "root" | ||
group "root" | ||
mode "0755" | ||
variables( | ||
:phpenv_root => node[:vccw][:phpenv][:phpenv_root] | ||
) | ||
action :create_if_missing | ||
end | ||
|
||
directory File.join(node[:vccw][:phpenv][:phpenv_root], "/shims") do | ||
recursive true | ||
owner "root" | ||
group "root" | ||
mode "0755" | ||
action :create | ||
end | ||
|
||
directory File.join(node[:vccw][:phpenv][:phpenv_root], "/versions") do | ||
recursive true | ||
owner "root" | ||
group "root" | ||
mode "0755" | ||
action :create | ||
end | ||
|
||
directory File.join(node[:vccw][:phpenv][:phpenv_root], "/plugins") do | ||
recursive true | ||
owner "root" | ||
group "root" | ||
mode "0755" | ||
action :create | ||
end | ||
|
||
git File.join(node[:vccw][:phpenv][:phpenv_root], "/plugins/php-build") do | ||
repository "https://github.com/php-build/php-build.git" | ||
reference "master" | ||
user "root" | ||
group "root" | ||
action :sync | ||
end | ||
|
||
template File.join(node[:vccw][:phpenv][:phpenv_root], "/plugins/php-build/share/php-build/default_configure_options") do | ||
source "default_configure_options.erb" | ||
owner "root" | ||
group "root" | ||
mode "0755" | ||
action :create | ||
end | ||
|
||
execute "install-php" do | ||
user "root" | ||
group "root" | ||
command <<-EOF | ||
rm -fr /tmp/php-build* | ||
#{File.join(node[:vccw][:phpenv][:phpenv_root], '/bin/phpenv')} install #{Shellwords.shellescape(node[:vccw][:phpenv][:php_version].to_s)} | ||
#{File.join(node[:vccw][:phpenv][:phpenv_root], '/bin/phpenv')} global #{Shellwords.shellescape(node[:vccw][:phpenv][:php_version].to_s)} | ||
#{File.join(node[:vccw][:phpenv][:phpenv_root], '/bin/phpenv')} rehash | ||
EOF | ||
environment ({ | ||
'PHPENV_ROOT' => node[:vccw][:phpenv][:phpenv_root] | ||
}) | ||
returns [0, 1] | ||
notifies :restart, "service[apache2]" | ||
end | ||
|
||
template File.join(node[:vccw][:phpenv][:phpenv_root], 'versions/', node[:vccw][:phpenv][:php_version].to_s, '/etc/conf.d/vccw.ini') do | ||
source "vccw.ini.erb" | ||
owner "root" | ||
group "root" | ||
mode "0644" | ||
variables(:directives => node['php']['directives']) | ||
notifies :restart, "service[apache2]" | ||
end | ||
|
||
template "/etc/sudoers.d/phpenv" do | ||
source "sudoers.erb" | ||
owner "root" | ||
group "root" | ||
mode "0400" | ||
variables( | ||
:phpenv_root => node[:vccw][:phpenv][:phpenv_root] | ||
) | ||
action :create | ||
end | ||
|
||
end |
33 changes: 33 additions & 0 deletions
33
provision/site-cookbooks/vccw/templates/default/default_configure_options.erb
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,33 @@ | ||
--without-pear | ||
--with-gd | ||
--enable-sockets | ||
--with-jpeg-dir=/usr | ||
--with-png-dir=/usr | ||
--enable-exif | ||
--enable-zip | ||
--with-zlib | ||
--with-zlib-dir=/usr | ||
--with-kerberos | ||
--with-openssl | ||
--with-mcrypt=/usr | ||
--enable-soap | ||
--enable-xmlreader | ||
--with-xsl | ||
--enable-ftp | ||
--enable-cgi | ||
--with-curl=/usr | ||
--with-tidy | ||
--with-xmlrpc | ||
--enable-sysvsem | ||
--enable-sysvshm | ||
--enable-shmop | ||
--with-mysql=mysqlnd | ||
--with-mysqli=mysqlnd | ||
--with-pdo-mysql=mysqlnd | ||
--with-mysql-sock=/var/lib/mysql/mysql.sock | ||
--with-pdo-sqlite | ||
--enable-pcntl | ||
--with-readline | ||
--enable-mbstring | ||
--enable-bcmath | ||
--with-apxs2=/usr/sbin/apxs |
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
6 changes: 6 additions & 0 deletions
6
provision/site-cookbooks/vccw/templates/default/phpenv.sh.erb
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,6 @@ | ||
# encoding: utf-8 | ||
# vim: ft=ruby expandtab shiftwidth=2 tabstop=2 | ||
|
||
export PHPENV_ROOT="<%= @phpenv_root %>" | ||
export PATH="${PHPENV_ROOT}/bin:$PATH" | ||
eval "$(phpenv 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 @@ | ||
Defaults secure_path = <%= @phpenv_root %>/shims:<%= @phpenv_root %>/bin:/sbin:/bin:/usr/sbin:/usr/bin |
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,3 @@ | ||
<% @directives.sort_by { |key, val| key }.each do |directive, value| -%> | ||
<%= "#{directive}=\"#{value}\"" %> | ||
<% end -%> |