2016-07-27 27 views
0

我已经在Windows 8中使用RailsInstaller和postgresql安装了Ruby on Rails。我尝试使用预先存在的应用程序的文件运行rails server,但是我遇到错误'JRuby或Windows不支持Worker模式'。RoR在Windows中不适用于在Linux中使用RoR构建的预先存在的应用程序

在我的config/puma.rb文件中,我将worker设置为0,然后在windows上不支持daemon模式。基本上每次我改变一些东西,我得到更多的错误。

我已经修复了环境变量,宝石等(如在其他文章中),比如这个Cannot install Puma gem on Ruby on Rails.有没有希望在windows机器上运行一个预先存在的RoR应用程序?

当我为RoR'blog'运行rails服务器时,它工作正常,所以我知道RoR绝对是在windows中工作的!

这是我的''de-identified'config/puma.rb文件。是因为在Windows中我没有/ var/app文件夹?我玩过目录等无济于事。

` 
#!/usr/bin/env puma 

# start puma with: 
# RAILS_ENV=production bundle exec puma -C ./config/puma.rb 

workers 0 
theident = 'nameofthing' 
application_path = '/var/app/'+ theident + '.address.com.au/current' 
railsenv = 'production' 
directory application_path 
environment railsenv 
daemonize false 
pidfile "#{application_path}/tmp/pids/puma-#{railsenv}.pid" 
state_path "#{application_path}/tmp/pids/puma-#{railsenv}.state" 
stdout_redirect"#{application_path}/log/puma-#{theident}.log" 
threads 0, 16 
bind "unix:///var/run/puma/" + theident + "_app.sock" ` 

我已经改变了这些目录到当前路径,现在运行的导轨上服务器“开始检查,但本地主机:3000是一个网页不能正常工作。我得到SIGUSR1的错误,SIGUSR2无法正常工作,SIGUSR2无法正常工作,等等。

回答

1

JRuby和Windows都不支持“workers”方法,所以最好的解决方案是从puma.rb中删除导致错误的行。在我的情况下,我删除了;

workers Integer(ENV['WEB_CONCURRENCY'] || 2) 

所以剩下我有;

threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5) 
threads threads_count, threads_count 

preload_app! 

rackup  DefaultRackup 
port  ENV['PORT']  || 3000 
environment ENV['RACK_ENV'] || 'development' 

on_worker_boot do 
    # Worker specific setup for Rails 4.1+ 
    # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot 
    ActiveRecord::Base.establish_connection 
end 

这可能是你不同,但具体的线路将与“工人”

+0

感谢您的建议开始 - 在最后,我不得不从我的Gemfile中删除PUMA宝石和之前安装节点JS让它工作! – RebRy

相关问题