passenger_apache2.rb 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. app = node.run_state[:current_app]
  20. include_recipe "apache2"
  21. include_recipe "apache2::mod_ssl"
  22. include_recipe "apache2::mod_rewrite"
  23. include_recipe "passenger_apache2::mod_rails"
  24. server_aliases = [ "#{app['id']}.#{node[:domain]}", node.fqdn ]
  25. if node.has_key?("ec2")
  26. server_aliases << node.ec2.public_hostname
  27. end
  28. web_app app['id'] do
  29. docroot "#{app['deploy_to']}/current/public"
  30. template "#{app['id']}.conf.erb"
  31. cookbook "#{app['id']}"
  32. server_name "#{app['id']}.#{node[:domain]}"
  33. server_aliases server_aliases
  34. log_dir node[:apache][:log_dir]
  35. rails_env node.app_environment
  36. end
  37. d = resources(:deploy => app['id'])
  38. d.restart_command do
  39. service "apache2" do action :restart; end
  40. end
  41. apache_site "000-default" do
  42. enable false
  43. end