From 3de69c1564c349882b7fc45358b1597309a5da24 Mon Sep 17 00:00:00 2001 From: Caleb Land Date: Thu, 23 May 2013 15:38:47 -0400 Subject: use the rackup setting in more places, and document it --- README.md | 10 +++++++--- unicorn | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) mode change 100644 => 100755 unicorn diff --git a/README.md b/README.md index 7bcc51e..e93ec8b 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ For Non-Capistrano-like layouts: unicorn_enable="YES" unicorn_command="/u/application/bin/unicorn_rails" - unicorn_command_args="/u/application/config.ru" + unicorn_rackup="/u/application/config.ru" unicorn_pidfile="/u/application/tmp/pids/unicorn.pid" unicorn_old_pidfile="/u/application/tmp/pids/unicorn.oldbin" unicorn_listen="/u/application/tmp/sockets/unicorn.sock" @@ -92,6 +92,7 @@ This infers all sorts of information about your app (you can always run `/usr/lo command: /u/application/current/bin/unicorn_rails command_args: /u/application/current/config.ru + rackup: /u/application/current/config.ru pidfile: /u/application/shared/pids/unicorn.pid old_pidfile: /u/application/shared/pids/unicorn.pid.oldbin listen: @@ -112,7 +113,9 @@ Let's look at these settings one by one: `command`: By default, it uses the `current/bin/unicorn_rails` [bundler binstub][binstub] located in your project to ensure your gems are loaded. `command` comes from FreeBSD's `rc.subr` init system functions. -`command_args`: This is the standard FreeBSD's `rc.subr` variable that holds the arguments to the above `command` +`command_args`: This is the standard FreeBSD's `rc.subr` variable that holds the arguments to the above `command`. The `rackup` setting is prepended to the beginning of this setting. Typically you don't need to set this. + +`rackup`: This is the `rackup` file that unicorn uses. By default this is set to `current/config.ru` for capistrano projects. `pidfile`: This is also part of FreeBSD's `rc.subr` system. This is where the built in functions will look for the pid of the process. By default, this rc script looks in the `shared/pids/unicorn.pid` file. @@ -155,7 +158,8 @@ You can override any of these parameter in your `/etc/rc.conf` by simply specify Using your own layout is easy, you can just leave the `unicorn_directory` variable out of your `/etc/rc.conf` and specify all of the above variables manually. Here's a list of those variables for your convenience: unicorn_command: The path to the unicorn command - unicorn_command_args: The non-flag arguments passed to the above command. This is usually the path to the Rack config.ru file + unicorn_command_args: The non-flag arguments passed to the above command. This is usually the path to the Rack config.ru file, and the rackup parameter is prepended to the beginning of this setting. Typically you do not need to set this. + unicorn_rackup: This is the path to the Rack config file (typically called `config.ru`). This setting is prepended to the `command_args` parameter unicorn_pidfile: The path where Unicorn will put its pid file unicorn_old_pidfile: The path where Unicorn will put its `old` pid file (usually the same as the sbove with `.oldbin` appended) unicorn_listen: The path to the socket or port to listen on. You can leave this blank to specify where to listen in the Unicorn config diff --git a/unicorn b/unicorn old mode 100644 new mode 100755 index 0817fbd..ed79ea0 --- a/unicorn +++ b/unicorn @@ -102,8 +102,9 @@ if [ -n "$2" ]; then unicorn_env=` _read_profile_var "${profile}" "env" "${unicorn_env}"` unicorn_flags=` _read_profile_var "${profile}" "flags" "${unicorn_flags}"` - command=`_read_profile_var "${profile}" "command" "${unicorn_command}" "${directory_command}"` - pidfile=`_read_profile_var "${profile}" "pidfile" "${directory_pidfile}"` + command=`_read_profile_var "${profile}" "command" "${unicorn_command}" "${directory_command}"` + command_args=`_read_profile_var "${profile}" "command_args" "${unicorn_command_args}" "${directory_command_args}"` + pidfile=`_read_profile_var "${profile}" "pidfile" "${directory_pidfile}"` else if [ "x${unicorn_profiles}" != "x" -a "x$1" != "x" ]; then # If we weren't started with a profile, run the command on all available profiles @@ -138,12 +139,14 @@ else unicorn_rackup=${unicorn_rackup:-$directory_rackup} unicorn_old_pidfile=${unicorn_old_pidfile:-$directory_old_pidfile} unicorn_chdir=${unicorn_chdir:-$directory_chdir} + unicorn_rackup=${unicorn_rackup:-$directory_rackup} unicorn_user=${unicorn_user:-$directory_user} unicorn_config=${unicorn_config:-$directory_config} unicorn_init_config=${unicorn_init_config:-$directory_init_config} unicorn_bundle_gemfile=${unicorn_bundle_gemfile:-$directory_bundle_gemfile} command=${unicorn_command:-$directory_command} + command_args=${unicorn_command_args:-$directory_command_args} pidfile=${unicorn_pidfile:-$directory_pidfile} fi fi @@ -162,7 +165,7 @@ required_files="${unicorn_config:-} ${unicorn_rackup:-}" [ -n "${unicorn_env}" ] && unicorn_flags="-E ${unicorn_env} ${unicorn_flags}" # Add our rackup file to the unicorn command_args -[ -n "${unicorn_rackup:-}" ] && command_args="${unicorn_rackup:-}" +[ -n "${unicorn_rackup:-}" ] && command_args="${unicorn_rackup:-} ${command_args:-}" # This function builds the command to start unicorn. This is split out so we can # print it from the "show" command @@ -277,6 +280,7 @@ unicorn_show_command() command: ${command} command_args: ${command_args} +rackup: ${unicorn_rackup} pidfile: ${pidfile} old_pidfile: ${unicorn_old_pidfile} listen: ${unicorn_listen} -- cgit v1.2.3