lastobelus-vlad 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/.autotest ADDED
@@ -0,0 +1,24 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'autotest/restart'
4
+
5
+ Autotest.add_hook :initialize do |at|
6
+ at.testlib = "minitest/autorun"
7
+ # at.extra_files << "../some/external/dependency.rb"
8
+ #
9
+ # at.libs << ":../some/external"
10
+ #
11
+ # at.add_exception 'vendor'
12
+ #
13
+ # at.add_mapping(/dependency.rb/) do |f, _|
14
+ # at.files_matching(/test_.*rb$/)
15
+ # end
16
+ #
17
+ # %w(TestA TestB).each do |klass|
18
+ # at.extra_class_map[klass] = "test/test_misc.rb"
19
+ # end
20
+ end
21
+
22
+ # Autotest.add_hook :run_command do |at|
23
+ # system "rake build"
24
+ # end
data/History.txt ADDED
@@ -0,0 +1,162 @@
1
+ === 1.4.0 / 2009-06-23
2
+
3
+ * 1 major enhancement:
4
+
5
+ * Switched to passenger as default app server.
6
+
7
+ * 11 minor enhancements:
8
+
9
+ * #rsync now takes ANY number of arguments and expects to you add "host:".
10
+ * Added Rake::RemoteTask#get.
11
+ * Added doco for why we don't ship a deploy task
12
+ * Added links to example maintenance recipes
13
+ * Added multi-env doco to getting_started.txt
14
+ * Added svn-over-ssh faq item. gah.
15
+ * Flipped tests to minitest
16
+ * Merged global #role and Rake::RemoteTask::role.
17
+ * Moved all global methods to Rake::RemoteTask and wrote #external to clean up.
18
+ * Moved rake extensions to hoe so everyone can enjoy the fun.
19
+ * put names the tempfile based on the remote path to ease debugging
20
+
21
+ * 2 bug fixes:
22
+
23
+ * passenger:start_app wasn't using the latest_release path
24
+ * set/fetch wasn't dealing with a default of false well. (Seth Falcon)
25
+
26
+ === 1.3.2 / 2009-03-16
27
+
28
+ * 3 minor enhancements:
29
+
30
+ * Added 'Deploying Merb with Vlad' by Graham Ashton.
31
+ * Added 'Deploying Sinatra with Vlad' by Graham Ashton.
32
+ * Core update task calls update with the actual revision once again
33
+
34
+ * 1 bug fix:
35
+
36
+ * Fix Git checkout/export methods. (Wilson)
37
+
38
+ === 1.3.1 / 2009-03-06
39
+
40
+ * 4 minor enhancements:
41
+
42
+ * Added faq on how to clear/replace tasks. (mikehale)
43
+ * Added sudo_prompt variable.
44
+ * Added top level sudo method to compliment run. (woahdae)
45
+ * Set sudo_flags to default to ['-p Password:']. (mly)
46
+
47
+ * 3 bug fixes:
48
+
49
+ * Fixed prompts during rollback. (goodieboy)
50
+ * deploy_via went AWOL in subversion module.
51
+ * vlad:migrate ignored migrate_target directory. (tomklaasen)
52
+
53
+ === 1.3.0 / 2009-03-04
54
+
55
+ * 9 major enhancements:
56
+
57
+ * Added darcs support. (Brian Palmer)
58
+ * Added git support. (Garry Dolley)
59
+ * Added lighttpd support.
60
+ * Added merb support. (Jamie Macey)
61
+ * Added passenger support. (Alan Harper)
62
+ * Added/merged god, nginx, thin, and maintenance tasks. (github clusterfuck)
63
+ * Allow set to specify that a proc value is :per_thread.
64
+ * Apply Mercurial SCM support patch. Closes ticket 13475
65
+ * remote_task now supports args and supplies task (by Daniel P. Kionka).
66
+
67
+ * 19 minor enhancements:
68
+
69
+ * Add role toplevel method similar to namespace.
70
+ * Added #put method that wraps up Tempfile/rsync pattern.
71
+ * Added #role toplevel method, similar to #namespace.
72
+ * Added FAQ for using vlad through a gateway.
73
+ * Added Phil Hagelburg's one-line multi-stage deployment patch
74
+ * Added rake tracing for rsync command.
75
+ * Added umask variable.
76
+ * Adds specific order to loading. Should fix a number of bugs.
77
+ * Extended vladdemo.sh to allow for N simulated hosts (mostly for testing)
78
+ * Fixed tempfile dependency in #put if you don't load lighttpd or perforce (yipstar)
79
+ * Mercurial now automatically initializes the repository. (Jamie Macey)
80
+ * Moved everything over to put.
81
+ * Now requires rake 0.8.1+.
82
+ * Parameterized 'head' into 'revision' variable (with head as default).
83
+ * Split shared symlink creation to a separate task. (Steve Purcell)
84
+ * Support rake 0.8.
85
+ * Switched to ThreadGroup for Action#execute
86
+ * Updated rakefile for new hoe abilities
87
+ * remote_task :role now allows an empty list of hosts.
88
+
89
+ * 11 bug fixes:
90
+
91
+ * Fixed vladdemo.rb, now uses my checkout for further stress testing.
92
+ * Moved core recipe to front. Was breaking mongrel setup.
93
+ * Added automatic client setup for perforce.
94
+ * Fix mercurial support.
95
+ * Fixed 'too many files' error.
96
+ * Fixed a lame warning in the tests.
97
+ * Fixed cleanup to actually properly clean up.
98
+ * Fixed rake var doco
99
+ * Moved generic app setup to core from mongrel.
100
+ * SSH flags are now an Array for proper inclusion in the command. (Guillaume Pierronnet)
101
+ * git archive now specifically specifies tar format. (knaveofdiamonds)
102
+
103
+ === 1.1.1 / 2008-01-14
104
+
105
+ * 5 major enhancements:
106
+
107
+ * Support for Rake 0.8. Should still work for Rake 0.7.
108
+ * Added git support (contributed by Garry Dolley).
109
+ * Reviewed for accuracy by Evan Phoenix.
110
+ * Added lighttpd.rb
111
+ * Added automatic client setup for perforce.
112
+ * Added mercurial SCM support patch. Closes ticket 13475.
113
+
114
+ * 6 minor enhancements:
115
+
116
+ * Added #put method that wraps up Tempfile/rsync pattern.
117
+ * Added automatic p4 client setup for perforce.
118
+ * Added vladdemo.sh
119
+ * Moved everything over to put.
120
+ * Moved generic app setup to core from mongrel.
121
+ * Parameterized 'head' into 'revision' variable (with head as default).
122
+
123
+ * 1 bug fix
124
+
125
+ * Fixed cleanup to actually properly clean up.
126
+
127
+ === 1.1.0 / 2007-09-12
128
+
129
+ * 3 major enhancements:
130
+
131
+ * Vlad.load now takes a hash of recipe overrides, eg: Vlad.load :web => :nginx.
132
+ See rdoc for defaults.
133
+ * Removed vlad_tasks.rb and split into vlad/apache.rb, vlad/mongrel.rb,
134
+ and vlad/core.rb.
135
+ * The flog ratio between capistrano+deps / vlad+deps is pi (or, damn close)!
136
+
137
+ * 12 minor enhancements:
138
+
139
+ * Added $TRACE to make it more available and cleaner to read.
140
+ * Added :svn_cmd variable.
141
+ * Added Rake.clear_tasks *str_or_regexp
142
+ * Added debug and mana_from_heaven tasks to Rakefile.
143
+ * Added more documentation.
144
+ * Added :rsync_cmd and :rsync_flags.
145
+ * Added :ssh_cmd and :ssh_flags.
146
+ * Added variable expansion to vlad:debug task.
147
+ * Removed :scm variable. Now a Vlad.load component/flavor/need-a-word-here.
148
+ * Removed :application var. Use it if you want it. We don't require it.
149
+ * Renamed :p4cmd to :p4_cmd.
150
+ * Renamed :rake var to :rake_cmd.
151
+
152
+ * 2 (important) bug fixes:
153
+
154
+ * HUGE: Fixed sudo hang bug #13072. Fix suggested by Chris Van Pelt.
155
+ * HUGE: Vlad.load calls user config last, allowing variable overrides.
156
+ ACK! Sorry!
157
+
158
+ === 1.0.0 / 2007-08-04
159
+
160
+ * 1 major enhancement
161
+
162
+ * Birthday!
data/Manifest.txt ADDED
@@ -0,0 +1,38 @@
1
+ .autotest
2
+ History.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ considerations.txt
7
+ doco/deploying-merb-with-vlad.txt
8
+ doco/deploying-sinatra-with-vlad.txt
9
+ doco/faq.txt
10
+ doco/getting_started.txt
11
+ doco/migration.txt
12
+ doco/perforce.txt
13
+ doco/variables.txt
14
+ lib/rake_remote_task.rb
15
+ lib/vlad.rb
16
+ lib/vlad/apache.rb
17
+ lib/vlad/core.rb
18
+ lib/vlad/darcs.rb
19
+ lib/vlad/git.rb
20
+ lib/vlad/god.rb
21
+ lib/vlad/lighttpd.rb
22
+ lib/vlad/maintenance.rb
23
+ lib/vlad/merb.rb
24
+ lib/vlad/mercurial.rb
25
+ lib/vlad/mongrel.rb
26
+ lib/vlad/nginx.rb
27
+ lib/vlad/passenger.rb
28
+ lib/vlad/perforce.rb
29
+ lib/vlad/subversion.rb
30
+ lib/vlad/thin.rb
31
+ test/test_rake_remote_task.rb
32
+ test/test_vlad.rb
33
+ test/test_vlad_git.rb
34
+ test/test_vlad_mercurial.rb
35
+ test/test_vlad_perforce.rb
36
+ test/test_vlad_subversion.rb
37
+ test/vlad_test_case.rb
38
+ vladdemo.sh
data/README.txt ADDED
@@ -0,0 +1,78 @@
1
+ = Vlad the Deployer by the Ruby Hit Squad
2
+
3
+ * http://rubyhitsquad.com/
4
+ * http://rubyforge.org/projects/hitsquad/
5
+
6
+ == DESCRIPTION
7
+
8
+ Vlad the Deployer is pragmatic application deployment automation,
9
+ without mercy. Much like Capistrano, but with 1/10th the
10
+ complexity. Vlad integrates seamlessly with Rake, and uses familiar
11
+ and standard tools like ssh and rsync.
12
+
13
+ Impale your application on the heartless spike of the Deployer.
14
+
15
+ == FEATURES/PROBLEMS
16
+
17
+ * Full deployment automation stack.
18
+ * Turnkey deployment for mongrel+apache+svn.
19
+ * Supports single server deployment with just 3 variables defined.
20
+ * Built on rake. Easy. Engine is small.
21
+ * Very few dependencies. All simple.
22
+ * Uses ssh with your ssh settings already in place.
23
+ * Uses rsync for efficient transfers.
24
+ * Run remote commands on one or more servers.
25
+ * Mix and match local and remote tasks.
26
+ * Compatible with all of your tab completion shell script rake-tastic goodness.
27
+ * Ships with tests that actually pass in 0.028 seconds!
28
+ * Does NOT support Windows right now (we think). Coming soon in 1.2.
29
+
30
+ == SYNOPSIS
31
+
32
+ % rake vlad:setup # first time only
33
+ % rake vlad:update
34
+ % rake vlad:migrate # optional
35
+ % rake vlad:start
36
+
37
+ == REQUIREMENTS
38
+
39
+ * Rake
40
+ * Hoe
41
+ * Rubyforge
42
+ * open4
43
+
44
+ == INSTALL
45
+
46
+ * sudo gem install vlad
47
+
48
+ == SPECIAL THANKS
49
+
50
+ * First, of course, to Capistrano. For coming up with the idea and
51
+ providing a lot of meat for the recipes.
52
+ * Scott Baron for coming up with one of the best project names evar.
53
+ * Bradley Taylor for giving us permission to use RailsMachine recipes sans-LGPL.
54
+
55
+ == LICENSE
56
+
57
+ (The MIT License)
58
+
59
+ Copyright (c) 2007-2009 Ryan Davis and the rest of the Ruby Hit Squad
60
+
61
+ Permission is hereby granted, free of charge, to any person obtaining
62
+ a copy of this software and associated documentation files (the
63
+ 'Software'), to deal in the Software without restriction, including
64
+ without limitation the rights to use, copy, modify, merge, publish,
65
+ distribute, sublicense, and/or sell copies of the Software, and to
66
+ permit persons to whom the Software is furnished to do so, subject to
67
+ the following conditions:
68
+
69
+ The above copyright notice and this permission notice shall be
70
+ included in all copies or substantial portions of the Software.
71
+
72
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
73
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
74
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
75
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
76
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
77
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
78
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,44 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+
6
+ Hoe.plugin :seattlerb
7
+
8
+ Hoe.spec 'vlad' do
9
+ self.rubyforge_name = 'hitsquad'
10
+
11
+ developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
12
+ developer 'Eric Hodel', 'drbrain@segment7.net'
13
+ developer 'Wilson Bilkovich', 'wilson@supremetyrant.com'
14
+
15
+ extra_deps << ['rake', '>= 0.8.1']
16
+ extra_deps << 'open4'
17
+
18
+ multiruby_skip << "1.9" << "rubinius"
19
+ end
20
+
21
+ desc "quick little hack to see what the state of the nation looks like"
22
+ task :debug do
23
+ Vlad.load :config => "lib/vlad/subversion.rb"
24
+ set :repository, "repository path"
25
+ set :deploy_to, "deploy path"
26
+ set :domain, "server domain"
27
+
28
+ Rake::Task['vlad:debug'].invoke
29
+ end
30
+
31
+ task :mana_from_heaven do
32
+ # vlad = vlad + rake + open4
33
+ # rake sans-contrib = 2035.98356718206
34
+ vlad = `flog -s lib`.to_f + 2350.30744806517 + 502.363818023761
35
+ cap = 11480.3919695285
36
+ ratio = cap / vlad
37
+ target = cap / Math::PI
38
+
39
+ puts "%14.8f = %s" % [vlad, "vlad"]
40
+ puts "%14.8f = %s" % [ratio, "ratio"]
41
+ puts "%14.8f = %s" % [target - vlad, "needed delta"]
42
+ end
43
+
44
+ # 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
@@ -0,0 +1,155 @@
1
+ # Deploying Merb with Vlad
2
+
3
+ This tutorial has been adapted from [Deploying Merb with Vlad](http://effectif.com/articles/deploying-merb-with-vlad) by [Graham Ashton](http://effectif.com "Effectif Development").
4
+
5
+ You've built your Merb app, and you want to get it running on your web server. You could use Capistrano, but if you prefer the simple things in life you might find that [Vlad](http://rubyhitsquad.com/Vlad_the_Deployer.html "Vlad the Deployer") is a better fit.
6
+
7
+ This is a Merb version of the [Deploying Sinatra with Vlad](deploying-sinatra-with-vlad "Deploying Sinatra with Vlad") article that I wrote yesterday. There are big similarities to that article, but in this one we also look at how to restart Merb automatically after the code has been deployed.
8
+
9
+ ## Creating a sample application
10
+
11
+ Let's start by making ourselves a test app:
12
+
13
+ $ merb-gen flat hi
14
+ $ cd hi
15
+
16
+ We can check that the app works locally by running it...
17
+
18
+ $ merb
19
+
20
+ ...and then opening [http://localhost:4000](http://localhost:4000) in a web browser.
21
+
22
+ We need to create a `public` directory too (because this is a flat app I don't already have one), as Vlad assumes that we have a `public` directory for our static assets. I'm also going to make an empty CSS file so that the directory doesn't get ignored by Git:
23
+
24
+ $ mkdir public
25
+ $ touch public/master.css
26
+
27
+ We'll deploy our application from version control. I'm using Git, but you can use any system that Vlad supports; just check your files into a repository that will be accessible from your web server.
28
+
29
+ ## Configuring Vlad
30
+
31
+ Okay, we're ready for Vlad. It's a Ruby gem, so it's very easy to install:
32
+
33
+ $ sudo gem install vlad
34
+ Successfully installed vlad-1.2.0
35
+ 1 gem installed
36
+ Installing ri documentation for vlad-1.2.0...
37
+ Installing RDoc documentation for vlad-1.2.0...
38
+
39
+ There's no need to install Vlad on your server, just your workstation.
40
+
41
+ You access Vlad's functionality through Rake tasks. Add the following code to a file called `lib/tasks/vlad.rake` (you may have to make the directory first, but Merb will automatically find it):
42
+
43
+ begin
44
+ $TESTING = true # workaround a conflict between DataMapper and Vlad
45
+ require "vlad"
46
+ Vlad.load(:app => nil, :scm => "git")
47
+ rescue LoadError
48
+ # do nothing
49
+ end
50
+
51
+ Note that we've told Vlad that we intend to use Git (subversion is the default). We've set `:app` to `nil` as Vlad assumes that we'll run our application with `mongrel_rails` (it seems to think everybody who uses Mongrel is using Rails). Merb has support for clusters built in, so we'll setup some simple replacements later.
52
+
53
+ If you run `rake -T` now you should see a bunch of vlad tasks that are available to you. You can't run them yet; you need to configure Vlad. Create a `config/deploy.rb` file in your editor and set the following variables in it:
54
+
55
+ set :application, "hi"
56
+ set :repository, "ssh://your.git.server/path/to/project/hi.git"
57
+ set :domain, "your.web.server"
58
+ set :deploy_to, "/var/apps/#{application}"
59
+
60
+ Make sure that `:repository` correctly references your source control system, and that `:domain` is set to the hostname of your server.
61
+
62
+ I won't be able to create any directories under the `/var/apps` directory (I'm going to run vlad using my own username in this example), so I need to login to my server and make sure that I can create files in the `hi` directory:
63
+
64
+ $ ssh your.web.server
65
+ $ sudo mkdir -p /var/apps/hi
66
+ $ sudo chown yourusername /var/apps/hi
67
+
68
+ Now you can try running Vlad, to create all the directories necessary to serve your project. Back on your workstation, type:
69
+
70
+ $ rake vlad:setup
71
+
72
+ You should find that some directories have been created within `/var/apps/hi` on your server.
73
+
74
+ Let's trying deploying some code:
75
+
76
+ $ rake vlad:update
77
+ (in /Users/graham/data/effectif/projects/hi)
78
+ Initialized empty Git repository in /var/apps/hi/scm/repo/.git/
79
+ Switched to a new branch "deployed-HEAD"
80
+
81
+ You should now find that if you ssh into your server that you can run the application:
82
+
83
+ $ ssh your.web.server
84
+ $ cd /var/apps/hi/current
85
+ $ merb
86
+
87
+ Try making a change to your source, committing it to your repository, then run `vlad:update` again. Your code will be updated. If you restart Merb in the new directory you'll see your changes in the browser.
88
+
89
+ If you're following along with these commands, be careful that you're running `merb` in the freshly deployed directory. `current` is a symlink to a specific release directory, so you'll need to leave the directory and return to it to see the new source code (i.e. symlinks don't get updated under your shell's feet). This should do it:
90
+
91
+ $ cd ~ && cd -
92
+ $ merb
93
+
94
+ Okay, we're nearly there. All we need to do now is to automatically restart Merb when we deploy a new copy of the code with the `vlad:update` task. Add the following code to the bottom of your `config/deploy.rb` file:
95
+
96
+ Rake.clear_tasks("vlad:stop", "vlad:start")
97
+
98
+ namespace :vlad do
99
+ def stop
100
+ run "merb -m #{deploy_to}/current -K all"
101
+ end
102
+
103
+ def start
104
+ run "merb -m #{deploy_to}/current -e production -c 2"
105
+ end
106
+
107
+ remote_task :start, :roles => :app do
108
+ stop
109
+ start
110
+ end
111
+
112
+ remote_task :stop, :roles => :app do
113
+ stop
114
+ end
115
+
116
+ remote_task :update do
117
+ Rake::Task["vlad:start"].invoke
118
+ end
119
+ end
120
+
121
+ Note that in this example we've started a two process cluster with the `-c` option in the `start` method.
122
+
123
+ You'll find (with the `vlad:start` command I've shown above) that Merb is running on port 4000. If you want to run Merb on port 80 then I would recommend running these Merb processes behind Nginx, but I'll leave configuring Nginx as an exercise for the reader (Google will help you out there).
124
+
125
+ Let's just make sure that it's working. Run `rake vlad:update` a couple of times and check that Merb is getting stopped and started properly (it fails to stop Merb on the first run below simply because this was the first time I'd started it):
126
+
127
+ $ rake vlad:update
128
+ (in /Users/graham/data/effectif/projects/hi)
129
+ Loading init file from /Users/graham/data/effectif/projects/hi/config/init.rb
130
+ Initialized empty Git repository in /var/apps/hi/scm/repo/.git/
131
+ Switched to a new branch "deployed-HEAD"
132
+ ~ Could not find a PID file at /var/apps/hi/current/log/merb.main.pid. Most likely the process is no longer running and the pid file was not cleaned up.
133
+ ~ In 7643
134
+ $ rake vlad:update
135
+ (in /Users/graham/data/effectif/projects/hi)
136
+ Loading init file from /Users/graham/data/effectif/projects/hi/config/init.rb
137
+ Initialized empty Git repository in /var/apps/hi/scm/repo/.git/
138
+ Switched to a new branch "deployed-HEAD"
139
+ ~ Killing pid 7643 with INT
140
+ ~ In 7840
141
+
142
+ Now point your browser at port 4000 of your server – your application should be running!
143
+
144
+ ## Deploying from a Git branch
145
+
146
+ If you want to deploy from a specific Git branch (`master` is the default) you can set the `:revision` variable in `deploy.rb`:
147
+
148
+ set :revision, "origin/mybranch"
149
+
150
+ ## Deploying as a different user
151
+
152
+ It's not a great idea to deploy and run applications as your own login name (it's better practice to run web applications as users that don't have many privileges). I've not really addressed users in this article in order to focus on the basics of Vlad, but if you're interested you can deploy as a different user with these settings in `deploy.rb`:
153
+
154
+ set :user, "deploy"
155
+ set :domain, "#{user}@domain.com"