剛剛完成通過rbenv在我的服務器上安裝新版本的ruby。獨角獸沒有使用rbenv版本或rails -v版本
rbenv versions
回報:
system
2.2.3
* 2.3.3 (set by /opt/pesto/current/config/.ruby-version)
我試圖重新啓動我的麒麟服務(sudo service unicorn restart
):
Couldn't restart.
無奈之下,我嘗試啓動(sudo service unicorn start
):
Could not find erubis-2.7.0 in any of the sources
Run `bundle install` to install missing gems.
我已經運行了bundle安裝。當我做rbenv local 2.3.3
以及rbenv global 2.3.3
,然後gem list
,我看到:
'erubis (2.7.0)'
在衆目睽睽下。這就是說 - 這個寶石絕對在那裏。
所以我看到它是否與我的其他版本做了一些奇怪的事情。我改rbenv global 2.2.3
和rbenv local 2.2.3
,做:
gem install erubis -v 2.7.0
這樣做之後,現在的錯誤是抱怨另一種不同的寶石,也已經在我的2.3.3寶石列表中找到......所以我的結論它絕對只看2.2.3寶石列表,因爲在2.2.3中加入寶石可以解決這個問題。
簡單地運行2.2.3的bundle install不是一個選項 - 我需要的依賴項僅在我的2.3.3發行版中可用。我真正想要的是獨角獸只提及2.3.3中的可用內容,並放棄查看2.2.3以及那裏可用的寶石。
這裏是我的unicorn.rb:
app_path = File.expand_path(File.dirname(__FILE__) + '/..')
# Set the working application directory
# working_directory "/path/to/your/app"
working_directory app_path
before_exec do |server|
ENV['BUNDLE_GEMFILE'] = "#{root}/Gemfile"
end
# Set the location of the unicorn pid file. This should match what we
put in the
# unicorn init script later.
pid (ENV['UNICORN_PID_PATH'] || "#{app_path}/tmp/") + 'unicorn.pid'
# You should define your stderr and stdout here. If you don't, stderr
defaults
# to /dev/null and you'll lose any error logging when in daemon mode.
stderr_path(app_path + '/log/unicorn.log') unless ENV['RAILS_ENV'] ==
'development'
stdout_path(app_path + '/log/unicorn.log') unless ENV['RAILS_ENV'] ==
'development'
# Unicorn socket
listen('127.0.0.1:3000', backlog: 64, :tcp_nopush => true) if
ENV['RAILS_ENV'] == 'development'
list en(app_path + '/tmp/unicorn.sock', backlog: 64) unless
ENV['RAILS_ENV'] == 'development'
listen(8080, :tcp_nopush => true) unless ENV['RAILS_ENV'] ==
'development'
# Number of processes
# worker_processes 4
worker_processes (ENV['RAILS_ENV'] == 'production' ? 16 : 1)
# Time-out
timeout 300
# Load the app up before forking.
preload_app true
# Garbage collection settings.
GC.respond_to?(:copy_on_write_friendly=) &&
GC.copy_on_write_friendly = true
# If using ActiveRecord, disconnect (from the database) before
forking.
before_fork do |server, worker|
defined?(ActiveRecord::Base) &&
ActiveRecord::Base.connection.disconnect!
end
# After forking, restore your ActiveRecord connection.
after_fork do |server, worker|
defined?(ActiveRecord::Base) &&
ActiveRecord::Base.establish_connection
end
我看不出它是指紅寶石版本在此配置文件中被引用。因此,我在計算如何讓獨角獸使用我的新紅寶石方面存在一些爭議。