Skip to content

Commit

Permalink
Sidekiq: Disables the cleanup recipe to avoid worker restarts every c…
Browse files Browse the repository at this point in the history
…hef run.

This fixes issue #350
  • Loading branch information
radamanthus committed Feb 12, 2018
1 parent 75e15a9 commit 676ea8e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
18 changes: 14 additions & 4 deletions cookbooks/sidekiq/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -78,10 +88,10 @@ end
Sidekiq.configure_client do |config|
config.redis = { :url => "redis://<your_db_server>", :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

Expand Down
5 changes: 4 additions & 1 deletion cookbooks/sidekiq/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 676ea8e

Please sign in to comment.