Switchtower, windows and dispatch.fcgi


#1

I just setup switchtower and I am very happy with it. Just one thing is
giving me some headache: My development machine is windows and my
deployment
host is Unix. Each time I deploy I need to make dispatch.fcgi
executable. I
wrote my own task for that. But does there exist any smarter way to get
this
automated ? I think Subversion offers some possiblity to declare a file
as
executable, but no idea how to integrate that into switchtower.

regards


#2

You can have subversion automatically set the executable bit for you
when it does a checkout/export to a *nix server. SwitchTower isn’t
involved at all other than doing the normal checkout/export.

From the command line you can type:
svn propset svn:executable ON public/dispatch.fcgi
svn commit public/dispatch.fcgi

If you are using tortoisesvn check out the following page to see how
to add the svn:executable property on a file:
http://tortoisesvn.sourceforge.net/docs/release/TortoiseSVN_en/
ch05s15.html

-Jonathan


#3

I wrote about this issue a little while ago:
http://blog.craz8.com/articles/2005/11/03/windows-unix-development-with-rail
s

I needed to set EOL style to make it work, in addition to the executable
property.


#4

I have a further question about this… I’m still trying to get my head
around all of the deployment and SVN stuff.

My situation is that I’m developing on Windows and deploying on a Debian
VPS. Up to now I’ve been deploying straight out of SVN, but I’d like to
move
to Switchtower. I’ve successfully gotten all of the install tasks done,
and
I’ve run the REMOTE_EXEC setup task successfully. I had to do Tom’s
propset
suggestion on the spinner/spawner/reaper tasks because the scripts were
coming out as non-executable and with the wrong line-endings. This
worked,
and those scripts now execute.

One last problem remains… I followed the advice of an article in the
Rails
Wiki about how to set SVN to ignore dispatch.fcgi so that I didn’t
constantly have to update my shebang lines when I switch between
development
in Windows and deployment on Linux. (c:\ruby\bin\ruby vs
/usr/local/bin/ruby) As such, the SVN export performed from Switchtower
doesn’t export a dispatch.fcgi file in deployment. Thus, my
current/public
dir has no dispatch.fcgi file. Not good.

Does anyone else have a better idea for how to deal with this issue? My
feeble mind just can’t seem to come up with a good way of dealing with
the
shebang conflict/SVN/deployment issue. How can I get Switchtower to
include
a dispatch.fcgi file without messing it up with the copy I use in
development that references the Windows Ruby location?

Thanks, all!


#5

Matt W. wrote:

Does anyone else have a better idea for how to deal with this issue? My
feeble mind just can’t seem to come up with a good way of dealing with
the
shebang conflict/SVN/deployment issue. How can I get Switchtower to
include
a dispatch.fcgi file without messing it up with the copy I use in
development that references the Windows Ruby location?

Thanks, all!

Hi Matt-

I actually have the same issue here because I deploy on a UNIX for other
folks and locally for myself on Windows. I have not implemented this
yet, but I plan on putting the UNIX version of dispatch.fcgi into SVN as
dispatch.fcgi.unix. The ‘real’ one will be the Windows one.

When I deploy to Windows, I just run SVN export. Then, my Windows
dispatch.fcgi is in place.

When I deploy in UNIX, I’m using Switchtower, so I’ll add a line that
copies over the dispatch.fcgi with the renamed dispatch.fcgi.unix. This
will be just a one-liner in the deploy script, I imagine. Just haven’t
gotten around to it.

Would this work for you?

Jake


#6

From my experience, the Linux shebang lines work fine on Windows, as Windows
doesn’t use this line at all.

I do have to run the server like this on Windows:

ruby script\server

Whereas, on Linux, the command would be:

        script/server

So, the wiki is wrong - have SVN get the dispatch.fcgi file and change
the
first line to be your Linux shebang for your Ruby interpreter.


From: removed_email_address@domain.invalid
[mailto:removed_email_address@domain.invalid] On Behalf Of Matt W.
Sent: Wednesday, January 04, 2006 7:31 PM
To: removed_email_address@domain.invalid
Subject: Re: [Rails] switchtower, windows and dispatch.fcgi

I have a further question about this… I’m still trying to get my head
around all of the deployment and SVN stuff.

My situation is that I’m developing on Windows and deploying on a Debian
VPS. Up to now I’ve been deploying straight out of SVN, but I’d like to
move
to Switchtower. I’ve successfully gotten all of the install tasks done,
and
I’ve run the REMOTE_EXEC setup task successfully. I had to do Tom’s
propset
suggestion on the spinner/spawner/reaper tasks because the scripts were
coming out as non-executable and with the wrong line-endings. This
worked,
and those scripts now execute.

One last problem remains… I followed the advice of an article in the
Rails
Wiki about how to set SVN to ignore dispatch.fcgi so that I didn’t
constantly have to update my shebang lines when I switch between
development
in Windows and deployment on Linux. (c:\ruby\bin\ruby vs
/usr/local/bin/ruby) As such, the SVN export performed from Switchtower
doesn’t export a dispatch.fcgi file in deployment. Thus, my
current/public
dir has no dispatch.fcgi file. Not good.

Does anyone else have a better idea for how to deal with this issue? My
feeble mind just can’t seem to come up with a good way of dealing with
the
shebang conflict/SVN/deployment issue. How can I get Switchtower to
include
a dispatch.fcgi file without messing it up with the copy I use in
development that references the Windows Ruby location?

Thanks, all!

I needed to set EOL style to make it work, in addition to the executable
property.


#7

I didn’t realize that Windows didn’t use the shebang line, but now that
you
mention it, it makes perfect sense. I never wrote a batch file or any
other
script that had a shebang line :slight_smile: I guess I just left it in because the
initial rails setup script creates it.

Just for the heck of it, I’m going to use the solution Jake and Jamis
put
forward… I should have known it would only be a couple lines of code
in
Ruby :wink:

Thanks, all! You rock!

Matt


#8

On Jan 4, 2006, at 8:30 PM, Matt W. wrote:

scripts now execute.
issue? My feeble mind just can’t seem to come up with a good way of
dealing with the shebang conflict/SVN/deployment issue. How can I
get Switchtower to include a dispatch.fcgi file without messing it
up with the copy I use in development that references the Windows
Ruby location?

One idea is to use SwitchTower’s put command to store the necessary
dispatch.fcgi file on each web and app server, via an
after_update_code hook. Something like:

task :after_update_code, :roles => [:app, :web] do
dispatch = File.read(“public/dispatch.fcgi.linux”)
put dispatch, “#{release_path}/public/dispatch.fcgi”, :mode => 0555
end

Or, you could store public/dispatch.fcgi.linux in your source code
repo and use an after_update_code hook to just rename it to
dispatch.fcgi.

  • Jamis