2017-09-22 3 views
0

Ich habe gerade eine neue Version von Ruby über Rbenv auf meinem Server installiert.Unicorn nicht mit rbenv Version oder Rails -V Version

rbenv versions kehrt:

system 
2.2.3 
* 2.3.3 (set by /opt/pesto/current/config/.ruby-version) 

Ich versuche, mein Einhorn Dienst (sudo service unicorn restart) neu zu starten:

Couldn't restart. 

In ihrer Verzweiflung versuche ich (sudo service unicorn start) zu starten:

Could not find erubis-2.7.0 in any of the sources 
Run `bundle install` to install missing gems. 

Ich habe bereits Bundle-Installation ausgeführt. Als ich rbenv local 2.3.3 sowie rbenv global 2.3.3 tun, dann gem list, ich sehe:

'erubis (2.7.0)' 

In plain sight. Das heißt - dieses Juwel ist definitiv da.

So sah ich, ob es etwas komisches mit meiner anderen Version machte. Ich wechselte zu rbenv global 2.2.3 und rbenv local 2.2.3 und tat

gem install erubis -v 2.7.0 

Danach tun, jetzt der Fehler über ein anderes beschwert, verschiedenen Edelstein, der auch schon in meiner 2.3.3 gem Liste zu finden ... so habe ich abgeschlossen dass es sich definitiv nur um die 2.2.3-Edelsteinliste handelt, da das Hinzufügen des Edelsteins zu 2.2.3 das Problem behoben hat.

Einfach zu installieren Bundle Installation für 2.2.3 ist keine Option - Ich brauche Abhängigkeiten, die nur in meiner 2.3.3-Distribution verfügbar sind. Was ich wirklich möchte, ist, dass Einhorn auf das verweist, was nur in 2.3.3 verfügbar ist, und auf 2.2.3 und welche Edelsteine ​​dort verfügbar sind.

Hier ist meine 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 

Ich sehe nicht, wo die Ruby-Version es sich bezieht sich in dieser Konfigurationsdatei verwiesen. Als solcher bin ich ein wenig unschlüssig herauszufinden, wie man ein Einhorn bekommt, um meinen neueren Rubin zu benutzen.

Antwort

0

Die Schienenversion, die Unicorn verwendet, kann in /etc/init.d/unicorn bearbeitet werden. Ich habe es geändert und es hat funktioniert.

Verwandte Themen