1

更新再起動後にプロジェクトで再起動する必要がある可能性のあるサービスを確認するために検索してきました。そのうちの 1 つは、考えているスフィンクスでした。

[Fri Nov 16 19:34:29.820 2012] [29623] accepting connections

しかし、etc/sphinxsearch に生成された sphinx.conf ファイルがなかったため、まだ searchd または searchd --stop を実行できません

次に、得た洞察に基づいて、ユニコーンまたはシンを再起動することを検討しました。問題は、宝石をチェックすると、シンとユニコーンの宝石が表示されることです。しかし、それらのいずれかを開始しようとすると、nginx および sphinxsearch ファイルが存在する etc/init.d/ にファイルが存在しません...

再起動すると、シンやユニコーンなどのアプリ サーバーのファイルが完全に消去されますか? 私たちは、実行中のRackspaceでホストされています

ルビー 1.9.2p290
レール (3.2.8、3.2.7、3.2.0)
nginx/1.1.19

  • unicorn と thin の gem があることに注意してください。ただし、私のアプリの config フォルダーには unicorn.rb または thin.rb がありません。これは本当にありがたいです。読んでくれてありがとう。

薄い 1.4.1
ユニコーン 4.3.1

ユニコーンを実行すると、ここで参照されているのと同じ問題が発生します

> /usr/local/bin/unicorn start

/usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/lib/unicorn/configurator.rb:610:in `parse_rackup_file': rackup file (start) not readable (ArgumentError)
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/lib/unicorn/configurator.rb:76:in `reload'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/lib/unicorn/configurator.rb:67:in `initialize'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:104:in `new'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:104:in `initialize'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/bin/unicorn:121:in `new'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/bin/unicorn:121:in `<top (required)>'
from /usr/local/bin/unicorn:19:in `load'
from /usr/local/bin/unicorn:19:in `<main>'

薄く実行すると、コマンドラインプロンプトが開きます...

/usr/local/bin/thin start

>> Using rack adapter

その他の宝石:

* 地元の宝石 *

actionmailer (3.2.8, 3.2.7, 3.2.0)
actionpack (3.2.8, 3.2.7, 3.2.0)
activemodel (3.2.8, 3.2.7, 3.2.0)
activerecord (3.2.8, 3.2.7, 3.2.0)
activeresource (3.2.8, 3.2.7, 3.2.0)
activesupport (3.2.8, 3.2.7, 3.2.0)
arel (3.0.2)
builder (3.0.0)
bundler (1.1.5)
carmen (1.0.0.beta2)
carmen-rails (1.0.0.beta3)
cocaine (0.2.1)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
daemons (1.1.9)
erubis (2.7.0)
eventmachine (0.12.10)
execjs (1.4.0)
faraday (0.8.4)
faraday_middleware (0.8.8)
foursquare2 (1.8.2)
geokit (1.6.5)
hashie (1.2.0)
hike (1.2.1)
httparty (0.8.3)
httpauth (0.1)
i18n (0.6.0)
journey (1.0.4)
jquery-rails (2.0.2)
json (1.7.4, 1.7.3)
jwt (0.1.5)
kgio (2.7.4)
lastfm (1.8.0)
libv8 (3.3.10.4 x86_64-linux)
mail (2.4.4)
mime-types (1.19, 1.18)
minitest (1.6.0)
multi_json (1.3.6)
multi_xml (0.5.1)
multipart-post (1.1.5)
mysql2 (0.3.11)
oauth2 (0.8.0)
paperclip (3.1.1)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.8, 3.2.7, 3.2.0)
railties (3.2.8, 3.2.7, 3.2.0)
raindrops (0.10.0, 0.9.0)
rake (0.9.2.2, 0.8.7)
rdoc (3.12, 2.5.8)
riddle (1.5.3)
sass (3.2.0, 3.1.19)
sass-rails (3.2.5)
sprockets (2.1.3)
sqlite3 (1.3.6)
sqlite3-ruby (1.3.3)
therubyracer (0.10.2, 0.10.1)
thin (1.4.1)
thinking-sphinx (2.0.10)
thor (0.16.0, 0.15.4, 0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
uglifier (1.2.7, 1.2.4)
unicorn (4.3.1)
xml-simple (1.1.1)

私は別のグループによって構築されたプロジェクトに取り組んでいます。config フォルダー内の定数ファイルにいくつかの変更を加えましたが (いくつかのドロップダウン フィールドに値を設定する配列の値を変更)、それらの変更が認識される前にアプリを再起動する必要がありました。ホスティングはRackspaceを介して行われ、サイトのオプションを介して再起動しました. 私は彼らに連絡し、私たちのサーバーのステータスを確認しました.ポートは開いていて動作しています. 問題は、サイトのアドレスにアクセスしたときにアプリが実行されていないことです。次に、サーバーのIPアドレスを入力すると、「Nginxへようこそ」と表示されます。しかし、ログファイルには次のように表示されます。

[Thu Nov 15 02:34:37.945 2012] [15916] caught SIGTERM, shutting down
[Thu Nov 15 02:34:37.996 2012] [15916] shutdown complete

私はサーバー側のセットアップにあまり精通していません。また、アプリケーションを開始する前に特定のサービスを開始する必要がある Rails プロジェクトに取り組んだこともありません。どのサービスを再起動する必要があるかを把握する方法と、それらを再起動する方法についての洞察をいただければ幸いです。この時点で、私は水の中で死んでいるような気がします...

ありがとう、

アラン

4

3 に答える 3

1

Nginx 自体は Rails アプリケーションには対応しません。リクエストを渡してレスポンスを返すことができる「アプリサーバー」が必要です。多くのオプションがありますが、最も人気があるのは Passenger、Thin、および Unicorn です。サーバー上のnginx構成から始めて、これらのいずれかが言及されているかどうかを確認することをお勧めします. それは、それらを再起動する方法を示しているはずです。

http://www.modrails.com/documentation/Users%20guide%20Nginx.html

http://articles.slicehost.com/2008/5/27/ubuntu-hardy-nginx-rails-and-thin

http://sirupsen.com/setting-up-unicorn-with-nginx/ (Rails on Unicorns まで下にスクロール)

于 2012-11-15T21:25:12.553 に答える
0

わかりましたので、オンラインで見つけた数え切れないほどのことを何時間も検索して試した後、コマンドラインからこれを実行しました:

unicorn_rails -p 3000

そして、魔法のようにサイトがバックアップされて実行されていますが、コンソールを閉じると(コマンドが実行されている)、サイトが再びダウンします。

うまくいけばこの問題を解決するために、これに従っていきます

注:これらは、物事を機能させるために私が行った手順です

サーバーを再起動するとき、アプリにアクセスできるようにするには、いくつかのサービスを再起動する必要があります。

1) thinking_sphinx
参照サイト
http://pat.github.com/ts/en/rake_tasks.html
http://www.claytonlz.com/2010/09/thinkingsphinx-conf-problems/

a)create/modify  app/config/sphinx.yml

    development:
      morphology: stem_en
      port: 9312
      bin_path: "/usr/bin"             # set up the path to binary for searchd
      searchd_binary_name: searchd
      indexer_binary_name: indexer
      #mem_limit: 128M
    test:
      morphology: stem_en
      port: 9312
      mem_limit: 128M
    production:
      morphology: stem_en
      port: 9312
      mem_limit: 512M
    # the searchd ip, in case it's not on localhost
    # address: 10.10.0.0
    # this is by default included in db/sphinx
    # searchd_file_path: "/path/to/shared/folder/sphinx"

b)rake thinking_sphinx:index
c)rake thinking_sphinx:configure       # creates config/development.sphinx.conf which helps define sphinx's indexing

d)# then you have to start sphinx, there are 2 ways to do this

    rake thinking_sphinx:start
    rake thinking_sphinx:stop

    OR

    searchd
    searchd --stop

    # only the rake commands worked for me, when I tried to run searchd
    # I got an error FATAL: no readable config file (looked in /etc/sphinxsearch/sphinx.conf, ./sphinx.conf).
    # for some reason we dont have a sphinx.conf file, but the rake commands work without it

e)# once you start thinking_sphinx check log/searchd.log file for the line
    [Fri Nov 16 19:34:29.820 2012] [29623] accepting connections

2) nginx
参照サイト:
http://wiki.nginx.org/CommandLine

a) check that nginx is up and running
    i) start server 
        # to check where nginx resides type in this into server console
        which nginx
        # whatever path it gives you is how you start the server this is my path
        /usr/sbin/nginx 
    ii) stop server
        /usr/sbin/nginx -s stop # use the path given by which command

3) unicorn (起動アプリサーバー)
参考サイト:
http://codelevy.com/2010/02/09/getting-started-with-unicorn.html

a) test if unicorn will run after previous changes
    unicorn_rails -p 3000
    # the site should now be up and running, check that it is
    # console should now log the different actions you do on the site 

b) create unicorn.rb in config folder (if none is there)
    # only start this step if the step above got the site running
    # close the console or exit the process you started above
    # contents of unicorn.rb 
    worker_processes 2      #(starts 2 child processes, not completely neccissary)
    preload_app true
    timeout 30
    listen 3000

    after_fork do |server, worker|
      ActiveRecord::Base.establish_connection
    end

c) run unicorn in the background
    # make sure you exited the process above before running this
    unicorn_rails -c config/unicorn.rb -D

    # this was giving me an error that it said was logged by stderr
    # I got the command to run by adding a command to the front
    http://stackoverflow.com/questions/2325152/check-for-stdout-or-stderr

    exec 2> /dev/null unicorn_rails -c config/unicorn.rb -D


d) (optional) check stats from starting unicorn

    i) pgrep -lf unicorn_rails
        #sample output
        5374 unicorn_rails master -c config/unicorn.rb -D             
        5388 unicorn_rails worker[0] -c config/unicorn.rb -D    # not needed currently  
        5391 unicorn_rails worker[1] -c config/unicorn.rb -D    # not needed currently

    ii) cat tmp/pids/unicorn.pid # from inside the streetpotato folder
        #sample output
        5374
于 2012-11-16T21:54:28.480 に答える