2012-05-25 8 views
5

मैं अपने आवेदन को उबंटू वीपीएस पर तैनात करता हूं। मैंने "वीपीएस पर तैनात" रेलवेकास्ट का पालन किया।यूनिकॉर्न के साथ प्रारंभिक या जेम लोड नहीं हुआ 500 आंतरिक सर्वर त्रुटि

सब कुछ चिकनी, ऊपर चला गया जब तक मैं निम्नलिखित मणि कहा: https://github.com/marceldegraaf/sisow

अपने स्थानीय विकास मशीन पर यह एक आकर्षण की तरह काम करता है, लेकिन बाद मैं इसे अपने उत्पादन वातावरण के लिए तैनात, रेल आवेदन अब शुरू नहीं होगी (500 आंतरिक सर्वर त्रुटि)।

मैंने अपनी यूनिकॉर्न कॉन्फ़िगरेशन, deploy.rb और अन्य फ़ाइलों का एक समूह में कई "tweaks" की कोशिश की है, लेकिन कुछ भी काम नहीं करता है।

RAILS_ENV=production bundle exec rails c 

मैं बिना किसी समस्या के मणि का उपयोग कर सकते

unicorn.log

E, [2012-05-25T16:38:14.742805 #27916] ERROR -- : reaped #<Process::Status: pid 5777 exit 1> worker=1 
I, [2012-05-25T16:38:14.742998 #27916] INFO -- : worker=1 spawning... 
I, [2012-05-25T16:38:14.746132 #5803] INFO -- : worker=1 spawned pid=5803 
I, [2012-05-25T16:38:14.746557 #5803] INFO -- : Refreshing Gem list 
/home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- sisow (LoadError) 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `block in require' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:251:in `require' 
    from /home/deployer/apps/my_app/releases/20120525140057/config/initializers/sisow.rb:1:in `<top (required)>' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:245:in `load' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:245:in `block in load' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:236:in `load_dependency' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.0/lib/active_support/dependencies.rb:245:in `load' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/railties-3.2.0/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/railties-3.2.0/lib/rails/engine.rb:587:in `each' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/railties-3.2.0/lib/rails/engine.rb:587:in `block in <class:Engine>' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/railties-3.2.0/lib/rails/initializable.rb:30:in `instance_exec' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/railties-3.2.0/lib/rails/initializable.rb:30:in `run' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/railties-3.2.0/lib/rails/initializable.rb:55:in `block in run_initializers' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/railties-3.2.0/lib/rails/initializable.rb:54:in `each' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/railties-3.2.0/lib/rails/initializable.rb:54:in `run_initializers' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/railties-3.2.0/lib/rails/application.rb:136:in `initialize!' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/railties-3.2.0/lib/rails/railtie/configurable.rb:30:in `method_missing' 
    from /home/deployer/apps/my_app/releases/20120525140057/config/environment.rb:5:in `<top (required)>' 
    from config.ru:4:in `require' 
    from config.ru:4:in `block in <main>' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize' 
    from config.ru:1:in `new' 
    from config.ru:1:in `<main>' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn.rb:44:in `eval' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn.rb:44:in `block in builder' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:696:in `call' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:696:in `build_app!' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:569:in `init_worker_process' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:589:in `worker_loop' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:487:in `spawn_missing_workers' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:498:in `maintain_worker_count' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:272:in `join' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/gems/unicorn-4.3.1/bin/unicorn:121:in `<top (required)>' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `load' 
    from /home/deployer/apps/my_app/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `<main>' 
E, [201 

गेंडा:

अजीब बात यह है कि जब मैं का उपयोग करें (?)। आरबी

app_path = "/home/deployer/apps/my_app" 
root = "/home/deployer/apps/my_app/current" 
bundle_path = "#{app_path}/shared/bundle" 
working_directory root 
pid "#{root}/tmp/pids/unicorn.pid" 
stderr_path "#{root}/log/unicorn.log" 
stdout_path "#{root}/log/unicorn.log" 

listen "/tmp/unicorn.my_app.sock" 
worker_processes 4 
timeout 30 

before_exec do |server|               
    ENV["BUNDLE_GEMFILE"] = "#{root}/Gemfile"        
end 

unicorn_init.sh

#!/bin/sh 
set -e 

# Feel free to change any of the following variables for your app: 
TIMEOUT=${TIMEOUT-60} 
APP_ROOT=/home/deployer/apps/my_app/current 
PID=$APP_ROOT/tmp/pids/unicorn.pid 
CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E production" 
AS_USER=deployer 
set -u 

OLD_PIN="$PID.oldbin" 

sig() { 
    test -s "$PID" && kill -$1 `cat $PID` 
} 

oldsig() { 
    test -s $OLD_PIN && kill -$1 `cat $OLD_PIN` 
} 

run() { 
    if [ "$(id -un)" = "$AS_USER" ]; then 
    eval $1 
    else 
    su -c "$1" - $AS_USER 
    fi 
} 

case "$1" in 
start) 
    sig 0 && echo >&2 "Already running" && exit 0 
    run "$CMD" 
    ;; 
stop) 
    sig QUIT && exit 0 
    echo >&2 "Not running" 
    ;; 
force-stop) 
    sig TERM && exit 0 
    echo >&2 "Not running" 
    ;; 
restart|reload) 
    sig HUP && echo reloaded OK && exit 0 
    echo >&2 "Couldn't reload, starting '$CMD' instead" 
    run "$CMD" 
    ;; 
upgrade) 
    if sig USR2 && sleep 2 && sig 0 && oldsig QUIT 
    then 
    n=$TIMEOUT 
    while test -s $OLD_PIN && test $n -ge 0 
    do 
     printf '.' && sleep 1 && n=$(($n - 1)) 
    done 
    echo 

    if test $n -lt 0 && test -s $OLD_PIN 
    then 
     echo >&2 "$OLD_PIN still exists after $TIMEOUT seconds" 
     exit 1 
    fi 
    exit 0 
    fi 
    echo >&2 "Couldn't upgrade, starting '$CMD' instead" 
    run "$CMD" 
    ;; 
reopen-logs) 
    sig USR1 
    ;; 
*) 
    echo >&2 "Usage: $0 <start|stop|restart|upgrade|force-stop|reopen-logs>" 
    exit 1 
    ;; 
esac 

Gemfile

source 'http://rubygems.org' 

gem 'rails', '3.2.0' 
gem "net-ssh", "~> 2.5.1" 

# Bundle edge Rails instead: 
# gem 'rails',  :git => 'git://github.com/rails/rails.git' 

gem 'pg' 
gem "cocoon" 
gem 'nokogiri' 
gem 'hpricot' 
gem "formtastic", "~> 2.1.1" 
gem "activeadmin", "~> 0.4.4" 
gem 'omniauth' 
gem 'country-select' 
gem "paperclip", "~> 3.0" 
gem 'cancan' 
gem 'rolify' 

gem "meta_search", '>= 1.1.0.pre' 
gem 'bourbon', "~> 2.0.0.rc1" 
gem "rails-boilerplate" 
gem 'geocoder' 
gem 'httparty' 
gem 'hashie' 
gem 'will_paginate', :git => "git://github.com/mislav/will_paginate.git" 
gem 'thinking-sphinx', '2.0.10' 
gem 'sanitize' 
gem 'feedzirra' 
gem "crypt19", "~> 1.2.1" 
gem 'wicked_pdf' 
gem 'forem', :git => "git://github.com/radar/forem.git" 
gem 'thin' 
gem 'whenever', :require => false 
gem "ckeditor", "3.7.1" 
gem 'sisow' 

# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', '~> 3.2.3' 
    gem 'coffee-rails', '~> 3.2.1' 
    gem 'uglifier', '>= 1.0.3' 
end 

gem 'haml-rails' 
gem 'jquery-rails' 

group :development do 
    gem 'ruby_parser' 
end 


# To use ActiveModel has_secure_password 
# gem 'bcrypt-ruby', '~> 3.0.0' 

# Use unicorn as the web server 
gem 'unicorn' 

# Deploy with Capistrano 
gem 'capistrano' 

# To use debugger 
# gem 'ruby-debug19', :require => 'ruby-debug' 
+0

मणि सूची क्या कहती है? शायद, आपको बस अपने सर्वर पर बंडल इंस्टॉल निष्पादित करना होगा। – sailor

+0

मणि 'मणि सूची' –

उत्तर

8

मेरे पास एक ही समस्या थी। पुन: प्रारंभ हो गेंडा सेवा मेरे लिए यह तय:

/etc/init.d/unicorn_my_app stop 
/etc/init.d/unicorn_my_app start 

क्रेडिट को जाता है: https://github.com/jdutil/contact_us/issues/15#issuecomment-7954768

+0

में सूचीबद्ध है मेरे लिए काम किया, धन्यवाद एंड्रयू –

1

मैं ठीक उसी समस्या लिया है (हालांकि अलग मणि के साथ - iCalendar)। मैं बहुत सी बातें की कोशिश की लेकिन मुझे क्या मदद मिली अंत में, माणिक (rbenv के माध्यम से), सफाई जवाहरात पुनर्स्थापित करने के लिए सर्वर से एप्लिकेशन को हटाने, मेरे unicorn.rb में जोड़ना था:

before_exec do |server| 
    ENV["BUNDLE_GEMFILE"] = "/path/to/app/current/Gemfile" 
end 

और अंत में शुरू से ही ताजा तैनाती कर (deply: सेटअप)।

मैं समाधान के बारे में 100% निश्चित नहीं हूं (यह अंत में काफी गड़बड़ था) लेकिन मुझे उम्मीद है कि यह आपकी भी मदद करेगा।

संबंधित मुद्दे