Reputation: 2061
After trying to start foreman, I get this error (note that it does seem to work on heroku though so I guess this is a strictly local problem):
hrn039:textthechange jon$ foreman start
02:20:00 web.1 | started with pid 7363
02:20:01 web.1 | /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/server.rb:33:in `parse!': missing argument: -e (OptionParser::MissingArgument)
02:20:01 web.1 | from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:280:in `parse_options'
02:20:01 web.1 | from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:180:in `options'
02:20:01 web.1 | from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/server.rb:54:in `set_environment'
02:20:01 web.1 | from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/server.rb:42:in `initialize'
02:20:01 web.1 | from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:50:in `new'
02:20:01 web.1 | from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:50:in `<top (required)>'
02:20:01 web.1 | from script/rails:6:in `require'
02:20:01 web.1 | from script/rails:6:in `<main>'
02:20:01 web.1 | process terminated
02:20:01 system | sending SIGTERM to all processes
The Procfile only has one line as specified by heroku
web: bundle exec rails server thin -p $PORT -e $RACK_ENV
And my gemfile has
gem 'thin'
Google isn't being very helpful with this error.
Thanks!
Upvotes: 8
Views: 4076
Reputation: 4526
This is not about executing on Heroku - see that the original question about is about executing with Foreman - which is local execution.
You can replicate your error by executing the following:
rails server thin -e
That's effectively what Foreman is running, given your Procfile:
web: bundle exec rails server thin -p $PORT -e $RACK_ENV
So I'm going to guess that you're not passing in an argument to -e. ie. you haven't defined RACK_ENV locally.
What you can do is create a .env
file in your local directory, something like
RACK_ENV=development
PORT=3000
Foreman will automatically pick up the local .env
file and set the environment appropriately, before creating the process based on your process type declaration.
Upvotes: 20
Reputation: 395
I just ran into this same problem. If you change your Procfile to just
web: bundle exec rails server thin -p $PORT
it should work. Note, this uses the default Thin port of 5000 rather than 3000 (which means you'll need to go to http://localhost:5000 to see your app.
Having just
web: bundle exec rails server thin
in your Procfile will use port 3000, but this will cause errors on Heroku.
Upvotes: 0
Reputation: 463
I had the same problem with rails v3.2 in Ubuntu 10.04. I managed to get thin running by doing the following steps:
Change your Procfile as follows:
web: bundle exec rails server thin -p $PORT -e development
Add $stdout.sync = true
on the top of your config.ru file, to direct server output to your terminal (otherwise you do not get output in your terminal)
Tell me if it works!
Upvotes: 0