timescaledb 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/Gemfile.scenic.lock +2 -2
- data/README.md +23 -16
- data/bin/console +2 -2
- data/bin/tsdb +6 -6
- data/examples/{Gemfile → all_in_one/Gemfile} +0 -0
- data/examples/{Gemfile.lock → all_in_one/Gemfile.lock} +0 -0
- data/examples/{all_in_one.rb → all_in_one/all_in_one.rb} +0 -0
- data/examples/ranking/.gitattributes +7 -0
- data/examples/ranking/.gitignore +29 -0
- data/examples/ranking/.ruby-version +1 -0
- data/examples/ranking/Gemfile +33 -0
- data/examples/ranking/Gemfile.lock +189 -0
- data/examples/ranking/README.md +166 -0
- data/examples/ranking/Rakefile +6 -0
- data/examples/ranking/app/controllers/application_controller.rb +2 -0
- data/examples/ranking/app/controllers/concerns/.keep +0 -0
- data/examples/ranking/app/jobs/application_job.rb +7 -0
- data/examples/ranking/app/models/application_record.rb +3 -0
- data/examples/ranking/app/models/concerns/.keep +0 -0
- data/examples/ranking/app/models/game.rb +2 -0
- data/examples/ranking/app/models/play.rb +7 -0
- data/examples/ranking/bin/bundle +114 -0
- data/examples/ranking/bin/rails +4 -0
- data/examples/ranking/bin/rake +4 -0
- data/examples/ranking/bin/setup +33 -0
- data/examples/ranking/config/application.rb +39 -0
- data/examples/ranking/config/boot.rb +4 -0
- data/examples/ranking/config/credentials.yml.enc +1 -0
- data/examples/ranking/config/database.yml +86 -0
- data/examples/ranking/config/environment.rb +5 -0
- data/examples/ranking/config/environments/development.rb +60 -0
- data/examples/ranking/config/environments/production.rb +75 -0
- data/examples/ranking/config/environments/test.rb +53 -0
- data/examples/ranking/config/initializers/cors.rb +16 -0
- data/examples/ranking/config/initializers/filter_parameter_logging.rb +8 -0
- data/examples/ranking/config/initializers/inflections.rb +16 -0
- data/examples/ranking/config/initializers/timescale.rb +3 -0
- data/examples/ranking/config/locales/en.yml +33 -0
- data/examples/ranking/config/puma.rb +43 -0
- data/examples/ranking/config/routes.rb +6 -0
- data/examples/ranking/config/storage.yml +34 -0
- data/examples/ranking/config.ru +6 -0
- data/examples/ranking/db/migrate/20220209120747_create_games.rb +10 -0
- data/examples/ranking/db/migrate/20220209120910_create_plays.rb +19 -0
- data/examples/ranking/db/migrate/20220209143347_create_score_per_hours.rb +5 -0
- data/examples/ranking/db/schema.rb +47 -0
- data/examples/ranking/db/seeds.rb +7 -0
- data/examples/ranking/db/views/score_per_hours_v01.sql +7 -0
- data/examples/ranking/lib/tasks/.keep +0 -0
- data/examples/ranking/log/.keep +0 -0
- data/examples/ranking/public/robots.txt +1 -0
- data/examples/ranking/storage/.keep +0 -0
- data/examples/ranking/tmp/.keep +0 -0
- data/examples/ranking/tmp/pids/.keep +0 -0
- data/examples/ranking/tmp/storage/.keep +0 -0
- data/examples/ranking/vendor/.keep +0 -0
- data/lib/{timescale → timescaledb}/acts_as_hypertable/core.rb +1 -1
- data/lib/{timescale → timescaledb}/acts_as_hypertable.rb +6 -6
- data/lib/{timescale → timescaledb}/chunk.rb +1 -1
- data/lib/{timescale → timescaledb}/compression_settings.rb +1 -1
- data/lib/{timescale → timescaledb}/continuous_aggregates.rb +3 -3
- data/lib/{timescale → timescaledb}/dimensions.rb +1 -1
- data/lib/{timescale → timescaledb}/hypertable.rb +4 -4
- data/lib/{timescale → timescaledb}/job.rb +1 -1
- data/lib/{timescale → timescaledb}/job_stats.rb +1 -1
- data/lib/{timescale → timescaledb}/migration_helpers.rb +2 -2
- data/lib/{timescale → timescaledb}/scenic/adapter.rb +2 -2
- data/lib/timescaledb/scenic/extension.rb +72 -0
- data/lib/{timescale → timescaledb}/schema_dumper.rb +4 -4
- data/lib/{timescale → timescaledb}/stats_report.rb +2 -2
- data/lib/timescaledb/version.rb +3 -0
- data/lib/timescaledb.rb +64 -0
- data/{timescale.gemspec → timescaledb.gemspec} +3 -3
- metadata +73 -23
- data/lib/timescale/version.rb +0 -3
- data/lib/timescale.rb +0 -62
File without changes
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class ApplicationJob < ActiveJob::Base
|
2
|
+
# Automatically retry jobs that encountered a deadlock
|
3
|
+
# retry_on ActiveRecord::Deadlocked
|
4
|
+
|
5
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
6
|
+
# discard_on ActiveJob::DeserializationError
|
7
|
+
end
|
File without changes
|
@@ -0,0 +1,114 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
|
13
|
+
m = Module.new do
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def invoked_as_script?
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV["BUNDLER_VERSION"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def cli_arg_version
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
bundler_version = nil
|
28
|
+
update_index = nil
|
29
|
+
ARGV.each_with_index do |a, i|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
+
bundler_version = a
|
32
|
+
end
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
+
bundler_version = $1
|
35
|
+
update_index = i
|
36
|
+
end
|
37
|
+
bundler_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def gemfile
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
43
|
+
|
44
|
+
File.expand_path("../../Gemfile", __FILE__)
|
45
|
+
end
|
46
|
+
|
47
|
+
def lockfile
|
48
|
+
lockfile =
|
49
|
+
case File.basename(gemfile)
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
51
|
+
else "#{gemfile}.lock"
|
52
|
+
end
|
53
|
+
File.expand_path(lockfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
def lockfile_version
|
57
|
+
return unless File.file?(lockfile)
|
58
|
+
lockfile_contents = File.read(lockfile)
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_version
|
64
|
+
@bundler_version ||=
|
65
|
+
env_var_version || cli_arg_version ||
|
66
|
+
lockfile_version
|
67
|
+
end
|
68
|
+
|
69
|
+
def bundler_requirement
|
70
|
+
return "#{Gem::Requirement.default}.a" unless bundler_version
|
71
|
+
|
72
|
+
bundler_gem_version = Gem::Version.new(bundler_version)
|
73
|
+
|
74
|
+
requirement = bundler_gem_version.approximate_recommendation
|
75
|
+
|
76
|
+
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
77
|
+
|
78
|
+
requirement += ".a" if bundler_gem_version.prerelease?
|
79
|
+
|
80
|
+
requirement
|
81
|
+
end
|
82
|
+
|
83
|
+
def load_bundler!
|
84
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
85
|
+
|
86
|
+
activate_bundler
|
87
|
+
end
|
88
|
+
|
89
|
+
def activate_bundler
|
90
|
+
gem_error = activation_error_handling do
|
91
|
+
gem "bundler", bundler_requirement
|
92
|
+
end
|
93
|
+
return if gem_error.nil?
|
94
|
+
require_error = activation_error_handling do
|
95
|
+
require "bundler/version"
|
96
|
+
end
|
97
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
98
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
99
|
+
exit 42
|
100
|
+
end
|
101
|
+
|
102
|
+
def activation_error_handling
|
103
|
+
yield
|
104
|
+
nil
|
105
|
+
rescue StandardError, LoadError => e
|
106
|
+
e
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
m.load_bundler!
|
111
|
+
|
112
|
+
if m.invoked_as_script?
|
113
|
+
load Gem.bin_path("bundler", "bundle")
|
114
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
6
|
+
|
7
|
+
def system!(*args)
|
8
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
9
|
+
end
|
10
|
+
|
11
|
+
FileUtils.chdir APP_ROOT do
|
12
|
+
# This script is a way to set up or update your development environment automatically.
|
13
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
14
|
+
# Add necessary setup steps to this file.
|
15
|
+
|
16
|
+
puts "== Installing dependencies =="
|
17
|
+
system! "gem install bundler --conservative"
|
18
|
+
system("bundle check") || system!("bundle install")
|
19
|
+
|
20
|
+
# puts "\n== Copying sample files =="
|
21
|
+
# unless File.exist?("config/database.yml")
|
22
|
+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
23
|
+
# end
|
24
|
+
|
25
|
+
puts "\n== Preparing database =="
|
26
|
+
system! "bin/rails db:prepare"
|
27
|
+
|
28
|
+
puts "\n== Removing old logs and tempfiles =="
|
29
|
+
system! "bin/rails log:clear tmp:clear"
|
30
|
+
|
31
|
+
puts "\n== Restarting application server =="
|
32
|
+
system! "bin/rails restart"
|
33
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative "boot"
|
2
|
+
|
3
|
+
require "rails"
|
4
|
+
# Pick the frameworks you want:
|
5
|
+
require "active_model/railtie"
|
6
|
+
require "active_job/railtie"
|
7
|
+
require "active_record/railtie"
|
8
|
+
require "active_storage/engine"
|
9
|
+
require "action_controller/railtie"
|
10
|
+
# require "action_mailer/railtie"
|
11
|
+
require "action_mailbox/engine"
|
12
|
+
require "action_text/engine"
|
13
|
+
require "action_view/railtie"
|
14
|
+
# require "action_cable/engine"
|
15
|
+
# require "rails/test_unit/railtie"
|
16
|
+
|
17
|
+
# Require the gems listed in Gemfile, including any gems
|
18
|
+
# you've limited to :test, :development, or :production.
|
19
|
+
Bundler.require(*Rails.groups)
|
20
|
+
|
21
|
+
module Ranking
|
22
|
+
class Application < Rails::Application
|
23
|
+
# Initialize configuration defaults for originally generated Rails version.
|
24
|
+
config.load_defaults 7.0
|
25
|
+
|
26
|
+
# Configuration for the application, engines, and railties goes here.
|
27
|
+
#
|
28
|
+
# These settings can be overridden in specific environments using the files
|
29
|
+
# in config/environments, which are processed later.
|
30
|
+
#
|
31
|
+
# config.time_zone = "Central Time (US & Canada)"
|
32
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
33
|
+
|
34
|
+
# Only loads a smaller set of middleware suitable for API only apps.
|
35
|
+
# Middleware like session, flash, cookies can be added back manually.
|
36
|
+
# Skip views, helpers and assets when generating a new resource.
|
37
|
+
config.api_only = true
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
89mWxkKPY+RpiS3ysJ0FE9ljcVzmhiJVCYL9MVKwqPzkU/tUhehytnhibSz/ZNV/ef8WqOzYm5DfFfKXAXXixut/Aazw8725RxxLUDcikpy8ayr13WZgj91XlaPLCHPVyuNlxgVJFN8HPw++Xfe3pakKeJB0hhAlCgwCWIT7tx7Zf6g8KaIbdvJ+U9drEu3n4OgaQuw+wzRU1EaI80BbX1r9+Uufg6t7mWzMEh7n55HEBTinyNL/UZgQ0XvOQs+bQjjHVxRATXT2Mxt1zF3FZQZ6ECtOPKBKit9PDaS3RCkN2tk3ObvXlmSbz2vcIB/oW03M63TfjmfXjpG25N8tXqLl0MKoyOv/3UiBqeC7orNLTXZuWxpaQyCjpTqmza/rQyPkTRsUt+V1Rtw1gZfMbTK/JOdXr1feMhrl--91mPoTmwkbiDY9sK--49vaWMgJTV11y2bdEDMgug==
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# PostgreSQL. Versions 9.3 and up are supported.
|
2
|
+
#
|
3
|
+
# Install the pg driver:
|
4
|
+
# gem install pg
|
5
|
+
# On macOS with Homebrew:
|
6
|
+
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
|
7
|
+
# On macOS with MacPorts:
|
8
|
+
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
|
9
|
+
# On Windows:
|
10
|
+
# gem install pg
|
11
|
+
# Choose the win32 build.
|
12
|
+
# Install PostgreSQL and put its /bin directory on your path.
|
13
|
+
#
|
14
|
+
# Configure Using Gemfile
|
15
|
+
# gem "pg"
|
16
|
+
#
|
17
|
+
default: &default
|
18
|
+
adapter: postgresql
|
19
|
+
encoding: unicode
|
20
|
+
# For details on connection pooling, see Rails configuration guide
|
21
|
+
# https://guides.rubyonrails.org/configuring.html#database-pooling
|
22
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
23
|
+
|
24
|
+
development:
|
25
|
+
<<: *default
|
26
|
+
database: ranking_development
|
27
|
+
|
28
|
+
# The specified database role being used to connect to postgres.
|
29
|
+
# To create additional roles in postgres see `$ createuser --help`.
|
30
|
+
# When left blank, postgres will use the default role. This is
|
31
|
+
# the same name as the operating system user running Rails.
|
32
|
+
#username: ranking
|
33
|
+
|
34
|
+
# The password associated with the postgres role (username).
|
35
|
+
#password:
|
36
|
+
|
37
|
+
# Connect on a TCP socket. Omitted by default since the client uses a
|
38
|
+
# domain socket that doesn't need configuration. Windows does not have
|
39
|
+
# domain sockets, so uncomment these lines.
|
40
|
+
#host: localhost
|
41
|
+
|
42
|
+
# The TCP port the server listens on. Defaults to 5432.
|
43
|
+
# If your server runs on a different port number, change accordingly.
|
44
|
+
#port: 5432
|
45
|
+
|
46
|
+
# Schema search path. The server defaults to $user,public
|
47
|
+
#schema_search_path: myapp,sharedapp,public
|
48
|
+
|
49
|
+
# Minimum log levels, in increasing order:
|
50
|
+
# debug5, debug4, debug3, debug2, debug1,
|
51
|
+
# log, notice, warning, error, fatal, and panic
|
52
|
+
# Defaults to warning.
|
53
|
+
#min_messages: notice
|
54
|
+
|
55
|
+
# Warning: The database defined as "test" will be erased and
|
56
|
+
# re-generated from your development database when you run "rake".
|
57
|
+
# Do not set this db to the same as development or production.
|
58
|
+
test:
|
59
|
+
<<: *default
|
60
|
+
database: ranking_test
|
61
|
+
|
62
|
+
# As with config/credentials.yml, you never want to store sensitive information,
|
63
|
+
# like your database password, in your source code. If your source code is
|
64
|
+
# ever seen by anyone, they now have access to your database.
|
65
|
+
#
|
66
|
+
# Instead, provide the password or a full connection URL as an environment
|
67
|
+
# variable when you boot the app. For example:
|
68
|
+
#
|
69
|
+
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
|
70
|
+
#
|
71
|
+
# If the connection URL is provided in the special DATABASE_URL environment
|
72
|
+
# variable, Rails will automatically merge its configuration values on top of
|
73
|
+
# the values provided in this file. Alternatively, you can specify a connection
|
74
|
+
# URL environment variable explicitly:
|
75
|
+
#
|
76
|
+
# production:
|
77
|
+
# url: <%= ENV["MY_APP_DATABASE_URL"] %>
|
78
|
+
#
|
79
|
+
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
80
|
+
# for a full overview on how database connection configuration can be specified.
|
81
|
+
#
|
82
|
+
production:
|
83
|
+
<<: *default
|
84
|
+
database: ranking_production
|
85
|
+
username: ranking
|
86
|
+
password: <%= ENV["RANKING_DATABASE_PASSWORD"] %>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
3
|
+
Rails.application.configure do
|
4
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
+
|
6
|
+
# In the development environment your application's code is reloaded any time
|
7
|
+
# it changes. This slows down response time but is perfect for development
|
8
|
+
# since you don't have to restart the web server when you make code changes.
|
9
|
+
config.cache_classes = false
|
10
|
+
|
11
|
+
# Do not eager load code on boot.
|
12
|
+
config.eager_load = false
|
13
|
+
|
14
|
+
# Show full error reports.
|
15
|
+
config.consider_all_requests_local = true
|
16
|
+
|
17
|
+
# Enable server timing
|
18
|
+
config.server_timing = true
|
19
|
+
|
20
|
+
# Enable/disable caching. By default caching is disabled.
|
21
|
+
# Run rails dev:cache to toggle caching.
|
22
|
+
if Rails.root.join("tmp/caching-dev.txt").exist?
|
23
|
+
config.cache_store = :memory_store
|
24
|
+
config.public_file_server.headers = {
|
25
|
+
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
26
|
+
}
|
27
|
+
else
|
28
|
+
config.action_controller.perform_caching = false
|
29
|
+
|
30
|
+
config.cache_store = :null_store
|
31
|
+
end
|
32
|
+
|
33
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
34
|
+
config.active_storage.service = :local
|
35
|
+
|
36
|
+
# Print deprecation notices to the Rails logger.
|
37
|
+
config.active_support.deprecation = :log
|
38
|
+
|
39
|
+
# Raise exceptions for disallowed deprecations.
|
40
|
+
config.active_support.disallowed_deprecation = :raise
|
41
|
+
|
42
|
+
# Tell Active Support which deprecation messages to disallow.
|
43
|
+
config.active_support.disallowed_deprecation_warnings = []
|
44
|
+
|
45
|
+
# Raise an error on page load if there are pending migrations.
|
46
|
+
config.active_record.migration_error = :page_load
|
47
|
+
|
48
|
+
# Highlight code that triggered database queries in logs.
|
49
|
+
config.active_record.verbose_query_logs = true
|
50
|
+
|
51
|
+
|
52
|
+
# Raises error for missing translations.
|
53
|
+
# config.i18n.raise_on_missing_translations = true
|
54
|
+
|
55
|
+
# Annotate rendered view with file names.
|
56
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
57
|
+
|
58
|
+
# Uncomment if you wish to allow Action Cable access from any origin.
|
59
|
+
# config.action_cable.disable_request_forgery_protection = true
|
60
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
3
|
+
Rails.application.configure do
|
4
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
+
|
6
|
+
# Code is not reloaded between requests.
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Eager load code on boot. This eager loads most of Rails and
|
10
|
+
# your application in memory, allowing both threaded web servers
|
11
|
+
# and those relying on copy on write to perform better.
|
12
|
+
# Rake tasks automatically ignore this option for performance.
|
13
|
+
config.eager_load = true
|
14
|
+
|
15
|
+
# Full error reports are disabled and caching is turned on.
|
16
|
+
config.consider_all_requests_local = false
|
17
|
+
|
18
|
+
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
19
|
+
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
20
|
+
# config.require_master_key = true
|
21
|
+
|
22
|
+
# Disable serving static files from the `/public` folder by default since
|
23
|
+
# Apache or NGINX already handles this.
|
24
|
+
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
25
|
+
|
26
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
27
|
+
# config.asset_host = "http://assets.example.com"
|
28
|
+
|
29
|
+
# Specifies the header that your server uses for sending files.
|
30
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
31
|
+
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
|
32
|
+
|
33
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
34
|
+
config.active_storage.service = :local
|
35
|
+
|
36
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
37
|
+
# config.force_ssl = true
|
38
|
+
|
39
|
+
# Include generic and useful information about system operation, but avoid logging too much
|
40
|
+
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
41
|
+
config.log_level = :info
|
42
|
+
|
43
|
+
# Prepend all log lines with the following tags.
|
44
|
+
config.log_tags = [ :request_id ]
|
45
|
+
|
46
|
+
# Use a different cache store in production.
|
47
|
+
# config.cache_store = :mem_cache_store
|
48
|
+
|
49
|
+
# Use a real queuing backend for Active Job (and separate queues per environment).
|
50
|
+
# config.active_job.queue_adapter = :resque
|
51
|
+
# config.active_job.queue_name_prefix = "ranking_production"
|
52
|
+
|
53
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
54
|
+
# the I18n.default_locale when a translation cannot be found).
|
55
|
+
config.i18n.fallbacks = true
|
56
|
+
|
57
|
+
# Don't log any deprecations.
|
58
|
+
config.active_support.report_deprecations = false
|
59
|
+
|
60
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
61
|
+
config.log_formatter = ::Logger::Formatter.new
|
62
|
+
|
63
|
+
# Use a different logger for distributed setups.
|
64
|
+
# require "syslog/logger"
|
65
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
|
66
|
+
|
67
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
68
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
69
|
+
logger.formatter = config.log_formatter
|
70
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Do not dump schema after migrations.
|
74
|
+
config.active_record.dump_schema_after_migration = false
|
75
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
|
8
|
+
Rails.application.configure do
|
9
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
10
|
+
|
11
|
+
# Turn false under Spring and add config.action_view.cache_template_loading = true.
|
12
|
+
config.cache_classes = true
|
13
|
+
|
14
|
+
# Eager loading loads your whole application. When running a single test locally,
|
15
|
+
# this probably isn't necessary. It's a good idea to do in a continuous integration
|
16
|
+
# system, or in some way before deploying your code.
|
17
|
+
config.eager_load = ENV["CI"].present?
|
18
|
+
|
19
|
+
# Configure public file server for tests with Cache-Control for performance.
|
20
|
+
config.public_file_server.enabled = true
|
21
|
+
config.public_file_server.headers = {
|
22
|
+
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
|
23
|
+
}
|
24
|
+
|
25
|
+
# Show full error reports and disable caching.
|
26
|
+
config.consider_all_requests_local = true
|
27
|
+
config.action_controller.perform_caching = false
|
28
|
+
config.cache_store = :null_store
|
29
|
+
|
30
|
+
# Raise exceptions instead of rendering exception templates.
|
31
|
+
config.action_dispatch.show_exceptions = false
|
32
|
+
|
33
|
+
# Disable request forgery protection in test environment.
|
34
|
+
config.action_controller.allow_forgery_protection = false
|
35
|
+
|
36
|
+
# Store uploaded files on the local file system in a temporary directory.
|
37
|
+
config.active_storage.service = :test
|
38
|
+
|
39
|
+
# Print deprecation notices to the stderr.
|
40
|
+
config.active_support.deprecation = :stderr
|
41
|
+
|
42
|
+
# Raise exceptions for disallowed deprecations.
|
43
|
+
config.active_support.disallowed_deprecation = :raise
|
44
|
+
|
45
|
+
# Tell Active Support which deprecation messages to disallow.
|
46
|
+
config.active_support.disallowed_deprecation_warnings = []
|
47
|
+
|
48
|
+
# Raises error for missing translations.
|
49
|
+
# config.i18n.raise_on_missing_translations = true
|
50
|
+
|
51
|
+
# Annotate rendered view with file names.
|
52
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
53
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Avoid CORS issues when API is called from the frontend app.
|
4
|
+
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
|
5
|
+
|
6
|
+
# Read more: https://github.com/cyu/rack-cors
|
7
|
+
|
8
|
+
# Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
9
|
+
# allow do
|
10
|
+
# origins "example.com"
|
11
|
+
#
|
12
|
+
# resource "*",
|
13
|
+
# headers: :any,
|
14
|
+
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
|
15
|
+
# end
|
16
|
+
# end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
|
4
|
+
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
|
5
|
+
# notations and behaviors.
|
6
|
+
Rails.application.config.filter_parameters += [
|
7
|
+
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
8
|
+
]
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, "\\1en"
|
8
|
+
# inflect.singular /^(ox)en/i, "\\1"
|
9
|
+
# inflect.irregular "person", "people"
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym "RESTful"
|
16
|
+
# end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t "hello"
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t("hello") %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# The following keys must be escaped otherwise they will not be retrieved by
|
20
|
+
# the default I18n backend:
|
21
|
+
#
|
22
|
+
# true, false, on, off, yes, no
|
23
|
+
#
|
24
|
+
# Instead, surround them with single quotes.
|
25
|
+
#
|
26
|
+
# en:
|
27
|
+
# "true": "foo"
|
28
|
+
#
|
29
|
+
# To learn more, please read the Rails Internationalization guide
|
30
|
+
# available at https://guides.rubyonrails.org/i18n.html.
|
31
|
+
|
32
|
+
en:
|
33
|
+
hello: "Hello world"
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Puma can serve each request in a thread from an internal thread pool.
|
2
|
+
# The `threads` method setting takes two numbers: a minimum and maximum.
|
3
|
+
# Any libraries that use thread pools should be configured to match
|
4
|
+
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
5
|
+
# and maximum; this matches the default thread size of Active Record.
|
6
|
+
#
|
7
|
+
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
8
|
+
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
|
9
|
+
threads min_threads_count, max_threads_count
|
10
|
+
|
11
|
+
# Specifies the `worker_timeout` threshold that Puma will use to wait before
|
12
|
+
# terminating a worker in development environments.
|
13
|
+
#
|
14
|
+
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
|
15
|
+
|
16
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
17
|
+
#
|
18
|
+
port ENV.fetch("PORT") { 3000 }
|
19
|
+
|
20
|
+
# Specifies the `environment` that Puma will run in.
|
21
|
+
#
|
22
|
+
environment ENV.fetch("RAILS_ENV") { "development" }
|
23
|
+
|
24
|
+
# Specifies the `pidfile` that Puma will use.
|
25
|
+
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
|
26
|
+
|
27
|
+
# Specifies the number of `workers` to boot in clustered mode.
|
28
|
+
# Workers are forked web server processes. If using threads and workers together
|
29
|
+
# the concurrency of the application would be max `threads` * `workers`.
|
30
|
+
# Workers do not work on JRuby or Windows (both of which do not support
|
31
|
+
# processes).
|
32
|
+
#
|
33
|
+
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
34
|
+
|
35
|
+
# Use the `preload_app!` method when specifying a `workers` number.
|
36
|
+
# This directive tells Puma to first boot the application and load code
|
37
|
+
# before forking the application. This takes advantage of Copy On Write
|
38
|
+
# process behavior so workers use less memory.
|
39
|
+
#
|
40
|
+
# preload_app!
|
41
|
+
|
42
|
+
# Allow puma to be restarted by `bin/rails restart` command.
|
43
|
+
plugin :tmp_restart
|