Skip to content

Commit

Permalink
Merge branch 'master' of github.com:lostboy/workless
Browse files Browse the repository at this point in the history
  • Loading branch information
lostboy committed Jun 3, 2012
2 parents 70af1a2 + d7f664c commit d7589da
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
40 changes: 35 additions & 5 deletions README.md
Expand Up @@ -5,21 +5,51 @@
This is an addon for delayed_job (> 2.0.0) http://github.com/collectiveidea/delayed_job This is an addon for delayed_job (> 2.0.0) http://github.com/collectiveidea/delayed_job
It is designed to be used when you're using Heroku as a host and have the need to do background work with delayed job but you don't want to leave the workers running all the time as it costs money. It is designed to be used when you're using Heroku as a host and have the need to do background work with delayed job but you don't want to leave the workers running all the time as it costs money.


You basically add the gem to your project and the rest is taken care of for you given a few CONFIG vars set on Heroku. By adding the gem to your project and configuring our Heroku app with some config variables workless should do the rest.


There are already a few of these out there, notably @mtravers' cheepnis http://github.com/mtravers/cheepnis and the autoscale branch of delayed_job by @pedro http://github.com/pedro/delayed_job/tree/autoscaling ## Update


Workless takes ideas from both and is helping me understand gem and plugin development. Prior to version 1.0.0 it was originally built for rails 3 on the delayed_job 2.1.0.pre2 but since 1.0.0 is compatible with rails 2.3.x, 3.0.x, 3.1.x and 3.2.x Version 1.0.0 has been released, this brings compatibility with delayed_job 3 and compatibility with Rails 2.3.x and up.

## Compatibility

Workless should work correctly with Rubies 1.8.7, ree, 1.9.2 and 1.9.3. It is compatible with Delayed Job since version 2.0.7 up to the latest version 3.0.1, the table below shows tested compatibility with ruby, rails and delayed_job

Ruby | Rails | Delayed Job
---------- | ------ | -----
1.8.7-ree | 2.1.14 | 2.0.7
1.9.2 | 3.2 | 2.1.4
1.9.2 | 3.2 | 3.0.1


## Installation ## Installation


Add the workless gem and the delayed_job gem to your project Gemfile and update your bundle. Its is recommended to specify the gem version for delayed_job especially if you are using rails 2.3.x which doesn't work with the latest delayed_job Add the workless gem and the delayed_job gem to your project Gemfile and update your bundle. Its is recommended to specify the gem version for delayed_job especially if you are using rails 2.3.x which doesn't work with the latest delayed_job


### For rails 2.3.x the latest compatible delayed_job is 2.0.7

<pre> <pre>
gem "workless" gem "delayed_job", "2.0.7"
gem "workless", "~> 1.0.1"
</pre> </pre>


Add your Heroku username / password as config vars to your Heroku instance, the same one you log in to Heroku with ### For rails 3.x with delayed_job 2.1.x

<pre>
gem "delayed_job", "~> 2.1.4"
gem "workless", "~> 1.0.1"
</pre>

### For rails 3.x with latest delayed_job 3.x using active record

<pre>
gem "delayed_job_active_record"
gem "workless", "~> 1.0.1"
</pre>

If you don't specify delayed_job in your Gemfile workless will bring it in, most likly the latest version (3.0.1)

Add your Heroku username / password as config vars to your Heroku instance, the same one you log in to Heroku with.
[You may also use your API key as the password](https://github.com/heroku/heroku/issues/103).


<pre> <pre>
heroku config:add HEROKU_USER=yourusername HEROKU_PASSWORD=yourpassword heroku config:add HEROKU_USER=yourusername HEROKU_PASSWORD=yourpassword
Expand Down
2 changes: 1 addition & 1 deletion lib/workless/scaler.rb
Expand Up @@ -19,7 +19,7 @@ def self.included(base)


module ClassMethods module ClassMethods
def scaler def scaler
@scaler ||= if ENV.include?("HEROKU_UPID") @scaler ||= if ENV.include?("HEROKU_USER")
client = ::Heroku::Client.new(ENV['HEROKU_USER'], ENV['HEROKU_PASSWORD']) client = ::Heroku::Client.new(ENV['HEROKU_USER'], ENV['HEROKU_PASSWORD'])
case client.info(ENV["APP_NAME"])[:stack] case client.info(ENV["APP_NAME"])[:stack]
when "cedar" when "cedar"
Expand Down

0 comments on commit d7589da

Please sign in to comment.