一部のガイド (例) では、これを使用して Web サーバーを起動することを推奨しています。
bundle exec rails server puma
しかし、私はいつもサーバーをpuma
直接起動しました
bundle exec puma
経由で puma (または他のサーバー) を起動すると、何か特別なことが起こりますrails server
か?
一部のガイド (例) では、これを使用して Web サーバーを起動することを推奨しています。
bundle exec rails server puma
しかし、私はいつもサーバーをpuma
直接起動しました
bundle exec puma
経由で puma (または他のサーバー) を起動すると、何か特別なことが起こりますrails server
か?
を使用するrails s <server>
と、サーバーは Rails コマンドから起動され、Rails 環境を認識します。
これにより、たとえば、 によって提供される任意の機能とフラグを使用できるようになりますrails server command
。
rails s --help
Usage: rails server [mongrel, thin, etc] [options]
-p, --port=port Runs Rails on the specified port.
Default: 3000
-b, --binding=ip Binds Rails to the specified ip.
Default: 0.0.0.0
-c, --config=file Use custom rackup configuration file
-d, --daemon Make server run as a Daemon.
-u, --debugger Enable ruby-debugging for the server.
-e, --environment=name Specifies the environment to run this server under (test/development/production).
Default: development
-P, --pid=pid Specifies the PID file.
Default: tmp/pids/server.pid
-h, --help Show this help message.
たとえば、デバッガーをセッション パスにアタッチし--debugger
たり、サーバーをデーモン化したりできます。
Puma
2 番目の利点は、gem を .xml ファイルにリストする必要があるため、インスタンスをバージョン管理できることですGemfile
。bundle exec
これは、あなたがやっているように始めれば、すでに真実です。
逆に、単純に実行$ puma
(または$ bundle exec puma
) すると、Rails システムを通過していません。Puma
ラック ブートストラップ ファイルを見つけようとし、それを使用します (Railsconfig.ru
がアプリケーション ルートにスクリプトを提供するため、これが機能します。
一般的に言えば、特定のオプションをサーバーに渡す必要がない場合、実質的な違いはありません。私は puma が好きで、実稼働環境で Unicorn を使用している場合でも一部のプロジェクトで使用する傾向があるため$ puma
、スタンドアロン コマンドとして実行すると便利ですGemfile
。
ただし、$ rails s puma
スタック全体でPuma
. これは、ドキュメントで提案されているコマンドでもあります。