Skip to content

Commit

Permalink
Merge pull request engineyard#217 from ess/sidekiq-env-vars
Browse files Browse the repository at this point in the history
Sidekiq runner honors env.custom
  • Loading branch information
rbankston committed Oct 5, 2015
2 parents 6cecd6b + a310532 commit 0658e14
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cookbooks/sidekiq/files/default/sidekiq
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@ pid_file="${pid_dir}/${worker_ref}.pid"
log_file="${app_root}/log/${worker_ref}.log"
conf_file="/data/${app_name}/shared/config/${worker_ref}.yml"
app_user=$(stat -L -c"%U" "${app_root}")
custom_env="/data/${app_name}/shared/config/env.custom"

sidekiq="${app_root}/ey_bundler_binstubs/sidekiq"
sidekiqctl="${app_root}/ey_bundler_binstubs/sidekiqctl"

# Load the custom env if it exists
if [ -e "${custom_env}" ]
then
source "${custom_env}"
fi

export HOME="/home/${app_user}"

# change to current directory
Expand Down Expand Up @@ -55,15 +62,15 @@ start ()
fi

# start sidekiq
sudo -u "${app_user}" -H "${sidekiq}" -C "${conf_file}" -e "${rails_env}" -r "${app_root}" -P "${pid_file}" -L "${log_file}" &
sudo -u "${app_user}" -E -H "${sidekiq}" -C "${conf_file}" -e "${rails_env}" -r "${app_root}" -P "${pid_file}" -L "${log_file}" &
exit $?
}

# stop sidekiq
stop ()
{
# stop using sidekiqctl
sudo -u "${app_user}" -H "${sidekiqctl}" stop "${pid_file}"
sudo -u "${app_user}" -E -H "${sidekiqctl}" stop "${pid_file}"
exit $?
}

Expand Down

0 comments on commit 0658e14

Please sign in to comment.