gabrielg-vlad 1.2.0

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/History.txt ADDED
@@ -0,0 +1,69 @@
1
+ == 1.3.0 / ??
2
+
3
+ * N major enhancements:
4
+ * Added darcs support. Patch #14141 by Brian Palmer.
5
+ * Added merb support. Patch #17455 by Jamie Macey.
6
+ * remote_task now supports arguments and supplies task like rake 0.8. Patch
7
+ by Daniel P. Kionka.
8
+ * N minor enhancements:
9
+ * Added #role toplevel method, similar to #namespace.
10
+ * Mercurial now automatically initializes the repository. Patch #17429 by
11
+ Jamie Macey.
12
+ * Basic passenger support. Patch 20743 by Alan Harper.
13
+ * Split shared symlink creation to a separate task. Patch #18158 by Steve
14
+ Purcell.
15
+ * remote_task :role now allows an empty list of hosts. Patch by Daniel P.
16
+ Kionka.
17
+ * N bug fixes:
18
+ * SSH flags are now an Array for proper inclusion in the command. Patch
19
+ #19513 by Guillaume Pierronnet.
20
+
21
+ == 1.1.1 / 2008-01-14
22
+
23
+ * 5 major enhancements:
24
+ * Support for Rake 0.8. Should still work for Rake 0.7.
25
+ * Added git support (contributed by Garry Dolley).
26
+ * Reviewed for accuracy by Evan Phoenix.
27
+ * Added lighttpd.rb
28
+ * Added automatic client setup for perforce.
29
+ * Added mercurial SCM support patch. Closes ticket 13475.
30
+ * 6 minor enhancements:
31
+ * Added #put method that wraps up Tempfile/rsync pattern.
32
+ * Added automatic p4 client setup for perforce.
33
+ * Added vladdemo.sh
34
+ * Moved everything over to put.
35
+ * Moved generic app setup to core from mongrel.
36
+ * Parameterized 'head' into 'revision' variable (with head as default).
37
+ * 1 bug fix
38
+ * Fixed cleanup to actually properly clean up.
39
+
40
+ == 1.1.0 / 2007-09-12
41
+
42
+ * 3 major enhancements:
43
+ * Vlad.load now takes a hash of recipe overrides, eg: Vlad.load :web => :nginx.
44
+ See rdoc for defaults.
45
+ * Removed vlad_tasks.rb and split into vlad/apache.rb, vlad/mongrel.rb,
46
+ and vlad/core.rb.
47
+ * The flog ratio between capistrano+deps / vlad+deps is pi (or, damn close)!
48
+ * 12 minor enhancements:
49
+ * Added $TRACE to make it more available and cleaner to read.
50
+ * Added :svn_cmd variable.
51
+ * Added Rake.clear_tasks *str_or_regexp
52
+ * Added debug and mana_from_heaven tasks to Rakefile.
53
+ * Added more documentation.
54
+ * Added :rsync_cmd and :rsync_flags.
55
+ * Added :ssh_cmd and :ssh_flags.
56
+ * Added variable expansion to vlad:debug task.
57
+ * Removed :scm variable. Now a Vlad.load component/flavor/need-a-word-here.
58
+ * Removed :application var. Use it if you want it. We don't require it.
59
+ * Renamed :p4cmd to :p4_cmd.
60
+ * Renamed :rake var to :rake_cmd.
61
+ * 2 (important) bug fixes:
62
+ * HUGE: Fixed sudo hang bug #13072. Fix suggested by Chris Van Pelt.
63
+ * HUGE: Vlad.load calls user config last, allowing variable overrides.
64
+ ACK! Sorry!
65
+
66
+ == 1.0.0 / 2007-08-04
67
+
68
+ * 1 major enhancement
69
+ * Birthday!
data/Manifest.txt ADDED
@@ -0,0 +1,28 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ considerations.txt
6
+ doco/faq.txt
7
+ doco/getting_started.txt
8
+ doco/migration.txt
9
+ doco/perforce.txt
10
+ doco/variables.txt
11
+ lib/rake_remote_task.rb
12
+ lib/vlad.rb
13
+ lib/vlad/apache.rb
14
+ lib/vlad/core.rb
15
+ lib/vlad/git.rb
16
+ lib/vlad/lighttpd.rb
17
+ lib/vlad/mercurial.rb
18
+ lib/vlad/mongrel.rb
19
+ lib/vlad/perforce.rb
20
+ lib/vlad/subversion.rb
21
+ test/test_rake_remote_task.rb
22
+ test/test_vlad.rb
23
+ test/test_vlad_git.rb
24
+ test/test_vlad_mercurial.rb
25
+ test/test_vlad_perforce.rb
26
+ test/test_vlad_subversion.rb
27
+ test/vlad_test_case.rb
28
+ vladdemo.sh
data/README.txt ADDED
@@ -0,0 +1,77 @@
1
+ = Vlad the Deployer
2
+ * http://rubyhitsquad.com/
3
+ * http://rubyforge.org/projects/hitsquad/
4
+
5
+ == DESCRIPTION:
6
+
7
+ Vlad the Deployer is pragmatic application deployment automation,
8
+ without mercy. Much like Capistrano, but with 1/10th the
9
+ complexity. Vlad integrates seamlessly with Rake, and uses familiar
10
+ and standard tools like ssh and rsync.
11
+
12
+ Impale your application on the heartless spike of the Deployer.
13
+
14
+ == FEATURES/PROBLEMS:
15
+
16
+ * Full deployment automation stack.
17
+ * Turnkey deployment for mongrel+apache+svn.
18
+ * Supports single server deployment with just 3 variables defined.
19
+ * Built on rake. Easy. Engine is small.
20
+ * Very few dependencies. All simple.
21
+ * Uses ssh with your ssh settings already in place.
22
+ * Uses rsync for efficient transfers.
23
+ * Run remote commands on one or more servers.
24
+ * Mix and match local and remote tasks.
25
+ * Compatible with all of your tab completion shell script rake-tastic goodness.
26
+ * Ships with tests that actually pass in 0.028 seconds!
27
+ * Does NOT support Windows right now (we think). Coming soon in 1.2.
28
+
29
+ == SYNOPSIS:
30
+
31
+ % rake vlad:setup # first time only
32
+ % rake vlad:update
33
+ % rake vlad:migrate # optional
34
+ % rake vlad:start
35
+
36
+ == REQUIREMENTS:
37
+
38
+ * Rake
39
+ * Hoe
40
+ * Rubyforge
41
+ * open4
42
+
43
+ == INSTALL:
44
+
45
+ * sudo gem install -y vlad
46
+
47
+ == SPECIAL THANKS:
48
+
49
+ * First, of course, to Capistrano. For coming up with the idea and
50
+ providing a lot of meat for the recipes.
51
+ * Scott Baron for coming up with one of the best project names evar.
52
+ * Bradley Taylor for giving us permission to use RailsMachine recipes sans-LGPL.
53
+
54
+ == LICENSE:
55
+
56
+ (The MIT License)
57
+
58
+ Copyright (c) 2007 Ryan Davis and the rest of the Ruby Hit Squad
59
+
60
+ Permission is hereby granted, free of charge, to any person obtaining
61
+ a copy of this software and associated documentation files (the
62
+ 'Software'), to deal in the Software without restriction, including
63
+ without limitation the rights to use, copy, modify, merge, publish,
64
+ distribute, sublicense, and/or sell copies of the Software, and to
65
+ permit persons to whom the Software is furnished to do so, subject to
66
+ the following conditions:
67
+
68
+ The above copyright notice and this permission notice shall be
69
+ included in all copies or substantial portions of the Software.
70
+
71
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
72
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
73
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
74
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
75
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
76
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
77
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,59 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ $: << 'lib'
6
+ require 'vlad'
7
+
8
+ hoe = Hoe.spec('gabrielg-vlad') do |vlad|
9
+ vlad.version = Vlad::VERSION
10
+ vlad.rubyforge_name = 'hitsquad'
11
+
12
+ vlad.developer('Ryan Davis', 'ryand-ruby@zenspider.com')
13
+ vlad.developer('Eric Hodel', 'drbrain@segment7.net')
14
+ vlad.developer('Wilson Bilkovich', 'wilson@supremetyrant.com')
15
+
16
+ vlad.extra_deps << ['rake', '>= 0.8.1']
17
+ vlad.extra_deps << 'open4'
18
+
19
+ vlad.multiruby_skip << "1.9" << "rubinius"
20
+
21
+ end
22
+
23
+
24
+ task :gemspec do
25
+ File.open("#{hoe.name}.gemspec", "w") {|f| f << hoe.spec.to_ruby }
26
+ end
27
+
28
+ desc "quick little hack to see what the state of the nation looks like"
29
+ task :debug do
30
+ Vlad.load :config => "lib/vlad/subversion.rb"
31
+ set :repository, "repository path"
32
+ set :deploy_to, "deploy path"
33
+ set :domain, "server domain"
34
+
35
+ Rake::Task['vlad:debug'].invoke
36
+ end
37
+
38
+ task :flog do
39
+ sh 'flog -s lib'
40
+ end
41
+
42
+ task :flog_full do
43
+ sh 'flog -a lib'
44
+ end
45
+
46
+ task :mana_from_heaven do
47
+ # vlad = vlad + rake + open4
48
+ # rake sans-contrib = 2035.98356718206
49
+ vlad = `flog -s lib`.to_f + 2350.30744806517 + 502.363818023761
50
+ cap = 11480.3919695285
51
+ ratio = cap / vlad
52
+ target = cap / Math::PI
53
+
54
+ puts "%14.8f = %s" % [vlad, "vlad"]
55
+ puts "%14.8f = %s" % [ratio, "ratio"]
56
+ puts "%14.8f = %s" % [target - vlad, "needed delta"]
57
+ end
58
+
59
+ # vim: syntax=Ruby
@@ -0,0 +1,91 @@
1
+ * might we want per connection values?
2
+
3
+ * :except => {:no_release => true}
4
+
5
+ It is common to configure tasks to 'announce' deployments in IRC, Campfire,
6
+ etc. If you have 6 app servers, you don't want to see 6 announcements. In
7
+ Capistrano, this is handled via the :no_release => true flag. Various tasks
8
+ only execute on the 'release' servers.
9
+
10
+ An easier way to meet this would be to introduce a :release role in the
11
+ default setup
12
+
13
+ role :release, "app1.example.com"
14
+
15
+ remote_task :announce_in_irc, :roles => :release ...
16
+
17
+ Drawback: Yet another thing to change when you migrate a project from cap to
18
+ vlad
19
+
20
+ * 'dynamic deployments'
21
+
22
+ role :app, "app1.example.com"
23
+ role :app, "app2.example.com"
24
+
25
+ Let's say that app1 and app2 need slightly different monit configurations.
26
+
27
+ In Capistrano, you might approach this by making two additional roles, and
28
+ splitting your 'push a monit config' task into two. This sucks.
29
+
30
+ Vlad makes the 'execution context' of a task available. In Vlad, you would:
31
+
32
+ remote_task :update_monit, :roles => :app
33
+ rsync "templates/#{target_host}.monitrc", "/etc/monitrc"
34
+ end
35
+
36
+ * fine-grained tasks
37
+
38
+ remote_task :update
39
+ remote_task :symlink
40
+ remote_task :migrate
41
+ remote_task :deploy => [:update, :symlink, :migrate, :restart]
42
+
43
+ Let's assume that this is a multi-server config with shared deploy path.
44
+ The user wants to do only a single checkout. If we make "update" be one big
45
+ task body that includes the update, symlink, and migrate steps,
46
+ it is difficult for the user to override the roles for the particular steps
47
+ they need to change.
48
+
49
+ If we break these into separate tasks, they can say:
50
+
51
+ Rake::Task["migrate"].options[:roles] = :master_db
52
+
53
+ and the migrations will only run on the master db
54
+
55
+ * sudo / via how? and if we call it via I will stab ppl. "user" is sufficient.
56
+
57
+ * handling 'use_sudo'
58
+
59
+ 1. Check for this inside the 'run' command, and preface the command
60
+ with 'sudo' if necessary
61
+
62
+ 2. Default this to 'false' in the reset method, and check for it
63
+ in the default tasks that we provide:
64
+ if use_sudo then
65
+ sudo "blah"
66
+ else
67
+ run "blah"
68
+ end
69
+
70
+ Option 2 has fewer moving parts, but clutters up the tasks that care about
71
+ this.
72
+
73
+ * Dependencies
74
+
75
+ Task dependencies aren't settable when creating a Rake::RemoteTask.
76
+
77
+ * Apache configuration
78
+
79
+ Pull in railsmachine/rails/recipes/apache.rb's apache configuration. Needs
80
+ erb to work.
81
+
82
+ * I really like tasks with naming <cmd>_<role> (eg setup_app,
83
+ start_web). We could easily make the front end remote_task command
84
+ look for such a convention and apply the :role => x automatically.
85
+
86
+ * from bousquet: get a couple of server environment recipes that prepare your
87
+ machine that would be the golden ticket:
88
+
89
+ rake vlad:prepare TYPE=accelerator | ubuntu | osx | osxserver | site5 | ...
90
+
91
+ and have people maintaining those setups who depend on them
data/doco/faq.txt ADDED
@@ -0,0 +1,81 @@
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 are there no before_action and after_action hooks?
9
+ === A: Because we use rake!
10
+
11
+ 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...
12
+
13
+ To extend a task (adding something after), just define it again:
14
+
15
+ task :action1 do
16
+ puts "one fish, two fish"
17
+ end
18
+
19
+ task :action1 do
20
+ puts "red fish, blue fish"
21
+ end
22
+
23
+ To prepend on a task, add a dependency:
24
+
25
+ task :action2 do
26
+ puts "red fish, blue fish"
27
+ end
28
+
29
+ task :myaction do
30
+ puts "one fish, two fish"
31
+ end
32
+
33
+ task :action2 => :myaction
34
+
35
+ === Q: How do I invoke another rule?
36
+ === A: The easiest way is via dependencies.
37
+
38
+ task :shazam! => [:action1, :action2]
39
+
40
+ The other way is to look it up and call invoke:
41
+
42
+ task :shazam! do
43
+ Rake::Task[:action1].invoke
44
+ Rake::Task[:action2].invoke
45
+ end
46
+
47
+ (Or, cheat and call out to rake again: sh "rake action1")
48
+
49
+ == Using SSH
50
+
51
+ === Q: Is there any way to set the ssh user?
52
+ === A: Yes, using ~/.ssh/config
53
+
54
+ Host example.com
55
+ User fluffy_bunny
56
+
57
+ OR: Alternatively, you can do this within your recipes like so:
58
+
59
+ set :user, "fluffy_bunny"
60
+ set :domain, "#{user}@example.com"
61
+
62
+ === Q: Is there any way to speed up ssh connections?
63
+ === A: Yes, add to your Host entry in ~/.ssh/config:
64
+
65
+ ControlMaster auto
66
+ ControlPath ~/.ssh/master-%r@%h:%p
67
+
68
+ === Q: I'm tired of typing in my password!
69
+ === A: Me too!
70
+
71
+ Put a password on your key, distribute your public key to the server and then use ssh-agent.
72
+
73
+ Check out this tiny tutorial at LBL: A brief ssh-agent tutorial <http://upc.lbl.gov/docs/user/sshagent.html>
74
+
75
+ 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.
76
+
77
+ === Q: How do I use Vlad with a gateway?
78
+ === A: Add the following to your deploy.rb variables:
79
+
80
+ set :ssh_flags, "-A #{mygateway}"
81
+ set :rsync_flags, "--rsh ssh -A #{mygateway} ssh"
@@ -0,0 +1,41 @@
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
+ * Add the following to your Rakefile:
18
+
19
+ begin
20
+ require 'vlad'
21
+ Vlad.load
22
+ rescue LoadError
23
+ # do nothing
24
+ end
25
+
26
+ Vlad.load has a lot of flexibility. See the rdoc for full information.
27
+
28
+ You don't need the begin/rescue/end block if you ensure that Vlad is
29
+ installed on all your servers. To be lazy, you can install vlad via:
30
+
31
+ % rake vlad:invoke COMMAND='sudo gem install vlad -y'
32
+
33
+ === Initial Launch
34
+
35
+ * Run <tt>rake vlad:setup vlad:update vlad:migrate vlad:start</tt>
36
+
37
+ === Subsequent Updates:
38
+
39
+ * <tt>rake vlad:update vlad:migrate vlad:start</tt>
40
+
41
+ Each step may be run separately.