よかろうもん!

アプリからインフラまで幅広くこなすいまどきのクラウドエンジニアが記す技術ブログ

thinを使ってみた

thinのオプションは以下のようなものがあります。

Server options:
-a, --address HOST bind to HOST address (default: 0.0.0.0)
-p, --port PORT use PORT (default: 3000)
-S, --socket PATH bind to unix domain socket
-e, --environment ENV Rails environment (default: development)
-c, --chdir PATH Change to dir before starting
-s, --servers NUM Number of servers to start
set a value >1 to start a cluster
-d, --daemonize Run daemonized in the background
-l, --log FILE File to redirect output
(default: log/thin.log)
-P, --pid FILE File to store PID
(default: tmp/pids/thin.pid)
-t, --timeout SEC Request or command timeout in sec
(default: 60)
-u, --user NAME User to run daemon as (use with -g)
-g, --group NAME Group to run daemon as (use with -u)
--prefix PATH Mount the app under PATH (start with /)
-C, --config PATH Load option from a config file
--stats Install the Stats adapter at /stats

Common options:
-D, --debug Set debbuging on
-V, --trace Set tracing on
-h, --help Show this message
-v, --version Show version

mongrelのようにYAML形式の設定ファイルを指定できるのかと思っていたが、どうやら出来ない様子。

その代わりといっては何ですが、複数インスタンスを起動するかを指定できるじゃないですか!

$ thin -s 5 start
Starting server on 0.0.0.0:3000 ...
Starting server on 0.0.0.0:3001 ...
Starting server on 0.0.0.0:3002 ...
Starting server on 0.0.0.0:3003 ...
Starting server on 0.0.0.0:3004 ...

ログについてはインスタンス毎に出力するようになっていました(thin.[ポート番号].log)。