・ Web系SE募集 (技術開発部開発系エンジニア・Java/Tomcat 420万円~750万円)
   ・ 社内SE募集 (業務系システムの開発・社内イントラ)

Ruby on Railsの最近のブログ記事

◇最新バージョンを テスト用DBで動作確認してみる。

    ※テスト用DBがなければ、前もって作っとく。
    mysql>
    mysql> create database redmine_test character set utf8;
    mysql> show databases;
    mysql> \q
    そして、今まで動かしていたので、
    $ rake db:migrate RAILS_ENV=test
    を実行しとく。
    ※以前のバージョンからのUPDATEなので、以前のテーブルの構成でからUPDATEするため。


 svn up して
$ svn up  ~/svn_work/Redmine/tags

 svn export する
$ svn export ~/svn_work/Redmine/tags/0.8.1/ ~/work/redmine0.8.1

 DBのconfigファイルであるYAMLファイルをコピーする。
$ cp /home/httpd/vhost/Redmine/config/database.yml ~/work/redmine0.8.1/config/database.yml

 作業場所に移動して
$ cd ~/work/redmine0.8.1/

 DBのマイグレーションを行う。
$ rake db:migrate RAILS_ENV=test

テストサーバー起動して動作確認してみる。
$ ./script/server -e test


テストDBで動作確認できたら、本番の前に、

◇まず、動いてるのを止める

mysqlのスレーブ止める。
mysqlのマスター止める。
Redmineの動いているApache止める。

◇次にバックアップする
以下、マスターで作業

mysql のデータバックアップしとく
 /usr/local/mysql/var を コピーしとく

Redmineのバックアップしとく
 /home/httpd/vhost/Redmine  を コピーしとく


svn export する。
$ svn export ~/svn_work/Redmine/tags/0.8.1/ /home/httpd/vhost/Redmine/ --force

移動して
$ cd /home/httpd/vhost/Redmine/

キャッシュおよびセッションを消去
$ rake tmp:cache:clear
$ rake tmp:sessions:clear

 DBのマイグレーションを行う。
$ rake db:migrate RAILS_ENV=test

サーバにアクセスできたらOK
$ ./script/server -e test

500エラーが出る場合、 Redmine/log/ 以下のログを確認する。
「sessions 系のエラーの場合」/home/httpd/vhost/Redmine/tmp/sessions に残ってるので
    $ rake tmp:sessions:clear を行うか、セッションファイルを削除する。


本番のDBのマイグレーションを行う。
$ rake db:migrate RAILS_ENV=production


本番のDBで、確認するために、テスト用サーバー起動
$ ./script/server -e production

ブラウザでアクセスして確認

最後にApache起動
$ sudo /usr/local/apache2/bin/apachectl start

adminでログインし、管理⇒情報 から、バージョンを確認しとく。
"管理 → ロールと権限"を開き、新しく追加された機能に対する権限の確認・設定を行う。

問題なければ、スレーブのMySQLを起動

----

その他・カスタマイズしたところを修正する。
使いやすい様にソースなど修正したものは、svn export で全て上書きされてしまうので、
カスタマイズしたファイルを直す。

例:
① ヘルプの日本語化対応も上書きされるので、忘れずに!
http://redmine.jp/faq/general/change-help-url-to-gude-ja/
Redmineのlib/redmine/info.rbを開き、 def help_url; に続くURLをhttp://redmine.jp/guide/に変更し、Redmineを再起動

② lang/ja.yml
general_csv_encoding: SJIS
general_pdf_encoding: UTF-8
label_age: 年齢 ・・・年齢という表現が気になるなら・・私は気にならないが。

general_csv_encoding: UTF-8
general_pdf_encoding: SJIS
label_age: age

③リポジトリで、テキストファイルの内容が日本語が多い場合ダウンロードされる件
http://groups.google.com/group/redmine-users-ja/browse_thread/thread/6d0eddad5a79d815
 

$ diff -u app/controllers/repositories_controller.rb ../Redmine-backup/app/controllers/repositories_controller.rb
--- app/controllers/repositories_controller.rb  2008-12-31 20:31:02.000000000 +0900
+++ ../Redmine-backup/app/controllers/repositories_controller.rb        2009-02-05 11:09:54.000000000 +0900
@@ -117,7 +117,7 @@

     @content = @repository.cat(@path, @rev)
     show_error_not_found and return unless @content
-    if 'raw' == params[:format] || @content.is_binary_data?
+    if 'raw' == params[:format] || @content.include?("\x00")
       # Force the download if it's a binary file
       send_data @content, :filename => @path.split('/').last
     else


④Wikiのヘルプ日本語化
$ cd public/help/
$ tar xzvf wiki_syntax_ja.tar.gz
 

⑤viewの変更
文章一覧
$ diff /home/httpd/vhost/Redmine/app/views/documents/_document.rhtml ~/svn_work/Redmine/tags/0.8.1/app/views/documents/_document.rhtml
1,4c1,3
< <div title="<%unless document.description.blank? %><%=h(truncate(document.description, 250)) %><% end %>">
< <font size=+0><%= link_to h(document.title), :controller => 'documents', :action => 'show', :id => document %></font>
<  - - -
< <em><%= format_time(document.created_on) %></em></div>
---
> <p><%= link_to h(document.title), :controller => 'documents', :action => 'show', :id => document %><br />
> <% unless document.description.blank? %><%=h(truncate(document.description, 250)) %><br /><% end %>
> <em><%= format_time(document.created_on) %></em></p>
 
----

 
⑥ガンチャートに担当者名を表示
$  diff -u ~/svn_work/Redmine/tags/0.8.1/app/views/issues/gantt.rhtml  /home/httpd/vhost/Redmine/app/views/issues/gantt.rhtml
--- /home/y.suzuki/svn_work/Redmine/tags/0.8.1/app/views/issues/gantt.rhtml     2009-02-17 14:46:33.000000000 +0900
+++ /home/httpd/vhost/Redmine/app/views/issues/gantt.rhtml      2009-02-23 16:06:57.000000000 +0900
@@ -86,7 +86,7 @@
     <div style="position: absolute;line-height:1.2em;height:16px;top:<%= top %>px;left:4px;overflow:hidden;"><small>
     <% if i.is_a? Issue %>
        <%= h("#{i.project} -") unless @project && @project == i.project %>
-       <%= link_to_issue i %>: <%=h i.subject %>
+       <%= link_to_issue i %>: (<%= i.assigned_to %>) <%=h i.subject %>
        <% else %>
                <span class="icon icon-package">
                <%= h("#{i.project} -") unless @project && @project == i.project %>
 
 
 
 

直したら再起動する。
再起動は
$RAILS_ROOT/tmp/restart.txtというファイルを作成

$ sudo -u apache touch /home/httpd/vhost/Redmine/tmp/restart.txt

せっかちなら
$ watch -n 1 ls -l /home/httpd/vhost/Redmine/tmp/restart.txt
で無くなるのを確認


参考URL
http://redmine.jp/guide/RedmineUpgrade
 

以下に、Rails 環境構築 を示す。

Ruby, RubyGems, Rake, Rails, Phusion Passenger (mod_rails) を順次インストールし、最後に動作確認のため「HelloWorld」を表示する。


Ruby インストール

http://www.ruby-lang.org/ja/downloads/

※ 圧縮ファイル [tar.bz2|tar.gz|zip]ファイル、安定版スナップショット、SVNで取得、と
ソースの取得方法が用意されているが、ソースが微妙に異なるので注意が必要。

$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz

tar xzvf ruby-1.8.7-p72.tar.gz
cd ruby-1.8.7-p72
./configure --help
./configure --prefix=$HOME
make
make test
make check
sudo make install


$ which ruby

RubyGems インストール

http://rubyforge.org/projects/rubygems/

wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar xzvf rubygems-1.3.1.tgz

cd rubygems-1.3.1
ruby setup.rb --help
sudo ruby setup.rb
(省略)
------------------------------------------------------------------------------

= Announce: RubyGems Release 1.3.0

NOTE:  RubyGems 1.1 and 1.2 have problems upgrading when there is no
rubygems-update installed.  You will need to follow the second set of update
instructions if you see "Nothing to update".

Release 1.3.0 fixes some bugs.

Bugs fixed:

* Disregard ownership of ~ under Windows while creating ~/.gem.  Fixes
  issues related to no uid support under Windows.
* Fix requires for Gem::inflate, Gem::deflate, etc.
* Make Gem.dir respect :gemhome value from config.  (Note: this feature may be
  removed since it is hard to implement on 1.9.)
* Kernel methods are now private.  Patch #20801 by Stefan Rusterholz.
* Gem::location_of_caller now behaves on Windows.  Patch by Daniel Berger.
* Silence PATH warning.

Deprecation Notices:

* Gem::manage_gems will be removed on or after March 2009.

For a full list of changes to RubyGems and the contributor for each change, see
the ChangeLog file.

Special thanks to Chad Wooley for backwards compatibility testing and Luis
Lavena for continuing windows support.

== How can I get RubyGems?

NOTE:  If you have installed RubyGems using a package system you may want to
install a new RubyGems through the same packaging system.

If you have a recent version of RubyGems (0.8.5 or later), then all
you need to do is:

  $ gem update --system   (you might need to be admin/root)

NOTE:  RubyGems 1.1 and 1.2 have problems upgrading when there is no
rubygems-update installed.  You will need to follow the second set of update
instructions if you see "Nothing to update".

NOTE: You may have to run the command twice if you have any previosly
installed rubygems-update gems.

If you have an older version of RubyGems installed, then you can still
do it in two steps:

  $ gem install rubygems-update  (again, might need to be admin/root)
  $ update_rubygems              (... here too)

If you don't have any gems install, there is still the pre-gem
approach to getting software ... doing it manually:

1. DOWNLOAD FROM: http://rubyforge.org/frs/?group_id=126
2. UNPACK INTO A DIRECTORY AND CD THERE
3. INSTALL WITH:  ruby setup.rb  (you may need admin/root privilege)

== To File Bugs

The RubyGems bug tracker can be found on RubyForge at:
http://rubyforge.org/tracker/?func=add&group_id=126&atid=575

When filing a bug, `gem env` output will be helpful in diagnosing the issue.

If you find a bug where RubyGems crashes, please provide debug output. You can
do that with `gem --debug the_command`.

== Thanks

Keep those gems coming!

-- Jim & Chad & Eric (for the RubyGems team)


------------------------------------------------------------------------------

RubyGems installed the following executables:
        /usr/local/bin/gem

If `gem` was installed by a previous RubyGems installation, you may need
to remove it by hand.

rake インストール

sudo gem install rake

sqlite3-ruby インストール

sudo gem install sqlite3-ruby

rails インストール

sudo gem install rails

rails 動作確認

mkdir -p ~/tmp/rails
cd ~/tmp/rails/
rails testapp
cd testapp/
./script/server

curl -I "http://localhost:3000/"
curl "http://localhost:3000/"
  or
lwp-request -e "http://localhost:3000/"

passenger (mod_rails) インストール

Phusion Passenger users guide

apxs の Pathを確認する。

$ ll /usr/local/apache2/bin/apxs
-rwxr-xr-x 1 suzu suzu 22597 11月 27 10:53 /usr/local/apache2/bin/apxs

root になって作業する

$ sudo su -
[root@x31 ~]# export APXS2=/usr/local/apache2/bin/apxs
[root@x31 ~]# export PATH=/usr/local/apache2/bin:$PATH
[root@x31 ~]# gem install passenger

[root@x31 ~]# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v2.0.3.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.

Checking for required software...

 * GNU C++ compiler... found at /usr/bin/g++
 * Ruby development headers... found
 * OpenSSL support for Ruby... found
 * RubyGems... found
 * Rake... found at /usr/local/bin/rake
 * Apache 2... found at /usr/local/apache2/bin/httpd
 * Apache 2 development headers... found at /usr/local/apache2/bin/apxs
 * Apache Portable Runtime (APR) development headers... found at /usr/local/apache2/bin/apr-1-config
 * fastthread... found
 * rack... found
--------------------------------------------

--------------------------------------------
Compiling and installing Apache 2 module...
cd /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3
rake clean apache2
(in /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3)
/usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/rake/gempackagetask.rb:15:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009.
### In ext/apache2:

rm -r pkg
### In ext/passenger:

### In ext/boost/src:

### In test:

### In benchmark:

### In ext/boost/src:

### In ext/apache2:

### In ext/apache2:

### In ext/apache2:

### In ext/apache2:

### In ext/apache2:

### In ext/apache2:

### In ext/apache2:

### In ext/apache2:

### In ext/apache2:

### In ext/passenger:
creating Makefile

### In ext/passenger:
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I. -D_FILE_OFFSET_BITS=64  -fPIC -g -O2   -c native_support.c
gcc -shared -o native_support.so native_support.o -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L.  -rdynamic -Wl,-export-dynamic


--------------------------------------------
The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so
   PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3
   PassengerRuby /usr/local/bin/ruby

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!

Press ENTER to continue.



--------------------------------------------
Deploying a Ruby on Rails application: an example

Suppose you have a Ruby on Rails application in /somewhere. Add a virtual host
to your Apache configuration file, and set its DocumentRoot to
/somewhere/public, like this:

   <VirtualHost *:80>
      ServerName www.yourhost.com
      DocumentRoot /somewhere/public
   </VirtualHost>

And that's it! You may also want to check the Users Guide for security and
optimization tips and other useful information:

  /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/doc/Users guide.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/

Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
[root@x31 ~]#
[root@x31 ~]# exit

動作確認 HelloWorld

$ mkdir /home/httpd/vhost/rails
$ cd /home/httpd/vhost/rails/
$ rails helloworld
$ cd helloworld/


$ ./script/generate controller HelloWorld index
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/hello_world
      exists  test/functional/
      create  app/controllers/hello_world_controller.rb
      create  test/functional/hello_world_controller_test.rb
      create  app/helpers/hello_world_helper.rb
      create  app/views/hello_world/index.html.erb


$ cat app/views/hello_world/index.html.erb
<h1>HelloWorld#index</h1>
<p>Find me in app/views/hello_world/index.html.erb</p>

$ ./script/server


$ curl "http://localhost:3000/hello_world/"
<h1>HelloWorld#index</h1>
<p>Find me in app/views/hello_world/index.html.erb</p>

HelloWorld - mod_rails

$ cat /home/httpd/conf/vhost-rails.conf

   LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so
   PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3
   PassengerRuby /usr/local/bin/ruby

<VirtualHost *:80 >
    ServerName localhost

    DocumentRoot /home/httpd/vhost/rails/helloworld/public

    ErrorLog  "|/usr/local/apache2/bin/rotatelogs /home/httpd/vhost/rails/helloworld/log/error_log.%Y%m%d 86400"
    CustomLog "|/usr/local/apache2/bin/rotatelogs /home/httpd/vhost/rails/helloworld/log/access_log.%Y%m%d 86400" combined

    DirectoryIndex index.html

    <Directory /home/httpd/vhost/rails/helloworld/public>
      Order allow,deny
      Allow from all
    </Directory>

</VirtualHost>



$ curl http://localhost/hello_world
<h1>HelloWorld#index</h1>
<p>Find me in app/views/hello_world/index.html.erb</p>

 ab - Apache HTTP server benchmarking tool
    http://www.apache.jp/manual/programs/ab.html

同時発行数を100リクエスト、10000回のアクセスを実行。
$ ab -n 10000 -c 100 
DBへのアクセスはせず、「Hello, world.」を返すぐらいだけのものでベンチマークをとります。
abコマンド実行中にtopコマンドでメモリの使用状況を確認。

◆メモリ(1プロセスあたり)

Ruby on Rails + mod_rails (mod_passenger)

Mem:    256400k total,   253792k used,     2608k free,      540k buffers
Swap:   524280k total,    18708k used,   505572k free,    21388k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 3041 suzu      25   0 45680  31m 1584 R 10.9 12.5   0:23.41 ruby
 3055 apache    15   0 12988 1888 1288 S  0.4  0.7   0:00.85 httpd

Django + mod_python
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 4207 apache    15   0 22408  14m 2272 S  8.0  5.6   0:03.64 httpd
    
Django + mod_wsgi
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 3019 apache    15   0 18072  10m 2284 S  7.0  4.0   0:05.13 httpd

Pylons + mod_wsgi
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 2915 apache    19   0 23920  14m 2568 R  0.0  5.7   0:07.15 httpd

◇結果

Ruby on Rails + mod_rails だけ、Swapを使ってしまいました。
また、Apacheのプロセスとは別に、Rubyのプロセスも必要で、メモリも消費するようにみえます。
一番メモリを消費しないのは、
Django + mod_wsgi
でした。


◆処理速度

Ruby on Rails + mod_rails (mod_passenger)
    Requests per second:    175.59 [#/sec] (mean)

Django + mod_python
    Requests per second:    576.02 [#/sec] (mean)
    
Django + mod_wsgi
    Requests per second:    854.67 [#/sec] (mean)

Pylons + mod_wsgi
    Requests per second:    380.65 [#/sec] (mean)

◇結果

秒間あたりの処理能力が一番よいのは
Django + mod_wsgi 
であり、最下位が
Ruby on Rails + mod_rails
でありました。今回の検証では、Ruby on Rails + mod_rails は、Swapを使用したため
速度比較としては、平等ではないかもしれません。

■総合結果

総合的にみても、Django + mod_wsgi が良く、Ruby on Rails + mod_rails は、最下位となりました。






Ruby on Rails Ver.2 + mod_rails (mod_passenger) で "Hello, world!" 』で用意したもので確認します。



Apache設定ファイル
$ cat mod_rails.conf
LoadModule passenger_module   /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so
PassengerRoot                 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3
PassengerRuby                 /usr/bin/ruby

$ cat app/views/helloworld/index.html.erb
<h1>Helloworld#index</h1>
Rails with mod_rails
<p>Find me in app/views/helloworld/index.html.erb</p>


$ curl "http://localhost/helloworld"
<h1>Helloworld#index</h1>
Rails with mod_rails
<p>Find me in app/views/helloworld/index.html.erb</p>

Apache Bench
$  ab -n 10000 -c 100  "http://localhost/helloworld"
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software:        Apache/2.2.9
Server Hostname:        localhost
Server Port:            80

Document Path:          /helloworld
Document Length:        101 bytes

Concurrency Level:      100
Time taken for tests:   56.952122 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      7000001 bytes
HTML transferred:       1010000 bytes
Requests per second:    175.59 [#/sec] (mean)
Time per request:       569.521 [ms] (mean)
Time per request:       5.695 [ms] (mean, across all concurrent requests)
Transfer rate:          120.01 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   5.1      0      70
Processing:    50  565 716.6    490   14510
Waiting:       40  562 706.0    490   14510
Total:        110  566 716.5    490   14510

Percentage of the requests served within a certain time (ms)
  50%    490
  66%    510
  75%    520
  80%    530
  90%    610
  95%   1030
  98%   1160
  99%   1610
 100%  14510 (longest request)


メモリの使用状況
top - 17:34:30 up 20 min,  2 users,  load average: 6.34, 6.10, 4.26
Tasks:  72 total,   8 running,  64 sleeping,   0 stopped,   0 zombie
Cpu(s): 82.7%us, 15.2%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  2.2%si,  0.0%st
Mem:    256400k total,   253792k used,     2608k free,      540k buffers
Swap:   524280k total,    18708k used,   505572k free,    21388k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 3041 suzu      25   0 45680  31m 1584 R 10.9 12.5   0:23.41 ruby
 3043 suzu      25   0 45680  31m 1584 R 14.5 12.5   0:23.71 ruby
 3045 suzu      25   0 45680  31m 1584 R 14.5 12.5   0:23.43 ruby
 3049 suzu      25   0 45680  31m 1584 R 13.0 12.5   0:23.48 ruby
 3047 suzu      25   0 45668  31m 1584 R 10.9 12.5   0:23.12 ruby
 3051 suzu      25   0 45676  31m 1584 R 14.5 12.5   0:23.31 ruby
 3039 suzu      20   0 32712  18m 1016 S  0.0  7.3   0:00.72 ruby
 3008 root      15   0 32708  13m 1916 S  0.0  5.2   0:03.58 ruby
 3078 suzu      15   0  8844 3252 1676 S  5.4  1.3   0:01.63 ab
 2756 root      15   0 12988 2216 1756 S  0.0  0.9   0:00.98 httpd
 2710 suzu      15   0  6440 2072 1296 S  0.0  0.8   0:00.89 bash
 3055 apache    15   0 12988 1888 1288 S  0.4  0.7   0:00.85 httpd
 3057 apache    15   0 12988 1888 1288 S  0.7  0.7   0:00.82 httpd
 3058 apache    15   0 12988 1888 1288 S  1.1  0.7   0:00.75 httpd
 3061 apache    16   0 12988 1888 1288 S  0.4  0.7   0:00.81 httpd
 3063 apache    15   0 12988 1888 1288 S  0.0  0.7   0:00.73 httpd
 3064 apache    15   0 12988 1888 1288 S  0.7  0.7   0:00.74 httpd
 3069 apache    15   0 12988 1888 1288 S  1.1  0.7   0:00.82 httpd
 3070 apache    15   0 12988 1888 1288 S  0.7  0.7   0:00.80 httpd
 3071 apache    15   0 12988 1888 1288 S  0.7  0.7   0:00.75 httpd
 3076 apache    15   0 12988 1888 1288 S  0.4  0.7   0:00.55 httpd
 3079 apache    15   0 12988 1888 1288 S  0.0  0.7   0:00.17 httpd
 3011 apache    15   0 12988 1884 1288 S  1.1  0.7   0:00.97 httpd
 3012 apache    15   0 12988 1884 1288 S  1.1  0.7   0:01.08 httpd
 3018 apache    15   0 12988 1884 1288 S  0.0  0.7   0:00.76 httpd
 3023 apache    16   0 12988 1884 1288 S  0.7  0.7   0:00.85 httpd
 3024 apache    15   0 12988 1884 1288 S  1.1  0.7   0:01.07 httpd
 3026 apache    15   0 12988 1884 1288 S  0.0  0.7   0:00.76 httpd
 3029 apache    15   0 12988 1884 1288 S  2.5  0.7   0:00.98 httpd
 2999 apache    15   0 12988 1848 1288 S  0.4  0.7   0:00.97 httpd
 3009 apache    15   0 12988 1836 1288 S  1.1  0.7   0:00.82 httpd

$ rails rails_with_passenger

$ script/generate controller helloworld index


$ cat app/views/helloworld/index.html.erb

Helloworld#index

Rails with mod_rails

Find me in app/views/helloworld/index.html.erb

Apache 設定ファイル
LoadModule passenger_module   /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so
PassengerRoot                 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3
PassengerRuby                 /usr/bin/ruby
VirtualHost とかに
DocumentRoot /home/httpd/vhost/rails/rails_with_passenger/public
<Directory   /home/httpd/vhost/rails/rails_with_passenger/public>
  Order allow,deny
  Allow from all
</Directory>
RailsBaseURI /
$ curl "http://localhost/helloworld"

Helloworld#index

Rails with mod_rails

Find me in app/views/helloworld/index.html.erb

このアーカイブについて

このページには、過去に書かれたブログ記事のうちRuby on Railsカテゴリに属しているものが含まれています。

前のカテゴリはPythonです。

次のカテゴリはSubversionです。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。