Skip to content
This repository has been archived by the owner on May 14, 2021. It is now read-only.

allow docroot to be subdirectory of deploy directory #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion providers/mod_php_apache2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
action :before_deploy do

new_resource = @new_resource
apache_docroot = "#{new_resource.application.path}/current"
apache_docroot << "/#{new_resource.docroot}" if new_resource.docroot

web_app new_resource.application.name do
docroot "#{new_resource.application.path}/current"
docroot apache_docroot
template new_resource.webapp_template || 'php.conf.erb'
cookbook new_resource.webapp_template ? new_resource.cookbook_name : "application_php"
server_name "#{new_resource.application.name}.#{node['domain']}"
Expand Down
3 changes: 3 additions & 0 deletions providers/php.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def install_packages

def create_settings_file
host = new_resource.find_database_server(new_resource.database_master_role)
relative_docroot = new_resource.docroot
relative_docroot ||= new_resource.application.docroot

template "#{new_resource.path}/shared/#{new_resource.local_settings_file_name}" do
source new_resource.settings_template || "#{new_resource.local_settings_file_name}.erb"
Expand All @@ -72,6 +74,7 @@ def create_settings_file
mode "644"
variables(
:path => "#{new_resource.path}/current",
:docroot => relative_docroot,
:host => host,
:database => new_resource.database
)
Expand Down
2 changes: 2 additions & 0 deletions resources/mod_php_apache2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@
attribute :server_aliases, :kind_of => [Array, NilClass], :default => nil
# Actually defaults to "php.conf.erb", but nil means it wasn't set by the user
attribute :webapp_template, :kind_of => [String, NilClass], :default => nil
# docroot: set when the http docroot is a subdir of the deployed app
attribute :docroot, :kind_of => [String, NilClass], :default => nil
2 changes: 2 additions & 0 deletions resources/php.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
# Actually defaults to "#{local_settings_file_name}.erb", but nil means it wasn't set by the user
attribute :settings_template, :kind_of => [String, NilClass], :default => nil
attribute :packages, :kind_of => [Array, Hash], :default => []
# docroot: set when the http docroot is a subdir of the deployed app
attribute :docroot, :kind_of => [String, NilClass], :default => nil

def local_settings_file_name
@local_settings_file_name ||= local_settings_file.split(/[\\\/]/).last
Expand Down