passenger_apache2.rb 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #
  2. # Cookbook Name:: application
  3. # Recipe:: passenger_apache2
  4. #
  5. # Copyright 2010, Opscode, Inc.
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. #
  19. Chef::Log.warn "The application::passenger_apache2 recipe is deprecated and will go away on Aug 1st. See the README for migration information."
  20. app = node.run_state[:current_app]
  21. include_recipe "apache2"
  22. include_recipe "apache2::mod_ssl"
  23. include_recipe "apache2::mod_rewrite"
  24. include_recipe "passenger_apache2::mod_rails"
  25. server_aliases = [ "#{app['id']}.#{node['domain']}", node['fqdn'] ]
  26. if node.has_key?("cloud")
  27. server_aliases << node['cloud']['public_hostname']
  28. end
  29. web_app app['id'] do
  30. docroot "#{app['deploy_to']}/current/public"
  31. template "#{app['id']}.conf.erb"
  32. cookbook "#{app['id']}"
  33. server_name "#{app['id']}.#{node[:domain]}"
  34. server_aliases server_aliases
  35. log_dir node[:apache][:log_dir]
  36. rails_env node.chef_environment
  37. end
  38. if ::File.exists?(::File.join(app['deploy_to'], "current"))
  39. d = resources(:deploy_revision => app['id'])
  40. d.restart_command do
  41. service "apache2" do action :restart; end
  42. end
  43. end
  44. apache_site "000-default" do
  45. enable false
  46. end