In this part of the workshop 7, we are going to examine the various platforms/software tools used for deployment such as UNIX environment suggested in the Discussion Notes, Mongrel or Mongrel cluster, Nginx, Subversion or Capistrano (during development stage), JRuby in the Java environment.
So far, we have developed a Ruby on Rails application. Due to, rails is a server independent language, you can focus on development rather than deployment. Therefore, we are going to introduce ways of deploying ruby on rails applications and deploying JRuby on Rails applications.
Deploying Ruby on Rails
Most Rails organizations use Capistrano to handle the actual deployment. On the other hand there are some ways to handle deploying. These are;
WEBrick
The simplest way or handling a Rails application is to handle it the same way you do when developing it: start a WEBrick server and be done with it. This solution is probably one of the worst ones. WEBrick is highly useful for testing your application during development. It’s small, it’s pure Ruby, and it's already installed on all Ruby machines. This makes it straightforward to handle. On the other hand, it’s written in pure Ruby, which means the performance could be much better. In fact, WEBrick is slow. It also has a tendency to hang and stop responding after a while. For these reasons, it works fine for short-lived development runs, and possibly also for running automated test suites. However, for real-world deployment, you need another solution.
Mongrel
Mongrel is widely believed to be much faster than WEBrick, and is also a good standalone library for creating smaller web applications. In many places, Mongrel has replaced WEBrick as the server of choice for Rails development. Because it is fast to start and easy to configure in standalone mode, this means you get a better and faster web server for your Rails development, all for free. For smaller web applications, you can also use Mongrel in standalone mode to serve Rails applications in production. If you know that the site traffic will be small, and there is no huge demand on scalability. Mongrel is usually good enough. It's also easy to get going; you can just start it with script/server and it runs accurately.
Pack of Mongrels
To solve the scalability problem with Mongrel, the standard solution is to deploy a “pack of Mongrels. This lets you start several Mongrel instances on the same machine with consecutive port numbers. The other side of this is usually a load balancer or some sort. The two most common real world deployments use Apache and Pound. The beauty or this solution is that if your needs grow, or if your site gets popular, you can just add more Mongrel instances, on the same or another computer. The Apache front end then load balances over all the new Mongrels with a reloading of the configuration tile (Bini, 2007, p. 200).
Deploying JRuby on Rails
JRuby is a Java implementation of the Ruby Programming Language. It is tightly integrated with Java to allow the embedding of the interpreter into any Java application with two-way access between the Java and Ruby code (Edelson, & Henry, 2008, p. 182). As it is mentioned above section, there are some variations on how to deploy a Rails application with Ruby framework. In addition to this there are some new possibilities using with JRuby.
WEBrick
Using WEBrick during development usually works well with JRuby. However, for deploymen, it suffers from exactly the same problems as WEBrick on regular Ruby: it’s slow and unstable, having a tendency to stop responding. Except for the most noncritical applications, you shouldn’t use WEBrick for deployment in JRuby.
Mongrel
Mongrel has a native extension written in C, which is one of the reasons its faster than WEBrick. This extension has been ported to Java, which means you can use Mongrel from JRuby. In addition, JRuby on Rails application has many advantages with Mongrel as regular Ruby.
Retty
Retty is a simple Rails plug-in, based on the Java web containers Jetty and GoldSpike. When you’ve installed the plug-in, you can start a Jetty server that handles Rails requests with this command: "jruby -s rake retty:run" Jetty is a small and fast web container, and running smaller Rails applications in this way makes for the best parts or a Rails application and embedding a real Java web server. You can use Retty for deploying smaller standalone applications without a problem, and It can also easily be used in a pack.
As a result, you can use Mongrel for smaller applications, but when your web page has high traffic rates, you need to use a real load balancer in front of them. The problem with this approach on the Java platform is that you don’t want to start several JVMs, because they are slow to start and resource heavy. JRuby supports the option of starting a JRuby server and spreads new runtimes for each request that arrives on that port. By using that capability, you can start several Mongrel instances in the same JVM (Bini, 2007, p. 205).
Can you get the OTBS Running in production mode as a minimal production server?
In order to have a minimal production server, we are going to use Mongrel Web Server for OTBS application. As it is stated above paragraph, Mongrel is quite efficient for this application at the beginnig. Then, Sqlite database is goning to be used. After these two significant part is installed to the production server, they are needed to configured properly for your application (OTBS). After all processes are completed accurately, the server can publish your application and everyone can access your web application all over the world.
References
Bini, O. (2007). Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to the Java Platform. Apress.
Edelson, J., & Henry, L. (2008). JRuby Cookbook (First ed.). O'Reilly Media.
Thursday, June 4, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment