The Hitchhiker’s Guide to Ruby On Rails Galaxy

Records of my voyage through RoR Galaxy

Posts Tagged ‘server’

Steps to Restart a Server on a Linux (ubuntu) Box for Rails, Mongrel and Merb stack

Posted by arjunghosh on April 15, 2008

Actually the title should read as

“Restarting Rails, Merb (a file upload framework) and Mongrel (a lightweight Web Server) Cluster”

Well this is also more of a reminder to self. So here goes the steps as follows:

Step 1: First connect to the Box, where the application is running, using any telnet application like Putty. It can be downloaded from this page. You need to put in the login credentials. For example login: vivanista and its password.

Step 2: Then you need to go to the ‘app’ folder. The command to write at cmd line is:-

cd app

Step 3: Then You need to update the application folder with the latest files from SVN repository.The command to write at cmd line is:-

svn update

Step 4: NOw we need to kill the Mreb process which is running on the server. For that we need to find the Mreb’s process id using the ‘grep’ cmd. The command to write at cmd line is:-

ps ax|grep merb

Step 5: Now you get the process ids i.e. pids of the Mreb you need to kill before restart. You need to kill the pid which has ruby folder as its initial folder in the text. The command to write at cmd line is:-

kill -9 (here the Merb pid to kill)

Step 6: Again run the ‘grep’ cmd of Step 4 to check if the Merb process has been killed properly

Step 7: Now restart Mongrel Cluster.(Note: Advantage of using cluster instead of single instance mongrel server is that it helps in load balancing and hence better performance of the server).The command to write at cmd line is:-

mongrel_rails cluster::restart

Step 8: Then go to the merbuploader folder to restart Merb. So you will be in ‘/app/merbuploader /’. To go ‘merbuploader’ folder, the cmd is:-

cd merbuploader

Step 9: Now to restart Merb, the cmd is:-

merb -d

Step 10: Now to exit the server and putty application, the cmd is:-

exit

Advertisements

Posted in Uncategorized | Tagged: , , , , , , | 1 Comment »

Starting multiple instances of WEBrick server from the command line

Posted by arjunghosh on September 6, 2007

Another instance of webrick server running wither another rails app at the same time at another port

As i mentioned in my previous log on starting WEBrick server manually from command line, here i look into the often asked question about starting Multiple instances of WEBrick server at the same time so that multiple Rails application can be run at the same time.

So continuing from my prev log…

Suppose we have to run another test called “AnotherTestRailsApp” beside “TestRailsApp” already running on our machine.

1. Now type the command

ruby script/server -p3001

For example:

“c:\AnotherTestRailsApp> ruby script/server -p9001”

2. Now to also run “AnotherTestRailsApp” rails app can be accessed by going to the address bar of your browser and typing the command at the address bar:

http://localhost:3001/

So here the above Rails app “AnotherTestRailsApp” is running on port 3001 instead of default 3000. This number can be any thing like 3010 or 9000.

3. So we now have one rails app “TestRailsApp” running at port 3000 and another “AnotherTestRailsApp” rails app running at port 3001

Posted in Uncategorized | Tagged: , , , | 4 Comments »

Starting WEBrick Server manualy from the command line

Posted by arjunghosh on September 6, 2007

Example of WEBrick server running at command line

1. First open the command line window. For windows get there by clicking on start->run

2. The following command will open the DOS command windows. Type the following:

cmd

3. Go to the folder which contains the your RoR project using the command:

“c:\> cd TestRailsApp “

4. Now type the command:

ruby script/server” at “c:\TestRailsApp> ruby script/server”

5. This will start the WEBrick Server for the particular application which in above example is TestRailsApp

6. Now this “TestRailsApp” rails app can be accessed by going to the address bar of your browser and typing “http://localhost:3000/”. This will open the default starting page of your application. Now the question is what is number 3000. Well thats the default port 3000 at which the server is running on and hence the application

Thats all from my recent travel through Rails Galaxy…

Posted in Uncategorized | Tagged: , , , | Leave a Comment »