putsreq 0.0.3 → 0.0.4
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 +5 -5
- data/.babelrc +26 -0
- data/.codeclimate.yml +29 -5
- data/.env.docker +6 -0
- data/.eslintignore +4 -0
- data/.eslintrc +22 -0
- data/.gitignore +8 -0
- data/.postcssrc.yml +3 -0
- data/.prettierrc +4 -0
- data/.reek +12 -0
- data/.rubocop.yml +47 -25
- data/.ruby-version +1 -1
- data/.simplecov +6 -0
- data/.travis.yml +38 -4
- data/Dockerfile +44 -0
- data/Gemfile +40 -61
- data/Gemfile.lock +294 -186
- data/Procfile +1 -1
- data/README.md +51 -46
- data/Rakefile +1 -1
- data/{public → app/assets}/images/logo.png +0 -0
- data/app/assets/javascripts/application.js +1 -1
- data/app/assets/javascripts/buckets.js.coffee +1 -21
- data/app/assets/stylesheets/{application.css → application.scss} +2 -1
- data/app/assets/stylesheets/buckets.css.scss +0 -2
- data/app/controllers/application_controller.rb +11 -9
- data/app/controllers/buckets_controller.rb +24 -18
- data/app/controllers/home_controller.rb +5 -5
- data/app/controllers/requests_controller.rb +13 -2
- data/app/helpers/application_helper.rb +6 -2
- data/app/interactors/create_or_retrieve_bucket.rb +17 -0
- data/app/interactors/create_request.rb +25 -7
- data/app/interactors/eval_response_builder.rb +9 -9
- data/app/interactors/filter_headers.rb +3 -3
- data/app/interactors/forward_request.rb +4 -4
- data/app/interactors/record_request.rb +1 -1
- data/app/interactors/track.rb +44 -0
- data/app/javascript/actionTypes.js +7 -0
- data/app/javascript/actions/index.js +64 -0
- data/app/javascript/components/Bucket.jsx +91 -0
- data/app/javascript/components/Pagination.jsx +67 -0
- data/app/javascript/components/RequestCount.jsx +21 -0
- data/app/javascript/components/request/Header.jsx +31 -0
- data/app/javascript/components/request/Response.jsx +28 -0
- data/app/javascript/components/request/index.jsx +47 -0
- data/app/javascript/packs/application.js +25 -0
- data/app/javascript/packs/hello_react.jsx +26 -0
- data/app/javascript/reducers/index.js +23 -0
- data/app/javascript/request_poller.js +19 -0
- data/app/javascript/store.js +9 -0
- data/app/models/bucket.rb +16 -10
- data/app/models/request.rb +2 -3
- data/app/models/user.rb +2 -2
- data/app/serializers/bucket_serializer.rb +11 -0
- data/app/serializers/request_serializer.rb +69 -0
- data/app/views/buckets/_buttons.html.erb +3 -3
- data/app/views/buckets/_form.html.erb +6 -6
- data/app/views/buckets/_readonly_buttons.html.erb +1 -1
- data/app/views/buckets/show.html.erb +12 -25
- data/app/views/home/index.html.erb +22 -16
- data/app/views/layouts/application.html.erb +21 -22
- data/app/views/layouts/devise.html.erb +16 -18
- data/app/views/shared/_flash.html.erb +3 -1
- data/bin/byebug +21 -0
- data/bin/cc-tddium-post-worker +21 -0
- data/bin/codeclimate-test-reporter +21 -0
- data/bin/coderay +21 -0
- data/bin/dotenv +21 -0
- data/bin/htmldiff +21 -0
- data/bin/httparty +21 -0
- data/bin/httpclient +21 -0
- data/bin/ldiff +21 -0
- data/bin/mongo_console +21 -0
- data/bin/nokogiri +21 -0
- data/bin/pry +21 -0
- data/bin/putsreq +18 -71
- data/bin/rackup +21 -0
- data/bin/rails +1 -1
- data/bin/ri +21 -0
- data/bin/rollbar-rails-runner +21 -0
- data/bin/rspec +10 -5
- data/bin/safe_yaml +21 -0
- data/bin/sass +21 -0
- data/bin/sass-convert +21 -0
- data/bin/scss +21 -0
- data/bin/sdoc +21 -0
- data/bin/sdoc-merge +21 -0
- data/bin/setup +38 -0
- data/bin/sprockets +21 -0
- data/bin/thor +21 -0
- data/bin/tilt +21 -0
- data/bin/unicorn +21 -0
- data/bin/unicorn_rails +21 -0
- data/bin/update +29 -0
- data/bin/webpack +15 -0
- data/bin/webpack-dev-server +15 -0
- data/bin/yarn +11 -0
- data/config/application.rb +6 -4
- data/config/boot.rb +1 -1
- data/config/environment.rb +1 -1
- data/config/environments/development.rb +7 -3
- data/config/environments/production.rb +5 -2
- data/config/environments/test.rb +3 -1
- data/config/initializers/devise.rb +2 -2
- data/config/initializers/rack_attack.rb +24 -0
- data/config/initializers/rollbar.rb +58 -0
- data/config/initializers/setup_email.rb +7 -7
- data/config/mongoid.yml +2 -2
- data/config/newrelic.yml +45 -0
- data/config/puma.rb +15 -0
- data/config/routes.rb +2 -0
- data/config/webpack/development.js +5 -0
- data/config/webpack/environment.js +3 -0
- data/config/webpack/production.js +5 -0
- data/config/webpack/test.js +5 -0
- data/config/webpacker.yml +70 -0
- data/docker-compose.yml +25 -0
- data/lib/putsreq/cli_helper.rb +114 -0
- data/lib/putsreq/version.rb +1 -1
- data/package.json +30 -0
- data/putsreq.gemspec +6 -7
- data/spec/controllers/buckets_controller_spec.rb +54 -46
- data/spec/interactors/create_or_retrieve_bucket_spec.rb +25 -0
- data/spec/interactors/create_request_spec.rb +11 -8
- data/spec/interactors/create_response_spec.rb +1 -1
- data/spec/interactors/eval_response_builder_spec.rb +14 -17
- data/spec/interactors/forward_request_spec.rb +4 -4
- data/spec/lib/putsreq/cli_helper_spec.rb +114 -0
- data/spec/models/bucket_spec.rb +3 -3
- data/spec/spec_helper.rb +25 -25
- data/yarn.lock +7043 -0
- metadata +85 -20
- data/.hound.yml +0 -14
- data/app/interactors/notify_count.rb +0 -15
- data/app/models/.keep +0 -0
- data/config/initializers/redis.rb +0 -17
- data/config/unicorn.rb +0 -16
- data/lib/assets/.keep +0 -0
- data/public/images/.keep +0 -0
- data/vendor/assets/javascripts/.keep +0 -0
- data/vendor/assets/stylesheets/.keep +0 -0
data/bin/tilt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'tilt' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
12
|
+
load(bundle_binstub) if File.file?(bundle_binstub)
|
|
13
|
+
|
|
14
|
+
require "pathname"
|
|
15
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
|
16
|
+
Pathname.new(__FILE__).realpath)
|
|
17
|
+
|
|
18
|
+
require "rubygems"
|
|
19
|
+
require "bundler/setup"
|
|
20
|
+
|
|
21
|
+
load Gem.bin_path("tilt", "tilt")
|
data/bin/unicorn
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'unicorn' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
12
|
+
load(bundle_binstub) if File.file?(bundle_binstub)
|
|
13
|
+
|
|
14
|
+
require "pathname"
|
|
15
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
|
16
|
+
Pathname.new(__FILE__).realpath)
|
|
17
|
+
|
|
18
|
+
require "rubygems"
|
|
19
|
+
require "bundler/setup"
|
|
20
|
+
|
|
21
|
+
load Gem.bin_path("unicorn", "unicorn")
|
data/bin/unicorn_rails
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'unicorn_rails' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
12
|
+
load(bundle_binstub) if File.file?(bundle_binstub)
|
|
13
|
+
|
|
14
|
+
require "pathname"
|
|
15
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
|
16
|
+
Pathname.new(__FILE__).realpath)
|
|
17
|
+
|
|
18
|
+
require "rubygems"
|
|
19
|
+
require "bundler/setup"
|
|
20
|
+
|
|
21
|
+
load Gem.bin_path("unicorn", "unicorn_rails")
|
data/bin/update
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'pathname'
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
include FileUtils
|
|
5
|
+
|
|
6
|
+
# path to your application root.
|
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
|
8
|
+
|
|
9
|
+
def system!(*args)
|
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
chdir APP_ROOT do
|
|
14
|
+
# This script is a way to update your development environment automatically.
|
|
15
|
+
# Add necessary update steps to this file.
|
|
16
|
+
|
|
17
|
+
puts '== Installing dependencies =='
|
|
18
|
+
system! 'gem install bundler --conservative'
|
|
19
|
+
system('bundle check') || system!('bundle install')
|
|
20
|
+
|
|
21
|
+
puts "\n== Updating database =="
|
|
22
|
+
system! 'bin/rails db:migrate'
|
|
23
|
+
|
|
24
|
+
puts "\n== Removing old logs and tempfiles =="
|
|
25
|
+
system! 'bin/rails log:clear tmp:clear'
|
|
26
|
+
|
|
27
|
+
puts "\n== Restarting application server =="
|
|
28
|
+
system! 'bin/rails restart'
|
|
29
|
+
end
|
data/bin/webpack
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
|
4
|
+
ENV["NODE_ENV"] ||= "development"
|
|
5
|
+
|
|
6
|
+
require "pathname"
|
|
7
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
|
8
|
+
Pathname.new(__FILE__).realpath)
|
|
9
|
+
|
|
10
|
+
require "rubygems"
|
|
11
|
+
require "bundler/setup"
|
|
12
|
+
|
|
13
|
+
require "webpacker"
|
|
14
|
+
require "webpacker/webpack_runner"
|
|
15
|
+
Webpacker::WebpackRunner.run(ARGV)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
|
4
|
+
ENV["NODE_ENV"] ||= "development"
|
|
5
|
+
|
|
6
|
+
require "pathname"
|
|
7
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
|
8
|
+
Pathname.new(__FILE__).realpath)
|
|
9
|
+
|
|
10
|
+
require "rubygems"
|
|
11
|
+
require "bundler/setup"
|
|
12
|
+
|
|
13
|
+
require "webpacker"
|
|
14
|
+
require "webpacker/dev_server_runner"
|
|
15
|
+
Webpacker::DevServerRunner.run(ARGV)
|
data/bin/yarn
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
VENDOR_PATH = File.expand_path('..', __dir__)
|
|
3
|
+
Dir.chdir(VENDOR_PATH) do
|
|
4
|
+
begin
|
|
5
|
+
exec "yarnpkg #{ARGV.join(" ")}"
|
|
6
|
+
rescue Errno::ENOENT
|
|
7
|
+
$stderr.puts "Yarn executable was not detected in the system."
|
|
8
|
+
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
|
9
|
+
exit 1
|
|
10
|
+
end
|
|
11
|
+
end
|
data/config/application.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
require File.expand_path('
|
|
1
|
+
require File.expand_path('boot', __dir__)
|
|
2
2
|
|
|
3
3
|
# require 'rails/all'
|
|
4
4
|
|
|
5
|
-
require
|
|
6
|
-
require
|
|
7
|
-
require
|
|
5
|
+
require 'action_controller/railtie'
|
|
6
|
+
require 'action_mailer/railtie'
|
|
7
|
+
require 'sprockets/railtie'
|
|
8
8
|
# require "rails/test_unit/railtie"
|
|
9
9
|
|
|
10
10
|
# Require the gems listed in Gemfile, including any gems
|
|
@@ -38,5 +38,7 @@ module PutsReq
|
|
|
38
38
|
config.to_prepare do
|
|
39
39
|
Devise::SessionsController.layout 'devise'
|
|
40
40
|
end
|
|
41
|
+
|
|
42
|
+
config.middleware.use Rack::Attack
|
|
41
43
|
end
|
|
42
44
|
end
|
data/config/boot.rb
CHANGED
data/config/environment.rb
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
ENV['REDISTOGO_URL'] = 'redis://127.0.0.1:6379'
|
|
2
|
-
|
|
3
1
|
PutsReq::Application.configure do
|
|
4
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
|
5
3
|
|
|
@@ -30,4 +28,10 @@ PutsReq::Application.configure do
|
|
|
30
28
|
config.assets.debug = true
|
|
31
29
|
|
|
32
30
|
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
|
|
33
|
-
|
|
31
|
+
|
|
32
|
+
config.allow_concurrency = true
|
|
33
|
+
|
|
34
|
+
config.assets.quiet = true
|
|
35
|
+
|
|
36
|
+
config.cache_store = :redis_store, ENV['REDIS_URL']
|
|
37
|
+
end
|
|
@@ -40,10 +40,10 @@ PutsReq::Application.configure do
|
|
|
40
40
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
|
41
41
|
|
|
42
42
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
43
|
-
|
|
43
|
+
config.force_ssl = true
|
|
44
44
|
|
|
45
45
|
# Set to :debug to see everything in the log.
|
|
46
|
-
config.log_level = :
|
|
46
|
+
config.log_level = :error
|
|
47
47
|
|
|
48
48
|
# Prepend all log lines with the following tags.
|
|
49
49
|
# config.log_tags = [ :subdomain, :uuid ]
|
|
@@ -53,6 +53,7 @@ PutsReq::Application.configure do
|
|
|
53
53
|
|
|
54
54
|
# Use a different cache store in production.
|
|
55
55
|
# config.cache_store = :mem_cache_store
|
|
56
|
+
config.cache_store = :redis_store, ENV['REDIS_URL']
|
|
56
57
|
|
|
57
58
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
|
58
59
|
# config.action_controller.asset_host = "http://assets.example.com"
|
|
@@ -79,4 +80,6 @@ PutsReq::Application.configure do
|
|
|
79
80
|
config.log_formatter = ::Logger::Formatter.new
|
|
80
81
|
|
|
81
82
|
config.action_mailer.default_url_options = { host: 'putsreq.com' }
|
|
83
|
+
|
|
84
|
+
config.allow_concurrency = true
|
|
82
85
|
end
|
data/config/environments/test.rb
CHANGED
|
@@ -14,7 +14,7 @@ PutsReq::Application.configure do
|
|
|
14
14
|
|
|
15
15
|
# Configure static asset server for tests with Cache-Control for performance.
|
|
16
16
|
config.serve_static_assets = true
|
|
17
|
-
config.static_cache_control =
|
|
17
|
+
config.static_cache_control = 'public, max-age=3600'
|
|
18
18
|
|
|
19
19
|
# Show full error reports and disable caching.
|
|
20
20
|
config.consider_all_requests_local = true
|
|
@@ -33,4 +33,6 @@ PutsReq::Application.configure do
|
|
|
33
33
|
|
|
34
34
|
# Print deprecation notices to the stderr.
|
|
35
35
|
config.active_support.deprecation = :stderr
|
|
36
|
+
|
|
37
|
+
config.public_file_server.enabled = true
|
|
36
38
|
end
|
|
@@ -41,12 +41,12 @@ Devise.setup do |config|
|
|
|
41
41
|
# Configure which authentication keys should be case-insensitive.
|
|
42
42
|
# These keys will be downcased upon creating or modifying a user and when used
|
|
43
43
|
# to authenticate or find a user. Default is :email.
|
|
44
|
-
config.case_insensitive_keys = [
|
|
44
|
+
config.case_insensitive_keys = [:email]
|
|
45
45
|
|
|
46
46
|
# Configure which authentication keys should have whitespace stripped.
|
|
47
47
|
# These keys will have whitespace before and after removed upon creating or
|
|
48
48
|
# modifying a user and when used to authenticate or find a user. Default is :email.
|
|
49
|
-
config.strip_whitespace_keys = [
|
|
49
|
+
config.strip_whitespace_keys = [:email]
|
|
50
50
|
|
|
51
51
|
# Tell if authentication through request.params is enabled. True by default.
|
|
52
52
|
# It can be set to an array that will enable params authentication only for the
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
def requests_count_path?(path)
|
|
2
|
+
path.end_with?('/requests_count')
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Rack::Attack.throttle('requests by bucket (path) ', limit: 45, period: 60) do |request|
|
|
6
|
+
request.path unless requests_count_path?(request.path)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Rack::Attack.throttle('requests by ip', limit: 45, period: 60) do |request|
|
|
10
|
+
request.ip unless requests_count_path?(request.path)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Rack::Attack.throttled_response = lambda do |env|
|
|
14
|
+
match_data = env['rack.attack.match_data']
|
|
15
|
+
now = match_data[:epoch_time]
|
|
16
|
+
|
|
17
|
+
headers = {
|
|
18
|
+
'RateLimit-Limit' => match_data[:limit].to_s,
|
|
19
|
+
'RateLimit-Remaining' => '0',
|
|
20
|
+
'RateLimit-Reset' => (now + (match_data[:period] - now % match_data[:period])).to_s
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
[429, headers, ['Your are requests are being temporally throttled. Please contact for increasing limits.\n']]
|
|
24
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Rollbar.configure do |config|
|
|
2
|
+
# Without configuration, Rollbar is enabled in all environments.
|
|
3
|
+
# To disable in specific environments, set config.enabled=false.
|
|
4
|
+
|
|
5
|
+
config.access_token = ENV['ROLLBAR_ACCESS_TOKEN']
|
|
6
|
+
|
|
7
|
+
config.enabled = Rails.env.production?
|
|
8
|
+
|
|
9
|
+
# By default, Rollbar will try to call the `current_user` controller method
|
|
10
|
+
# to fetch the logged-in user object, and then call that object's `id`,
|
|
11
|
+
# `username`, and `email` methods to fetch those properties. To customize:
|
|
12
|
+
# config.person_method = "my_current_user"
|
|
13
|
+
# config.person_id_method = "my_id"
|
|
14
|
+
# config.person_username_method = "my_username"
|
|
15
|
+
# config.person_email_method = "my_email"
|
|
16
|
+
|
|
17
|
+
# If you want to attach custom data to all exception and message reports,
|
|
18
|
+
# provide a lambda like the following. It should return a hash.
|
|
19
|
+
# config.custom_data_method = lambda { {:some_key => "some_value" } }
|
|
20
|
+
|
|
21
|
+
# Add exception class names to the exception_level_filters hash to
|
|
22
|
+
# change the level that exception is reported at. Note that if an exception
|
|
23
|
+
# has already been reported and logged the level will need to be changed
|
|
24
|
+
# via the rollbar interface.
|
|
25
|
+
# Valid levels: 'critical', 'error', 'warning', 'info', 'debug', 'ignore'
|
|
26
|
+
# 'ignore' will cause the exception to not be reported at all.
|
|
27
|
+
# config.exception_level_filters.merge!('MyCriticalException' => 'critical')
|
|
28
|
+
config.exception_level_filters['Mongoid::Errors::DocumentNotFound'] = 'ignore'
|
|
29
|
+
config.exception_level_filters['ActionController::RoutingError'] = 'ignore'
|
|
30
|
+
config.exception_level_filters['ActionDispatch::ParamsParser::ParseError'] = 'ignore'
|
|
31
|
+
config.exception_level_filters['ActionDispatch::Http::Parameters::ParseError'] = 'ignore'
|
|
32
|
+
#
|
|
33
|
+
# You can also specify a callable, which will be called with the exception instance.
|
|
34
|
+
# config.exception_level_filters.merge!('MyCriticalException' => lambda { |e| 'critical' })
|
|
35
|
+
|
|
36
|
+
# Enable asynchronous reporting (uses girl_friday or Threading if girl_friday
|
|
37
|
+
# is not installed)
|
|
38
|
+
# config.use_async = true
|
|
39
|
+
# Supply your own async handler:
|
|
40
|
+
# config.async_handler = Proc.new { |payload|
|
|
41
|
+
# Thread.new { Rollbar.process_from_async_handler(payload) }
|
|
42
|
+
# }
|
|
43
|
+
|
|
44
|
+
# Enable asynchronous reporting (using sucker_punch)
|
|
45
|
+
# config.use_sucker_punch
|
|
46
|
+
|
|
47
|
+
# Enable delayed reporting (using Sidekiq)
|
|
48
|
+
# config.use_sidekiq
|
|
49
|
+
# You can supply custom Sidekiq options:
|
|
50
|
+
# config.use_sidekiq 'queue' => 'default'
|
|
51
|
+
|
|
52
|
+
# If you run your staging application instance in production environment then
|
|
53
|
+
# you'll want to override the environment reported by `Rails.env` with an
|
|
54
|
+
# environment variable like this: `ROLLBAR_ENV=staging`. This is a recommended
|
|
55
|
+
# setup for Heroku. See:
|
|
56
|
+
# https://devcenter.heroku.com/articles/deploying-to-a-custom-rails-environment
|
|
57
|
+
config.environment = ENV['ROLLBAR_ENV'] || Rails.env
|
|
58
|
+
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
ActionMailer::Base.smtp_settings = {
|
|
2
|
-
:
|
|
3
|
-
:
|
|
4
|
-
:
|
|
5
|
-
:
|
|
6
|
-
:
|
|
7
|
-
:
|
|
8
|
-
:
|
|
2
|
+
address: 'smtp.sendgrid.net',
|
|
3
|
+
port: '587',
|
|
4
|
+
authentication: :plain,
|
|
5
|
+
user_name: ENV['SENDGRID_USERNAME'],
|
|
6
|
+
password: ENV['SENDGRID_PASSWORD'],
|
|
7
|
+
domain: 'heroku.com',
|
|
8
|
+
enable_starttls_auto: true
|
|
9
9
|
}
|
|
10
10
|
ActionMailer::Base.delivery_method = :smtp
|
data/config/mongoid.yml
CHANGED
|
@@ -3,13 +3,13 @@ development:
|
|
|
3
3
|
default:
|
|
4
4
|
database: puts_req
|
|
5
5
|
hosts:
|
|
6
|
-
-
|
|
6
|
+
- <%= ENV['MONGO_URI'] %>
|
|
7
7
|
test:
|
|
8
8
|
clients:
|
|
9
9
|
default:
|
|
10
10
|
database: puts_req_test
|
|
11
11
|
hosts:
|
|
12
|
-
-
|
|
12
|
+
- <%= ENV['MONGO_URI'] %>
|
|
13
13
|
production:
|
|
14
14
|
clients:
|
|
15
15
|
default:
|
data/config/newrelic.yml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file configures the New Relic Agent. New Relic monitors Ruby, Java,
|
|
3
|
+
# .NET, PHP, Python, Node, and Go applications with deep visibility and low
|
|
4
|
+
# overhead. For more information, visit www.newrelic.com.
|
|
5
|
+
#
|
|
6
|
+
# Generated June 15, 2019
|
|
7
|
+
#
|
|
8
|
+
# This configuration file is custom generated for app24107725@heroku.com
|
|
9
|
+
#
|
|
10
|
+
# For full documentation of agent configuration options, please refer to
|
|
11
|
+
# https://docs.newrelic.com/docs/agents/ruby-agent/installation-configuration/ruby-agent-configuration
|
|
12
|
+
|
|
13
|
+
common: &default_settings
|
|
14
|
+
# Required license key associated with your New Relic account.
|
|
15
|
+
license_key: <%= ENV['NEW_RELIC_LICENSE_KEY'] %>
|
|
16
|
+
|
|
17
|
+
# Your application name. Renaming here affects where data displays in New
|
|
18
|
+
# Relic. For more details, see https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/renaming-applications
|
|
19
|
+
app_name: PutsReq
|
|
20
|
+
|
|
21
|
+
# To disable the agent regardless of other settings, uncomment the following:
|
|
22
|
+
# agent_enabled: false
|
|
23
|
+
|
|
24
|
+
# Logging level for log/newrelic_agent.log
|
|
25
|
+
log_level: info
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# Environment-specific settings are in this section.
|
|
29
|
+
# RAILS_ENV or RACK_ENV (as appropriate) is used to determine the environment.
|
|
30
|
+
# If your application has other named environments, configure them here.
|
|
31
|
+
development:
|
|
32
|
+
<<: *default_settings
|
|
33
|
+
app_name: PutsReq (Development)
|
|
34
|
+
|
|
35
|
+
test:
|
|
36
|
+
<<: *default_settings
|
|
37
|
+
# It doesn't make sense to report to New Relic from automated test runs.
|
|
38
|
+
monitor_mode: false
|
|
39
|
+
|
|
40
|
+
staging:
|
|
41
|
+
<<: *default_settings
|
|
42
|
+
app_name: PutsReq (Staging)
|
|
43
|
+
|
|
44
|
+
production:
|
|
45
|
+
<<: *default_settings
|
data/config/puma.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
|
|
2
|
+
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
|
|
3
|
+
threads threads_count, threads_count
|
|
4
|
+
|
|
5
|
+
preload_app!
|
|
6
|
+
|
|
7
|
+
rackup DefaultRackup
|
|
8
|
+
port ENV['PORT'] || 3000
|
|
9
|
+
environment ENV['RACK_ENV'] || 'development'
|
|
10
|
+
|
|
11
|
+
on_worker_boot do
|
|
12
|
+
# Worker specific setup for Rails 4.1+
|
|
13
|
+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
|
|
14
|
+
# ActiveRecord::Base.establish_connection
|
|
15
|
+
end
|
data/config/routes.rb
CHANGED
|
@@ -3,10 +3,12 @@ PutsReq::Application.routes.draw do
|
|
|
3
3
|
|
|
4
4
|
root to: 'home#index'
|
|
5
5
|
|
|
6
|
+
get ':token/requests_count' => 'buckets#requests_count'
|
|
6
7
|
post 'buckets' => 'buckets#create', as: :buckets
|
|
7
8
|
get ':token/inspect' => 'buckets#show', as: :bucket
|
|
8
9
|
get ':token/last' => 'buckets#last', as: :bucket_last
|
|
9
10
|
get ':token/requests/:id' => 'requests#show', as: :request
|
|
11
|
+
get ':token/requests' => 'requests#index', as: :requests
|
|
10
12
|
get ':token/last_response' => 'buckets#last_response', as: :bucket_last_response
|
|
11
13
|
put ':token/buckets' => 'buckets#update', as: :update_bucket
|
|
12
14
|
match ':token' => 'buckets#record', via: :all, as: :bucket_record
|