Monitoring ROR server (thin or mongrel) for resources and availability in WINDOWS and re-spawn - ruby-on-rails

First thing I would like to say is, i know deploying ror applications in windows is not recommended, but in this case i have no choice due to some client restrictions.
I am looking for a tool like Upstart for windows which will moniter my instance of Thin or Mongrel and will 're-spawn' in case of crashes or availability.
Now I looked around quite a bit and most solutions like UpStart, or Passenger server are only available for Unix environments.
Any known tools for windows? and how to use them?
I am also open to any alternative ror servers for windows that can do this automatically like passenger does.
Thanks
Shaunak

Maybe a bat script as a scheduled task to run wmic process, scan to find Mongrel, and if it's not found to run it?
Sorry, I'd do it in bash, or I'd have a code example for you.
This would also make a good python script, in my opinion.

Related

Delay when issuing any rails commands on windows vista

Everytime I run any rails command on my windows vista dev box there is always something like a 30 second delay before the command does anything. I don't have the firewall enabled and the virus protection is disabled. Any thoughts on what could be causing this?
Thanks
I can't comment on this specific issue, but I can say I had nothing but problems trying to run Rails on Windows in the past. That said, after trying Ubuntu and MacOs, I still prefer to use Windows as my primary UI. My solution is to run Ubuntu Server on a VM, and use a Samba file share to access dev files, with putty as my primary console interface. The linux command line is far more powerful, and is where the Rails ecosystem is really geared to be running.
VirtualBox: http://virtualbox.com
Ubuntu: http://ubuntu.com
Samba: http://www.samba.org/
Putty: http://www.chiark.greenend.org.uk/~sgtatham/putty/
With these tools, you can run your Rails stack in a nice linux server environment, and still enjoy the utility and functionality of the Windows GUI. (Although I'd recommend you move from Vista to 7)

Is there any advantage to using WEBrick in development mode for Rails?

I develop on a Mac, and I'm pretty comfortable setting up an Ubuntu VM with Apache installed, so "you don't need to install Apache" is not really a reason. I run Ruby from the VM anyway, so there doesn't seem to be much difference in system resources needed.
In my head, the advantage of using Apache is that it's going to perform more consistently with my production server.
So what reasons are there to use WEBrick? Does it make development easier somehow?
No there are no advantages. The only "advantage" is that it is the pre-bundled webserver so you at least "have something"
I'm sure most experienced Ruby devs use something else like thin, mongrel, unicorn, pow, passenger, etc...
I'd go for phusion passenger + passsenger pref pane: http://www.fngtps.com/2008/06/putting-the-pane-back-into-deployment
Awesomeness. This way I can act more like the production server and take it easy when adding new projects etc.
I've been using Rails for a school project, and I find the colorized logs helpful when I'm trying to figure out what the server is doing. Sure you could tail -f the apache logs, but color is nice IMO.

Run thin webserver as a windows service

i'm trying to deploy in production Redmine application. I heard that thin is the fastest ruby on rails webserver so I installed it. Now I have a really simple problem: i must start it every time i reboot the machine via cmd because there isn't a prebuilt windows service or something similar that allow me to autostart it. How could i fix the problem? I saw that there is a bat file, so i tried to make a C# windows service like this and it starts correctly but if I stop it the service stops but the webserver is still active and it will never shutdown. The only way to stop thin is to reboot the machine. Maybe I'm wrong, could someone post an example of how should i run thin as a windows service?
i've written a blogpost about this a while ago, but most of it should still be applicable. Hope it helps.
But to be honest, i always deploy on windows using the mongrel-service gem, and configure an apache in front to load-balance between 3 mongrels. Much easier.
Also the big advantage for me was that if something went wrong with thin-service, it didn't restart automatically, while the mongrel-service guards your mongrel process, and if it for whatever reason goes down, it will restart it again. For me that was something i could not miss.

How to use a VM to create a Rails staging environment

My app is in development and I do all my testing using WEBrick (I like the terminal output).
On the production server it will run on Phusion Passenger.
I'm running Snow Leopard and wish to test the app in an environment similar to the production environment.
Can I use Parallels to run a Debian install with Apache and Passenger and configure Capistrano to deploy to that?
Thanks!
I have been using VMware for that sort of thing. Its really easy to deal with network wise. I have recently switched to Virtualbox which is much nicer to actually work in (at least for me), does the same things, and is free. Download the Debian iso and create a new VM that uses it as its CDrom. Thats about all you need to do. Good luck.
This may not be the answer you're looking for but I've found it very straightforward to just run passenger locally for development. You can always tail the development.log, it's really just as easy as watching the terminal output from webrick.
Dev setup is made all the easier with the drag and drop ease of the phusion passenger pref pane.
http://www.fngtps.com/passenger-preference-pane
Seems like it would be easier than setting up the VM and all. Though yes, there could still be differences if your not hosting on OS X server I suppose.

How to monitor passenger / mod_rails processes?

I searched the site already but couldn't find any suitable information. As there is always some expert around I'm sure one of guys knows exactly what I'm searching for :-)
We're on a balanced system:
Machine 1: HAProxy load balancer
Machine 2 & 3: Apache mod_rails and (of course) our Rails applications
Those were the days when we were able to monitor all Mongrel processes using monit (or other monitoring tools).
Is there any way to do an easy and clever monitoring of passenger processes with monit (or other tools), too? How can I dynamically get all pids of the running processes and pass them to monitoring?
Matt
There are various options available. Here are some of them:
The passenger-status tool lets you inspect its internal status
FiveRuns Manage can monitor a Passenger installation
Scout can also monitor Passenger
I made a plugin which make Passenger processes monitorable by Monit:
https://github.com/romanbsd/passenger_monit
Its a little ghetto but run these commands
watch passenger-status
watch passenger-memory-stats
then install and run htop
I did a quick search and I think I found the thing your looking for. He uses a script which runs off "passenger-status" as John Topley said.
http://blog.slowb.ro/2013/06/18/add-passenger-status-to-monitoring-on-zenoss/

Resources