New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow using env var to specify pidfile #36486
Conversation
railties/CHANGELOG.md
Outdated
@@ -1,3 +1,5 @@ | |||
# (Unreleased) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to add a section header.
railties/CHANGELOG.md
Outdated
|
||
- Support using environment variable to set pidfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use *
and add your name. Please refer to other CHANGELOG files.
https://github.com/rails/rails/blob/master/activesupport/CHANGELOG.md
https://github.com/rails/rails/blob/master/activerecord/CHANGELOG.md
@@ -114,7 +114,7 @@ class ServerCommand < Base # :nodoc: | |||
desc: "Runs server as a Daemon." | |||
class_option :using, aliases: "-u", type: :string, | |||
desc: "Specifies the Rack server used to run the application (thin/puma/webrick).", banner: :name | |||
class_option :pid, aliases: "-P", type: :string, default: DEFAULT_PID_PATH, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change affected to an output of help. Please add a default value to desc like port
and binding
.
You should need to fix rails/railties/lib/rails/commands/server/server_command.rb Lines 263 to 265 in c8a8460
|
@y-yagi thanks for your comments - first time working on Rails and I missed a few things :-). I've addressed them all - couldn't find a particular test for the |
I missed to point out rails/railties/lib/rails/commands/server/server_command.rb Lines 208 to 210 in aeba121
|
Previously it was only possible to specify the location of the pidfile for the 'rails server' command with the '-P' flag. This adds support for specifying the pidfile using a PIDFILE env var, which can still be overridden by the '-P' flag and with the default pidfile path unchanged. The motivation for this feature comes from using Docker to run multiple instances of the same rails app. When developing a rails app with Docker, it's common to bind-mount the rails root directory in the running container, so that changes to files are shared between the container and the host. However, this doesn't work so well with the pidfile and it's necessary to (remember to) add a '-P' flag to the 'rails server' command line; being able to specify this flag using an env var would make developing with Rails+Docker a bit simpler.
@y-yagi sure, done :-). |
@benthorner Thanks!! |
Summary
Previously it was only possible to specify the location of the pidfile
for the 'rails server' command with the '-P' flag. This adds support for
specifying the pidfile using a PIDFILE env var, which can still be
overridden by the '-P' flag and with the default pidfile path unchanged.
The motivation for this feature comes from using Docker to run multiple
instances of the same rails app. When developing a rails app with
Docker, it's common to bind-mount the rails root directory in the
running container, so that changes to files are shared between the
container and the host. However, this doesn't work so well with the
pidfile and it's necessary to (remember to) add a '-P' flag to the
'rails server' command line; being able to specify this flag using an
env var would make developing with Rails+Docker a bit simpler.
Other Information