使用Foreman gem的无效架构文件

时间:2012-04-19 03:45:08

标签: ruby-on-rails foreman rackup

尝试在vagrant(Ubuntu)上运行foreman start。

Procfile

web:            bundle exec thin start --port 3000
private_pub:    bundle exec thin start --port 9292 --rackup private_pub.ru

private_pub.ru在我的根目录下,Procfile也是。

如果我这样做(它有效):

rackup private_pub.ru -s thin -E production

并在rails服务器之后...

但是当我这样做时:

foreman start

20:43:18 web.1          | started with pid 3447
20:43:18 private_pub.1  | started with pid 3450
20:43:20 private_pub.1  | /home/vagrant/.rvm/gems/ruby-1.9.3-p125/gems/thin-1.3.1/lib/thin/controllers/controller.rb:183:in `load_rackup_config': Invalid rackup file.  please specify either a .ru or .rb file (RuntimeError)
20:43:20 private_pub.1  |       from /home/vagrant/.rvm/gems/ruby-1.9.3-p125/gems/thin-1.3.1/lib/thin/controllers/controller.rb:71:in `start'
20:43:20 private_pub.1  |       from /home/vagrant/.rvm/gems/ruby-1.9.3-p125/gems/thin-1.3.1/lib/thin/runner.rb:185:in `run_command'
20:43:20 private_pub.1  |       from /home/vagrant/.rvm/gems/ruby-1.9.3-p125/gems/thin-1.3.1/lib/thin/runner.rb:151:in `run!'
20:43:20 private_pub.1  |       from /home/vagrant/.rvm/gems/ruby-1.9.3-p125/gems/thin-1.3.1/bin/thin:6:in `<top (required)>'
20:43:20 private_pub.1  |       from /home/vagrant/.rvm/gems/ruby-1.9.3-p125/bin/thin:19:in `load'
20:43:20 private_pub.1  |       from /home/vagrant/.rvm/gems/ruby-1.9.3-p125/bin/thin:19:in `<main>'
20:43:20 private_pub.1  | process terminated
20:43:20 system         | sending SIGTERM to all processes
20:43:20 system         | sending SIGTERM to pid 3447
20:43:25 system         | sending SIGKILL to all processes
20:43:25 system         | sending SIGKILL to pid 3447

1 个答案:

答案 0 :(得分:1)

问题在于Vagrant。您的Procfile(在Windows下克隆)具有Windows行结尾(\ r \ n)。由于文件末尾有换行符,因此瘦看'private_pub.ru \ r'作为其rackup文件,所以此处的测试:https://github.com/macournoyer/thin/blob/master/lib/thin/controllers/controller.rb#L176失败。

删除换行符以解决问题。