autoscaler 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d9c40f5b4987f7af492eff1ec34d8e02f44b37e
4
- data.tar.gz: 56d95752a486f9c581159edbbfe83c0c19758654
3
+ metadata.gz: ec6a1b37ad89976bcf80edccfd67480c72aee6f0
4
+ data.tar.gz: c94e28fe7bcd92502be6dbee2cd9fd45b2ecbcb9
5
5
  SHA512:
6
- metadata.gz: e2e5887494d03fe84f6292b5aff7106239425bce9f7d174e5e9883b8f53c76b64caf03ebd8a384dad42dd392fcf986e292ce6604249ad8aa58c69ed1e5fa5085
7
- data.tar.gz: 33402342e76458cc4039947fb69dbc5bad237249daf6512cf8064515cbee1c23549acd9c0fccd77328d063954fa825249c5bae4adf9209763fd1cfaa9bc87045
6
+ metadata.gz: 6885e017918b53921cffb12aff92b59579ea1023d41f4f5bc5828d6f50dda383a92b5ca8c6320905b72b30bd37bced45c5c39b31d20bfc6647b4f6531fca5733
7
+ data.tar.gz: 7c3c78d2c162e50a4432e95ea907c39977a5b07fb44433d5d84bfc35dcb9ae75dcddadaff765d67b3b2d3e379046d950aaefd679516e1e04d6bd594655cab8c6
@@ -1,9 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.0
4
+
5
+ - Heroku has claimed the `HEROKU_` ENV prefix for Herkou-16 stack. The preferred variables are now `AUTOSCALER_HEROKU_APP` and `AUTOSCALER_HEROKU_ACCESS_TOKEN`. (The complex example has been similarly updated.) The old ENV variables will still be accepted, with a warning, but may be removed in a major release. (HerokuScaler was not updated.)
6
+ - Added an obsolescence warning to HerokuScaler, since the old API is no longer available. It may be removed in a major release.
7
+
3
8
  ## 0.13.0
4
9
 
5
10
  - Update version spec to Sidekiq 5
6
- - redis gem implments `call` for something else since 3.3.0, which was confusing duck sniffing.
11
+ - redis gem implements `call` for something else since 3.3.0, which was confusing duck sniffing.
7
12
 
8
13
  ## 0.12.0
9
14
 
data/README.md CHANGED
@@ -14,10 +14,8 @@ Tested on Ruby 2.1.7 and Heroku Cedar stack.
14
14
 
15
15
  This gem uses the [Heroku Platform-Api](https://github.com/heroku/platform-api) gem, which requires an OAuth token from Heroku. It will also need the heroku app name. By default, these are specified through environment variables. You can also pass them to `HerokuPlatformScaler` explicitly.
16
16
 
17
- HEROKU_ACCESS_TOKEN=.....
18
- HEROKU_APP=....
19
-
20
- Support is still present for [Heroku-Api](https://github.com/heroku/heroku.rb) via `HerokuScaler` and `HEROKU_API_KEY`, but may be removed in a future major version.
17
+ AUTOSCALER_HEROKU_ACCESS_TOKEN=.....
18
+ AUTOSCALER_HEROKU_APP=....
21
19
 
22
20
  Install the middleware in your `Sidekiq.configure_` blocks
23
21
 
@@ -65,9 +63,9 @@ You can pass a scaling strategy object instead of the timeout to the server midd
65
63
 
66
64
  The project is setup to run RSpec with Guard. It expects a redis instance on a custom port, which is started by the Guardfile.
67
65
 
68
- The HerokuPlatformScaler is not tested by default because it makes live API requests. Specify `HEROKU_APP` and `HEROKU_ACCESS_TOKEN` on the command line, and then watch your app's logs.
66
+ The HerokuPlatformScaler is not tested by default because it makes live API requests. Specify `AUTOSCALER_HEROKU_APP` and `AUTOSCALER_HEROKU_ACCESS_TOKEN` on the command line, and then watch your app's logs.
69
67
 
70
- HEROKU_APP=... HEROKU_ACCESS_TOKEN=... guard
68
+ AUTOSCALER_HEROKU_APP=... AUTOSCALER_HEROKU_ACCESS_TOKEN=... guard
71
69
  heroku logs --app ...
72
70
 
73
71
  ## Authors
@@ -5,7 +5,7 @@ require 'autoscaler/heroku_platform_scaler'
5
5
  # This setup is for multiple queues, where each queue has a dedicated process type
6
6
 
7
7
  heroku = nil
8
- if ENV['HEROKU_APP']
8
+ if ENV['AUTOSCALER_HEROKU_APP']
9
9
  heroku = {}
10
10
  scaleable = %w[default import] - (ENV['ALWAYS'] || '').split(' ')
11
11
  scaleable.each do |queue|
@@ -13,8 +13,8 @@ if ENV['HEROKU_APP']
13
13
  # same as the queue name
14
14
  heroku[queue] = Autoscaler::HerokuPlatformScaler.new(
15
15
  queue,
16
- ENV['HEROKU_ACCESS_TOKEN'],
17
- ENV['HEROKU_APP'])
16
+ ENV['AUTOSCALER_HEROKU_ACCESS_TOKEN'],
17
+ ENV['AUTOSCALER_HEROKU_APP'])
18
18
  end
19
19
  end
20
20
 
@@ -26,16 +26,16 @@ Sidekiq.configure_client do |config|
26
26
  end
27
27
  end
28
28
 
29
- # define HEROKU_PROCESS in the Procfile:
29
+ # define AUTOSCALER_HEROKU_PROCESS in the Procfile:
30
30
  #
31
- # default: env HEROKU_PROCESS=default bundle exec sidekiq -r ./background/boot.rb
32
- # import: env HEROKU_PROCESS=import bundle exec sidekiq -q import -c 1 -r ./background/boot.rb
31
+ # default: env AUTOSCALER_HEROKU_PROCESS=default bundle exec sidekiq -r ./background/boot.rb
32
+ # import: env AUTOSCALER_HEROKU_PROCESS=import bundle exec sidekiq -q import -c 1 -r ./background/boot.rb
33
33
 
34
34
  Sidekiq.configure_server do |config|
35
35
  config.server_middleware do |chain|
36
- if heroku && ENV['HEROKU_PROCESS'] && heroku[ENV['HEROKU_PROCESS']]
36
+ if heroku && ENV['AUTOSCALER_HEROKU_PROCESS'] && heroku[ENV['AUTOSCALER_HEROKU_PROCESS']]
37
37
  p "Setting up auto-scaledown"
38
- chain.add(Autoscaler::Sidekiq::Server, heroku[ENV['HEROKU_PROCESS']], 60, [ENV['HEROKU_PROCESS']]) # 60 second timeout
38
+ chain.add(Autoscaler::Sidekiq::Server, heroku[ENV['AUTOSCALER_HEROKU_PROCESS']], 60, [ENV['AUTOSCALER_HEROKU_PROCESS']]) # 60 second timeout
39
39
  else
40
40
  p "Not scaleable"
41
41
  end
@@ -5,7 +5,7 @@ require 'autoscaler/heroku_platform_scaler'
5
5
  # This is setup for a single queue (default) and worker process (worker)
6
6
 
7
7
  heroku = nil
8
- if ENV['HEROKU_APP']
8
+ if ENV['AUTOSCALER_HEROKU_APP']
9
9
  heroku = Autoscaler::HerokuPlatformScaler.new
10
10
  #heroku.exception_handler = lambda {|exception| MyApp.logger.error(exception)}
11
11
  end
@@ -9,8 +9,18 @@ module Autoscaler
9
9
  # @param [String] app Heroku app name
10
10
  def initialize(
11
11
  type = 'worker',
12
- token = ENV['HEROKU_ACCESS_TOKEN'],
13
- app = ENV['HEROKU_APP'])
12
+ token = ENV['AUTOSCALER_HEROKU_ACCESS_TOKEN'],
13
+ app = ENV['AUTOSCALER_HEROKU_APP'])
14
+
15
+ if (token.nil? && ENV['HEROKU_ACCESS_TOKEN'])
16
+ warn "Autoscaler: ENV AUTOSCALER_HEROKU_ACCESS_TOKEN is now preferred, HEROKU_ACCESS_TOKEN may be removed in a future release"
17
+ token = ENV['HEROKU_ACCESS_TOKEN']
18
+ end
19
+ if (app.nil? && ENV['HEROKU_APP'])
20
+ warn "Autoscaler: ENV AUTOSCALER_HEROKU_APP is now preferred, HEROKU_APP may be removed in a future release"
21
+ app = ENV['HEROKU_APP']
22
+ end
23
+
14
24
  @client = PlatformAPI.connect_oauth(token)
15
25
  @type = type
16
26
  @app = app
@@ -3,6 +3,7 @@ require 'autoscaler/counter_cache_memory'
3
3
 
4
4
  module Autoscaler
5
5
  # Wraps the Heroku API to provide just the interface that we need for scaling.
6
+ # OBSOLETE: The v1 Heroku API is no longer available, and HerokuScaler will likely be removed in a future major release. Please see current setup instructions and examples for HerokuPlatformScaler.
6
7
  class HerokuScaler
7
8
  # @param [String] type process type this scaler controls
8
9
  # @param [String] key Heroku API key
@@ -11,6 +12,9 @@ module Autoscaler
11
12
  type = 'worker',
12
13
  key = ENV['HEROKU_API_KEY'],
13
14
  app = ENV['HEROKU_APP'])
15
+
16
+ warn "Autoscaler: The v1 Heroku API is no longer available, and HerokuScaler will likely be removed in a future major release. Please see current setup instructions and examples for HerokuPlatformScaler."
17
+
14
18
  @client = Heroku::API.new(:api_key => key)
15
19
  @type = type
16
20
  @app = app
@@ -1,4 +1,4 @@
1
1
  module Autoscaler
2
2
  # version number
3
- VERSION = "0.13.0"
3
+ VERSION = "0.14.0"
4
4
  end
@@ -6,7 +6,7 @@ RSpec.configure do |config|
6
6
  config.mock_with :rspec
7
7
 
8
8
  config.filter_run_excluding :api1 => true unless ENV['HEROKU_API_KEY']
9
- config.filter_run_excluding :platform_api => true unless ENV['HEROKU_ACCESS_TOKEN']
9
+ config.filter_run_excluding :platform_api => true unless ENV['AUTOSCALER_HEROKU_ACCESS_TOKEN'] || ENV['HEROKU_ACCESS_TOKEN']
10
10
  end
11
11
 
12
12
  class TestScaler
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoscaler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Love
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-06-12 00:00:00.000000000 Z
12
+ date: 2017-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq