Class: PoolParty::Resources::PassengerSite
- Inherits:
-
PoolParty::Resource
- Object
- Base
- PoolParty::Resource
- PoolParty::Resources::PassengerSite
- Defined in:
- lib/poolparty/plugins/apache2/passenger_site.rb
Overview
Usage:
passenger_site do end
Instance Attribute Summary
Attributes inherited from PoolParty::Resource
#exists, #graph_index, #meta_not_if, #meta_notifies, #meta_only_if, #meta_subscribes
Attributes inherited from Base
Instance Method Summary collapse
- #after_loaded(opts = {}) ⇒ Object
- #has_site_directory(dir_name = '', opts = {}) ⇒ Object
- #passenger_entry(file) ⇒ Object
- #site_directory ⇒ Object
Methods inherited from PoolParty::Resource
#after_compile, #after_loaded_requires_parent, #before_compile, #case_of, #cloud, #compile, define_resource, define_resource_methods, defined, defined_resources, #does_not_exist!, #exists!, #has_method_name, has_method_name, inherited, #initialize, is_base_resource_class?, method_defined!, method_defined?, #not_if, #notifies, #only_if, #pool, #print_to_chef, #print_variable, #requires, #subscribes
Methods inherited from Base
#add_ordered_resources_to_result, #all_resources, #before_load, clouds_dot_rb_dir, #clouds_dot_rb_dir, clouds_dot_rb_file, #clouds_dot_rb_file, #compile_opts, #create_graph, #dependencies, #get_resource, #has_searchable_paths, #initialize, #method_missing, #ordered_resources, #output_resources_graph, #resources, #resources_graph, #run_in_context, #run_with_callbacks, #to_s, #valid?, #validations
Methods included from Delayed
Methods included from Callbacks
Methods included from SearchablePaths
Constructor Details
This class inherits a constructor from PoolParty::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PoolParty::Base
Instance Method Details
#after_loaded(opts = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/poolparty/plugins/apache2/passenger_site.rb', line 18 def after_loaded(opts={}) enable_passenger port "80" unless self.port has_directory(:name => dir, :owner => www_user, :mode => '0744') has_directory(:name => "#{site_directory}", :owner => www_user, :mode => '0744') has_site_directory 'logs' if [:deploy_dirs] || opts[:with_deployment_directories] has_site_directory "shared" has_site_directory "shared/public" has_site_directory "shared/config" has_site_directory "shared/log" has_site_directory "releases" if !File.exists?("#{dir}/#{name}/current") # setup an initial symlink so apache will start even if there have not been any deploys yet #has_site_directory "releases/initial/public" #FIXME the following line is chef specific. It will fail with puppet has_link(:target_file => "#{dir}/#{name}/current", :to => "#{dir}/#{name}/releases/initial", :requires => get_directory(site_directory)) end log_dir = "#{site_directory}/shared/log" appended_path "current" else log_dir = "#{site_directory}/log" end pass_entry = <<-EOE <VirtualHost *:#{port}> ServerName #{name} DocumentRoot #{site_directory}/public RailsEnv #{environment} ErrorLog #{log_dir}/error_log CustomLog #{log_dir}/access_log common </VirtualHost> EOE passenger_entry(pass_entry) install_site(name, :no_file => true) # we already created the file with #passenger_entry end |
#has_site_directory(dir_name = '', opts = {}) ⇒ Object
69 70 71 72 73 74 |
# File 'lib/poolparty/plugins/apache2/passenger_site.rb', line 69 def has_site_directory( dir_name='' , opts={}) has_directory({ :name => "#{site_directory}/#{dir_name}", :owner => www_user, :mode =>'0744' }.merge(opts) ) end |
#passenger_entry(file) ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/poolparty/plugins/apache2/passenger_site.rb', line 61 def passenger_entry(file) if ::File.file?(file) has_file({:name => "/etc/apache2/sites-available/#{name}", :template => file}) else has_file({:content => file, :name => "/etc/apache2/sites-available/#{name}" }) end end |
#site_directory ⇒ Object
76 77 78 |
# File 'lib/poolparty/plugins/apache2/passenger_site.rb', line 76 def site_directory "#{dir}/#{name}%s" % [appended_path ? "/" + appended_path : ""] end |