2

Rails アプリを起動するには、/var/www/html/appまず dir に移動します。
次に、残りの 2 つのコマンドを実行します。

1. $ cd /var/www/html/app
2. $ bundle exec rake sunspot:solr:start RAILS_ENV=production
3. $ unicorn_rails -c config/unicorn.rb -E production -D

最初の行を省略したい。2番目と3番目のコマンドに入れます。
出来ますか?

4

5 に答える 5

2

この問題を解決する最善の方法は、独自のシェル スクリプトを作成することです。とても簡単で、多くの点で便利です。

#!/bin/sh
# file-name: app-start.sh
cd /var/www/html/app
bundle exec rake sunspot:solr:start RAILS_ENV=production
unicorn_rails -c config/unicorn.rb -E production -D

それから

chmod +x app-start.sh
./app-start.sh
于 2013-10-21T08:31:23.260 に答える
1

foremanを使用して、これらのさまざまなプロセスを開始および管理できます。

  1. $ cd /var/www/html/app
  2. Procfileたとえば、次のプロセスで名前が付けられたファイルを作成します。

    web: unicorn_rails -c config/unicorn.rb -E production -D (ここで改行、SO がこれを行っている理由がわからない) 検索: bundle exec rake sunspot:solr:start RAILS_ENV=production

  3. でプロセスを開始しますforeman start

これは、Heroku でアプリをホストするときにとにかく行うことです。

于 2013-10-22T11:55:35.640 に答える