psousa (owner)

Revisions

gist: 137330 Download_button fork
public
Description:
this is a capistrano recipe for deploying with git, passenger
Public Clone URL: git://gist.github.com/137330.git
Embed All Files: show embed
deploy.rb example for capistrano and passenger #
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
set :application, "your_application_name"
set :deploy_to, "/home/a_user_on_your_server/apps/#{application}"
 
#############################################################
# Settings
#############################################################
 
default_run_options[:pty] = true
set :use_sudo, true
set :port, 22
 
#############################################################
# Servers
#############################################################
 
set :user, "your_remote_server_username"
set :domain, "your_remote_server_ip"
set :runner, "your_remote_server_username"
server domain, :app, :web
role :db, domain, :primary => true
 
 
#############################################################
# GIT
#############################################################
 
set :repository, "the_address_for_your_git_repository_with_your_project_source_code"
set :scm, "git"
ssh_options[:forward_agent] = true
set :branch, "master"
 
#############################################################
# Passenger
#############################################################
 
namespace :deploy do
  # Restart passenger on deploy
  desc "Restarting mod_rails with restart.txt"
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "touch #{current_path}/tmp/restart.txt"
  end
  
  [:start, :stop].each do |t|
    desc "#{t} task is a no-op with mod_rails"
    task t, :roles => :app do ; end
  end
  
end
 
#optional task so that you can manually restart whenever you want
namespace :passenger do
  desc "Restart Passenger Application"
  task :restart do
    run "touch #{current_path}/tmp/restart.txt"
  end
end
 
 
# task example to run after a successful deploy, use it to copy files, create symlinks and much more
#desc "after updating code, it copies production database yml"
#task :after_update_code, :roles=> :app do
# run "cp #{release_path}/config/production.database.yml #{release_path}/config/database.yml"
#end