Rails Update to 3.2.11 breaks running multiple servers
Asked Answered
T

3

15

Our application runs two Rails servers at different ports that talk to each other. Using Rails 3.2.8, I could open a terminal, cd to the project, run rails s -p3000, open another terminal, run rails s -p3001 and everything worked fine. The gemfile contains thin, so thin would be launched automatically, but using the rails s would allow using the --debugger when needed.

Since updating the Rails 3.2.11 this no longer works. I get an error: "A server is already running. Check /home/george/Projects/dashboard/tmp/pids/server.pid". I can launch thin directly on both ports, but then have no debugging support. Launching thin on one and rails on the other seemed to not work, but it was not clear that all the server tasks were getting killed when the error stopped the server.

Tekla answered 15/1, 2013 at 0:41 Comment(0)
B
34

Both commands are checking the default PID file location (tmp/pids/server.pid), so you're seeing this error. Try running multiple servers like so:

Server 1: bundle exec rails s

Server 2: bundle exec rails s -p 3001 -P tmp/pids/server2.pid

Bosket answered 21/1, 2013 at 20:45 Comment(3)
I'll have to try that. I assumed something like that would be the correct fix, but could not find it documented anywhere. Where is the documentation for the -P flag?Tekla
I found that via bundle exec rails s --help.Bosket
Ahhh..., need that 's'. Thanks, you get credit for the correct answer.Tekla
T
2

Posted elsewhere on Stackoverflow was the mention that if you have problems with rails 3.2.11, try locking rack at 1.4.1. This seems to work so far. I added:

gem 'rack' , '1.4.1'

to the gemfile, and then executed

bundle update rack
Tekla answered 15/1, 2013 at 0:41 Comment(0)
T
0

try using foreman https://github.com/ddollar/foreman

Railscast: http://railscasts.com/episodes/281-foreman?view=comments

Troy answered 24/10, 2013 at 7:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.