3

我有一个本地开发的 Rails 应用程序。它非常简单,没有数据库,只有一个控制器,可以访问 Facebook 数据并将它们呈现在视图中。顺便说一下,使用了gem RestGraph

在我将此应用程序推送到 heroku 之前,我使用 foreman start 对其进行了测试。由于我在需要安装“瘦”gem 并创建一个 Procfile 之前使用的是 WEBrick,其内容如下:

web: bundle exec thin start -R config.ru -e $RACK_ENV -p $PORT

似乎还需要一个“.env”文件,内容如下:

RACK_ENV=development
PORT=3000

'config.ru' 文件由 rails 生成,内容如下:

require ::File.expand_path('../config/environment',  __FILE__)
run Myapp::Application

现在我输入了“工头开始”,但我得到的只是一行:

15:33:18 web.1     | started with pid 27143

服务器不会启动。如果我强制终止它,错误是:

/usr/local/foreman/lib/foreman/engine.rb:141: [BUG] rb_sys_fail() - errno == 0

这不是很有帮助。

4

2 回答 2

1

可能是您的日志没有被“卡住”,而是被缓冲:工头只显示带有“started wit pid #”的行,没有别的

我通过添加解决了这个问题

$stdout.sync = true

到 config.ru

然后你可能会从工头那里得到更多有用的反馈。

于 2012-09-21T02:15:54.167 回答
0

This seems a little over complex. From looking at a couple of apps I have I have the following in my procfile:

bundle exec rails server thin -p $PORT

I also don't have a .env file in these instances.

One thing worth noting is that Foreman will ignore the port you pass in most of the time, it likes to sit in a port range higher than 5000

于 2012-05-18T09:33:19.323 回答