nuex-vlad 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/doco/faq.txt ADDED
@@ -0,0 +1,131 @@
1
+ == Rake & Recipes
2
+
3
+ === Q: Why is there no vlad:restart?
4
+ === A: It is cleaner!
5
+
6
+ We don't want to have to think about what state we're in and where. So vlad:start does a restart if necessary. Restart is just "start again" after all... That is what start does.
7
+
8
+ === Q: Why is there no vlad:deploy?
9
+ === A: Because everyone is a unique beautiful flower.
10
+
11
+ Everyone's deployment is different. Everyone. Unique scaling
12
+ requirements. Yadda yadda yadda. So rather than supply something that
13
+ nobody will use, we decided not to supply anything at all. Here is an
14
+ example deploy that I stole from the web (and improved) that you may like:
15
+
16
+ desc "Full deployment cycle"
17
+ task "vlad:deploy" => %w[
18
+ vlad:update
19
+ vlad:migrate
20
+ vlad:reset_session
21
+ vlad:start
22
+ vlad:cleanup
23
+ ]
24
+
25
+ Just pop that in your config/deploy.rb, tweak it as necessary, and have at it.
26
+
27
+ === Q: Why are there no before_action and after_action hooks?
28
+ === A: Because we use rake!
29
+
30
+ Rake don't need no stinkin' hooks! They're too clever. Last I checked before_after_before_start worked in cap... how? why? I dunno...
31
+
32
+ To extend a task (adding something after), just define it again:
33
+
34
+ task :action1 do
35
+ puts "one fish, two fish"
36
+ end
37
+
38
+ task :action1 do
39
+ puts "red fish, blue fish"
40
+ end
41
+
42
+ To prepend on a task, add a dependency:
43
+
44
+ task :action2 do
45
+ puts "red fish, blue fish"
46
+ end
47
+
48
+ task :myaction do
49
+ puts "one fish, two fish"
50
+ end
51
+
52
+ task :action2 => :myaction
53
+
54
+ === Q: How can I replace a rake task instead of just adding to it?
55
+ === A: Use Rake.clear_tasks str_or_regexp
56
+
57
+ namespace :vlad do
58
+ # Clear existing update task so that we can redefine instead of adding to it.
59
+ Rake.clear_tasks('vlad:update')
60
+
61
+ remote_task :update, :roles => :app do
62
+ #custom update stuff
63
+ end
64
+ end
65
+
66
+ === Q: How do I invoke another rule?
67
+ === A: The easiest way is via dependencies.
68
+
69
+ task :shazam! => [:action1, :action2]
70
+
71
+ The other way is to look it up and call invoke:
72
+
73
+ task :shazam! do
74
+ Rake::Task[:action1].invoke
75
+ Rake::Task[:action2].invoke
76
+ end
77
+
78
+ (Or, cheat and call out to rake again: sh "rake action1")
79
+
80
+ == Using SSH
81
+
82
+ === Q: Is there any way to set the ssh user?
83
+ === A: Yes, using ~/.ssh/config
84
+
85
+ Host example.com
86
+ User fluffy_bunny
87
+
88
+ OR: Alternatively, you can do this within your recipes like so:
89
+
90
+ set :user, "fluffy_bunny"
91
+ set :domain, "#{user}@example.com"
92
+
93
+ === Q: Is there any way to speed up ssh connections?
94
+ === A: Yes, add to your Host entry in ~/.ssh/config:
95
+
96
+ ControlMaster auto
97
+ ControlPath ~/.ssh/master-%r@%h:%p
98
+
99
+ === Q: I'm tired of typing in my password!
100
+ === A: Me too!
101
+
102
+ Put a password on your key, distribute your public key to the server and then use ssh-agent.
103
+
104
+ Check out this tiny tutorial at LBL: A brief ssh-agent tutorial <http://upc.lbl.gov/docs/user/sshagent.html>
105
+
106
+ If you're on a mac (on tiger, not leopard), use SSHKeychain, we love it. <http://www.sshkeychain.org/>. If you are on leopard, you get all of this for free.
107
+
108
+ === Q: How do I use Vlad with a gateway?
109
+ === A: Add the following to your deploy.rb variables:
110
+
111
+ set :ssh_flags, "-A #{mygateway}"
112
+ set :rsync_flags, "--rsh ssh -A #{mygateway} ssh"
113
+
114
+ === Q: OMG subversion is stupid! It keeps asking for "Authentication Realm"
115
+ === A: Yes, yes it is.
116
+
117
+ If you're seeing local checkouts work fine but they don't over ssh
118
+ (even to localhost!) then ssh into that machine (yes, even localhost)
119
+ and do a checkout there to a temporary directory. From then on,
120
+ checkout over ssh should work fine.
121
+
122
+ % svn co https://blah/blah /tmp/happy
123
+ ... works fine ...
124
+ % ssh localhost svn co https://blah/blah /tmp/sad
125
+ ... asks for authentication and then hangs ...
126
+ % ssh localhost
127
+ % svn co https://blah/blah /tmp/sad-no-happy
128
+ ... asks for authentication ...
129
+ ... works fine ...
130
+ % ssh localhost svn co https://blah/blah /tmp/happy2
131
+ ... works fine ...
@@ -0,0 +1,61 @@
1
+
2
+ == Quick Start for a 1-Server Solution:
3
+
4
+ === Setup
5
+
6
+ * Create a deploy file, usually in "config/deploy.rb":
7
+
8
+ set :application, "project"
9
+ set :domain, "example.com"
10
+ set :deploy_to, "/path/to/install"
11
+ set :repository, 'http://svn.example.com/project/branches/stable/'
12
+
13
+ This defaults to using 'svn export' from +repository+, and a single
14
+ server for +app+, +db+, and +www+. If you need to tweak these things,
15
+ refer to the variable documentation.
16
+
17
+ * If you want a multi-config environment, change your config like so:
18
+
19
+ set :application, "project"
20
+ set :repository, 'http://svn.example.com/project/branches/stable/'
21
+
22
+ task :beta do
23
+ set :domain, "beta.example.com"
24
+ set :deploy_to, "/path/to/install-beta"
25
+ end
26
+
27
+ task :dev do
28
+ set :domain, "dev.example.com"
29
+ set :deploy_to, "/path/to/install-dev"
30
+ end
31
+
32
+ task :prod do
33
+ set :domain, "example.com"
34
+ set :deploy_to, "/path/to/install"
35
+ end
36
+
37
+ * Add the following to your Rakefile:
38
+
39
+ begin
40
+ require 'vlad'
41
+ Vlad.load
42
+ rescue LoadError
43
+ # do nothing
44
+ end
45
+
46
+ Vlad.load has a lot of flexibility. See the rdoc for full information.
47
+
48
+ You don't need the begin/rescue/end block if you ensure that Vlad is
49
+ installed on all your servers. To be lazy, you can install vlad via:
50
+
51
+ % rake vlad:invoke COMMAND='sudo gem install vlad -y'
52
+
53
+ === Initial Launch
54
+
55
+ * Run <tt>rake vlad:setup vlad:update vlad:migrate vlad:start</tt>
56
+
57
+ === Subsequent Updates:
58
+
59
+ * <tt>rake vlad:update vlad:migrate vlad:start</tt>
60
+
61
+ Each step may be run separately.
@@ -0,0 +1,43 @@
1
+ == Converting from Capistrano
2
+
3
+ * 'set scm' is removed. Vlad.load :scm => :something if you don't use subversion.
4
+ * 'task' blocks are renamed to 'remote_task'.
5
+ * Most variables are the same. See variables.txt for details.
6
+ * No +with_command+ / +sudo+ / +via+ wonkiness
7
+ * Uses real ssh so env vars and the like are not a problem
8
+ - no +with_env+ as a result.
9
+ * Vlad doesn't use ':no_release' or ':primary'.
10
+ - If you have a task that needs to run on only one host from a role,
11
+ you should declare a new role for that host:
12
+
13
+ role :master_db, "master.example.com"
14
+
15
+ ..and then override the role for the task you want to limit:
16
+
17
+ Rake::Task["mytask"].options[:roles] = :master_db
18
+
19
+ * The 'host' method can be used to consolidate multiple 'role' calls.
20
+ - host "www.example.com", :app, :web, :db
21
+ specifies a host with three roles.
22
+ * migrate_env is now migrate_args.
23
+ * Vlad doesn't have before/after magic add-on tasks.
24
+
25
+ == BEFORE:
26
+
27
+ set :application, "rubyholic"
28
+ set :domain, "zenspider.textdriven.com"
29
+ set :repository, "svn://svn.example.com/rubyholic/branches/stable"
30
+ set :deploy_to, "/users/home/zenspider/domains/new.rubyholic.com"
31
+
32
+ set :user, "zenspider"
33
+ set :use_sudo, false
34
+
35
+ role :web, domain
36
+ role :app, domain
37
+ role :db, domain, :primary => true
38
+
39
+ == AFTER:
40
+
41
+ set :domain, "zenspider.textdriven.com"
42
+ set :repository, "svn://svn.example.com/rubyholic/branches/stable"
43
+ set :deploy_to, "/users/home/zenspider/domains/new.rubyholic.com"
data/doco/perforce.txt ADDED
@@ -0,0 +1,5 @@
1
+ # Using Perforce
2
+
3
+ TODO: write real doco.
4
+
5
+ Set up a .p4config file and put it in the client's scm directories.
@@ -0,0 +1,79 @@
1
+
2
+ == Core Variables
3
+
4
+ repository:: REQUIRED: Repository path: e.g. http://repo.example.com/svn
5
+ deploy_to:: REQUIRED: Deploy path on target machines. e.g. /var/www/app
6
+ domain:: REQUIRED: Used for the common case of a single target
7
+ server. e.g. example.com
8
+ current_path:: The full path on the remote host that will be symlinked
9
+ as 'current'. Defaults to "#{deploy_to}/current".
10
+ current_release:: The full path to the current release's actual location.
11
+ Defaults to "#{releases_path}/#{releases.last}".
12
+ deploy_timestamped:: Create timestamped release directories instead of using
13
+ revision numbers. Defaults to true.
14
+ deploy_via:: Which SCM command should be used when deploying the app.
15
+ Defaults to "export".
16
+ latest_release:: The most recent release, which may not yet have been
17
+ symlinked. Defaults to release_path.
18
+ migrate_args:: Set this to change the RAILS_ENV that 'rake db:migrate'
19
+ will run under. Defaults to "".
20
+ migrate_target:: Set this if you need to specify a particular migration
21
+ 'VERSION' number. Defaults to "latest".
22
+ rails_env:: Specifies the RAILS_ENV environment variable that will
23
+ be used. Defaults to "production".
24
+ rake_cmd:: Set this if you need to specify an alternate path to
25
+ 'rake'. Defaults to "rake".
26
+ release_name:: Name of the release directory, if deploy_timestamped is
27
+ true. Defaults to timestamp: "YYYYMMDDHHMMSS".
28
+ release_path:: Path to this release, which may not have been created
29
+ yet. Defaults to "#{releases_path}/#{release_name}".
30
+ releases:: An array of all existing releases, oldest first.
31
+ Defaults to latest release directory name.
32
+ releases_path:: Full path to the 'releases' directory on the remote host.
33
+ Defaults to "#{deploy_to}/releases".
34
+ revision:: Revision to use for release. Defaults to 'head'.
35
+ rsync_cmd:: Path to rsync command. Defaults to "rsync".
36
+ rsync_flags:: Flags for rsync. Defaults to ['-azP', '--delete'].
37
+ scm_path:: Path on the remote host that will be used as 'working
38
+ space' for SCM tasks. Defaults to "#{deploy_to}/scm".
39
+ shared_path:: Full path to remote 'shared' directory, symlinked into
40
+ your app by default. Defaults to "#{deploy_to}/shared".
41
+ ssh_cmd:: Path to ssh. Defaults to "ssh".
42
+ ssh_flags:: Flags for ssh. Defaults to [].
43
+ sudo_cmd:: Path to sudo command. Defaults to "sudo".
44
+ sudo_flags:: Flogs for sudo. Defaults to ["-p Password:"].
45
+ sudo_prompt:: Regexp for sudo password prompt. Defaults to /^Password:/.
46
+ sudo_password:: Asks for password when referenced.
47
+ umask:: Sets your umask value. Defaults to "02".
48
+
49
+ == Apache Web Variables:
50
+
51
+ web_command:: Command to execute when controlling the web server.
52
+ Defaults to "apachectl".
53
+
54
+ == Mongrel App Variables:
55
+
56
+ mongrel_address:: Defaults to "127.0.0.1"
57
+ mongrel_clean:: Defaults to false
58
+ mongrel_command:: Defaults to 'mongrel_rails'
59
+ mongrel_conf:: Defaults to "#{shared_path}/mongrel_cluster.conf"
60
+ mongrel_config_script:: Defaults to nil
61
+ mongrel_environment:: Defaults to "production"
62
+ mongrel_group:: Defaults to nil
63
+ mongrel_log_file:: Defaults to nil
64
+ mongrel_pid_file:: Defaults to nil
65
+ mongrel_port:: Defaults to 8000
66
+ mongrel_prefix:: Defaults to nil
67
+ mongrel_servers:: Defaults to 2
68
+ mongrel_user:: Defaults to nil
69
+
70
+ == Perforce SCM Variables:
71
+
72
+ p4_cmd:: The perforce command to use. Defaults to "p4"
73
+ source:: A perforce SCM worker instance.
74
+
75
+ == Subversion SCM Variables:
76
+
77
+ source:: A subversion SCM worker instance.
78
+ svn_cmd:: The subversion command to use. Defaults to "svn"
79
+