forked from mdespuits/capistrano-recipes
-
Notifications
You must be signed in to change notification settings - Fork 3
/
apache_unicorn.rb
47 lines (33 loc) · 1.39 KB
/
apache_unicorn.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
#
# Recipre to deploy Unicorn app server with Apache2
# Source: https://github.com/teambox/teambox/wiki/Installing-on-Ubuntu-using-Apache-and-Unicorn
# ------------------------------------------------------------------
set_default :apache_port, 80
set_default :apache_available_dir, "/etc/httpd/sites-available"
set_default :domain_name, "#{application}.com"
set_default :virtual_host, "#{application}"
set_default :unicorn_port, 5000 # Note: apache is not able to listen on a socket.
namespace :apache do
namespace :unicorn do
desc <<-EOF
Create virtual host for Apache with Unicorn
Install required for Unicorn Apache modules, upload ERB Apache Virtual
host template and enable site for Apache application config file
Configuration
-------------
Change values accordingly to your host.
* set :apache_port, 80
* set :apache_available_dir, "/etc/httpd/sites-available"
* set :domain_name, "#{application}.com"
* set :virtual_host, "#{application}"
EOF
task :configure do
json = "/tmp/#{user}_apache_unicorn_modules.json"
puts "JSON" + json
template "apache_unicorn_virtual_host.conf.erb", "#{apache_available_dir}/#{virtual_host}"
run "#{try_sudo} a2ensite #{virtual_host}"
template "apache_unicorn_modules.json.erb", json
run "#{chef_solo_command} #{json} ; rm -f #{json}"
end
end
end