From 676ea8eb3555a5dea08ca884a399b5144661379e Mon Sep 17 00:00:00 2001 From: Radamanthus Batnag Date: Mon, 12 Feb 2018 16:39:49 +0800 Subject: [PATCH] Sidekiq: Disables the cleanup recipe to avoid worker restarts every chef run. This fixes issue #350 --- cookbooks/sidekiq/readme.md | 18 ++++++++++++++---- cookbooks/sidekiq/recipes/default.rb | 5 ++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/cookbooks/sidekiq/readme.md b/cookbooks/sidekiq/readme.md index 2dd73503..b1fc1cd6 100644 --- a/cookbooks/sidekiq/readme.md +++ b/cookbooks/sidekiq/readme.md @@ -62,10 +62,20 @@ sidekiq({ }) ``` -By default, the recipe will install Sidekiq on to a utility instance with the name `sidekiq`. If the utility name is `nil` or there is no utility instance matching the name given, Sidekiq will be installed on all application/solo instances. +By default, the recipe will install Sidekiq on utility instances with the name `sidekiq`. If the utility name is `nil` or there is no utility instance matching the name given, Sidekiq will be installed on all application/solo instances. If you wish to have more than one sidekiq utility instance, name the sidekiq utility instances as "sidekiq" and also set the `utility_name` to `sidekiq`. +NOTE: If you change the `utility_name` setting, say, from `sidekiq_old` to `sidekiq_new`, the sidekiq monitrc file will not be cleaned up for you, and sidekiq will continue running on the `sidekiq_old` instances. You will have to do a manual cleanup on the `sidekiq_old` instances: stop sidekiq, remove the sidekiq .monitrc file in `/etc/monit.d/`, then run `sudo monit reload`. + +The manual cleanup is the recommended approach for production environments. For development environments, we have provided the `sidekiq::cleanup` recipe. Just uncomment this line in `recipes/default.rb`: + +``` +# include_recipe "sidekiq::cleanup" +``` + +We do not recommend enabling it on production environments because when this is enabled, the sidekiq workers will be restarted every chef run. + ## Multi Instance Deploys By default engineyard will install Redis to your DB instance and if you wish to keep it there rather than the preferred method of creating a utility instance you will need to tell Sidekiq where to find Redis. You can do this by adding a Sidekiq intializer in `config/initializers/sidekiq.rb` with the following information: @@ -78,10 +88,10 @@ end Sidekiq.configure_client do |config| config.redis = { :url => "redis://", :namespace => 'sidekiq' } end -``` +``` -More information on setting the location of your server can be found at: -https://github.com/mperham/sidekiq/wiki/Advanced-Options +More information on setting the location of your server can be found at: +https://github.com/mperham/sidekiq/wiki/Advanced-Options ## Deploy Hooks diff --git a/cookbooks/sidekiq/recipes/default.rb b/cookbooks/sidekiq/recipes/default.rb index 835fd4f6..217a722b 100644 --- a/cookbooks/sidekiq/recipes/default.rb +++ b/cookbooks/sidekiq/recipes/default.rb @@ -3,5 +3,8 @@ # Recipe:: default # -include_recipe "sidekiq::cleanup" +# Running sidekiq::cleanup is only recommended for development environments. +# Please see the README for more information. + +#include_recipe "sidekiq::cleanup" include_recipe "sidekiq::setup"