heroku-scaler 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +35 -0
- data/LICENSE +22 -0
- data/README.md +1 -0
- data/heroku-scaler.gemspec +20 -0
- data/lib/heroku-scaler.rb +1 -0
- data/lib/heroku-scaler/railtie.rb +7 -0
- data/lib/heroku-scaler/version.rb +3 -0
- data/lib/tasks/heroku_scale.rake +56 -0
- metadata +65 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8d9da01ef9c047bf8ba94ac959180e4c853c7937
|
4
|
+
data.tar.gz: 92b23067c35522391e6401ecdcdedebfbf38b2b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 829cb9be362a94790490a5f67234eaae5c900ce0ff173e075b5cdaa8cf55883b1d5c535a35bed42746e18340f5537fca07a00b8f4d6e04820352191b2e83b298
|
7
|
+
data.tar.gz: 70cff84b5a1ed2b454a63c9c14844bda245667a4bc9796af54eefe782e74d504b89ab5ccade4fd967d907b7d8d8f9156a713a0b45d7bad73ca051128e1005e0a
|
data/.gitignore
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/vendor/bundle
|
26
|
+
/lib/bundler/man/
|
27
|
+
|
28
|
+
# for a library or gem, you might want to ignore these files since the code is
|
29
|
+
# intended to run in multiple environments; otherwise, check them in:
|
30
|
+
# Gemfile.lock
|
31
|
+
# .ruby-version
|
32
|
+
# .ruby-gemset
|
33
|
+
|
34
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
+
.rvmrc
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Foraker Labs
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# heroku-scaler
|
@@ -0,0 +1,20 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require 'heroku-scaler/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'heroku-scaler'
|
8
|
+
s.version = HerokuScaler::VERSION
|
9
|
+
s.summary = "Heroku Scaler"
|
10
|
+
s.description = "A simple script to allow cron-based scaling of a Heroku app"
|
11
|
+
s.authors = ["stirlingolson"]
|
12
|
+
s.email = 'seo@foraker.com'
|
13
|
+
s.homepage = 'https://github.com/foraker/heroku-scaler'
|
14
|
+
s.license = 'MIT'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split($/)
|
17
|
+
s.require_paths = ['lib']
|
18
|
+
|
19
|
+
s.add_dependency 'platform-api', '~> 0'
|
20
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'heroku-scaler/railtie' if defined?(Rake)
|
@@ -0,0 +1,56 @@
|
|
1
|
+
namespace :heroku_scale do
|
2
|
+
namespace :web do
|
3
|
+
desc "Scale heroku web dynos up if it is a weekday"
|
4
|
+
task :up_if_weekday do
|
5
|
+
Rake::Task['heroku_scale:web:up'].invoke if weekday?
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "Scale heroku web dynos up"
|
9
|
+
task :up do
|
10
|
+
heroku.formation.update(app_name, 'web', {
|
11
|
+
"size" => big_dyno_type,
|
12
|
+
"quantity" => big_dyno_count
|
13
|
+
})
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Scale heroku web dynos down"
|
17
|
+
task :down do
|
18
|
+
heroku.formation.update(app_name, 'web', {
|
19
|
+
"size" => small_dyno_type,
|
20
|
+
"quantity" => small_dyno_count
|
21
|
+
})
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def heroku
|
27
|
+
@heroku ||= PlatformAPI.connect_oauth(oauth_token)
|
28
|
+
end
|
29
|
+
|
30
|
+
def oauth_token
|
31
|
+
ENV["SCALE_OAUTH_TOKEN"]
|
32
|
+
end
|
33
|
+
|
34
|
+
def app_name
|
35
|
+
ENV["SCALE_APP_NAME"] || 'ids-production'
|
36
|
+
end
|
37
|
+
|
38
|
+
def big_dyno_type
|
39
|
+
ENV["SCALE_BIG_DYNO_TYPE"] || "Performance"
|
40
|
+
end
|
41
|
+
|
42
|
+
def big_dyno_count
|
43
|
+
ENV["SCALE_BIG_DYNO_COUNT"] || 3
|
44
|
+
end
|
45
|
+
|
46
|
+
def small_dyno_type
|
47
|
+
ENV["SCALE_SMALL_DYNO_TYPE"] || "Standard-2X"
|
48
|
+
end
|
49
|
+
|
50
|
+
def small_dyno_count
|
51
|
+
ENV["SCALE_SMALL_DYNO_COUNT"] || 1
|
52
|
+
end
|
53
|
+
|
54
|
+
def weekday?
|
55
|
+
(1..5).include?(Date.today.cwday)
|
56
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: heroku-scaler
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.11
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- stirlingolson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: platform-api
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: A simple script to allow cron-based scaling of a Heroku app
|
28
|
+
email: seo@foraker.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- ".gitignore"
|
34
|
+
- LICENSE
|
35
|
+
- README.md
|
36
|
+
- heroku-scaler.gemspec
|
37
|
+
- lib/heroku-scaler.rb
|
38
|
+
- lib/heroku-scaler/railtie.rb
|
39
|
+
- lib/heroku-scaler/version.rb
|
40
|
+
- lib/tasks/heroku_scale.rake
|
41
|
+
homepage: https://github.com/foraker/heroku-scaler
|
42
|
+
licenses:
|
43
|
+
- MIT
|
44
|
+
metadata: {}
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 2.2.2
|
62
|
+
signing_key:
|
63
|
+
specification_version: 4
|
64
|
+
summary: Heroku Scaler
|
65
|
+
test_files: []
|