Scaling a Rails Application from the Bottom Up" Jason Hoffman (Room: Oregon Ballroom 204)

スピーカ:joyent CTO DavidYoung

前編 --------
ハードウェアの選び方/コロケーションサイトの選び方
中編 --------
ハードウェアの選び方を更に深く

一番興味を引いた所は
solarisをプラットフォームにして Virtualzationを行って
freebsdを動かすという構成を取っている(!)
エッジサーバを仮想化するのがアツイらしい。
確かにzfsを使って管理する事考えるとすごく利に適っている

[この人こんな所でも登場していた]
http://jp.sun.com/solutions/infra/dc/consoli_virtual/virtualization/

後編 --------
レイヤ7のお話に移行

  • -

BIGIPの設定から
Mongrel(event-driven)
JRuby in Glassfish

  • -

構成
BIG IP -> Mongrel

  • -

J-EAI
XMPP-Jabber message bus for XML(atom)
Erlang-based
Cluster-ready and very scalable
Lots of connectors:SMTP,JDBC
App <-> Bus <-> DataBase

  • -

PowerDNS便利そう

※走り書きですません...

redmineのwikiでhikidoc記法が使いたい

textileはどうも気に入らないと言うことなので
実現可能かどうかテストする意味でとりあえずquick hack

Index: app/helpers/application_helper.rb
===================================================================
--- app/helpers/application_helper.rb   (revision 439)
+++ app/helpers/application_helper.rb   (working copy)
@@ -125,21 +125,25 @@
     # example:
     #   [[link]] -> "link":link
     #   [[link|title]] -> "title":link
-    text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| "\"#{$3 || $1}\":" + format_wiki_link.call(Wiki.titleize($1)) }
+    text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| "[[#{$3 || $1}|" + format_wiki_link.call(Wiki.titleize($1)) + "]]" }
 
     # turn issue ids to textile links
     # example:
     #   #52 -> "#52":/issues/show/52
-    text = text.gsub(/#(\d+)(?=\b)/) {|m| "\"##{$1}\":" + url_for(:controller => 'issues', :action => 'show', :id => $1) }
+    text = text.gsub(/#(\d+)(?=\b)/) {|m| "[[##{$1}|" + url_for(:controller => 'issues', :action => 'show', :id => $1) + "]]" }
        
     # turn revision ids to textile links (@project needed)
     # example:
     #   r52 -> "r52":/repositories/revision/6?rev=52 (@project.id is 6)
-    text = text.gsub(/r(\d+)(?=\b)/) {|m| "\"r#{$1}\":" + url_for(:controller => 'repositories', :action => 'revision', :id => @project.id, :rev => $1) } if @project
+    text = text.gsub(/r(\d+)(?=\b)/) {|m| "[[#{$1}|" + url_for(:controller => 'repositories', :action => 'revision', :id => @project.id, :rev => $1) + "]]" } if @project
    
     # finally textilize text
+    require 'hikidoc'
     @do_textilize ||= (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? "textilize")
-    text = @do_textilize ? auto_link(RedCloth.new(text).to_html) : simple_format(auto_link(h(text)))
+    text = @do_textilize ? auto_link(HikiDoc.new(text).to_html) : simple_format(auto_link(h(text)))
   end
   
   def error_messages_for(object_name, options = {})

ひとまずちゃんと表示出来るようになったので、しっかりpluginとして作りますかうん

モジュール化とtable_name

rabbitjob:~/.tmp/te hirokazu$ ./script/generate model Hatena::Tes
      create  app/models/hatena
      create  test/unit/hatena
      create  test/fixtures/hatena
      create  app/models/hatena/tes.rb
      create  test/unit/hatena/tes_test.rb
      create  test/fixtures/hatena/hatena_tes.yml
      create  db/migrate
      create  db/migrate/001_create_hatena_tes.rb

で、

rabbitjob:~/.tmp/te hirokazu$ ./script/console 
Loading development environment.
>> Hatena::Tes.table_name
=> "tes"
>> quit

自分でtable_name指定すれば問題無く動くんだけど...

class Hatena::Tes < ActiveRecord::Base
  self.table_name = :hatena_tes
end

眠いせいかな?

mongrel_railsとmime type

  1. 雛形になるconfigを作る
hitokuro$ mongrel_rails start -G config/mongrel_opts.conf
** Writing config to config/mongrel_opts.conf
## Exiting. Re-run without -G and WITH -C using your new config file.
  1. configへmimeマッピング情報の追加
:mime_map: config/mongrel_mime.conf
  1. mime_typeのマッピングファイルを作る
hitokuro$ cat config/mongrel_mime.conf 
.js: text/javascript; charset=UTF-8
.json: text/javascript; charset=UTF-8
.htm: text/html; charset=UTF-8
.html: text/html; charset=UTF-8
.css: text/css; charset=UTF-8
.txt: text/plain; charset=UTF-8

参項
http://mongrel.rubyforge.org/docs/howto.html

っていうかコレもしかして railsのenvironmentに入っちゃう?そんな気がしてきた29才