README.md in sidekiq-cluster-0.0.1 vs README.md in sidekiq-cluster-0.1.0

- old
+ new

@@ -1,41 +1,60 @@ [![Build Status](https://travis-ci.org/kigster/sidekiq-cluster.svg?branch=master)](https://travis-ci.org/kigster/sidekiq-cluster) ## Sidekiq Cluster -This is a tiny gem that allows starting sidekiq using multiple processes. +This is a tiny gem that allows starting sidekiq using multiple processes. It is originally based on the wonderful [Honebadger Cluster Script](http://blog.honeybadger.io/introducing-our-sidekiq-cluster-script/). -It does not depend on any particular version of sidekiq, as long as the CLI class of Sidekiq remains named the same. +Features: + * It does not depend on any particular version of sidekiq, as long as the CLI class of Sidekiq remains named the same. + + * It does not attempt to replicate Sidekiq's command line options. Script itself can be controlled with its own CLI options preceeding the double dash `--`. Options to Sidekiq are expected after the double dash. + + * You can specify **max number of processes** and **max total RAM used by this cluster** (expressed as a percentage of total). If one of the Sidekiq processes exceeeds it, it is automatically restarted. + ### Usage -Install the gem: +The easiest way to use Sidekiq Cluster is to add it to your Gemfile: +```ruby +gem 'sidekiq-cluster', require: false ``` -gem install sidekiq-cluster + +Run `bundle`, and then start Sidekiq cluster like so (this starts exactly two Sidekiq Processes): + +```bash +# this starts sidekiq with default options +$ bundle exec sidekiq-cluster -N 2 + +# this starts sidekiq with custom options +$ bundle exec sidekiq-cluster -N 2 -- -r $(pwd) -q default,10 -q high,100 ``` +### Command Line Options + + Then try running it with `--help`: ``` sidekiq-cluster -h USAGE sidekiq-cluster [options] -- [sidekiq-options] EXAMPLES $ cd rails_app - $ bundle exec sidekiq-cluster -N 2 -- -c 10 -q default,12 -l log/sidekiq.log + $ bundle exec sidekiq-cluster -N 2 -- -c 10 -q default,12 -L log/sidekiq.log SIDEKIQ CLUSTER OPTIONS -n, --name=NAME the name of this cluster, used when when running multiple clusters -P, --pidfile=FILE Pidfile prefix, eg "/var/www/shared/config/sidekiq.pid" - -l, --logfile=FILE Logfile for the cluster script + -L, --logfile=FILE Logfile for the cluster script -M, --max-memory=PERCENT Maximum percent RAM that this cluster should not exceed. Defaults to 80%. -N, --num-processes=NUM Number of processes to start, @@ -52,16 +71,16 @@ ```bash $ cd rails-app $ echo "gem 'sidekiq-cluster'" >> Gemfile $ bundle install -$ bundle exec sidekiq-cluster \ - -P /var/pids/sidekiq.pid \ # these are arguments to sidekiq-cluster - -n default \ - -M 90 \ - -L /var/log/sidekiq-cluster.log \ - -N 2 \ - -- \ # these are arguments for sidekiq. +$ bundle exec sidekiq-cluster \ # these arguments are for sidekiq-cluster: + --pidfile /var/pids/sidekiq.pid \ + --name default \ + --max-memory 90 \ + --logfile /var/log/sidekiq-cluster.log \ + --num-processes 2 \ + -- \ # these arguments are for sidekiq: -L /var/log/sidekiq.log -c 10 -e production -q default,10 -q critical,20 ``` ## Contributing to sidekiq-cluster