roo_on_rails 1.2.0 → 1.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 414e52a1f4a204155e8ac72fb782b1c3f8e02fbf
4
- data.tar.gz: 455803293bc94052f1fb00d760d75bd93fc219d8
3
+ metadata.gz: 8f0cf22be3d0412ce55d496e5bbb8bb9f79db969
4
+ data.tar.gz: a84b3635f83120868e711a40bb891a977d27afaa
5
5
  SHA512:
6
- metadata.gz: 023dd6254c42da164c858dad3e521a464df7835431a623b6c7444012e03a71a272a11d80f939791443520f27c230795d9c700402f79c25c1e45b116f14c20fc5
7
- data.tar.gz: 96a9cabce8b2bb63f686ec4e3a03bed076a0589a961467d2fe464957731d985530cdd314a41ba81cdc5db1c6e19a52714a134e77d02262a9292df79e851a5164
6
+ metadata.gz: 34ffa0d2d2da72f352cf30a988e390c5aca2013bd492f006d64b6ca8470612822b046084f3d6094af197abbec52b33ca159aa075c5660599588e12ec685890bb
7
+ data.tar.gz: fc11d895cd22c56458d2a03c95639a79c55ae20a02168db587efd6ecbfd90e8136e08a0507b32cc025406f5f5d10bb0c030e41c8bf0390059562b7a1aacd9c60
data/.travis.yml CHANGED
@@ -23,3 +23,5 @@ matrix:
23
23
  - rvm: ruby-head
24
24
  - rvm: 2.4.0
25
25
  gemfile: gemfiles/rails_3.gemfile
26
+ services:
27
+ - redis-server
data/Appraisals CHANGED
@@ -1,12 +1,17 @@
1
- appraise "rails-3" do
1
+ appraise 'rails-3' do
2
+ gem 'rails', '~> 3.2'
2
3
  gem 'sqlite3'
3
- gem "rails", "~> 3.2"
4
+ gem 'sidekiq', '< 5'
4
5
  end
5
6
 
6
- appraise "rails-4" do
7
- gem "rails", "~> 4.2"
7
+ appraise 'rails-4' do
8
+ gem 'rails', '~> 4.2'
9
+ gem 'sqlite3'
10
+ gem 'pg'
8
11
  end
9
12
 
10
- appraise "rails-5" do
11
- gem "rails", "~> 5.0"
13
+ appraise 'rails-5' do
14
+ gem 'rails', '~> 5.0'
15
+ gem 'sqlite3'
16
+ gem 'pg'
12
17
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ # v1.3.0 (2017-04-28)
2
+
3
+ Features:
4
+
5
+ - Sets database statement timeout to 200ms by default (#13).
6
+ - Sets migration statement timeout to 10s by default (#16, #17)
7
+ - Adds Sidekiq and Hirefire (workers) integration (#11)
8
+ - Adds the ability to tag logs with key/value pairs (#20)
9
+
10
+ Fixes:
11
+
12
+ - Use correct GitHub context name for CircleCI (#12)
13
+ - Do not depend on sort order for Codecov GitHub contexts (#12)
14
+ - Do not add `Rack::SslEnforcer` middleware in test environment (#15)
15
+ - Fix for "undefined constant: RooOnRails::Rack::Timeout" (#18)
16
+
1
17
  # v1.2.0 (2017-03-21)
2
18
 
3
19
  Features:
data/README.md CHANGED
@@ -50,7 +50,6 @@ Running the `roo_on_rails` script currently checks for:
50
50
  - presence of the Heroku preboot flag;
51
51
  - correct Github master branch protection.
52
52
 
53
-
54
53
  ### New Relic configuration
55
54
 
56
55
  We enforce configuration of New Relic.
@@ -95,6 +94,48 @@ We'll insert the following middlewares into the rails stack:
95
94
  2. `Rack::SslEnforcer`: enforces HTTPS.
96
95
  3. `Rack::Deflater`: compresses responses from the application, can be disabled with `ROO_ON_RAILS_RACK_DEFLATE` (default: 'YES').
97
96
 
97
+ ### Database configuration
98
+
99
+ The database statement timeout will be set to a low value by default. Use `DATABASE_STATEMENT_TIMEOUT` (milliseconds, default 200) to customise.
100
+
101
+ For database creation and migration (specifically the `db:create`, `db:migrate`, `db:migrate:down` and `db:rollback` tasks) a much higher statement timeout is set by default. Use `MIGRATION_STATEMENT_TIMEOUT` (milliseconds, default 10000) to customise.
102
+
103
+ _Note: This configuration is not supported in Rails 3 and will be skipped. Set statement timeouts directly in the database._
104
+
105
+ ### Sidekiq
106
+
107
+ When `SIDEKIQ_ENABLED` is set we'll:
108
+
109
+ - check for the existence of a worker line in your Procfile
110
+ - add SLA style queues to your worker list
111
+ - check for a HIREFIRE_TOKEN and if it's set enable SLA based autoscaling
112
+
113
+ The following ENV are available:
114
+
115
+ - `SIDEKIQ_ENABLED`
116
+ - `SIDEKIQ_THREADS` (default: 25) - Sets sidekiq concurrency value
117
+ - `SIDEKIQ_DATABASE_REAPING_FREQUENCY` (default: 10) - For sidekiq processes the amount of time in seconds rails will wait before attempting to find and recover connections from dead threads
118
+
119
+ ### Logging
120
+
121
+ For clearer and machine-parseable log output, there in an extension to be able to add context to your logs which is output as [logfmt](https://brandur.org/logfmt) key/value pairs after the log message.
122
+
123
+ ```ruby
124
+ # in application.rb
125
+
126
+ Rails.logger = RooOnRails::ContextLogging.new(ActiveSupport::Logger.new($stdout))
127
+ ```
128
+
129
+ You can then add context using the `with` method:
130
+
131
+ ```ruby
132
+ logger.with(a: 1, b: 2) { logger.info 'Stuff' }
133
+ logger.with(a: 1) { logger.with(b: 2) { logger.info('Stuff') } }
134
+ logger.with(a: 1, b: 2).info('Stuff')
135
+ ```
136
+
137
+ See the [class documentation](/deliveroo/roo_on_rails/tree/master/lib/roo_on_rails/context_logging.rb) for further details.
138
+
98
139
  ## Contributing
99
140
 
100
141
  Bug reports and pull requests are welcome on GitHub at https://github.com/deliveroo/roo_on_rails.
data/exe/roo_on_rails CHANGED
@@ -1,9 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
- require 'pry'
4
3
  require 'roo_on_rails/config'
5
4
  require 'roo_on_rails/harness'
5
+ require 'roo_on_rails/sidekiq/loader'
6
6
 
7
- module RooOnRails
8
- Harness.new(try_fix: true, context: Config.load).run
7
+ if ARGV.include? 'sidekiq'
8
+ RooOnRails::Sidekiq::Loader.run
9
+ else
10
+ module RooOnRails
11
+ Harness.new(try_fix: true, context: Config.load).run
12
+ end
9
13
  end
@@ -5,7 +5,8 @@ source "https://rubygems.org"
5
5
  gem "guard"
6
6
  gem "guard-rspec"
7
7
  gem "appraisal"
8
- gem "sqlite3"
9
8
  gem "rails", "~> 3.2"
9
+ gem "sqlite3"
10
+ gem "sidekiq", "< 5"
10
11
 
11
12
  gemspec :path => "../"
@@ -1,14 +1,17 @@
1
1
  PATH
2
- remote: ../
2
+ remote: ..
3
3
  specs:
4
- roo_on_rails (1.1.0)
4
+ roo_on_rails (1.3.0)
5
5
  dotenv-rails (~> 2.1)
6
6
  hashie (~> 3.4)
7
+ hirefire-resource
7
8
  newrelic_rpm (~> 3.17)
9
+ octokit
8
10
  platform-api (~> 0.8)
9
11
  rack-ssl-enforcer
10
12
  rack-timeout
11
13
  rails (>= 3.2.22, < 5.1)
14
+ sidekiq
12
15
 
13
16
  GEM
14
17
  remote: https://rubygems.org/
@@ -40,22 +43,33 @@ GEM
40
43
  activesupport (3.2.22.5)
41
44
  i18n (~> 0.6, >= 0.6.4)
42
45
  multi_json (~> 1.0)
43
- appraisal (2.1.0)
46
+ addressable (2.5.1)
47
+ public_suffix (~> 2.0, >= 2.0.2)
48
+ appraisal (2.2.0)
44
49
  bundler
45
50
  rake
46
51
  thor (>= 0.14.0)
47
52
  arel (3.0.3)
48
53
  builder (3.0.4)
49
54
  byebug (9.0.6)
55
+ codecov (0.1.10)
56
+ json
57
+ simplecov
58
+ url
50
59
  coderay (1.1.1)
60
+ concurrent-ruby (1.0.5)
61
+ connection_pool (2.2.1)
51
62
  diff-lcs (1.3)
63
+ docile (1.1.5)
52
64
  dotenv (2.2.0)
53
65
  dotenv-rails (2.2.0)
54
66
  dotenv (= 2.2.0)
55
67
  railties (>= 3.2, < 5.1)
56
68
  erubis (2.7.0)
57
69
  excon (0.55.0)
58
- ffi (1.9.17)
70
+ faraday (0.12.1)
71
+ multipart-post (>= 1.2, < 3)
72
+ ffi (1.9.18)
59
73
  formatador (0.2.5)
60
74
  guard (2.14.1)
61
75
  formatador (>= 0.2.4)
@@ -77,6 +91,7 @@ GEM
77
91
  excon
78
92
  multi_json (>= 1.9.2)
79
93
  hike (1.2.3)
94
+ hirefire-resource (0.4.0)
80
95
  i18n (0.8.1)
81
96
  journey (1.0.4)
82
97
  json (1.8.6)
@@ -88,14 +103,18 @@ GEM
88
103
  mail (2.5.4)
89
104
  mime-types (~> 1.16)
90
105
  treetop (~> 1.4.8)
106
+ memfs (1.0.0)
91
107
  method_source (0.8.2)
92
108
  mime-types (1.25.1)
93
109
  multi_json (1.12.1)
110
+ multipart-post (2.0.0)
94
111
  nenv (0.3.0)
95
112
  newrelic_rpm (3.18.1.330)
96
113
  notiffany (0.1.1)
97
114
  nenv (~> 0.1)
98
115
  shellany (~> 0.0)
116
+ octokit (4.7.0)
117
+ sawyer (~> 0.8.0, >= 0.5.3)
99
118
  platform-api (0.8.0)
100
119
  heroics (~> 0.0.17)
101
120
  polyglot (0.3.5)
@@ -106,9 +125,12 @@ GEM
106
125
  pry-byebug (3.4.2)
107
126
  byebug (~> 9.0)
108
127
  pry (~> 0.10)
128
+ public_suffix (2.0.5)
109
129
  rack (1.4.7)
110
130
  rack-cache (1.7.0)
111
131
  rack (>= 0.4)
132
+ rack-protection (1.5.3)
133
+ rack
112
134
  rack-ssl (1.3.4)
113
135
  rack
114
136
  rack-ssl-enforcer (0.2.9)
@@ -136,6 +158,7 @@ GEM
136
158
  ffi (>= 0.5.0)
137
159
  rdoc (3.12.2)
138
160
  json (~> 1.4)
161
+ redis (3.3.3)
139
162
  rspec (3.5.0)
140
163
  rspec-core (~> 3.5.0)
141
164
  rspec-expectations (~> 3.5.0)
@@ -150,7 +173,20 @@ GEM
150
173
  rspec-support (~> 3.5.0)
151
174
  rspec-support (3.5.0)
152
175
  ruby_dep (1.5.0)
176
+ sawyer (0.8.1)
177
+ addressable (>= 2.3.5, < 2.6)
178
+ faraday (~> 0.8, < 1.0)
153
179
  shellany (0.0.1)
180
+ sidekiq (4.2.10)
181
+ concurrent-ruby (~> 1.0)
182
+ connection_pool (~> 2.2, >= 2.2.0)
183
+ rack-protection (>= 1.5.0)
184
+ redis (~> 3.2, >= 3.2.1)
185
+ simplecov (0.14.1)
186
+ docile (~> 1.1.0)
187
+ json (>= 1.8, < 3)
188
+ simplecov-html (~> 0.10.0)
189
+ simplecov-html (0.10.0)
154
190
  slop (3.6.0)
155
191
  sprockets (2.2.3)
156
192
  hike (~> 1.2)
@@ -163,7 +199,8 @@ GEM
163
199
  treetop (1.4.15)
164
200
  polyglot
165
201
  polyglot (>= 0.3.1)
166
- tzinfo (0.3.52)
202
+ tzinfo (0.3.53)
203
+ url (0.3.2)
167
204
 
168
205
  PLATFORMS
169
206
  ruby
@@ -171,13 +208,17 @@ PLATFORMS
171
208
  DEPENDENCIES
172
209
  appraisal
173
210
  bundler (~> 1.13)
211
+ codecov
174
212
  guard
175
213
  guard-rspec
214
+ memfs
176
215
  pry-byebug
177
216
  rails (~> 3.2)
178
217
  rake (~> 10.0)
179
218
  roo_on_rails!
180
219
  rspec (~> 3.0)
220
+ sidekiq (< 5)
221
+ simplecov
181
222
  sqlite3
182
223
  thor (~> 0.19)
183
224
 
@@ -6,5 +6,7 @@ gem "guard"
6
6
  gem "guard-rspec"
7
7
  gem "appraisal"
8
8
  gem "rails", "~> 4.2"
9
+ gem "sqlite3"
10
+ gem "pg"
9
11
 
10
12
  gemspec :path => "../"
@@ -1,14 +1,17 @@
1
1
  PATH
2
- remote: ../
2
+ remote: ..
3
3
  specs:
4
- roo_on_rails (1.1.0)
4
+ roo_on_rails (1.3.0)
5
5
  dotenv-rails (~> 2.1)
6
6
  hashie (~> 3.4)
7
+ hirefire-resource
7
8
  newrelic_rpm (~> 3.17)
9
+ octokit
8
10
  platform-api (~> 0.8)
9
11
  rack-ssl-enforcer
10
12
  rack-timeout
11
13
  rails (>= 3.2.22, < 5.1)
14
+ sidekiq
12
15
 
13
16
  GEM
14
17
  remote: https://rubygems.org/
@@ -47,26 +50,36 @@ GEM
47
50
  minitest (~> 5.1)
48
51
  thread_safe (~> 0.3, >= 0.3.4)
49
52
  tzinfo (~> 1.1)
50
- appraisal (2.1.0)
53
+ addressable (2.5.1)
54
+ public_suffix (~> 2.0, >= 2.0.2)
55
+ appraisal (2.2.0)
51
56
  bundler
52
57
  rake
53
58
  thor (>= 0.14.0)
54
59
  arel (6.0.4)
55
60
  builder (3.2.3)
56
61
  byebug (9.0.6)
62
+ codecov (0.1.10)
63
+ json
64
+ simplecov
65
+ url
57
66
  coderay (1.1.1)
58
67
  concurrent-ruby (1.0.5)
68
+ connection_pool (2.2.1)
59
69
  diff-lcs (1.3)
70
+ docile (1.1.5)
60
71
  dotenv (2.2.0)
61
72
  dotenv-rails (2.2.0)
62
73
  dotenv (= 2.2.0)
63
74
  railties (>= 3.2, < 5.1)
64
75
  erubis (2.7.0)
65
76
  excon (0.55.0)
66
- ffi (1.9.17)
77
+ faraday (0.12.1)
78
+ multipart-post (>= 1.2, < 3)
79
+ ffi (1.9.18)
67
80
  formatador (0.2.5)
68
- globalid (0.3.7)
69
- activesupport (>= 4.1.0)
81
+ globalid (0.4.0)
82
+ activesupport (>= 4.2.0)
70
83
  guard (2.14.1)
71
84
  formatador (>= 0.2.4)
72
85
  listen (>= 2.7, < 4.0)
@@ -86,7 +99,9 @@ GEM
86
99
  erubis (~> 2.0)
87
100
  excon
88
101
  multi_json (>= 1.9.2)
102
+ hirefire-resource (0.4.0)
89
103
  i18n (0.8.1)
104
+ json (2.1.0)
90
105
  listen (3.1.5)
91
106
  rb-fsevent (~> 0.9, >= 0.9.4)
92
107
  rb-inotify (~> 0.9, >= 0.9.7)
@@ -96,6 +111,7 @@ GEM
96
111
  lumberjack (1.0.11)
97
112
  mail (2.6.4)
98
113
  mime-types (>= 1.16, < 4)
114
+ memfs (1.0.0)
99
115
  method_source (0.8.2)
100
116
  mime-types (3.1)
101
117
  mime-types-data (~> 3.2015)
@@ -103,13 +119,17 @@ GEM
103
119
  mini_portile2 (2.1.0)
104
120
  minitest (5.10.1)
105
121
  multi_json (1.12.1)
122
+ multipart-post (2.0.0)
106
123
  nenv (0.3.0)
107
124
  newrelic_rpm (3.18.1.330)
108
- nokogiri (1.7.0.1)
125
+ nokogiri (1.7.1)
109
126
  mini_portile2 (~> 2.1.0)
110
127
  notiffany (0.1.1)
111
128
  nenv (~> 0.1)
112
129
  shellany (~> 0.0)
130
+ octokit (4.7.0)
131
+ sawyer (~> 0.8.0, >= 0.5.3)
132
+ pg (0.20.0)
113
133
  platform-api (0.8.0)
114
134
  heroics (~> 0.0.17)
115
135
  pry (0.10.4)
@@ -119,7 +139,10 @@ GEM
119
139
  pry-byebug (3.4.2)
120
140
  byebug (~> 9.0)
121
141
  pry (~> 0.10)
142
+ public_suffix (2.0.5)
122
143
  rack (1.6.5)
144
+ rack-protection (1.5.3)
145
+ rack
123
146
  rack-ssl-enforcer (0.2.9)
124
147
  rack-test (0.6.3)
125
148
  rack (>= 1.0)
@@ -152,6 +175,7 @@ GEM
152
175
  rb-fsevent (0.9.8)
153
176
  rb-inotify (0.9.8)
154
177
  ffi (>= 0.5.0)
178
+ redis (3.3.3)
155
179
  rspec (3.5.0)
156
180
  rspec-core (~> 3.5.0)
157
181
  rspec-expectations (~> 3.5.0)
@@ -166,7 +190,20 @@ GEM
166
190
  rspec-support (~> 3.5.0)
167
191
  rspec-support (3.5.0)
168
192
  ruby_dep (1.5.0)
193
+ sawyer (0.8.1)
194
+ addressable (>= 2.3.5, < 2.6)
195
+ faraday (~> 0.8, < 1.0)
169
196
  shellany (0.0.1)
197
+ sidekiq (5.0.0)
198
+ concurrent-ruby (~> 1.0)
199
+ connection_pool (~> 2.2, >= 2.2.0)
200
+ rack-protection (>= 1.5.0)
201
+ redis (~> 3.3, >= 3.3.3)
202
+ simplecov (0.14.1)
203
+ docile (~> 1.1.0)
204
+ json (>= 1.8, < 3)
205
+ simplecov-html (~> 0.10.0)
206
+ simplecov-html (0.10.0)
170
207
  slop (3.6.0)
171
208
  sprockets (3.7.1)
172
209
  concurrent-ruby (~> 1.0)
@@ -175,10 +212,12 @@ GEM
175
212
  actionpack (>= 4.0)
176
213
  activesupport (>= 4.0)
177
214
  sprockets (>= 3.0.0)
215
+ sqlite3 (1.3.13)
178
216
  thor (0.19.4)
179
217
  thread_safe (0.3.6)
180
- tzinfo (1.2.2)
218
+ tzinfo (1.2.3)
181
219
  thread_safe (~> 0.1)
220
+ url (0.3.2)
182
221
 
183
222
  PLATFORMS
184
223
  ruby
@@ -186,13 +225,18 @@ PLATFORMS
186
225
  DEPENDENCIES
187
226
  appraisal
188
227
  bundler (~> 1.13)
228
+ codecov
189
229
  guard
190
230
  guard-rspec
231
+ memfs
232
+ pg
191
233
  pry-byebug
192
234
  rails (~> 4.2)
193
235
  rake (~> 10.0)
194
236
  roo_on_rails!
195
237
  rspec (~> 3.0)
238
+ simplecov
239
+ sqlite3
196
240
  thor (~> 0.19)
197
241
 
198
242
  BUNDLED WITH
@@ -6,5 +6,7 @@ gem "guard"
6
6
  gem "guard-rspec"
7
7
  gem "appraisal"
8
8
  gem "rails", "~> 5.0"
9
+ gem "sqlite3"
10
+ gem "pg"
9
11
 
10
12
  gemspec :path => "../"