heroscale 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (7) hide show
  1. data/Gemfile +4 -0
  2. data/Gemfile.lock +29 -0
  3. data/LICENSE +20 -0
  4. data/README.md +58 -0
  5. data/Rakefile +43 -0
  6. data/heroscale.gemspec +35 -0
  7. metadata +99 -0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source :rubygems
2
+
3
+ gem "rake"
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,29 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ heroscale (0.0.1)
5
+ rack (~> 1.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.1.2)
11
+ rack (1.2.1)
12
+ rake (0.8.7)
13
+ rspec (2.1.0)
14
+ rspec-core (~> 2.1.0)
15
+ rspec-expectations (~> 2.1.0)
16
+ rspec-mocks (~> 2.1.0)
17
+ rspec-core (2.1.0)
18
+ rspec-expectations (2.1.0)
19
+ diff-lcs (~> 1.1.2)
20
+ rspec-mocks (2.1.0)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ heroscale!
27
+ rack (~> 1.0)
28
+ rake
29
+ rspec (~> 2.0)
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Jacques Crocker
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,58 @@
1
+ Heroscale
2
+ =============
3
+
4
+ This gem provides a Rack Interface to your Heroku web app that allows you to query the current `HTTP_X_HEROKU_QUEUE_DEPTH` for your app via an api handler
5
+
6
+ This allows you to query your app to get the queue size and current dyno count
7
+ /heroscale/status
8
+
9
+ ## Installation (Rails 3)
10
+
11
+ To install Heroscale, just add the following line to your Gemfile:
12
+
13
+ gem "heroscale"
14
+
15
+ Then run `bundle install`
16
+
17
+ ## Deploy to Heroku and test that it works
18
+
19
+ After adding the gem and configuraton, go ahead and deploy to heroku
20
+
21
+ git push heroku master
22
+
23
+ Once you've deployed and everything seems to be working, go ahead and test it out by running
24
+
25
+ rake heroscale:test
26
+
27
+ This will query your heroku app and verify that it is returning the right response.
28
+
29
+ ## Securing
30
+
31
+ For most people, having the queue size and dynos on a publically available url is not a big deal. However if you want to secure it, just run:
32
+
33
+ rails g heroscale:secure
34
+
35
+ This will generate an config within config/initializers/heroscale.rb with a generated api key
36
+
37
+ Heroscale.configure do |c|
38
+ c.api_key = "my_api_key"
39
+ end
40
+
41
+ Queries to your app will then need to be: `/heroscale/status?api=my_api_key`
42
+
43
+ Redeploy to Heroku and then run:
44
+
45
+ rake heroscale:test
46
+
47
+ to verify everything is still working
48
+
49
+ ## Installation (Sinatra)
50
+
51
+ Just add Heroscale::Middleware to your config.ru
52
+
53
+ TODO: more details
54
+
55
+ ## Installation (Rails 2)
56
+
57
+ TODO: more details
58
+
data/Rakefile ADDED
@@ -0,0 +1,43 @@
1
+ require "bundler"
2
+ Bundler.setup
3
+
4
+ require 'rake'
5
+ require 'rake/gempackagetask'
6
+
7
+ gemspec = eval(File.read('heroscale.gemspec'))
8
+ Rake::GemPackageTask.new(gemspec) do |pkg|
9
+ pkg.gem_spec = gemspec
10
+ end
11
+
12
+ desc "build the gem and release it to rubygems.org"
13
+ task :release => :gem do
14
+ puts "Tagging #{gemspec.version}..."
15
+ system "git tag -a #{gemspec.version} -m 'Tagging #{gemspec.version}'"
16
+ puts "Pushing to Github..."
17
+ system "git push --tags"
18
+ puts "Pushing to rubygems.org..."
19
+ system "gem push pkg/#{gemspec.name}-#{gemspec.version}.gem"
20
+ end
21
+
22
+ require "rspec"
23
+ require "rspec/core/rake_task"
24
+
25
+ Rspec::Core::RakeTask.new(:spec) do |spec|
26
+ spec.pattern = "spec/**/*_spec.rb"
27
+ end
28
+
29
+ Rspec::Core::RakeTask.new('spec:progress') do |spec|
30
+ spec.rspec_opts = %w(--format progress)
31
+ spec.pattern = "spec/**/*_spec.rb"
32
+ end
33
+
34
+ require "rake/rdoctask"
35
+ Rake::RDocTask.new do |rdoc|
36
+ rdoc.rdoc_dir = "rdoc"
37
+ rdoc.title = "Heroku Rails #{gemspec.version}"
38
+ rdoc.rdoc_files.include("README*")
39
+ rdoc.rdoc_files.include("lib/**/*.rb")
40
+ end
41
+
42
+
43
+ task :default => :spec
data/heroscale.gemspec ADDED
@@ -0,0 +1,35 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "heroscale"
3
+ s.version = "0.0.1"
4
+
5
+ s.authors = ["Jacques Crocker"]
6
+ s.summary = "Autoscale your heroku app"
7
+ s.description = "This rack middleware that allows easy external querying of your heroku's app queue depth"
8
+
9
+ s.email = "railsjedi@gmail.com"
10
+ s.homepage = "http://github.com/railsjedi/heroscale"
11
+ s.rubyforge_project = "none"
12
+
13
+ s.require_paths = ["lib"]
14
+ s.files = Dir['lib/**/*',
15
+ 'spec/**/*',
16
+ 'heroscale.gemspec',
17
+ 'Gemfile',
18
+ 'Gemfile.lock',
19
+ 'LICENSE',
20
+ 'Rakefile',
21
+ 'README.md']
22
+
23
+ s.test_files = Dir['spec/**/*']
24
+ s.rdoc_options = ["--charset=UTF-8"]
25
+ s.extra_rdoc_files = [
26
+ "LICENSE",
27
+ "README.md"
28
+ ]
29
+
30
+ s.add_runtime_dependency 'rack', '~> 1.0'
31
+ s.add_development_dependency "rspec", "~> 2.0"
32
+ end
33
+
34
+
35
+
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: heroscale
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Jacques Crocker
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-11-13 00:00:00 -08:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rack
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 0
30
+ version: "1.0"
31
+ type: :runtime
32
+ prerelease: false
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rspec
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 2
43
+ - 0
44
+ version: "2.0"
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *id002
48
+ description: This rack middleware that allows easy external querying of your heroku's app queue depth
49
+ email: railsjedi@gmail.com
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files:
55
+ - LICENSE
56
+ - README.md
57
+ files:
58
+ - heroscale.gemspec
59
+ - Gemfile
60
+ - Gemfile.lock
61
+ - LICENSE
62
+ - Rakefile
63
+ - README.md
64
+ has_rdoc: true
65
+ homepage: http://github.com/railsjedi/heroscale
66
+ licenses: []
67
+
68
+ post_install_message:
69
+ rdoc_options:
70
+ - --charset=UTF-8
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 176599757990332131
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 176599757990332131
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ requirements: []
92
+
93
+ rubyforge_project: none
94
+ rubygems_version: 1.3.7
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: Autoscale your heroku app
98
+ test_files: []
99
+