Running multiple instances of Rails Server

前端 未结 8 628
南笙
南笙 2020-12-14 06:34

I am new to Rails, so please forgive me if this is obvious.

I am doing a lot of experimenting, creating to applications, testing features, etc. It got my first scaff

8条回答
  •  春和景丽
    2020-12-14 06:48

    In the current version Rails 5.2.0 and Ruby 2.4.1p111, starting two instances of server for the same app is possible with multiple PIDs.

    $ rails s 
    => Booting Puma
    => Rails 5.2.0 application starting in development 
    => Run `rails server -h` for more startup options
    Puma starting in single mode...
    * Version 3.11.4 (ruby 2.4.1-p111), codename: Love Song
    * Min threads: 5, max threads: 5
    * Environment: development
    * Listening on tcp://0.0.0.0:3000
    Use Ctrl-C to stop
    

    Now starting one more server on different port fails with pid issues.

    $ rails s -p 3001
    => Booting Puma
    => Rails 5.2.0 application starting in development 
    => Run `rails server -h` for more startup options
    A server is already running. Check /Users/biju/app1/tmp/pids/server.pid.
    Exiting
    

    Below approach of starting server works to use multiple instances of application.

    $ rails s -p 3001 -P 321412
    => Booting Puma
    => Rails 5.2.0 application starting in development 
    => Run `rails server -h` for more startup options
    Puma starting in single mode...
    * Version 3.11.4 (ruby 2.4.1-p111), codename: Love Song
    * Min threads: 5, max threads: 5
    * Environment: development
    * Listening on tcp://localhost:3001
    Use Ctrl-C to stop
    

提交回复
热议问题