ms_deploy 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/TODO +3 -0
- data/lib/ms_deploy/recipes/bundler.rb +26 -0
- data/lib/ms_deploy/recipes/deploy/assets.rb +12 -0
- data/lib/ms_deploy/recipes/deploy/nginx.rb +49 -0
- data/lib/ms_deploy/recipes/deploy/setup.rb +39 -0
- data/lib/ms_deploy/recipes/deploy/symlink.rb +24 -0
- data/lib/ms_deploy/recipes/deploy/unicorn.rb +23 -0
- data/lib/ms_deploy/recipes/info.rb +38 -0
- data/lib/ms_deploy/recipes/mysql.rb +47 -0
- data/lib/ms_deploy/recipes/redis.rb +41 -0
- data/lib/ms_deploy/recipes/templates/ssl_vhost.erb +85 -0
- data/lib/ms_deploy/recipes/templates/vhost.erb +81 -0
- data/lib/ms_deploy/recipes/whenever.rb +8 -0
- data/lib/ms_deploy/render.rb +8 -0
- data/lib/ms_deploy/version.rb +3 -0
- data/lib/ms_deploy.rb +1 -0
- data/ms_deploy.gemspec +20 -0
- metadata +77 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
|
3
|
+
# defaults
|
4
|
+
#set :bundle_gemfile, "Gemfile"
|
5
|
+
#set :bundle_dir, File.join(fetch(:shared_path), 'bundle')
|
6
|
+
#set :bundle_without, [:development, :test]
|
7
|
+
#set :bundle_roles, #{role_default} # e.g. [:app, :batch]
|
8
|
+
|
9
|
+
set :bundle_cmd, "/home/deploy/.rbenv/shims/bundle"
|
10
|
+
# http://shapeshed.com/journal/using-rbenv-to-manage-rubies/
|
11
|
+
# you can also apply a clever technique to allow you switch versions of ruby by pushing a new .rbenv-version file with capistrano. From version 1.1rc bundler allows you to specify a shebang for binstubs. To use this add the following to your capistrano recipe.
|
12
|
+
set :bundle_flags, "--deployment --quiet --binstubs --shebang ruby-local-exec"
|
13
|
+
|
14
|
+
require 'bundler/capistrano'
|
15
|
+
|
16
|
+
set :rake, 'bundle exec rake'
|
17
|
+
|
18
|
+
namespace :bundler do
|
19
|
+
task :install_gem do
|
20
|
+
run "cd #{current_path} && gem install bundler --pre --no-ri --no-rdoc"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
before "bundle:install", "bundler:install_gem"
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
|
3
|
+
namespace :deploy do
|
4
|
+
desc "Compile assets"
|
5
|
+
task :assets do
|
6
|
+
run "cd #{release_path}; RAILS_ENV=#{rails_env} #{rake} assets:precompile"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
after 'deploy:symlink_dependencies', 'deploy:assets'
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "ms_deploy/render"
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance.load do
|
4
|
+
|
5
|
+
namespace :deploy do
|
6
|
+
namespace :nginx do
|
7
|
+
desc <<-DESC
|
8
|
+
Starts the nginx web-server.
|
9
|
+
DESC
|
10
|
+
task :start do
|
11
|
+
#run "sudo god start nginx"
|
12
|
+
run "sudo /etc/init.d/nginx start"
|
13
|
+
end
|
14
|
+
|
15
|
+
desc <<-DESC
|
16
|
+
#Stops the nginx web-server.
|
17
|
+
DESC
|
18
|
+
task :stop do
|
19
|
+
#run "sudo god stop nginx"
|
20
|
+
run "sudo /etc/init.d/nginx stop"
|
21
|
+
end
|
22
|
+
|
23
|
+
desc <<-DESC
|
24
|
+
Restarts the nginx web-server.
|
25
|
+
DESC
|
26
|
+
task :restart do
|
27
|
+
#run "sudo god restart nginx"
|
28
|
+
run "sudo /etc/init.d/nginx restart"
|
29
|
+
end
|
30
|
+
|
31
|
+
task :install do
|
32
|
+
template_path = File.expand_path('../../templates/vhost.erb', __FILE__)
|
33
|
+
vars = {'application'=> application, 'project_root' => deploy_to + '/current', 'server_name' => server_name}
|
34
|
+
config_path = "#{shared_path}/config/#{application}_vhost.conf"
|
35
|
+
|
36
|
+
put(render_erb_template(template_path, vars), config_path)
|
37
|
+
sudo "rm -f /etc/nginx/sites-enabled/#{application}.conf"
|
38
|
+
sudo "ln -s #{config_path} /etc/nginx/sites-enabled/#{application}.conf"
|
39
|
+
end
|
40
|
+
|
41
|
+
task :uninstall do
|
42
|
+
sudo "rm -f /etc/nginx/sites-enabled/#{application}.conf"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
after :"deploy:setup", :"deploy:nginx:install";
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
|
3
|
+
rails_root = File.expand_path('../../../', __FILE__)
|
4
|
+
|
5
|
+
namespace :deploy do
|
6
|
+
namespace :prepare do
|
7
|
+
task :create_config do
|
8
|
+
config_file = "#{rails_root}/#{fetch(:configuration_file_prefix, 'config')}.#{fetch(:stage, 'production')}.yml"
|
9
|
+
raise "No '#{rails_root}/#{fetch(:configuration_file_prefix, 'config')}.#{fetch(:stage, 'production')}.yml' config file for '#{fetch(:stage, 'production')}'" unless File.exists? config_file
|
10
|
+
|
11
|
+
run "mkdir -p #{shared_path}/config/"
|
12
|
+
put(File.read(config_file), "#{shared_path}/config/#{fetch(:configuration_file_prefix, 'config')}.production.yml", :via => :scp)
|
13
|
+
end
|
14
|
+
|
15
|
+
task :create_database_config do
|
16
|
+
config_file = "#{rails_root}/database.#{fetch(:stage, 'production')}.yml"
|
17
|
+
raise "No '#{rails_root}/database.#{fetch(:configuration_file_prefix, 'config')}.#{fetch(:stage, 'production')}.yml' config file for '#{fetch(:stage, 'production')}'" unless File.exists? config_file
|
18
|
+
|
19
|
+
run "mkdir -p #{shared_path}/config/"
|
20
|
+
put(File.read(config_file), "#{shared_path}/config/database.yml", :via => :scp)
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Set up shared directory structure"
|
24
|
+
task :create_shared_folders do
|
25
|
+
shared_directories_to_create.each { |directory| run "mkdir -p #{directory}" }
|
26
|
+
end
|
27
|
+
|
28
|
+
#desc "Rebuilds css and js asset packages"
|
29
|
+
#task :rebuild_asset_cache, :roles => :app do
|
30
|
+
# run "cd #{current_path} && #{rake_path} RAILS_ENV=#{fetch(:rails_env, "production")} asset:packager:build_all" # If you’d like to prevent Capistrano from applying your Moonshine manifests for any reason:
|
31
|
+
#end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
before :"deploy:setup", :"deploy:prepare:create_config";
|
36
|
+
before :"deploy:setup", :"deploy:prepare:create_database_config";
|
37
|
+
before :"deploy:setup", :"deploy:prepare:create_shared_folders";
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
|
3
|
+
namespace :deploy do
|
4
|
+
desc <<-DESC
|
5
|
+
Symlink shared directories and files.
|
6
|
+
DESC
|
7
|
+
task :symlink_dependencies do
|
8
|
+
shared_directories_to_link = fetch(:shared_directories_to_link, [])
|
9
|
+
directories_to_create = fetch(:directories_to_create, [])
|
10
|
+
files_to_delete = fetch(:files_to_delete, [])
|
11
|
+
files_to_link = fetch(:files_to_link, {})
|
12
|
+
chmods_to_set = fetch(:chmods_to_set, [])
|
13
|
+
|
14
|
+
directories_to_create.each { |directory| run "mkdir -p #{directory}" }
|
15
|
+
shared_directories_to_link.each { |source, target| run "ln -s #{source} #{target}" }
|
16
|
+
files_to_delete.each { |file| run "rm #{file}" }
|
17
|
+
files_to_link.each { |source, target| run "ln -s #{source} #{target}"}
|
18
|
+
chmods_to_set.each { |target, chmod| run "chmod #{chmod} #{target}" }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
after 'deploy:symlink', 'deploy:symlink_dependencies'
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
|
3
|
+
set :unicorn_binary, "bundle exec unicorn"
|
4
|
+
set :unicorn_config, "#{current_path}/config/unicorn.production.rb"
|
5
|
+
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"
|
6
|
+
|
7
|
+
namespace :deploy do
|
8
|
+
task :start, :roles => :app, :except => { :no_release => true } do
|
9
|
+
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
|
10
|
+
end
|
11
|
+
task :stop, :roles => :app, :except => { :no_release => true } do
|
12
|
+
run "if [ -f #{unicorn_pid} ]; then #{try_sudo} kill `cat #{unicorn_pid}`; fi"
|
13
|
+
end
|
14
|
+
task :graceful_stop, :roles => :app, :except => { :no_release => true } do
|
15
|
+
run "#{try_sudo} kill -s QUIT `cat #{unicorn_pid}`"
|
16
|
+
end
|
17
|
+
task :restart, :roles => :app, :except => { :no_release => true } do
|
18
|
+
stop
|
19
|
+
start
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
|
3
|
+
namespace :info do
|
4
|
+
desc <<-DESC
|
5
|
+
Tail all or a single remote file
|
6
|
+
|
7
|
+
The logfile can be specified with a LOGFILE-environment variable.
|
8
|
+
It defaults to RAILS_ENV.log
|
9
|
+
DESC
|
10
|
+
task :tail, :roles => :app do
|
11
|
+
ENV["LOGFILE"] ||= "#{rails_env}.log"
|
12
|
+
begin
|
13
|
+
stream "tail -f #{shared_path}/log/#{ENV["LOGFILE"]}"
|
14
|
+
rescue Interrupt
|
15
|
+
puts "\n--interrupted by user--"
|
16
|
+
puts ""
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Display the currently deployed Application, Revision and Release"
|
21
|
+
task :version, :roles => :app, :except => { :no_release => true } do
|
22
|
+
rev = current_revision
|
23
|
+
rel = current_release.split('/').pop
|
24
|
+
|
25
|
+
puts ""
|
26
|
+
puts " AppName: #{fetch(:application)}"
|
27
|
+
puts " Version: #{rev}"
|
28
|
+
puts " Release: #{rel}"
|
29
|
+
puts ""
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Display the uname"
|
33
|
+
task :uname do
|
34
|
+
run "uname -a"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance.load do
|
4
|
+
|
5
|
+
namespace :deploy do
|
6
|
+
namespace :prepare do
|
7
|
+
task :database do
|
8
|
+
set_unless :db_admin_user, 'root'
|
9
|
+
set_unless :db_admin_password, Capistrano::CLI.password_prompt("Type your mysql password for user #{db_admin_user}: ")
|
10
|
+
set_unless :db_name, application.to_s + '_' + rails_env.to_s
|
11
|
+
set_unless :db_password, database_config['password']
|
12
|
+
|
13
|
+
unless database_exits?
|
14
|
+
create_database
|
15
|
+
end
|
16
|
+
setup_database_permissions
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def database_exits?
|
22
|
+
exists = false
|
23
|
+
|
24
|
+
run "mysql --user=#{db_admin_user} --password=#{db_admin_password} --execute=\"show databases;\"" do |channel, stream, data|
|
25
|
+
exists = exists || data.include?(db_name)
|
26
|
+
end
|
27
|
+
|
28
|
+
exists
|
29
|
+
end
|
30
|
+
|
31
|
+
def create_database
|
32
|
+
create_sql = <<-SQL
|
33
|
+
CREATE DATABASE #{db_name};
|
34
|
+
SQL
|
35
|
+
|
36
|
+
run "mysql --user=#{db_admin_user} --password=#{db_admin_password} --execute=\"#{create_sql}\""
|
37
|
+
end
|
38
|
+
|
39
|
+
def setup_database_permissions
|
40
|
+
grant_sql = <<-SQL
|
41
|
+
GRANT ALL PRIVILEGES ON #{db_name}.* TO #{application}@localhost IDENTIFIED BY '#{db_password}';
|
42
|
+
SQL
|
43
|
+
|
44
|
+
run "mysql --user=#{db_admin_user} --password=#{db_admin_password} --execute=\"#{grant_sql}\""
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
|
3
|
+
namespace :redis do
|
4
|
+
|
5
|
+
desc "Install redis"
|
6
|
+
task :install do
|
7
|
+
["#{sudo} rm -r /tmp/redis",
|
8
|
+
"#{sudo} rm /usr/local/bin/redis-*",
|
9
|
+
"git clone git://github.com/antirez/redis.git /tmp/redis",
|
10
|
+
"cd /tmp/redis && git pull",
|
11
|
+
"cd /tmp/redis && git checkout v2.0.4-stable",
|
12
|
+
"cd /tmp/redis && make clean",
|
13
|
+
"cd /tmp/redis && make",
|
14
|
+
"cd /tmp/redis && #{sudo} make install",
|
15
|
+
"#{sudo} cp /tmp/redis/redis.conf /etc/",
|
16
|
+
"#{sudo} sed -i 's/daemonize no/daemonize yes/' /etc/redis.conf",
|
17
|
+
"#{sudo} sed -i 's/# bind 127.0.0.1/bind 127.0.0.1/' /etc/redis.conf"
|
18
|
+
].each {|cmd| run cmd}
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Start the Redis server"
|
22
|
+
task :start do
|
23
|
+
run "redis-server /etc/redis.conf"
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Stop the Redis server"
|
27
|
+
task :stop do
|
28
|
+
run 'echo "SHUTDOWN" | nc localhost 6379'
|
29
|
+
#sudo 'kill `cat /var/run/redis.pid`'
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Restart the Redis server"
|
33
|
+
task :restart do
|
34
|
+
redis.stop
|
35
|
+
sleep(1)
|
36
|
+
redis.start
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
|
2
|
+
upstream <%= application %>_server {
|
3
|
+
# fail_timeout=0 means we always retry an upstream even if it failed
|
4
|
+
# to return a good HTTP response (in case the Unicorn master nukes a
|
5
|
+
# single worker for timing out).
|
6
|
+
|
7
|
+
# This is the socket we configured in unicorn.rb
|
8
|
+
server unix: <%= project_root %>/tmp/sockets/unicorn.sock fail_timeout=0;
|
9
|
+
|
10
|
+
# for TCP setups, point these to your backend servers
|
11
|
+
# server 127.0.0.1:8080 fail_timeout=0;
|
12
|
+
# server 192.168.0.8:8080 fail_timeout=0;
|
13
|
+
# server 192.168.0.9:8080 fail_timeout=0;
|
14
|
+
}
|
15
|
+
|
16
|
+
server {
|
17
|
+
|
18
|
+
listen 443;
|
19
|
+
server_name <%= server_name %>;
|
20
|
+
|
21
|
+
ssl on;
|
22
|
+
ssl_certificate /usr/local/nginx/conf/cert.pem;
|
23
|
+
ssl_certificate_key /usr/local/nginx/conf/cert.key;
|
24
|
+
|
25
|
+
client_max_body_size 4G;
|
26
|
+
|
27
|
+
# ~2 seconds is often enough for most folks to parse HTML/CSS and
|
28
|
+
# retrieve needed images/icons/frames, connections are cheap in
|
29
|
+
# nginx so increasing this is generally safe...
|
30
|
+
#keepalive_timeout 5;
|
31
|
+
|
32
|
+
# path for static files
|
33
|
+
root <%= project_root %>/public;
|
34
|
+
|
35
|
+
# Prefer to serve static files directly from nginx to avoid unnecessary
|
36
|
+
# data copies from the application server.
|
37
|
+
#
|
38
|
+
# try_files directive appeared in in nginx 0.7.27 and has stabilized
|
39
|
+
# over time. Older versions of nginx (e.g. 0.6.x) requires
|
40
|
+
# "if (!-f $request_filename)" which was less efficient:
|
41
|
+
# http://bogomips.org/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127
|
42
|
+
try_files $uri/index.html $uri.html $uri @app;
|
43
|
+
|
44
|
+
location / {
|
45
|
+
# an HTTP header important enough to have its own Wikipedia entry:
|
46
|
+
# http://en.wikipedia.org/wiki/X-Forwarded-For
|
47
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
48
|
+
|
49
|
+
# enable this if and only if you use HTTPS, this helps Rack
|
50
|
+
# set the proper protocol for doing redirects:
|
51
|
+
# proxy_set_header X-Forwarded-Proto https;
|
52
|
+
|
53
|
+
# pass the Host: header from the client right along so redirects
|
54
|
+
# can be set properly within the Rack application
|
55
|
+
proxy_set_header Host $http_host;
|
56
|
+
|
57
|
+
# we don't want nginx trying to do something clever with
|
58
|
+
# redirects, we set the Host: header above already.
|
59
|
+
proxy_redirect off;
|
60
|
+
|
61
|
+
# set "proxy_buffering off" *only* for Rainbows! when doing
|
62
|
+
# Comet/long-poll/streaming. It's also safe to set if you're using
|
63
|
+
# only serving fast clients with Unicorn + nginx, but not slow
|
64
|
+
# clients. You normally want nginx to buffer responses to slow
|
65
|
+
# clients, even with Rails 3.1 streaming because otherwise a slow
|
66
|
+
# client can become a bottleneck of Unicorn.
|
67
|
+
#
|
68
|
+
# The Rack application may also set "X-Accel-Buffering (yes|no)"
|
69
|
+
# in the response headers do disable/enable buffering on a
|
70
|
+
# per-response basis.
|
71
|
+
# proxy_buffering off;
|
72
|
+
|
73
|
+
if (!-f $request_filename) {
|
74
|
+
proxy_pass http://app_server;
|
75
|
+
break;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
# Rails error pages
|
80
|
+
error_page 500 502 503 504 /500.html;
|
81
|
+
location = /500.html {
|
82
|
+
root <%= project_root %>/public;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
@@ -0,0 +1,81 @@
|
|
1
|
+
|
2
|
+
upstream <%= application %>_server {
|
3
|
+
# fail_timeout=0 means we always retry an upstream even if it failed
|
4
|
+
# to return a good HTTP response (in case the Unicorn master nukes a
|
5
|
+
# single worker for timing out).
|
6
|
+
|
7
|
+
# This is the socket we configured in unicorn.rb
|
8
|
+
server unix:/tmp/sockets/<%= application %>.sock fail_timeout=0;
|
9
|
+
|
10
|
+
# for TCP setups, point these to your backend servers
|
11
|
+
# server 127.0.0.1:8080 fail_timeout=0;
|
12
|
+
# server 192.168.0.8:8080 fail_timeout=0;
|
13
|
+
# server 192.168.0.9:8080 fail_timeout=0;
|
14
|
+
}
|
15
|
+
|
16
|
+
server {
|
17
|
+
|
18
|
+
listen 80;
|
19
|
+
server_name <%= server_name %>;
|
20
|
+
|
21
|
+
client_max_body_size 4G;
|
22
|
+
|
23
|
+
# ~2 seconds is often enough for most folks to parse HTML/CSS and
|
24
|
+
# retrieve needed images/icons/frames, connections are cheap in
|
25
|
+
# nginx so increasing this is generally safe...
|
26
|
+
#keepalive_timeout 5;
|
27
|
+
|
28
|
+
# path for static files
|
29
|
+
root <%= project_root %>/public;
|
30
|
+
|
31
|
+
# Prefer to serve static files directly from nginx to avoid unnecessary
|
32
|
+
# data copies from the application server.
|
33
|
+
#
|
34
|
+
# try_files directive appeared in in nginx 0.7.27 and has stabilized
|
35
|
+
# over time. Older versions of nginx (e.g. 0.6.x) requires
|
36
|
+
# "if (!-f $request_filename)" which was less efficient:
|
37
|
+
# http://bogomips.org/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127
|
38
|
+
try_files $uri/index.html $uri.html $uri @app;
|
39
|
+
|
40
|
+
location / {
|
41
|
+
# an HTTP header important enough to have its own Wikipedia entry:
|
42
|
+
# http://en.wikipedia.org/wiki/X-Forwarded-For
|
43
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
44
|
+
|
45
|
+
# enable this if and only if you use HTTPS, this helps Rack
|
46
|
+
# set the proper protocol for doing redirects:
|
47
|
+
# proxy_set_header X-Forwarded-Proto https;
|
48
|
+
|
49
|
+
# pass the Host: header from the client right along so redirects
|
50
|
+
# can be set properly within the Rack application
|
51
|
+
proxy_set_header Host $http_host;
|
52
|
+
|
53
|
+
# we don't want nginx trying to do something clever with
|
54
|
+
# redirects, we set the Host: header above already.
|
55
|
+
proxy_redirect off;
|
56
|
+
|
57
|
+
# set "proxy_buffering off" *only* for Rainbows! when doing
|
58
|
+
# Comet/long-poll/streaming. It's also safe to set if you're using
|
59
|
+
# only serving fast clients with Unicorn + nginx, but not slow
|
60
|
+
# clients. You normally want nginx to buffer responses to slow
|
61
|
+
# clients, even with Rails 3.1 streaming because otherwise a slow
|
62
|
+
# client can become a bottleneck of Unicorn.
|
63
|
+
#
|
64
|
+
# The Rack application may also set "X-Accel-Buffering (yes|no)"
|
65
|
+
# in the response headers do disable/enable buffering on a
|
66
|
+
# per-response basis.
|
67
|
+
# proxy_buffering off;
|
68
|
+
|
69
|
+
if (!-f $request_filename) {
|
70
|
+
proxy_pass http://<%= application %>_server;
|
71
|
+
break;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
# Rails error pages
|
76
|
+
error_page 500 502 503 504 /500.html;
|
77
|
+
location = /500.html {
|
78
|
+
root <%= project_root %>/public;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
data/lib/ms_deploy.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "ms_deploy/version"
|
data/ms_deploy.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/ms_deploy/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Michael Schiller"]
|
6
|
+
gem.email = ["michael.schiller@gmx.de"]
|
7
|
+
gem.description = %q{capistrano deployment task for my projects}
|
8
|
+
gem.summary = %q{capistrano deployment task for my projects}
|
9
|
+
gem.homepage = "https://github.com/mschiller/ms_deploy"
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "ms_deploy"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
|
17
|
+
gem.add_dependency('erubis')
|
18
|
+
|
19
|
+
gem.version = MsDeploy::VERSION
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ms_deploy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Michael Schiller
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: erubis
|
16
|
+
requirement: &76228310 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *76228310
|
25
|
+
description: capistrano deployment task for my projects
|
26
|
+
email:
|
27
|
+
- michael.schiller@gmx.de
|
28
|
+
executables: []
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files: []
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- Gemfile
|
34
|
+
- Rakefile
|
35
|
+
- TODO
|
36
|
+
- lib/ms_deploy.rb
|
37
|
+
- lib/ms_deploy/recipes/bundler.rb
|
38
|
+
- lib/ms_deploy/recipes/deploy/assets.rb
|
39
|
+
- lib/ms_deploy/recipes/deploy/nginx.rb
|
40
|
+
- lib/ms_deploy/recipes/deploy/setup.rb
|
41
|
+
- lib/ms_deploy/recipes/deploy/symlink.rb
|
42
|
+
- lib/ms_deploy/recipes/deploy/unicorn.rb
|
43
|
+
- lib/ms_deploy/recipes/info.rb
|
44
|
+
- lib/ms_deploy/recipes/mysql.rb
|
45
|
+
- lib/ms_deploy/recipes/redis.rb
|
46
|
+
- lib/ms_deploy/recipes/templates/ssl_vhost.erb
|
47
|
+
- lib/ms_deploy/recipes/templates/vhost.erb
|
48
|
+
- lib/ms_deploy/recipes/whenever.rb
|
49
|
+
- lib/ms_deploy/render.rb
|
50
|
+
- lib/ms_deploy/version.rb
|
51
|
+
- ms_deploy.gemspec
|
52
|
+
homepage: https://github.com/mschiller/ms_deploy
|
53
|
+
licenses: []
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
requirements: []
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.8.11
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: capistrano deployment task for my projects
|
76
|
+
test_files: []
|
77
|
+
has_rdoc:
|