Skip to content
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

Support for setting config file paths & file names. #52

Merged
merged 1 commit into from May 28, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Expand Up @@ -59,11 +59,13 @@ cap unicorn:reload

You can modify any of the following options in your `deploy.rb` config.

- `unicorn_env` - Set unicorn environment. Default to `rails_env` variable.
- `unicorn_pid` - Set unicorn PID file path. Default to `current_path/tmp/pids/unicorn.pid`
- `unicorn_bin` - Set unicorn executable file. Default to `unicorn`.
- `unicorn_bundle` - Set bundler command for unicorn. Default to `bundle`.
- `unicorn_user` - Launch unicorn master as the specified user. Default to `user` variable.
- `unicorn_env` - Set unicorn environment. Default to `rails_env` variable.
- `unicorn_pid` - Set unicorn PID file path. Default to `current_path/tmp/pids/unicorn.pid`
- `unicorn_bin` - Set unicorn executable file. Default to `unicorn`.
- `unicorn_bundle` - Set bundler command for unicorn. Default to `bundle`.
- `unicorn_user` - Launch unicorn master as the specified user. Default to `user` variable.
- `unicorn_config_path` - Set the directory where unicorn config files reside. Default to `current_path/config`.
- `unicorn_config_filename` - Set the filename of the unicorn config file. Not used in multistage installations. Default to `unicorn.rb`.

### Multistage

Expand Down
6 changes: 4 additions & 2 deletions lib/capistrano-unicorn/capistrano_integration.rb
Expand Up @@ -24,6 +24,8 @@ def self.load_into(capistrano_config)
_cset(:unicorn_bundle) { fetch(:bundle_cmd) rescue 'bundle' }
_cset(:unicorn_restart_sleep_time) { 2 }
_cset(:unicorn_user) { nil }
_cset(:unicorn_config_path) { "#{fetch(:current_path)}/config" }
_cset(:unicorn_config_filename) { "unicorn.rb" }
end

# Check if a remote process exists using its pid file
Expand Down Expand Up @@ -94,8 +96,8 @@ def kill_unicorn(signal)
# Start the Unicorn server
#
def start_unicorn
primary_config_path = "#{current_path}/config/unicorn.rb"
secondary_config_path = "#{current_path}/config/unicorn/#{unicorn_env}.rb"
primary_config_path = "#{unicorn_config_path}/#{unicorn_config_filename}"
secondary_config_path = "#{unicorn_config_path}/unicorn/#{unicorn_env}.rb"

script = <<-END
set -x;
Expand Down