Reputation: 375
I would like to run two Rails servers from the same directory, on different ports. Here's what I have tried:
rails s
, which starts my server on port 3000.puma -p 7676
, which starts another server on port 7676.No matter what order I run these commands, whether I switch out puma
for rails s
, one of the servers always gets shut down.
The error it shows is:
A server is already running. Check /Users/<username>/<appname>/tmp/pids/server.pid.
Now, following several stack overflow answers, it seems you can tell the command where it should look for the pid:
rails s
rails s -p 3007 -P `pwd`/tmp/pids/alternative_server.pid
This fails with the exact same error:
A server is already running. Check /Users/<username>/<appname>/tmp/pids/server.pid.
So far my only recourse has been to clone my project in a seperate directory and run the server from there. This is obviously not ideal since I need to keep pulling any changes I make on the branch.
Versions:
Version 3.6.0 (ruby 2.3.1-p112)
5.0.0.1
Upvotes: 1
Views: 1590
Reputation: 5204
You need to comment plugin :tmp_restart
in config/puma.rb
.
This is source code of this plugin: https://github.com/puma/puma/blob/master/lib/puma/plugin/tmp_restart.rb
Upvotes: 3