简体   繁体   中英

'foreman start' is stuck

I have a locally developed Rails application. It is very simple, with no database but only a controller that accesses Facebook data and renders them in view. By the way, gem RestGraph is used.

Before I push this application to heroku, I used foreman start to test it. Since I was using WEBrick before I need to install 'thin' gem and create a Procfile which reads:

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

an '.env' file seems also required, which reads:

RACK_ENV=development
PORT=3000

The 'config.ru' file is generate by rails, which reads:

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

Now I entered 'foreman start', but all I get is one line:

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

The server will not boot. And if I force terminate it, the error is:

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

Which is not very helpful.

It may be that instead of being "stuck," your log is just being buffered: foreman only shows line with “started wit pid #” and nothing else

I solved that issue by adding

$stdout.sync = true

to config.ru

Then you might get more helpful feedback from Foreman.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM