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.- In another terminal tab, I run
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:
- Puma:
Version 3.6.0 (ruby 2.3.1-p112)
- Rails:
5.0.0.1