Forum: Ruby on Rails switchtower, windows and dispatch.fcgi

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
30269682335f1fb247d71969fa715b5e?d=identicon&s=25 Roberto Saccon (rsaccon)
on 2006-01-04 00:42
(Received via mailing list)
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
609e59bf8c5bfef51d142de60f1e5a2a?d=identicon&s=25 Jonathan Younger (Guest)
on 2006-01-04 02:21
(Received via mailing list)
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/To...
ch05s15.html

-Jonathan
3f900b38ec3b2c45427c354722fa4ce3?d=identicon&s=25 Tom Fakes (tomfakes)
on 2006-01-04 02:24
(Received via mailing list)
I wrote about this issue a little while ago:
http://blog.craz8.com/articles/2005/11/03/windows-...
s

I needed to set EOL style to make it work, in addition to the executable
property.
678aa0aabf79a4933b7efc6d585dc141?d=identicon&s=25 Matt White (Guest)
on 2006-01-05 04:52
(Received via mailing list)
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!
E51c6ae07e72cf04ef869868cb8eca6e?d=identicon&s=25 Jake Janovetz (Guest)
on 2006-01-05 04:59
Matt White 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
3f900b38ec3b2c45427c354722fa4ce3?d=identicon&s=25 Tom Fakes (tomfakes)
on 2006-01-05 17:43
(Received via mailing list)
>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: rails-bounces@lists.rubyonrails.org
[mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Matt White
Sent: Wednesday, January 04, 2006 7:31 PM
To: rails@lists.rubyonrails.org
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.
992fe8c19bbbc27f2b562a9f96efc03d?d=identicon&s=25 Jamis Buck (Guest)
on 2006-01-05 17:44
(Received via mailing list)
On Jan 4, 2006, at 8:30 PM, Matt White 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
678aa0aabf79a4933b7efc6d585dc141?d=identicon&s=25 Matt White (Guest)
on 2006-01-05 17:44
(Received via mailing list)
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 :) 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 ;)

Thanks, all! You rock!

Matt
This topic is locked and can not be replied to.