- Do not require the user to patch Capistrano.
- Make the usage of WinRM in the Capfile as seamless as possible.
To accomplish what I wanted I had to override some methods within Capistrano to inject WinRM functionality. The end result adds a winrm command that should work almost identical to Capistrano's own run command. It should also allow your current Capfile to run unmodified if you do not have any winrm tasks.
To define a WinRM task you can simply do this:
winrm also supports using blocks just like run so you can format your output a bit better like so:
There you have it. As long is WinRM is configured on the remote Windows systems you can now manage them with your Capistrano infrastructure. There is a gem up on Rubygems that adds in the functionality so just do a:
gem install -r capistrano_winrm
The source code for this extension is also up on Github:
github.com/zenchild/capistrano_winrm
hi..
ReplyDeletelooks very nice.
been working with cap for a while on rails,
plus for java web apps. my system at the
moment consists of java web (solr), mysql
+ asp.net mvc.
on the windows + .net side.
What do you do for uploads onto the server?
The workflow i'd like is:
upload a zip + powershell script
run powershell script (on remote server).
powershell would then unzip, install app etc.
i've used scp with Cygwin but am not doing that
anymore, it drove me insane.
regards.
Hey Mick,
ReplyDeleteI do not have a very good solution for transferring files today. There are a couple blog posts that talk about various ways of doing it via WinRM here:
http://stage.vambenepe.com/archives/844
http://stillpearling.blogspot.com/2009/02/more-powershell-remoting.html
They're probably not exactly what you're looking for though. The best solution in my mind would be to get the powershell remoting protocol working over WinRM so one could use something like wget to fetch files to the remote computer. Something like this (http://poshcode.org/417). I'm still in the very early stages of figuring out powershell remoting though so that solution is a bit further down the road.
Sorry I don't have a very good solution for you.
Cheers,
Dan
yeah, i've looked at various PS based ones. i always seem to get out-of-mem probs.
ReplyDeletei'll sure i'll find a solution. was just checking to make sure u didnt know anything obvious..
cheers