Home Home
Sign up | Login

Author Archive

How to set up a Production Server for your Rails App

May 28th, 2010 by

Hi folks,

as you know it’s exciting to create a new rails application for several tasks. It’s fast, easy and everything is predefined. But what do you do if your application is (nearly) done? The next logical step is to set up a production web server – for me, this step always was a difficult issue.  Mongrel/WEBrick was started via ‘ruby script/server’ and your application was reachable on your localhost, mostly on port 3000. You’re the only user who interacts with it – no problem (as long as your application is in development).

“The Web, however is an extremely concurrent environment. Production web servers, such as Apache, Lighttpd, and Zeus, can work on several requests – even tens or hundreds of requests – at the same time. A single-process, single-threaded Ruby-based web server can’t possibly keep up.” (quoted from ‘Agile Web Development with Rails’)

Therefore I want to show briefly how to set up a front-end server with an existing Rails application using an Apache server and the RubyGem ‘Passenger‘. Do the following as root.

1. Install Passenger (One-click Install) (assumed that Ruby itself and all needed Gems are installed)

2. Install Apache and it’s dependencies:

$> zypper in apache2

3. Add the Passenger module to your Apache server:

$> a2enmod passenger

4. Create a virtual host on your Apache server. Create ‘/etc/apache2/vhosts.d/myapp.conf’ and insert:

<VirtualHost *:80>
ServerName www.myapp.com
DocumentRoot /srv/rails/myapp/public
RailsEnv development
<Directory /srv/rails/myapp/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>

Be sure that the path to your application is correct and do not forget the public directory! As you can see this virtual host receives all requests on port 80 (http). The line ‘RailsEnv development‘ specifies the ‘RAILS_ENV’ variable (in this case ‘development’, the default value is ‘production’).  Normally you want ‘production’ for your production server!

5. Activate your virtual host in ‘/etc/apache2/listen.conf’. Just enable the line (remove the leading hash mark)::

#NameVirtualHost *:80

6. Now you can start your Apache server:

$> rcapache2 start

Important: when you want to check the log file be aware of the mode Passenger runs the Rails application (‘production.log’/’development.log’). By default, the log file is written by the user who owns the ‘environment.rb’ – check the log file’s write permissions (See also: User switching).

Have a look at the documentation! There you find a lot of configuration options which you should think of.

That’s it. Sure, there are many many other ways to get such a server running and this was just scratching the surface but should be a good point to start. Thanks to Thomas Schmidt for a good introduction into the topic.

Phusion Passenger
Passenger Apache Documentation

FOSDEM´10

March 1st, 2010 by

Hi, folks!

I just want to post a small summarize about my experiences at FOSDEM 2010 in Brussels. For me as a trainee at the SUSE it was my first linux related europaeen meeting i ever joined, so it was quite amazing. On 5th February we started from Nuremberg at 12 am towards Begium and arrived circa 10 o’clock in the evening. After the check in we started to conquer the nightlife of Brussels which was tougher I expected because of my missing french skills. Unfortunaly, i missed the so popular “beer event” :(

On saturday day we attended the FOSDEM which tooks place at the ULB campus. It looked quite unspectular from outside but after we entered the building i had to grind out getting a first overview.  Many people, many stands  – from Amarok over Fedora, Debian and  SUSE to VLC – and a great atmosphere. After the opening talks I joined the Ruby on Rails lectures which were very intressting for me as becoming RoR coder. There was a lecture about Datamapper which was quite new for me as well as working with MongoDB and the “25 good practices in Ruby on Rails development”.

The next day was followed by a lecture about Aptoid, an project for deploying an own app server and the appropriated client app, and a informative talk about Mozilla´s Firefox Mobil (I’am using an Android smartphone so of course I’am curious what the stage of work it is). After some SUSE lectures about building images with KIWI and SUSE Studio the meeting was drawn to a close.  And remember, this was just an extract of +200 lectures!

For me it was a great experience and very informative – for things i already knew and i did not knew- and I’am looking forward to join FOSDEM in 2011!

fosdem2010

Opening talk

fosdem2010_2

The openSUSE booth

OBS webclient is now able to handle requests

November 10th, 2009 by

Since a few days, the OBS webbclient is now able to handle requests which means that you can accept/decline requests concerning you or revoke own requests. Furthermore you see a complete diff for submit requests. For me, it was my first experience with Ruby on Rails but it seems to be very exciting. So the usability is not perfect now but i will working on it.

Next step is to implement the attribute system (//lizards.opensuse.org/2009/11/02/obs-attribute-system/)