Class: PoolParty::Plugin::PassengerSite
- Inherits:
-
Apache
- Object
- PoolParty::PoolPartyBaseClass
- Service
- Plugin
- Apache
- PoolParty::Plugin::PassengerSite
- Defined in:
- lib/poolparty/plugins/apache2/passenger_site.rb
Overview
Usage:
passengersite do end
Instance Attribute Summary
Attributes inherited from PoolParty::PoolPartyBaseClass
#init_opts, #ordered_resources
Instance Method Summary collapse
- #has_site_directory(dir_name = '', opts = {}) ⇒ Object
- #loaded(opts = {}, prnt = nil) ⇒ Object
- #passenger_entry(file) ⇒ Object
- #site_directory ⇒ Object
Methods inherited from Apache
#absent_apache_module, #base_install, #before_load, #config, #configs, #enable, #enable_default, #enable_passenger, #install, #install_passenger, #install_site, #installed_as_worker, #listen, #passenger_configs, #present_apache_module, #site, #site_include
Methods inherited from Plugin
#after_create, #before_load, #bootstrap_commands, #bootstrap_gems, #calls, #cloud, #configure_commands, #enable, inherited, #initialize, #is_plugin?
Methods included from Callbacks
Methods included from DependencyResolverCloudExtensions
Methods included from CloudResourcer
#dependency_resolver, #instances, #plugin_directory, #run_stored_block, #store_block, #stored_block, #using
Methods inherited from Service
add_has_and_does_not_have_methods_for, #cloud, #to_properties_hash
Methods inherited from PoolParty::PoolPartyBaseClass
add_has_and_does_not_have_methods_for, #add_resource, add_resource_lookup_method, #add_service, #add_to_parent_if_parent_exists_and_is_a_service, #get_local_resource, #get_name_from_options_and_extra_options, #get_resource, #handle_option_values, #in_local_resources?, #initialize, #inspect, #is_a_resource?, #is_plugin?, #plugin_store, #resource, #resources, #run_in_context, #run_with_callbacks, #search_in_known_locations, #store_in_local_resources, #to_hash, #to_json
Methods included from SearchablePaths
Constructor Details
This class inherits a constructor from PoolParty::Plugin::Plugin
Instance Method Details
#has_site_directory(dir_name = '', opts = {}) ⇒ Object
72 73 74 75 76 77 |
# File 'lib/poolparty/plugins/apache2/passenger_site.rb', line 72 def has_site_directory( dir_name='' , opts={}) has_directory({ :name => "#{site_directory}/#{dir_name}", :owner => www_user, :mode =>'0744' }.merge(opts) ) end |
#loaded(opts = {}, prnt = nil) ⇒ Object
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 60 61 62 |
# File 'lib/poolparty/plugins/apache2/passenger_site.rb', line 19 def loaded(opts={}, prnt=nil) 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_symlink({:target_file => "#{dir}/#{name}/current", :to => "#{dir}/#{name}/releases/initial"}) end log_dir = "#{site_directory}/shared/log" appended_path "current" else log_dir = "#{site_directory}/log" end passenger_entry " <VirtualHost *:\#{port}>\nServerName \#{name}\nDocumentRoot \#{site_directory}/public\nRailsEnv \#{enviornment}\nErrorLog \#{log_dir}/error_log\nCustomLog \#{log_dir}/access_log common\n </VirtualHost>\n EOE\n \n # has_directory(:name => \"/var/www\")\n # has_directory(:name => \"/var/www/\#{name}\")\n # has_directory(:name => \"/var/www/\#{name}/log\")\n parent.install_site(name, :no_file => true) # we already created the file with #passenger_entry\nend\n" |
#passenger_entry(file) ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/poolparty/plugins/apache2/passenger_site.rb', line 64 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
79 80 81 |
# File 'lib/poolparty/plugins/apache2/passenger_site.rb', line 79 def site_directory "#{dir}/#{name}%s" % [appended_path ? "/" + appended_path : ""] end |