Capistrano DSL for highly customized deployment

75 views
Skip to first unread message

campesr

unread,
Nov 29, 2009, 11:50:54 AM11/29/09
to Capistrano
Hi everybody,

I'm curious whether it is possible to use Capistrano's DSL and general
foundation (roles, tasks, #run, #sudo, #put etc.) to build a custom
Rakefile/Capfile?

No automagic deploy:migrate tasks (especially for non-rails
projects!), no automagic 'mkdir -p (..)/release; ln -nfs (..)/
current'.

Just the bare foundation (task :deploy, :role => web do; upload
'file.txt', '...'; end) with all the goods (parallel exec, roles etc.)
for custom deployment? Is that possible?

Many thanks in advance.

Lee Hambley

unread,
Nov 29, 2009, 2:20:11 PM11/29/09
to capis...@googlegroups.com
Hi Campser,

I've addressed your points inline below.

I'm curious whether it is possible to use Capistrano's DSL and general
foundation (roles, tasks, #run, #sudo, #put etc.) to build a custom
Rakefile/Capfile?

Yes, of course - you can write your own task definitions using Run, run (with Sudo) and any of the other commands utilised by the core.
 
 
No automagic deploy:migrate tasks (especially for non-rails
projects!), no automagic 'mkdir -p (..)/release; ln -nfs (..)/
current'.

Would you propose we bundle migration calls for every possible way of migrating; or equip people with the tools to build their own? With regard to your second point I maintain a gem (railsless-deploy) which you can find on Github, or via the GemCutter site, this is everything you expect from a regular deploy, with no assumptions about your server/migrations, etc - you get clean, revision controlled releases with rollback.

There is a discussion ongoing about whether or not this is a smart thing to make the default for Capistrano; I suspect my notion that it should be the default will win out, especially as changes, and more options ship with future versions of rails.
 

Just the bare foundation (task :deploy, :role => web do; upload
'file.txt', '...'; end) with all the goods (parallel exec, roles etc.)
for custom deployment? Is that possible?

Yes, and most documented via examples (as there's actually not much to document about Capistrano 5/6 function calls and a handful of default configuration - which is why writing documentation is so difficult for it. (and RDoc is basically incapable of documenting a DSL implementation. The latest YARDoc (The Whole Nine) comes a lot closer to what we need, but none of the active contributors (that's me and Rafael G.) don't have the time to do it all.

Many thanks in advance.

I suggest you take a look at my railsless deploy script; it's one Ruby file packaged up in a gem; and its the default file with things removed. Take a look, outside the context of the whole of Capistrano's core (which is horrible to read!) the railsless deploy is a pretty light thing to read through; I also preserved & modified the comments in the code, so you shouldn't struggle at all.

-- Lee Hambley

Twitter: @leehambley | @capistranorb
Blog: http://lee.hambley.name/
Working with Rails: http://is.gd/1s5W1

campesr

unread,
Nov 29, 2009, 3:40:11 PM11/29/09
to Capistrano
Wow, thanks a lot for that eloquent answer.

I'll be looking at your railsless gem; seems it's exactly what I've
been looking for.

> There is a discussion ongoing about whether or not this is a smart thing to
> make the default for Capistrano; I suspect my notion that it should be the
> default will win out, especially as changes, and more options ship with
> future versions of rails.

I'd also support a target-agnostic development-_tool_ for developers
(be it Ruby, PHP or ... Java). The notion of agnosticism lurking
around in the Ruby / Rails / Merb / etc. community at the moment, is
great as I think: great tools, unified SPECS = DRY RAD.

Thanks again for your time.

Cheers.

Pharrisee

unread,
Nov 30, 2009, 10:55:27 AM11/30/09
to Capistrano
As a bit of an aside, I'm using capistrano as the basis for a whole
toolset for staging between IBM WebSphere Portal servers/clusters:

Integration cluster, vertical 2 node cluster (1 physical server)
Preprod, vertical and horizontal 4 node cluster (2 physical servers)
Production, vertical and horizontal 4 node cluster (2 physical
servers)
DR (hot standby), vertical and horizontal 4 node cluster (2 physical
servers)

my usage of capistrano is probable very simple but as an automation
tool I've not come across any easier tool.

this is an abridged list of my tasks:

activate_portlets, add_welsh, build_deployables, build_english,
build_welsh, checkout_langs, collapse_wps, deploy_langs,
deploy_themes, deploy_wcm, do_welsh_stuff, dowcm, editwcm,
empty_portal, expand_deployables, expand_wps, export_portal,
export_wps, fix_config, fix_peoplefinder, get_portlets, get_xmlfiles,
getwcm, import_portal, importwcm, install_wps, put_xmlfiles, putwcm,
remove_deployables, remove_wps, remove_wps_expanded, restart_portals,
stage, stage_no_export, start1, start_clone01, start_clone02,
start_portals, status, status1, statusdm, stop1, stop_clone01,
stop_clone02, stop_portals, sync1, sync_portals, transfer_portlets,
upload_deployables, webSphere61_fix

As you can see there's quite a lot there, ranging from simple stop/
start tasks thru to building configuration files and transforming xml
config files with xslt.

I'm not sure whether cap is the right tool for provisioning servers,
but for the right tasks it can't be beat.
Reply all
Reply to author
Forward
0 new messages