mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Upgraded to rails 8.0.2, moved from dalli to solid cache, moved from delayed_job to solid queue, and add solid cable. deploy/rails-dev-run.sh no longer needs to chmod. Fixed finished_at callback for matches. Migrated from Devise to built in rails auth. Added view tests for the bracket page testing that all bout numbers render for all matches in each bracket type.
This commit is contained in:
38
Gemfile
38
Gemfile
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
|
|||||||
|
|
||||||
ruby '3.2.0'
|
ruby '3.2.0'
|
||||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||||
gem 'rails', '7.2.2'
|
gem 'rails', '8.0.2'
|
||||||
|
|
||||||
# Added in rails 7.1
|
# Added in rails 7.1
|
||||||
gem 'rails-html-sanitizer'
|
gem 'rails-html-sanitizer'
|
||||||
@@ -10,9 +10,12 @@ gem 'rails-html-sanitizer'
|
|||||||
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
|
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
|
||||||
gem "sprockets-rails"
|
gem "sprockets-rails"
|
||||||
|
|
||||||
|
# Reduces boot times through caching; required in config/boot.rb
|
||||||
|
gem "bootsnap", require: false
|
||||||
|
|
||||||
# Use sqlite3 as the database for Active Record
|
# Use sqlite3 as the database for Active Record
|
||||||
# can't use 2.0 maybe in a future rails upgrade?
|
# Use sqlite3 version compatible with Rails 8
|
||||||
gem 'sqlite3', "~> 1.4", :group => :development
|
gem 'sqlite3', ">= 2.1", :group => :development
|
||||||
|
|
||||||
# Use Uglifier as compressor for JavaScript assets
|
# Use Uglifier as compressor for JavaScript assets
|
||||||
gem 'uglifier'
|
gem 'uglifier'
|
||||||
@@ -34,7 +37,7 @@ gem 'sdoc', :group => :doc
|
|||||||
gem 'spring', :group => :development
|
gem 'spring', :group => :development
|
||||||
|
|
||||||
# Use ActiveModel has_secure_password
|
# Use ActiveModel has_secure_password
|
||||||
# gem 'bcrypt', '~> 3.1.7'
|
gem 'bcrypt', '~> 3.1.7'
|
||||||
|
|
||||||
# Use unicorn as the app server
|
# Use unicorn as the app server
|
||||||
# gem 'unicorn'
|
# gem 'unicorn'
|
||||||
@@ -49,20 +52,31 @@ gem 'spring', :group => :development
|
|||||||
group :production do
|
group :production do
|
||||||
gem 'rails_12factor'
|
gem 'rails_12factor'
|
||||||
gem 'mysql2'
|
gem 'mysql2'
|
||||||
gem 'dalli'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
gem 'solid_cache'
|
||||||
|
|
||||||
gem 'influxdb-rails'
|
gem 'influxdb-rails'
|
||||||
gem 'devise'
|
# Authentication
|
||||||
|
# gem 'devise' # Removed - replaced with Rails built-in authentication
|
||||||
|
|
||||||
|
# Role Management
|
||||||
gem 'cancancan'
|
gem 'cancancan'
|
||||||
gem 'round_robin_tournament'
|
gem 'round_robin_tournament'
|
||||||
gem 'rb-readline'
|
gem 'rb-readline'
|
||||||
gem 'delayed_job_active_record'
|
# Replacing Delayed Job with Solid Queue
|
||||||
|
# gem 'delayed_job_active_record'
|
||||||
|
gem 'solid_queue'
|
||||||
|
gem 'solid_cable'
|
||||||
gem 'puma'
|
gem 'puma'
|
||||||
gem 'passenger'
|
gem 'passenger'
|
||||||
gem 'tzinfo-data'
|
gem 'tzinfo-data'
|
||||||
gem 'daemons'
|
gem 'daemons'
|
||||||
gem 'delayed_job_web'
|
# Interface for viewing and managing background jobs
|
||||||
|
# gem 'delayed_job_web'
|
||||||
|
# Note: solid_queue-ui is not compatible with Rails 8.0 yet
|
||||||
|
# We'll create a custom UI or wait for compatibility updates
|
||||||
|
# gem 'solid_queue_ui', '~> 0.1.1'
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
# gem 'rubocop'
|
# gem 'rubocop'
|
||||||
@@ -71,3 +85,11 @@ group :development do
|
|||||||
gem 'bundler-audit'
|
gem 'bundler-audit'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
group :development, :test do
|
||||||
|
gem 'mocha'
|
||||||
|
# rails-controller-testing is needed for assert_template
|
||||||
|
gem 'rails-controller-testing'
|
||||||
|
end
|
||||||
|
|
||||||
|
gem 'font-awesome-sass'
|
||||||
|
|
||||||
|
|||||||
275
Gemfile.lock
275
Gemfile.lock
@@ -1,66 +1,65 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actioncable (7.2.2)
|
actioncable (8.0.2)
|
||||||
actionpack (= 7.2.2)
|
actionpack (= 8.0.2)
|
||||||
activesupport (= 7.2.2)
|
activesupport (= 8.0.2)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (>= 0.6.1)
|
websocket-driver (>= 0.6.1)
|
||||||
zeitwerk (~> 2.6)
|
zeitwerk (~> 2.6)
|
||||||
actionmailbox (7.2.2)
|
actionmailbox (8.0.2)
|
||||||
actionpack (= 7.2.2)
|
actionpack (= 8.0.2)
|
||||||
activejob (= 7.2.2)
|
activejob (= 8.0.2)
|
||||||
activerecord (= 7.2.2)
|
activerecord (= 8.0.2)
|
||||||
activestorage (= 7.2.2)
|
activestorage (= 8.0.2)
|
||||||
activesupport (= 7.2.2)
|
activesupport (= 8.0.2)
|
||||||
mail (>= 2.8.0)
|
mail (>= 2.8.0)
|
||||||
actionmailer (7.2.2)
|
actionmailer (8.0.2)
|
||||||
actionpack (= 7.2.2)
|
actionpack (= 8.0.2)
|
||||||
actionview (= 7.2.2)
|
actionview (= 8.0.2)
|
||||||
activejob (= 7.2.2)
|
activejob (= 8.0.2)
|
||||||
activesupport (= 7.2.2)
|
activesupport (= 8.0.2)
|
||||||
mail (>= 2.8.0)
|
mail (>= 2.8.0)
|
||||||
rails-dom-testing (~> 2.2)
|
rails-dom-testing (~> 2.2)
|
||||||
actionpack (7.2.2)
|
actionpack (8.0.2)
|
||||||
actionview (= 7.2.2)
|
actionview (= 8.0.2)
|
||||||
activesupport (= 7.2.2)
|
activesupport (= 8.0.2)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
racc
|
rack (>= 2.2.4)
|
||||||
rack (>= 2.2.4, < 3.2)
|
|
||||||
rack-session (>= 1.0.1)
|
rack-session (>= 1.0.1)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.2)
|
rails-dom-testing (~> 2.2)
|
||||||
rails-html-sanitizer (~> 1.6)
|
rails-html-sanitizer (~> 1.6)
|
||||||
useragent (~> 0.16)
|
useragent (~> 0.16)
|
||||||
actiontext (7.2.2)
|
actiontext (8.0.2)
|
||||||
actionpack (= 7.2.2)
|
actionpack (= 8.0.2)
|
||||||
activerecord (= 7.2.2)
|
activerecord (= 8.0.2)
|
||||||
activestorage (= 7.2.2)
|
activestorage (= 8.0.2)
|
||||||
activesupport (= 7.2.2)
|
activesupport (= 8.0.2)
|
||||||
globalid (>= 0.6.0)
|
globalid (>= 0.6.0)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
actionview (7.2.2)
|
actionview (8.0.2)
|
||||||
activesupport (= 7.2.2)
|
activesupport (= 8.0.2)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.11)
|
erubi (~> 1.11)
|
||||||
rails-dom-testing (~> 2.2)
|
rails-dom-testing (~> 2.2)
|
||||||
rails-html-sanitizer (~> 1.6)
|
rails-html-sanitizer (~> 1.6)
|
||||||
activejob (7.2.2)
|
activejob (8.0.2)
|
||||||
activesupport (= 7.2.2)
|
activesupport (= 8.0.2)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (7.2.2)
|
activemodel (8.0.2)
|
||||||
activesupport (= 7.2.2)
|
activesupport (= 8.0.2)
|
||||||
activerecord (7.2.2)
|
activerecord (8.0.2)
|
||||||
activemodel (= 7.2.2)
|
activemodel (= 8.0.2)
|
||||||
activesupport (= 7.2.2)
|
activesupport (= 8.0.2)
|
||||||
timeout (>= 0.4.0)
|
timeout (>= 0.4.0)
|
||||||
activestorage (7.2.2)
|
activestorage (8.0.2)
|
||||||
actionpack (= 7.2.2)
|
actionpack (= 8.0.2)
|
||||||
activejob (= 7.2.2)
|
activejob (= 8.0.2)
|
||||||
activerecord (= 7.2.2)
|
activerecord (= 8.0.2)
|
||||||
activesupport (= 7.2.2)
|
activesupport (= 8.0.2)
|
||||||
marcel (~> 1.0)
|
marcel (~> 1.0)
|
||||||
activesupport (7.2.2)
|
activesupport (8.0.2)
|
||||||
base64
|
base64
|
||||||
benchmark (>= 0.3)
|
benchmark (>= 0.3)
|
||||||
bigdecimal
|
bigdecimal
|
||||||
@@ -72,14 +71,17 @@ GEM
|
|||||||
minitest (>= 5.1)
|
minitest (>= 5.1)
|
||||||
securerandom (>= 0.3)
|
securerandom (>= 0.3)
|
||||||
tzinfo (~> 2.0, >= 2.0.5)
|
tzinfo (~> 2.0, >= 2.0.5)
|
||||||
|
uri (>= 0.13.1)
|
||||||
base64 (0.2.0)
|
base64 (0.2.0)
|
||||||
bcrypt (3.1.20)
|
bcrypt (3.1.20)
|
||||||
benchmark (0.4.0)
|
benchmark (0.4.0)
|
||||||
bigdecimal (3.1.9)
|
bigdecimal (3.1.9)
|
||||||
brakeman (7.0.0)
|
bootsnap (1.18.4)
|
||||||
|
msgpack (~> 1.2)
|
||||||
|
brakeman (7.0.2)
|
||||||
racc
|
racc
|
||||||
builder (3.3.0)
|
builder (3.3.0)
|
||||||
bullet (8.0.1)
|
bullet (8.0.3)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
uniform_notifier (~> 1.11)
|
uniform_notifier (~> 1.11)
|
||||||
bundler-audit (0.9.2)
|
bundler-audit (0.9.2)
|
||||||
@@ -97,27 +99,25 @@ GEM
|
|||||||
connection_pool (2.5.0)
|
connection_pool (2.5.0)
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
daemons (1.4.1)
|
daemons (1.4.1)
|
||||||
dalli (3.2.8)
|
|
||||||
date (3.4.1)
|
date (3.4.1)
|
||||||
delayed_job (4.1.13)
|
|
||||||
activesupport (>= 3.0, < 9.0)
|
|
||||||
delayed_job_active_record (4.1.11)
|
|
||||||
activerecord (>= 3.0, < 9.0)
|
|
||||||
delayed_job (>= 3.0, < 5)
|
|
||||||
delayed_job_web (1.4.4)
|
|
||||||
activerecord (> 3.0.0)
|
|
||||||
delayed_job (> 2.0.3)
|
|
||||||
rack-protection (>= 1.5.5)
|
|
||||||
sinatra (>= 1.4.4)
|
|
||||||
devise (4.9.4)
|
|
||||||
bcrypt (~> 3.0)
|
|
||||||
orm_adapter (~> 0.1)
|
|
||||||
railties (>= 4.1.0)
|
|
||||||
responders
|
|
||||||
warden (~> 1.2.3)
|
|
||||||
drb (2.2.1)
|
drb (2.2.1)
|
||||||
erubi (1.13.1)
|
erubi (1.13.1)
|
||||||
|
et-orbi (1.2.11)
|
||||||
|
tzinfo
|
||||||
execjs (2.10.0)
|
execjs (2.10.0)
|
||||||
|
ffi (1.17.1-aarch64-linux-gnu)
|
||||||
|
ffi (1.17.1-aarch64-linux-musl)
|
||||||
|
ffi (1.17.1-arm-linux-gnu)
|
||||||
|
ffi (1.17.1-arm-linux-musl)
|
||||||
|
ffi (1.17.1-arm64-darwin)
|
||||||
|
ffi (1.17.1-x86_64-darwin)
|
||||||
|
ffi (1.17.1-x86_64-linux-gnu)
|
||||||
|
ffi (1.17.1-x86_64-linux-musl)
|
||||||
|
font-awesome-sass (6.7.2)
|
||||||
|
sassc (~> 2.0)
|
||||||
|
fugit (1.11.1)
|
||||||
|
et-orbi (~> 1, >= 1.2.11)
|
||||||
|
raabro (~> 1.4)
|
||||||
globalid (1.2.1)
|
globalid (1.2.1)
|
||||||
activesupport (>= 6.1)
|
activesupport (>= 6.1)
|
||||||
i18n (1.14.7)
|
i18n (1.14.7)
|
||||||
@@ -127,7 +127,7 @@ GEM
|
|||||||
influxdb (~> 0.6, >= 0.6.4)
|
influxdb (~> 0.6, >= 0.6.4)
|
||||||
railties (>= 5.0)
|
railties (>= 5.0)
|
||||||
io-console (0.8.0)
|
io-console (0.8.0)
|
||||||
irb (1.15.1)
|
irb (1.15.2)
|
||||||
pp (>= 0.6.0)
|
pp (>= 0.6.0)
|
||||||
rdoc (>= 4.0.0)
|
rdoc (>= 4.0.0)
|
||||||
reline (>= 0.4.2)
|
reline (>= 0.4.2)
|
||||||
@@ -138,7 +138,7 @@ GEM
|
|||||||
rails-dom-testing (>= 1, < 3)
|
rails-dom-testing (>= 1, < 3)
|
||||||
railties (>= 4.2.0)
|
railties (>= 4.2.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
logger (1.6.6)
|
logger (1.7.0)
|
||||||
loofah (2.24.0)
|
loofah (2.24.0)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.12.0)
|
nokogiri (>= 1.12.0)
|
||||||
@@ -149,10 +149,10 @@ GEM
|
|||||||
net-smtp
|
net-smtp
|
||||||
marcel (1.0.4)
|
marcel (1.0.4)
|
||||||
mini_mime (1.1.5)
|
mini_mime (1.1.5)
|
||||||
mini_portile2 (2.8.8)
|
minitest (5.25.5)
|
||||||
minitest (5.25.4)
|
mocha (2.7.1)
|
||||||
mustermann (3.0.3)
|
ruby2_keywords (>= 0.0.5)
|
||||||
ruby2_keywords (~> 0.0.1)
|
msgpack (1.8.0)
|
||||||
mysql2 (0.5.6)
|
mysql2 (0.5.6)
|
||||||
net-imap (0.5.6)
|
net-imap (0.5.6)
|
||||||
date
|
date
|
||||||
@@ -164,23 +164,25 @@ GEM
|
|||||||
net-smtp (0.5.1)
|
net-smtp (0.5.1)
|
||||||
net-protocol
|
net-protocol
|
||||||
nio4r (2.7.4)
|
nio4r (2.7.4)
|
||||||
nokogiri (1.18.3)
|
nokogiri (1.18.7-aarch64-linux-gnu)
|
||||||
mini_portile2 (~> 2.8.2)
|
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
nokogiri (1.18.3-aarch64-linux-gnu)
|
nokogiri (1.18.7-aarch64-linux-musl)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
nokogiri (1.18.3-arm-linux-gnu)
|
nokogiri (1.18.7-arm-linux-gnu)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
nokogiri (1.18.3-arm64-darwin)
|
nokogiri (1.18.7-arm-linux-musl)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
nokogiri (1.18.3-x86_64-darwin)
|
nokogiri (1.18.7-arm64-darwin)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
nokogiri (1.18.3-x86_64-linux-gnu)
|
nokogiri (1.18.7-x86_64-darwin)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
orm_adapter (0.5.0)
|
nokogiri (1.18.7-x86_64-linux-gnu)
|
||||||
passenger (6.0.26)
|
racc (~> 1.4)
|
||||||
|
nokogiri (1.18.7-x86_64-linux-musl)
|
||||||
|
racc (~> 1.4)
|
||||||
|
passenger (6.0.27)
|
||||||
rack (>= 1.6.13)
|
rack (>= 1.6.13)
|
||||||
rackup (>= 2.0.0)
|
rackup (>= 1.0.1)
|
||||||
rake (>= 12.3.3)
|
rake (>= 12.3.3)
|
||||||
pp (0.6.2)
|
pp (0.6.2)
|
||||||
prettyprint
|
prettyprint
|
||||||
@@ -190,12 +192,9 @@ GEM
|
|||||||
stringio
|
stringio
|
||||||
puma (6.6.0)
|
puma (6.6.0)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
|
raabro (1.4.0)
|
||||||
racc (1.8.1)
|
racc (1.8.1)
|
||||||
rack (3.1.12)
|
rack (3.1.12)
|
||||||
rack-protection (4.1.1)
|
|
||||||
base64 (>= 0.1.0)
|
|
||||||
logger (>= 1.6.0)
|
|
||||||
rack (>= 3.0.0, < 4)
|
|
||||||
rack-session (2.1.0)
|
rack-session (2.1.0)
|
||||||
base64 (>= 0.1.0)
|
base64 (>= 0.1.0)
|
||||||
rack (>= 3.0.0)
|
rack (>= 3.0.0)
|
||||||
@@ -203,20 +202,24 @@ GEM
|
|||||||
rack (>= 1.3)
|
rack (>= 1.3)
|
||||||
rackup (2.2.1)
|
rackup (2.2.1)
|
||||||
rack (>= 3)
|
rack (>= 3)
|
||||||
rails (7.2.2)
|
rails (8.0.2)
|
||||||
actioncable (= 7.2.2)
|
actioncable (= 8.0.2)
|
||||||
actionmailbox (= 7.2.2)
|
actionmailbox (= 8.0.2)
|
||||||
actionmailer (= 7.2.2)
|
actionmailer (= 8.0.2)
|
||||||
actionpack (= 7.2.2)
|
actionpack (= 8.0.2)
|
||||||
actiontext (= 7.2.2)
|
actiontext (= 8.0.2)
|
||||||
actionview (= 7.2.2)
|
actionview (= 8.0.2)
|
||||||
activejob (= 7.2.2)
|
activejob (= 8.0.2)
|
||||||
activemodel (= 7.2.2)
|
activemodel (= 8.0.2)
|
||||||
activerecord (= 7.2.2)
|
activerecord (= 8.0.2)
|
||||||
activestorage (= 7.2.2)
|
activestorage (= 8.0.2)
|
||||||
activesupport (= 7.2.2)
|
activesupport (= 8.0.2)
|
||||||
bundler (>= 1.15.0)
|
bundler (>= 1.15.0)
|
||||||
railties (= 7.2.2)
|
railties (= 8.0.2)
|
||||||
|
rails-controller-testing (1.0.5)
|
||||||
|
actionpack (>= 5.0.1.rc1)
|
||||||
|
actionview (>= 5.0.1.rc1)
|
||||||
|
activesupport (>= 5.0.1.rc1)
|
||||||
rails-dom-testing (2.2.0)
|
rails-dom-testing (2.2.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
minitest
|
minitest
|
||||||
@@ -229,9 +232,9 @@ GEM
|
|||||||
rails_stdout_logging
|
rails_stdout_logging
|
||||||
rails_serve_static_assets (0.0.5)
|
rails_serve_static_assets (0.0.5)
|
||||||
rails_stdout_logging (0.0.5)
|
rails_stdout_logging (0.0.5)
|
||||||
railties (7.2.2)
|
railties (8.0.2)
|
||||||
actionpack (= 7.2.2)
|
actionpack (= 8.0.2)
|
||||||
activesupport (= 7.2.2)
|
activesupport (= 8.0.2)
|
||||||
irb (~> 1.13)
|
irb (~> 1.13)
|
||||||
rackup (>= 1.0.0)
|
rackup (>= 1.0.0)
|
||||||
rake (>= 12.2)
|
rake (>= 12.2)
|
||||||
@@ -239,26 +242,34 @@ GEM
|
|||||||
zeitwerk (~> 2.6)
|
zeitwerk (~> 2.6)
|
||||||
rake (13.2.1)
|
rake (13.2.1)
|
||||||
rb-readline (0.5.5)
|
rb-readline (0.5.5)
|
||||||
rdoc (6.12.0)
|
rdoc (6.13.1)
|
||||||
psych (>= 4.0.0)
|
psych (>= 4.0.0)
|
||||||
reline (0.6.0)
|
reline (0.6.1)
|
||||||
io-console (~> 0.5)
|
io-console (~> 0.5)
|
||||||
responders (3.1.1)
|
|
||||||
actionpack (>= 5.2)
|
|
||||||
railties (>= 5.2)
|
|
||||||
round_robin_tournament (0.1.2)
|
round_robin_tournament (0.1.2)
|
||||||
ruby2_keywords (0.0.5)
|
ruby2_keywords (0.0.5)
|
||||||
|
sassc (2.4.0)
|
||||||
|
ffi (~> 1.9)
|
||||||
sdoc (2.6.1)
|
sdoc (2.6.1)
|
||||||
rdoc (>= 5.0)
|
rdoc (>= 5.0)
|
||||||
securerandom (0.4.1)
|
securerandom (0.4.1)
|
||||||
sinatra (4.1.1)
|
solid_cable (3.0.7)
|
||||||
logger (>= 1.6.0)
|
actioncable (>= 7.2)
|
||||||
mustermann (~> 3.0)
|
activejob (>= 7.2)
|
||||||
rack (>= 3.0.0, < 4)
|
activerecord (>= 7.2)
|
||||||
rack-protection (= 4.1.1)
|
railties (>= 7.2)
|
||||||
rack-session (>= 2.0.0, < 3)
|
solid_cache (1.0.7)
|
||||||
tilt (~> 2.0)
|
activejob (>= 7.2)
|
||||||
spring (4.2.1)
|
activerecord (>= 7.2)
|
||||||
|
railties (>= 7.2)
|
||||||
|
solid_queue (1.1.4)
|
||||||
|
activejob (>= 7.1)
|
||||||
|
activerecord (>= 7.1)
|
||||||
|
concurrent-ruby (>= 1.3.1)
|
||||||
|
fugit (~> 1.11.0)
|
||||||
|
railties (>= 7.1)
|
||||||
|
thor (~> 1.3.1)
|
||||||
|
spring (4.3.0)
|
||||||
sprockets (4.2.1)
|
sprockets (4.2.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (>= 2.2.4, < 4)
|
rack (>= 2.2.4, < 4)
|
||||||
@@ -266,29 +277,29 @@ GEM
|
|||||||
actionpack (>= 6.1)
|
actionpack (>= 6.1)
|
||||||
activesupport (>= 6.1)
|
activesupport (>= 6.1)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
sqlite3 (1.7.3-aarch64-linux)
|
sqlite3 (2.6.0-aarch64-linux-gnu)
|
||||||
sqlite3 (1.7.3-arm-linux)
|
sqlite3 (2.6.0-aarch64-linux-musl)
|
||||||
sqlite3 (1.7.3-arm64-darwin)
|
sqlite3 (2.6.0-arm-linux-gnu)
|
||||||
sqlite3 (1.7.3-x86-linux)
|
sqlite3 (2.6.0-arm-linux-musl)
|
||||||
sqlite3 (1.7.3-x86_64-darwin)
|
sqlite3 (2.6.0-arm64-darwin)
|
||||||
sqlite3 (1.7.3-x86_64-linux)
|
sqlite3 (2.6.0-x86_64-darwin)
|
||||||
stringio (3.1.5)
|
sqlite3 (2.6.0-x86_64-linux-gnu)
|
||||||
|
sqlite3 (2.6.0-x86_64-linux-musl)
|
||||||
|
stringio (3.1.6)
|
||||||
thor (1.3.2)
|
thor (1.3.2)
|
||||||
tilt (2.6.0)
|
|
||||||
timeout (0.4.3)
|
timeout (0.4.3)
|
||||||
turbolinks (5.2.1)
|
turbolinks (5.2.1)
|
||||||
turbolinks-source (~> 5.2)
|
turbolinks-source (~> 5.2)
|
||||||
turbolinks-source (5.2.0)
|
turbolinks-source (5.2.0)
|
||||||
tzinfo (2.0.6)
|
tzinfo (2.0.6)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
tzinfo-data (1.2025.1)
|
tzinfo-data (1.2025.2)
|
||||||
tzinfo (>= 1.0.0)
|
tzinfo (>= 1.0.0)
|
||||||
uglifier (4.2.1)
|
uglifier (4.2.1)
|
||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
uniform_notifier (1.16.0)
|
uniform_notifier (1.16.0)
|
||||||
|
uri (1.0.3)
|
||||||
useragent (0.16.11)
|
useragent (0.16.11)
|
||||||
warden (1.2.9)
|
|
||||||
rack (>= 2.0.9)
|
|
||||||
websocket-driver (0.7.7)
|
websocket-driver (0.7.7)
|
||||||
base64
|
base64
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
@@ -296,39 +307,45 @@ GEM
|
|||||||
zeitwerk (2.7.2)
|
zeitwerk (2.7.2)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
aarch64-linux
|
aarch64-linux-gnu
|
||||||
arm-linux
|
aarch64-linux-musl
|
||||||
|
arm-linux-gnu
|
||||||
|
arm-linux-musl
|
||||||
arm64-darwin
|
arm64-darwin
|
||||||
x86-linux
|
|
||||||
x86_64-darwin
|
x86_64-darwin
|
||||||
x86_64-linux
|
x86_64-linux-gnu
|
||||||
|
x86_64-linux-musl
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
bcrypt (~> 3.1.7)
|
||||||
|
bootsnap
|
||||||
brakeman
|
brakeman
|
||||||
bullet
|
bullet
|
||||||
bundler-audit
|
bundler-audit
|
||||||
cancancan
|
cancancan
|
||||||
coffee-rails
|
coffee-rails
|
||||||
daemons
|
daemons
|
||||||
dalli
|
font-awesome-sass
|
||||||
delayed_job_active_record
|
|
||||||
delayed_job_web
|
|
||||||
devise
|
|
||||||
influxdb-rails
|
influxdb-rails
|
||||||
jbuilder
|
jbuilder
|
||||||
jquery-rails
|
jquery-rails
|
||||||
|
mocha
|
||||||
mysql2
|
mysql2
|
||||||
passenger
|
passenger
|
||||||
puma
|
puma
|
||||||
rails (= 7.2.2)
|
rails (= 8.0.2)
|
||||||
|
rails-controller-testing
|
||||||
rails-html-sanitizer
|
rails-html-sanitizer
|
||||||
rails_12factor
|
rails_12factor
|
||||||
rb-readline
|
rb-readline
|
||||||
round_robin_tournament
|
round_robin_tournament
|
||||||
sdoc
|
sdoc
|
||||||
|
solid_cable
|
||||||
|
solid_cache
|
||||||
|
solid_queue
|
||||||
spring
|
spring
|
||||||
sprockets-rails
|
sprockets-rails
|
||||||
sqlite3 (~> 1.4)
|
sqlite3 (>= 2.1)
|
||||||
turbolinks
|
turbolinks
|
||||||
tzinfo-data
|
tzinfo-data
|
||||||
uglifier
|
uglifier
|
||||||
@@ -337,4 +354,4 @@ RUBY VERSION
|
|||||||
ruby 3.2.0p0
|
ruby 3.2.0p0
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.1
|
2.6.7
|
||||||
|
|||||||
173
README.md
173
README.md
@@ -1,30 +1,24 @@
|
|||||||
# README
|
# README
|
||||||
This application is being created to run a wrestling tournament.
|
This application is being created to run a wrestling tournament.
|
||||||
|
|
||||||
### Current master status
|
|
||||||
[](https://circleci.com/gh/jcwimer/wrestlingApp/tree/master)
|
|
||||||
|
|
||||||
### Current development status
|
|
||||||
[](https://circleci.com/gh/jcwimer/wrestlingApp/tree/development)
|
|
||||||
|
|
||||||
# Info
|
# Info
|
||||||
**License:** MIT License
|
**License:** MIT License
|
||||||
|
|
||||||
**Public Production Url:** [https://wrestlingdev.com](http://wrestlingdev.com)
|
**Public Production Url:** [https://wrestlingdev.com](https://wrestlingdev.com)
|
||||||
|
|
||||||
**App Info**
|
**App Info**
|
||||||
* Ruby 3.1.4
|
* Ruby 3.2.0
|
||||||
* Rails 7.1.3.2
|
* Rails 8.0.0
|
||||||
* DB mysql or mariadb
|
* DB MySQL/MariaDB
|
||||||
* Memcached
|
* Memcached
|
||||||
* Delayed Jobs
|
* Solid Queue for background job processing
|
||||||
|
|
||||||
# Development
|
# Development
|
||||||
|
|
||||||
## Develop with docker
|
## Develop with docker
|
||||||
All dependencies are wrapped in docker. Tests can be run with `bash bin/run-tests-with-docker.sh`. That is the same command used in CI.
|
All dependencies are wrapped in docker. Tests can be run with `bash bin/run-tests-with-docker.sh`. That is the same command used in CI.
|
||||||
|
|
||||||
If you want to run a full rails environment shell in docker run: `bash bin/rails-dev-run.sh wrestlingapp-dev`
|
If you want to run a full rails environment shell in docker run: `bash bin/rails-dev-run.sh wrestlingdev-dev`
|
||||||
From here, you can run the normal rails commands.
|
From here, you can run the normal rails commands.
|
||||||
|
|
||||||
Special rake tasks:
|
Special rake tasks:
|
||||||
@@ -32,7 +26,9 @@ Special rake tasks:
|
|||||||
* `rake tournament:assign_random_wins` to run locally
|
* `rake tournament:assign_random_wins` to run locally
|
||||||
* `docker-compose -f deploy/docker-compose-test.yml exec -T app rails tournament:assign_random_wins` to run on the dev server
|
* `docker-compose -f deploy/docker-compose-test.yml exec -T app rails tournament:assign_random_wins` to run on the dev server
|
||||||
|
|
||||||
To deploy a a full local version of the app `bash deploy/deploy-test.sh` (this requires docker-compose to be installed). This deploys a full version of the app. App, delayed job, memcached, and mariadb. Now, you can open [http://localhost](http://localhost). Delayed jobs are turned off in dev and everything that is a delayed job in prod just runs in browser.
|
To deploy a full local version of the app `bash deploy/deploy-test.sh` (this requires docker-compose to be installed). This deploys a full version of the app including Rails app, Solid Queue background workers, Memcached, and MariaDB. Now, you can open [http://localhost](http://localhost).
|
||||||
|
|
||||||
|
In development environments, background jobs run inline (synchronously) by default. In production and staging environments, jobs are processed asynchronously by separate worker processes.
|
||||||
|
|
||||||
To run a single test file:
|
To run a single test file:
|
||||||
1. Get a shell with ruby and rails: `bash bin/rails-dev-run.sh wrestlingdev-development`
|
1. Get a shell with ruby and rails: `bash bin/rails-dev-run.sh wrestlingdev-development`
|
||||||
@@ -43,9 +39,34 @@ To run a single test inside a file:
|
|||||||
2. `rake test TEST=test/models/match_test.rb TESTOPTS="--name='/test_Match_should_not_be_valid_if_an_incorrect_win_type_is_given/'"`
|
2. `rake test TEST=test/models/match_test.rb TESTOPTS="--name='/test_Match_should_not_be_valid_if_an_incorrect_win_type_is_given/'"`
|
||||||
|
|
||||||
## Develop with rvm
|
## Develop with rvm
|
||||||
With rvm installed, run `rvm install `
|
With rvm installed, run `rvm install ruby-3.2.0`
|
||||||
Then, `cd ../; cd wrestlingApp`. This will load the gemset file in this repo.
|
Then, `cd ../; cd wrestlingApp`. This will load the gemset file in this repo.
|
||||||
|
|
||||||
|
## Quick Rails Commands Without Local Installation
|
||||||
|
You can run one-off Rails commands without installing Rails locally by using the development Docker image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build the development image
|
||||||
|
docker build -t wrestlingdev-dev -f deploy/rails-dev-Dockerfile .
|
||||||
|
|
||||||
|
# Run a specific Rails command
|
||||||
|
docker run -it -v $(pwd):/rails wrestlingdev-dev rails db:migrate
|
||||||
|
|
||||||
|
# Run the Rails console
|
||||||
|
docker run -it -v $(pwd):/rails wrestlingdev-dev rails console
|
||||||
|
|
||||||
|
# Run a custom Rake task
|
||||||
|
docker run -it -v $(pwd):/rails wrestlingdev-dev rake jobs:create_running
|
||||||
|
```
|
||||||
|
|
||||||
|
This approach is useful for quick commands without the need to set up a full development environment. The image contains all required dependencies for the application.
|
||||||
|
|
||||||
|
For a more convenient experience with a persistent shell, use the included wrapper script:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash bin/rails-dev-run.sh wrestlingdev-dev
|
||||||
|
```
|
||||||
|
|
||||||
## Rails commands
|
## Rails commands
|
||||||
Whether you have a shell from docker or are using rvm you can now run normal rails commands:
|
Whether you have a shell from docker or are using rvm you can now run normal rails commands:
|
||||||
* `bundle config set --local without 'production'`
|
* `bundle config set --local without 'production'`
|
||||||
@@ -57,37 +78,119 @@ Whether you have a shell from docker or are using rvm you can now run normal rai
|
|||||||
* etc.
|
* etc.
|
||||||
* `rake finish_seed_tournaments` will complete all matches from the seed data. This command takes about 5 minutes to execute
|
* `rake finish_seed_tournaments` will complete all matches from the seed data. This command takes about 5 minutes to execute
|
||||||
|
|
||||||
|
## Testing Job Status
|
||||||
|
|
||||||
|
To help with testing the job status display in the UI, several rake tasks are provided:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create a test "Running" job for the first tournament
|
||||||
|
rails jobs:create_running
|
||||||
|
|
||||||
|
# Create a test "Completed" job for the first tournament
|
||||||
|
rails jobs:create_completed
|
||||||
|
|
||||||
|
# Create a test "Error" job for the first tournament
|
||||||
|
rails jobs:create_failed
|
||||||
|
```
|
||||||
|
|
||||||
|
See `SOLID_QUEUE.md` for more details about the job system.
|
||||||
|
|
||||||
## Update gems
|
## Update gems
|
||||||
|
|
||||||
1. `bash bin/rails-dev-run.sh wrestlingdev-dev` to open a contianer with a rails shell available
|
1. `bash bin/rails-dev-run.sh wrestlingdev-dev` to open a contianer with a rails shell available
|
||||||
2. `bundle config --delete without` to remove the bundle config that ignores production gems
|
2. `bundle config --delete without` to remove the bundle config that ignores production gems
|
||||||
3. `bundle update`
|
3. `bundle update`
|
||||||
|
4. `bundle config set --local without 'production'` to reset your without locally
|
||||||
|
|
||||||
Note: If updating rails, do not change the version in `Gemfile` until after you run `bash bin/run-rails-dev.sh wrestlingdev-dev`. Creating the container will fail due to a mismatch in Gemfile and Gemfile.lock.
|
Note: If updating rails, do not change the version in `Gemfile` until after you run `bash bin/rails-dev-run.sh wrestlingdev-dev`. Creating the container will fail due to a mismatch in Gemfile and Gemfile.lock.
|
||||||
Then run `rails app:update` to update rails.
|
Then run `rails app:update` to update rails.
|
||||||
|
|
||||||
# Deployment
|
# Deployment
|
||||||
|
|
||||||
The production version of this is currently deployed in Kubernetes. See [Deploying with Kubernetes](deploy/kubernetes/README.md)
|
The production version of this is currently deployed in Kubernetes. See [Deploying with Kubernetes](deploy/kubernetes/README.md)
|
||||||
|
|
||||||
**Required environment variables for deployment**
|
## Server Configuration
|
||||||
* `WRESTLINGDEV_DB_NAME=databasename`
|
|
||||||
* `WRESTLINGDEV_DB_USER=databaseusername`
|
|
||||||
* `WRESTLINGDEV_DB_PWD=databasepassword`
|
|
||||||
* `WRESTLINGDEV_DB_HOST=database.homename`
|
|
||||||
* `WRESTLINGDEV_DB_PORT=databaseport`
|
|
||||||
* `WRESTLINGDEV_DEVISE_SECRET_KEY=devise_key` can be generated with `rake secret`
|
|
||||||
* `WRESTLINGDEV_SECRET_KEY_BASE=secret_key` can be generated with `rake secret`
|
|
||||||
* `WRESTLINGDEV_EMAIL_PWD=emailpwd` Email has to be a gmail account for now.
|
|
||||||
* `WRESTLINGDEV_EMAIL=email address`
|
|
||||||
|
|
||||||
**Optional environment variables**
|
### Puma and SolidQueue
|
||||||
* `MEMCACHIER_PASSWORD=memcachier_password` needed for caching password
|
|
||||||
* `MEMCACHIER_SERVERS=memcachier_hostname:memcachier_port` needed for caching
|
The application uses an intelligent auto-scaling configuration for Puma (the web server) and SolidQueue (background job processing):
|
||||||
* `MEMCACHIER_USERNAME=memcachier_username` needed for caching
|
|
||||||
* `WRESTLINGDEV_NEW_RELIC_LICENSE_KEY=new_relic_license_key` this is only needed to use new relic
|
- **Auto Detection**: The server automatically detects available CPU cores and memory, and scales accordingly.
|
||||||
* `WRESTLINGDEV_INFLUXDB_DATABASE=influx_db_name` to send metrics to influxdb this is required
|
- **Worker Scaling**: In production, the number of Puma workers is calculated based on available memory (assuming ~400MB per worker) and CPU cores.
|
||||||
* `WRESTLINGDEV_INFLUXDB_HOST=influx_db_ip_or_hostname` to send metrics to influxdb this is required
|
- **Thread Configuration**: Each Puma worker uses 5-12 threads by default, optimized for mixed I/O and CPU workloads.
|
||||||
* `WRESTLINGDEV_INFLUXDB_PORT=influx_db_port` to send metrics to influxdb this is required
|
- **SolidQueue Integration**: When `SOLID_QUEUE_IN_PUMA=true`, background jobs run within the Puma process.
|
||||||
* `WRESTLINGDEV_INFLUXDB_USERNAME=influx_db_username` to send metrics to influxdb this is optional
|
- **Database Connection Pool**: Automatically sized based on the maximum number of threads across all workers.
|
||||||
* `WRESTLINGDEV_INFLUXDB_PASSWORD=influx_db_password` to send metrics to influxdb this is optional
|
|
||||||
|
The configuration is designed to adapt to different environments:
|
||||||
|
- Small servers: Uses fewer workers to avoid memory exhaustion
|
||||||
|
- Large servers: Scales up to utilize available CPU cores
|
||||||
|
- Development: Uses a single worker for simplicity
|
||||||
|
|
||||||
|
All of these settings can be overridden with environment variables if needed.
|
||||||
|
|
||||||
|
To see the current configuration in the logs, look for these lines on startup:
|
||||||
|
```
|
||||||
|
Puma starting with X worker(s), Y-Z threads per worker
|
||||||
|
Available system resources: X CPU(s), YMMMB RAM
|
||||||
|
SolidQueue plugin enabled in Puma
|
||||||
|
```
|
||||||
|
|
||||||
|
## Environment Variables
|
||||||
|
|
||||||
|
### Required Environment Variables
|
||||||
|
* `WRESTLINGDEV_DB_NAME` - Database name for the main application
|
||||||
|
* `WRESTLINGDEV_DB_USR` - Database username
|
||||||
|
* `WRESTLINGDEV_DB_PWD` - Database password
|
||||||
|
* `WRESTLINGDEV_DB_HOST` - Database hostname
|
||||||
|
* `WRESTLINGDEV_DB_PORT` - Database port
|
||||||
|
* `WRESTLINGDEV_DEVISE_SECRET_KEY` - Secret key for Devise (can be generated with `rake secret`)
|
||||||
|
* `WRESTLINGDEV_SECRET_KEY_BASE` - Rails application secret key (can be generated with `rake secret`)
|
||||||
|
* `WRESTLINGDEV_EMAIL` - Email address (currently must be a Gmail account)
|
||||||
|
* `WRESTLINGDEV_EMAIL_PWD` - Email password
|
||||||
|
|
||||||
|
### Optional Environment Variables
|
||||||
|
* `SOLID_QUEUE_IN_PUMA` - Set to "true" to run Solid Queue workers inside Puma (default in development)
|
||||||
|
* `WEB_CONCURRENCY` - Number of Puma workers (auto-detected based on CPU/memory if not specified)
|
||||||
|
* `RAILS_MIN_THREADS` - Minimum number of threads per Puma worker (defaults to 5)
|
||||||
|
* `RAILS_MAX_THREADS` - Maximum number of threads per Puma worker (defaults to 12)
|
||||||
|
* `DATABASE_POOL_SIZE` - Database connection pool size (auto-calculated if not specified)
|
||||||
|
* `SOLID_QUEUE_WORKERS` - Number of SolidQueue workers (auto-calculated if not specified)
|
||||||
|
* `SOLID_QUEUE_THREADS` - Number of threads per SolidQueue worker (auto-calculated if not specified)
|
||||||
|
* `PORT` - Port for Puma server to listen on (defaults to 3000)
|
||||||
|
* `RAILS_LOG_LEVEL` - Log level for Rails in production (defaults to "info")
|
||||||
|
* `PIDFILE` - PID file location for Puma
|
||||||
|
* `RAILS_SSL_TERMINATION` - Set to "true" to enable force_ssl in production (HTTPS enforcement)
|
||||||
|
* `REVERSE_PROXY_SSL_TERMINATION` - Set to "true" if the app is behind a SSL-terminating reverse proxy
|
||||||
|
* `CI` - Set in CI environments to enable eager loading in test environment
|
||||||
|
* `WRESTLINGDEV_NEW_RELIC_LICENSE_KEY` - New Relic license key for monitoring
|
||||||
|
|
||||||
|
### InfluxDB Configuration (all required if using InfluxDB)
|
||||||
|
* `WRESTLINGDEV_INFLUXDB_DATABASE` - InfluxDB database name
|
||||||
|
* `WRESTLINGDEV_INFLUXDB_HOST` - InfluxDB hostname
|
||||||
|
* `WRESTLINGDEV_INFLUXDB_PORT` - InfluxDB port
|
||||||
|
* `WRESTLINGDEV_INFLUXDB_USERNAME` - InfluxDB username (optional)
|
||||||
|
* `WRESTLINGDEV_INFLUXDB_PASSWORD` - InfluxDB password (optional)
|
||||||
|
|
||||||
|
See `SOLID_QUEUE.md` for details about the job system configuration.
|
||||||
|
|
||||||
|
# AI Assistant Note
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This section contains information specifically for AI code assistants to help understand the codebase structure:
|
||||||
|
|
||||||
|
1. Project type: Rails 8 application for managing wrestling tournaments
|
||||||
|
2. Key components:
|
||||||
|
- Database: MySQL/MariaDB in production, SQLite in development
|
||||||
|
- Background jobs: SolidQueue running in Puma (SOLID_QUEUE_IN_PUMA=true)
|
||||||
|
- Multiple databases: One each for main app, queue, cache, and cable
|
||||||
|
3. Development paths:
|
||||||
|
- Docker-based: Primary method using deploy/rails-dev-Dockerfile
|
||||||
|
- RVM-based: Alternative for local development
|
||||||
|
4. Important services:
|
||||||
|
- Tournament management (tournaments, matches, wrestlers)
|
||||||
|
- Background job processing (SolidQueue)
|
||||||
|
- User authentication (Devise)
|
||||||
|
5. Deployment: Kubernetes-based with environment variables
|
||||||
|
-->
|
||||||
|
|
||||||
|
This project provides multiple ways to develop and deploy, with Docker being the primary method.
|
||||||
288
SOLID_QUEUE.md
Normal file
288
SOLID_QUEUE.md
Normal file
@@ -0,0 +1,288 @@
|
|||||||
|
# SolidQueue, SolidCache, and SolidCable Setup
|
||||||
|
|
||||||
|
This application uses Rails 8's built-in background job processing, caching, and ActionCable features with separate dedicated databases.
|
||||||
|
|
||||||
|
## Database Configuration
|
||||||
|
|
||||||
|
We use separate databases for the main application, SolidQueue, SolidCache, and SolidCable. This ensures complete separation and avoids any conflicts or performance issues.
|
||||||
|
|
||||||
|
In `config/database.yml`, we have the following setup:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
development:
|
||||||
|
primary:
|
||||||
|
database: db/development.sqlite3
|
||||||
|
queue:
|
||||||
|
database: db/development-queue.sqlite3
|
||||||
|
cache:
|
||||||
|
database: db/development-cache.sqlite3
|
||||||
|
cable:
|
||||||
|
database: db/development-cable.sqlite3
|
||||||
|
|
||||||
|
test:
|
||||||
|
primary:
|
||||||
|
database: db/test.sqlite3
|
||||||
|
queue:
|
||||||
|
database: db/test-queue.sqlite3
|
||||||
|
cache:
|
||||||
|
database: db/test-cache.sqlite3
|
||||||
|
cable:
|
||||||
|
database: db/test-cable.sqlite3
|
||||||
|
|
||||||
|
production:
|
||||||
|
primary:
|
||||||
|
database: <%= ENV['WRESTLINGDEV_DB_NAME'] %>
|
||||||
|
queue:
|
||||||
|
database: <%= ENV['WRESTLINGDEV_DB_NAME'] %>-queue
|
||||||
|
cache:
|
||||||
|
database: <%= ENV['WRESTLINGDEV_DB_NAME'] %>-cache
|
||||||
|
cable:
|
||||||
|
database: <%= ENV['WRESTLINGDEV_DB_NAME'] %>-cable
|
||||||
|
```
|
||||||
|
|
||||||
|
## Migration Structure
|
||||||
|
|
||||||
|
Migrations for each database are stored in their respective directories:
|
||||||
|
|
||||||
|
- Main application migrations: `db/migrate/`
|
||||||
|
- SolidQueue migrations: `db/queue/migrate/`
|
||||||
|
- SolidCache migrations: `db/cache/migrate/`
|
||||||
|
- SolidCable migrations: `db/cable/migrate/`
|
||||||
|
|
||||||
|
## Running Migrations
|
||||||
|
|
||||||
|
When deploying the application, you need to run migrations for each database separately:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run main application migrations
|
||||||
|
rails db:migrate
|
||||||
|
|
||||||
|
# Run SolidQueue migrations
|
||||||
|
rails db:migrate:queue
|
||||||
|
|
||||||
|
# Run SolidCache migrations
|
||||||
|
rails db:migrate:cache
|
||||||
|
|
||||||
|
# Run SolidCable migrations
|
||||||
|
rails db:migrate:cable
|
||||||
|
```
|
||||||
|
|
||||||
|
## Environment Configuration
|
||||||
|
|
||||||
|
In the environment configuration files (`config/environments/*.rb`), we've configured the paths for migrations and set up the appropriate adapters:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
# SolidCache configuration
|
||||||
|
config.cache_store = :solid_cache_store
|
||||||
|
config.paths["db/migrate"] << "db/cache/migrate"
|
||||||
|
|
||||||
|
# SolidQueue configuration
|
||||||
|
config.active_job.queue_adapter = :solid_queue
|
||||||
|
config.paths["db/migrate"] << "db/queue/migrate"
|
||||||
|
|
||||||
|
# ActionCable configuration
|
||||||
|
config.paths["db/migrate"] << "db/cable/migrate"
|
||||||
|
```
|
||||||
|
|
||||||
|
The database connections are configured in their respective YAML files:
|
||||||
|
|
||||||
|
### config/cache.yml
|
||||||
|
```yaml
|
||||||
|
production:
|
||||||
|
database: cache
|
||||||
|
# other options...
|
||||||
|
```
|
||||||
|
|
||||||
|
### config/queue.yml
|
||||||
|
```yaml
|
||||||
|
production:
|
||||||
|
database: queue
|
||||||
|
# other options...
|
||||||
|
```
|
||||||
|
|
||||||
|
### config/cable.yml
|
||||||
|
```yaml
|
||||||
|
production:
|
||||||
|
adapter: solid_cable
|
||||||
|
database: cable
|
||||||
|
# other options...
|
||||||
|
```
|
||||||
|
|
||||||
|
## SolidQueue Configuration
|
||||||
|
|
||||||
|
SolidQueue is used for background job processing in all environments except test. The application is configured to run jobs as follows:
|
||||||
|
|
||||||
|
### Development and Production
|
||||||
|
In both development and production environments, SolidQueue is configured to process jobs asynchronously. This provides consistent behavior across environments while maintaining performance.
|
||||||
|
|
||||||
|
### Test
|
||||||
|
In the test environment only, jobs are executed synchronously using the inline adapter. This makes testing more predictable and avoids the need for separate worker processes during tests.
|
||||||
|
|
||||||
|
Configuration is in `config/initializers/solid_queue.rb`:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
# Configure ActiveJob queue adapter based on environment
|
||||||
|
if Rails.env.test?
|
||||||
|
# In test, use inline adapter for simplicity and predictability
|
||||||
|
Rails.application.config.active_job.queue_adapter = :inline
|
||||||
|
else
|
||||||
|
# In development and production, use solid_queue with async execution
|
||||||
|
Rails.application.config.active_job.queue_adapter = :solid_queue
|
||||||
|
|
||||||
|
# Configure for regular async processing
|
||||||
|
Rails.application.config.active_job.queue_adapter_options = {
|
||||||
|
execution_mode: :async,
|
||||||
|
logger: Rails.logger
|
||||||
|
}
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running with Puma
|
||||||
|
|
||||||
|
By default, the application is configured to run SolidQueue workers within the Puma processes. This is done by setting the `SOLID_QUEUE_IN_PUMA` environment variable to `true` in the production Dockerfile, which enables the Puma plugin for SolidQueue.
|
||||||
|
|
||||||
|
This means you don't need to run separate worker processes in production - the same Puma processes that handle web requests also handle background jobs. This simplifies deployment and reduces resource requirements.
|
||||||
|
|
||||||
|
The application uses an intelligent auto-scaling configuration for SolidQueue when running in Puma:
|
||||||
|
|
||||||
|
1. **Auto Detection**: The Puma configuration automatically detects available CPU cores and memory
|
||||||
|
2. **Worker Scaling**: Puma workers are calculated based on available memory and CPU cores
|
||||||
|
3. **SolidQueue Integration**: When enabled, SolidQueue simply runs within the Puma process
|
||||||
|
|
||||||
|
You can enable SolidQueue in Puma by setting:
|
||||||
|
```bash
|
||||||
|
SOLID_QUEUE_IN_PUMA=true
|
||||||
|
```
|
||||||
|
|
||||||
|
In `config/puma.rb`:
|
||||||
|
```ruby
|
||||||
|
# Run the Solid Queue supervisor inside of Puma for single-server deployments
|
||||||
|
if ENV["SOLID_QUEUE_IN_PUMA"] == "true" && !Rails.env.test?
|
||||||
|
# Simply load the SolidQueue plugin with default settings
|
||||||
|
plugin :solid_queue
|
||||||
|
|
||||||
|
# Log that SolidQueue is enabled
|
||||||
|
puts "SolidQueue plugin enabled in Puma"
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
On startup, you'll see a log message confirming that SolidQueue is enabled in Puma.
|
||||||
|
|
||||||
|
## Job Owner Tracking
|
||||||
|
|
||||||
|
Jobs in this application include metadata about their owner (typically a tournament) to allow tracking and displaying job status to tournament directors. Each job includes:
|
||||||
|
|
||||||
|
- `job_owner_id`: Usually the tournament ID
|
||||||
|
- `job_owner_type`: A description of the job (e.g., "Create a backup")
|
||||||
|
|
||||||
|
This information is serialized with the job and can be used to filter and display jobs on tournament pages.
|
||||||
|
|
||||||
|
## Job Pattern: Simplified Job Enqueuing
|
||||||
|
|
||||||
|
Our job classes follow a simplified pattern that works consistently across all environments:
|
||||||
|
|
||||||
|
1. Service classes always use `perform_later` to enqueue jobs
|
||||||
|
2. The execution mode is determined centrally by the ActiveJob adapter configuration
|
||||||
|
3. Each job finds the needed records and calls the appropriate method on the service class or model
|
||||||
|
|
||||||
|
Example service class method:
|
||||||
|
```ruby
|
||||||
|
def create_backup
|
||||||
|
# Set up job owner information for tracking
|
||||||
|
job_owner_id = @tournament.id
|
||||||
|
job_owner_type = "Create a backup"
|
||||||
|
|
||||||
|
# Use perform_later which will execute based on centralized adapter config
|
||||||
|
TournamentBackupJob.perform_later(@tournament.id, @reason, job_owner_id, job_owner_type)
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
Example job class:
|
||||||
|
```ruby
|
||||||
|
class TournamentBackupJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
# For storing job owner metadata
|
||||||
|
attr_accessor :job_owner_id, :job_owner_type
|
||||||
|
|
||||||
|
# For execution via job queue with IDs
|
||||||
|
def perform(tournament_id, reason, job_owner_id = nil, job_owner_type = nil)
|
||||||
|
# Store job owner metadata
|
||||||
|
self.job_owner_id = job_owner_id
|
||||||
|
self.job_owner_type = job_owner_type
|
||||||
|
|
||||||
|
# Find the record
|
||||||
|
tournament = Tournament.find_by(id: tournament_id)
|
||||||
|
return unless tournament
|
||||||
|
|
||||||
|
# Create the service class and call the raw method
|
||||||
|
TournamentBackupService.new(tournament, reason).create_backup_raw
|
||||||
|
end
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
## Job Classes
|
||||||
|
|
||||||
|
The following job classes are available:
|
||||||
|
|
||||||
|
- `AdvanceWrestlerJob`: For advancing wrestlers in brackets
|
||||||
|
- `TournamentBackupJob`: For creating tournament backups
|
||||||
|
- `WrestlingdevImportJob`: For importing from wrestlingdev
|
||||||
|
- `GenerateTournamentMatchesJob`: For generating tournament matches
|
||||||
|
- `CalculateSchoolScoreJob`: For calculating school scores
|
||||||
|
|
||||||
|
## Job Status
|
||||||
|
|
||||||
|
Jobs in this application can have the following statuses:
|
||||||
|
|
||||||
|
1. **Running**: Job is currently being executed. This is determined by checking if a record exists in the `solid_queue_claimed_executions` table for the job.
|
||||||
|
|
||||||
|
2. **Scheduled**: Job is scheduled to run at a future time. This is determined by checking if `scheduled_at` is in the future.
|
||||||
|
|
||||||
|
3. **Error**: Job has failed. This is determined by:
|
||||||
|
- Checking if a record exists in the `solid_queue_failed_executions` table for the job
|
||||||
|
- Checking if `failed_at` is present
|
||||||
|
|
||||||
|
4. **Completed**: Job has finished successfully. This is determined by checking if `finished_at` is present and no error records exist.
|
||||||
|
|
||||||
|
5. **Pending**: Job is waiting to be picked up by a worker. This is the default status when none of the above conditions are met.
|
||||||
|
|
||||||
|
## Testing Job Status
|
||||||
|
|
||||||
|
To help with testing the job status display in the UI, several rake tasks are provided:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create a test "Running" job for the first tournament
|
||||||
|
rails jobs:create_running
|
||||||
|
|
||||||
|
# Create a test "Completed" job for the first tournament
|
||||||
|
rails jobs:create_completed
|
||||||
|
|
||||||
|
# Create a test "Error" job for the first tournament
|
||||||
|
rails jobs:create_failed
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
If you encounter issues with SolidQueue or the separate databases:
|
||||||
|
|
||||||
|
1. Make sure all databases exist:
|
||||||
|
```sql
|
||||||
|
CREATE DATABASE IF NOT EXISTS wrestlingtourney;
|
||||||
|
CREATE DATABASE IF NOT EXISTS wrestlingtourney-queue;
|
||||||
|
CREATE DATABASE IF NOT EXISTS wrestlingtourney-cache;
|
||||||
|
CREATE DATABASE IF NOT EXISTS wrestlingtourney-cable;
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Ensure all migrations have been run for each database.
|
||||||
|
|
||||||
|
3. Check that environment configurations properly connect to the right databases.
|
||||||
|
|
||||||
|
4. Verify that the database user has appropriate permissions for all databases.
|
||||||
|
|
||||||
|
5. If jobs aren't processing in production, check that `SOLID_QUEUE_IN_PUMA` is set to `true` in your environment.
|
||||||
|
|
||||||
|
## References
|
||||||
|
|
||||||
|
- [SolidQueue README](https://github.com/rails/solid_queue)
|
||||||
|
- [Rails Multiple Database Configuration](https://guides.rubyonrails.org/active_record_multiple_databases.html)
|
||||||
@@ -5,6 +5,21 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
after_action :set_csrf_cookie_for_ng
|
after_action :set_csrf_cookie_for_ng
|
||||||
|
|
||||||
|
# Add helpers for authentication (replacing Devise)
|
||||||
|
helper_method :current_user, :user_signed_in?
|
||||||
|
|
||||||
|
def current_user
|
||||||
|
@current_user ||= User.find_by(id: session[:user_id]) if session[:user_id]
|
||||||
|
end
|
||||||
|
|
||||||
|
def user_signed_in?
|
||||||
|
current_user.present?
|
||||||
|
end
|
||||||
|
|
||||||
|
def authenticate_user!
|
||||||
|
redirect_to login_path, alert: "Please log in to access this page" unless user_signed_in?
|
||||||
|
end
|
||||||
|
|
||||||
def set_csrf_cookie_for_ng
|
def set_csrf_cookie_for_ng
|
||||||
cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?
|
cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class MatAssignmentRulesController < ApplicationController
|
class MatAssignmentRulesController < ApplicationController
|
||||||
before_action :set_tournament
|
before_action :set_tournament
|
||||||
before_action :check_access_manage
|
before_action :check_access_manage
|
||||||
before_action :set_mat_assignment_rule, only: [:edit, :update, :show, :destroy]
|
before_action :set_mat_assignment_rule, only: [:edit, :update, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@mat_assignment_rules = @tournament.mat_assignment_rules
|
@mat_assignment_rules = @tournament.mat_assignment_rules
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class MatchesController < ApplicationController
|
class MatchesController < ApplicationController
|
||||||
before_action :set_match, only: [:show, :edit, :update, :destroy, :stat]
|
before_action :set_match, only: [:show, :edit, :update, :stat]
|
||||||
before_action :check_access, only: [:edit,:update, :stat]
|
before_action :check_access, only: [:edit,:update, :stat]
|
||||||
|
|
||||||
# GET /matches/1
|
# GET /matches/1
|
||||||
|
|||||||
57
app/controllers/password_resets_controller.rb
Normal file
57
app/controllers/password_resets_controller.rb
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
class PasswordResetsController < ApplicationController
|
||||||
|
before_action :get_user, only: [:edit, :update]
|
||||||
|
before_action :valid_user, only: [:edit, :update]
|
||||||
|
before_action :check_expiration, only: [:edit, :update]
|
||||||
|
|
||||||
|
def new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@user = User.find_by(email: params[:password_reset][:email].downcase)
|
||||||
|
if @user
|
||||||
|
@user.create_reset_digest
|
||||||
|
@user.send_password_reset_email
|
||||||
|
redirect_to root_url, notice: "Email sent with password reset instructions"
|
||||||
|
else
|
||||||
|
flash.now[:alert] = "Email address not found"
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
if params[:user][:password].empty?
|
||||||
|
@user.errors.add(:password, "can't be empty")
|
||||||
|
render 'edit'
|
||||||
|
elsif @user.update(user_params)
|
||||||
|
session[:user_id] = @user.id
|
||||||
|
redirect_to root_url, notice: "Password has been reset"
|
||||||
|
else
|
||||||
|
render 'edit'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def user_params
|
||||||
|
params.require(:user).permit(:password, :password_confirmation)
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_user
|
||||||
|
@user = User.find_by(email: params[:email])
|
||||||
|
end
|
||||||
|
|
||||||
|
def valid_user
|
||||||
|
unless @user && @user.authenticated?(:reset, params[:id])
|
||||||
|
redirect_to root_url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_expiration
|
||||||
|
if @user.password_reset_expired?
|
||||||
|
redirect_to new_password_reset_url, alert: "Password reset has expired"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
20
app/controllers/sessions_controller.rb
Normal file
20
app/controllers/sessions_controller.rb
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
class SessionsController < ApplicationController
|
||||||
|
def new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
user = User.find_by(email: params[:session][:email].downcase)
|
||||||
|
if user && user.authenticate(params[:session][:password])
|
||||||
|
session[:user_id] = user.id
|
||||||
|
redirect_to root_path, notice: "Logged in successfully"
|
||||||
|
else
|
||||||
|
flash.now[:alert] = "Invalid email/password combination"
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
session.delete(:user_id)
|
||||||
|
redirect_to root_path, notice: "Logged out successfully"
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class TournamentsController < ApplicationController
|
class TournamentsController < ApplicationController
|
||||||
before_action :set_tournament, only: [:all_results, :delete_school_keys, :generate_school_keys,:reset_bout_board,:calculate_team_scores,:bout_sheets,:swap,:weigh_in_sheet,:error,:teampointadjust,:remove_teampointadjust,:remove_school_delegate,:remove_delegate,:school_delegate,:delegate,:matches,:weigh_in,:weigh_in_weight,:create_custom_weights,:show,:edit,:update,:destroy,:up_matches,:no_matches,:team_scores,:brackets,:generate_matches,:bracket,:all_brackets]
|
before_action :set_tournament, only: [:all_results, :delete_school_keys, :generate_school_keys,:reset_bout_board,:calculate_team_scores,:bout_sheets,:swap,:weigh_in_sheet,:error,:teampointadjust,:remove_teampointadjust,:remove_school_delegate,:remove_delegate,:school_delegate,:delegate,:matches,:weigh_in,:weigh_in_weight,:create_custom_weights,:show,:edit,:update,:destroy,:up_matches,:no_matches,:team_scores,:generate_matches,:bracket,:all_brackets]
|
||||||
before_action :check_access_manage, only: [:delete_school_keys, :generate_school_keys,:reset_bout_board,:calculate_team_scores,:swap,:weigh_in_sheet,:teampointadjust,:remove_teampointadjust,:remove_school_delegate,:school_delegate,:weigh_in,:weigh_in_weight,:create_custom_weights,:update,:edit,:generate_matches,:matches]
|
before_action :check_access_manage, only: [:delete_school_keys, :generate_school_keys,:reset_bout_board,:calculate_team_scores,:swap,:weigh_in_sheet,:teampointadjust,:remove_teampointadjust,:remove_school_delegate,:school_delegate,:weigh_in,:weigh_in_weight,:create_custom_weights,:update,:edit,:generate_matches,:matches]
|
||||||
before_action :check_access_destroy, only: [:destroy,:delegate,:remove_delegate]
|
before_action :check_access_destroy, only: [:destroy,:delegate,:remove_delegate]
|
||||||
before_action :check_tournament_errors, only: [:generate_matches]
|
before_action :check_tournament_errors, only: [:generate_matches]
|
||||||
@@ -229,6 +229,7 @@ class TournamentsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
@tournament = Tournament.find(params[:id])
|
||||||
@schools = @tournament.schools.includes(:delegates).sort_by{|school|school.name}
|
@schools = @tournament.schools.includes(:delegates).sort_by{|school|school.name}
|
||||||
@weights = @tournament.weights.sort_by{|x|[x.max]}
|
@weights = @tournament.weights.sort_by{|x|[x.max]}
|
||||||
@mats = @tournament.mats.sort_by{|mat|mat.name}
|
@mats = @tournament.mats.sort_by{|mat|mat.name}
|
||||||
|
|||||||
48
app/controllers/users_controller.rb
Normal file
48
app/controllers/users_controller.rb
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
class UsersController < ApplicationController
|
||||||
|
before_action :require_login, only: [:edit, :update]
|
||||||
|
before_action :correct_user, only: [:edit, :update]
|
||||||
|
|
||||||
|
def new
|
||||||
|
@user = User.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@user = User.new(user_params)
|
||||||
|
if @user.save
|
||||||
|
session[:user_id] = @user.id
|
||||||
|
redirect_to root_path, notice: "Account created successfully"
|
||||||
|
else
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@user = User.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@user = User.find(params[:id])
|
||||||
|
if @user.update(user_params)
|
||||||
|
redirect_to root_path, notice: "Account updated successfully"
|
||||||
|
else
|
||||||
|
render 'edit'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def user_params
|
||||||
|
params.require(:user).permit(:email, :password, :password_confirmation)
|
||||||
|
end
|
||||||
|
|
||||||
|
def require_login
|
||||||
|
unless current_user
|
||||||
|
redirect_to login_path, alert: "Please log in to access this page"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def correct_user
|
||||||
|
@user = User.find(params[:id])
|
||||||
|
redirect_to root_path unless current_user == @user
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
class WeightsController < ApplicationController
|
class WeightsController < ApplicationController
|
||||||
before_action :set_weight, only: [:pool_order, :show, :edit, :update, :destroy,:re_gen]
|
before_action :set_weight, only: [:pool_order, :show, :edit, :update, :destroy]
|
||||||
before_action :check_access_manage, only: [:pool_order, :new,:create,:update,:destroy,:edit, :re_gen]
|
before_action :check_access_manage, only: [:pool_order, :new,:create,:update,:destroy,:edit]
|
||||||
before_action :check_access_read, only: [:show]
|
before_action :check_access_read, only: [:show]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class WrestlersController < ApplicationController
|
class WrestlersController < ApplicationController
|
||||||
before_action :set_wrestler, only: [:show, :edit, :update, :destroy, :update_pool]
|
before_action :set_wrestler, only: [:show, :edit, :update, :destroy]
|
||||||
before_action :check_access, only: [:new, :create, :update, :destroy, :edit, :update_pool]
|
before_action :check_access, only: [:new, :create, :update, :destroy, :edit]
|
||||||
before_action :check_read_access, only: [:show]
|
before_action :check_read_access, only: [:show]
|
||||||
|
|
||||||
# GET /wrestlers/1
|
# GET /wrestlers/1
|
||||||
@@ -36,7 +36,7 @@ class WrestlersController < ApplicationController
|
|||||||
@school_permission_key = wrestler_params[:school_permission_key].presence
|
@school_permission_key = wrestler_params[:school_permission_key].presence
|
||||||
@weights = @school.tournament.weights if @school
|
@weights = @school.tournament.weights if @school
|
||||||
|
|
||||||
# Remove the key from attributes so it isn’t assigned to the model.
|
# Remove the key from attributes so it isn't assigned to the model.
|
||||||
@wrestler = Wrestler.new(wrestler_params.except(:school_permission_key))
|
@wrestler = Wrestler.new(wrestler_params.except(:school_permission_key))
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|||||||
16
app/jobs/advance_wrestler_job.rb
Normal file
16
app/jobs/advance_wrestler_job.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
class AdvanceWrestlerJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
# Class method for direct execution in test environment
|
||||||
|
def self.perform_sync(wrestler, match)
|
||||||
|
# Execute directly on provided objects
|
||||||
|
service = AdvanceWrestler.new(wrestler, match)
|
||||||
|
service.advance_raw
|
||||||
|
end
|
||||||
|
|
||||||
|
def perform(wrestler, match)
|
||||||
|
# Execute the job
|
||||||
|
service = AdvanceWrestler.new(wrestler, match)
|
||||||
|
service.advance_raw
|
||||||
|
end
|
||||||
|
end
|
||||||
7
app/jobs/application_job.rb
Normal file
7
app/jobs/application_job.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
class ApplicationJob < ActiveJob::Base
|
||||||
|
# Automatically retry jobs that encountered a deadlock
|
||||||
|
# retry_on ActiveRecord::Deadlocked
|
||||||
|
|
||||||
|
# Most jobs are safe to ignore if the underlying records are no longer available
|
||||||
|
# discard_on ActiveJob::DeserializationError
|
||||||
|
end
|
||||||
17
app/jobs/calculate_school_score_job.rb
Normal file
17
app/jobs/calculate_school_score_job.rb
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
class CalculateSchoolScoreJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
# Class method for direct execution in test environment
|
||||||
|
def self.perform_sync(school)
|
||||||
|
# Execute directly on provided objects
|
||||||
|
school.calculate_score_raw
|
||||||
|
end
|
||||||
|
|
||||||
|
def perform(school)
|
||||||
|
# Log information about the job
|
||||||
|
Rails.logger.info("Calculating score for school ##{school.id} (#{school.name})")
|
||||||
|
|
||||||
|
# Execute the calculation
|
||||||
|
school.calculate_score_raw
|
||||||
|
end
|
||||||
|
end
|
||||||
27
app/jobs/generate_tournament_matches_job.rb
Normal file
27
app/jobs/generate_tournament_matches_job.rb
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
class GenerateTournamentMatchesJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
# Class method for direct execution in test environment
|
||||||
|
def self.perform_sync(tournament)
|
||||||
|
# Execute directly on provided objects
|
||||||
|
generator = GenerateTournamentMatches.new(tournament)
|
||||||
|
generator.generate_raw
|
||||||
|
end
|
||||||
|
|
||||||
|
def perform(tournament)
|
||||||
|
# Log information about the job
|
||||||
|
Rails.logger.info("Starting tournament match generation for tournament ##{tournament.id}")
|
||||||
|
|
||||||
|
begin
|
||||||
|
# Execute the job
|
||||||
|
generator = GenerateTournamentMatches.new(tournament)
|
||||||
|
generator.generate_raw
|
||||||
|
|
||||||
|
Rails.logger.info("Completed tournament match generation for tournament ##{tournament.id}")
|
||||||
|
rescue => e
|
||||||
|
Rails.logger.error("Error generating tournament matches: #{e.message}")
|
||||||
|
Rails.logger.error(e.backtrace.join("\n"))
|
||||||
|
raise # Re-raise the error so it's properly recorded
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
19
app/jobs/tournament_backup_job.rb
Normal file
19
app/jobs/tournament_backup_job.rb
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
class TournamentBackupJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
# Class method for direct execution in test environment
|
||||||
|
def self.perform_sync(tournament, reason = nil)
|
||||||
|
# Execute directly on provided objects
|
||||||
|
service = TournamentBackupService.new(tournament, reason)
|
||||||
|
service.create_backup_raw
|
||||||
|
end
|
||||||
|
|
||||||
|
def perform(tournament, reason = nil)
|
||||||
|
# Log information about the job
|
||||||
|
Rails.logger.info("Creating backup for tournament ##{tournament.id} (#{tournament.name}), reason: #{reason || 'manual'}")
|
||||||
|
|
||||||
|
# Execute the backup
|
||||||
|
service = TournamentBackupService.new(tournament, reason)
|
||||||
|
service.create_backup_raw
|
||||||
|
end
|
||||||
|
end
|
||||||
21
app/jobs/wrestlingdev_import_job.rb
Normal file
21
app/jobs/wrestlingdev_import_job.rb
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
class WrestlingdevImportJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
# Class method for direct execution in test environment
|
||||||
|
def self.perform_sync(tournament, import_data = nil)
|
||||||
|
# Execute directly on provided objects
|
||||||
|
importer = WrestlingdevImporter.new(tournament)
|
||||||
|
importer.import_data = import_data if import_data
|
||||||
|
importer.import_raw
|
||||||
|
end
|
||||||
|
|
||||||
|
def perform(tournament, import_data = nil)
|
||||||
|
# Log information about the job
|
||||||
|
Rails.logger.info("Starting import for tournament ##{tournament.id} (#{tournament.name})")
|
||||||
|
|
||||||
|
# Execute the import
|
||||||
|
importer = WrestlingdevImporter.new(tournament)
|
||||||
|
importer.import_data = import_data if import_data
|
||||||
|
importer.import_raw
|
||||||
|
end
|
||||||
|
end
|
||||||
4
app/mailers/application_mailer.rb
Normal file
4
app/mailers/application_mailer.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
class ApplicationMailer < ActionMailer::Base
|
||||||
|
default from: ENV["WRESTLINGDEV_EMAIL"]
|
||||||
|
layout 'mailer'
|
||||||
|
end
|
||||||
11
app/mailers/user_mailer.rb
Normal file
11
app/mailers/user_mailer.rb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
class UserMailer < ApplicationMailer
|
||||||
|
# Subject can be set in your I18n file at config/locales/en.yml
|
||||||
|
# with the following lookup:
|
||||||
|
#
|
||||||
|
# en.user_mailer.password_reset.subject
|
||||||
|
#
|
||||||
|
def password_reset(user)
|
||||||
|
@user = user
|
||||||
|
mail to: user.email, subject: "Password reset"
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -6,9 +6,8 @@ class Match < ApplicationRecord
|
|||||||
has_many :schools, :through => :wrestlers
|
has_many :schools, :through => :wrestlers
|
||||||
validate :score_validation, :win_type_validation, :bracket_position_validation, :overtime_type_validation
|
validate :score_validation, :win_type_validation, :bracket_position_validation, :overtime_type_validation
|
||||||
|
|
||||||
# Callback to update finished_at when finished changes
|
# Callback to update finished_at when a match is finished
|
||||||
# for some reason saved_change_to_finished? does not work on before_save like it does for after_update
|
before_save :update_finished_at
|
||||||
before_save :update_finished_at, if: -> { will_save_change_to_attribute?(:finished) }
|
|
||||||
|
|
||||||
after_update :after_finished_actions, if: -> {
|
after_update :after_finished_actions, if: -> {
|
||||||
saved_change_to_finished? ||
|
saved_change_to_finished? ||
|
||||||
@@ -312,6 +311,12 @@ class Match < ApplicationRecord
|
|||||||
private
|
private
|
||||||
|
|
||||||
def update_finished_at
|
def update_finished_at
|
||||||
self.finished_at = finished == 1 ? Time.current.utc : nil
|
# Get the changes that will be persisted
|
||||||
|
changes = changes_to_save
|
||||||
|
|
||||||
|
# Check if finished is changing from 0 to 1 or if it's already 1 but has no timestamp
|
||||||
|
if (changes['finished'] && changes['finished'][1] == 1) || (finished == 1 && finished_at.nil?)
|
||||||
|
self.finished_at = Time.current.utc
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -36,13 +36,9 @@ class School < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def calculate_score
|
def calculate_score
|
||||||
if Rails.env.production?
|
# Use perform_later which will execute based on centralized adapter config
|
||||||
self.delay(:job_owner_id => self.tournament.id, :job_owner_type => "Calculate team score for #{self.name}").calculate_score_raw
|
CalculateSchoolScoreJob.perform_later(self)
|
||||||
else
|
end
|
||||||
calculate_score_raw
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def calculate_score_raw
|
def calculate_score_raw
|
||||||
newScore = total_points_scored_by_wrestlers - total_points_deducted
|
newScore = total_points_scored_by_wrestlers - total_points_deducted
|
||||||
|
|||||||
@@ -14,16 +14,6 @@ class Tournament < ApplicationRecord
|
|||||||
|
|
||||||
attr_accessor :import_text
|
attr_accessor :import_text
|
||||||
|
|
||||||
def deferred_jobs
|
|
||||||
Delayed::Job.where(job_owner_id: self.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def clear_errored_deferred_jobs
|
|
||||||
Delayed::Job.where(job_owner_id: self.id, last_error: ! nil).each do |job|
|
|
||||||
job.destroy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.search_date_name(pattern)
|
def self.search_date_name(pattern)
|
||||||
if pattern.blank? # blank? covers both nil and empty string
|
if pattern.blank? # blank? covers both nil and empty string
|
||||||
all
|
all
|
||||||
@@ -87,11 +77,8 @@ class Tournament < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def total_rounds
|
def total_rounds
|
||||||
if self.matches.count > 0
|
# Assuming this is line 147 that's causing the error
|
||||||
self.matches.sort_by{|m| m.round}.last.round
|
matches.maximum(:round) || 0 # Return 0 if no matches or max round is nil
|
||||||
else
|
|
||||||
0
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def assign_mats(mats_to_assign)
|
def assign_mats(mats_to_assign)
|
||||||
@@ -260,4 +247,25 @@ class Tournament < ApplicationRecord
|
|||||||
TournamentBackupService.new(self, "Manual backup").create_backup
|
TournamentBackupService.new(self, "Manual backup").create_backup
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def confirm_all_weights_have_original_seeds
|
||||||
|
error_string = wrestlers_with_higher_seed_than_bracket_size_error
|
||||||
|
error_string += wrestlers_with_duplicate_original_seed_error
|
||||||
|
error_string += wrestlers_with_out_of_order_seed_error
|
||||||
|
|
||||||
|
return error_string.blank?
|
||||||
|
end
|
||||||
|
|
||||||
|
def confirm_each_weight_class_has_correct_number_of_wrestlers
|
||||||
|
error_string = pool_to_bracket_number_of_wrestlers_error
|
||||||
|
error_string += modified_sixteen_man_number_of_wrestlers_error
|
||||||
|
error_string += double_elim_number_of_wrestlers_error
|
||||||
|
|
||||||
|
return error_string.blank?
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def connection_adapter
|
||||||
|
ActiveRecord::Base.connection.adapter_name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@@ -1,12 +1,56 @@
|
|||||||
class User < ApplicationRecord
|
class User < ApplicationRecord
|
||||||
|
attr_accessor :reset_token
|
||||||
|
|
||||||
# Include default devise modules. Others available are:
|
# Include default devise modules. Others available are:
|
||||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||||
has_many :tournaments
|
has_many :tournaments
|
||||||
has_many :delegated_tournament_permissions, class_name: "TournamentDelegate"
|
has_many :delegated_tournament_permissions, class_name: "TournamentDelegate"
|
||||||
has_many :delegated_school_permissions, class_name: "SchoolDelegate"
|
has_many :delegated_school_permissions, class_name: "SchoolDelegate"
|
||||||
|
|
||||||
devise :database_authenticatable, :registerable,
|
# Replace Devise with has_secure_password
|
||||||
:recoverable, :rememberable, :trackable, :validatable
|
has_secure_password
|
||||||
|
|
||||||
|
# Add validations that were handled by Devise
|
||||||
|
validates :email, presence: true, uniqueness: { case_sensitive: false }
|
||||||
|
validates :password, length: { minimum: 6 }, allow_nil: true
|
||||||
|
|
||||||
|
# These are the Devise modules we were using:
|
||||||
|
# devise :database_authenticatable, :registerable,
|
||||||
|
# :recoverable, :rememberable, :trackable, :validatable
|
||||||
|
|
||||||
|
# Returns the hash digest of the given string
|
||||||
|
def self.digest(string)
|
||||||
|
cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST : BCrypt::Engine.cost
|
||||||
|
BCrypt::Password.create(string, cost: cost)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns a random token
|
||||||
|
def self.new_token
|
||||||
|
SecureRandom.urlsafe_base64
|
||||||
|
end
|
||||||
|
|
||||||
|
# Sets the password reset attributes
|
||||||
|
def create_reset_digest
|
||||||
|
self.reset_token = User.new_token
|
||||||
|
update_columns(reset_digest: User.digest(reset_token), reset_sent_at: Time.zone.now)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Sends password reset email
|
||||||
|
def send_password_reset_email
|
||||||
|
UserMailer.password_reset(self).deliver_now
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns true if a password reset has expired
|
||||||
|
def password_reset_expired?
|
||||||
|
reset_sent_at < 2.hours.ago
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns true if the given token matches the digest
|
||||||
|
def authenticated?(attribute, token)
|
||||||
|
digest = send("#{attribute}_digest")
|
||||||
|
return false if digest.nil?
|
||||||
|
BCrypt::Password.new(digest).is_password?(token)
|
||||||
|
end
|
||||||
|
|
||||||
def delegated_tournaments
|
def delegated_tournaments
|
||||||
tournaments_delegated = []
|
tournaments_delegated = []
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
class AdvanceWrestler
|
class AdvanceWrestler
|
||||||
def initialize( wrestler, last_match )
|
def initialize(wrestler, last_match)
|
||||||
@wrestler = wrestler
|
@wrestler = wrestler
|
||||||
@tournament = @wrestler.tournament
|
@tournament = @wrestler.tournament
|
||||||
@last_match = last_match
|
@last_match = last_match
|
||||||
end
|
end
|
||||||
|
|
||||||
def advance
|
def advance
|
||||||
if Rails.env.production?
|
# Use perform_later which will execute based on centralized adapter config
|
||||||
self.delay(:job_owner_id => @tournament.id, :job_owner_type => "Advance wrestler #{@wrestler.name} in the bracket").advance_raw
|
# This will be converted to inline execution in test environment by ActiveJob
|
||||||
else
|
AdvanceWrestlerJob.perform_later(@wrestler, @last_match)
|
||||||
advance_raw
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def advance_raw
|
def advance_raw
|
||||||
@tournament.clear_errored_deferred_jobs
|
|
||||||
if @last_match && @last_match.finished?
|
if @last_match && @last_match.finished?
|
||||||
pool_to_bracket_advancement if @tournament.tournament_type == "Pool to bracket"
|
pool_to_bracket_advancement if @tournament.tournament_type == "Pool to bracket"
|
||||||
ModifiedDoubleEliminationAdvance.new(@wrestler, @last_match).bracket_advancement if @tournament.tournament_type.include? "Modified 16 Man Double Elimination"
|
ModifiedDoubleEliminationAdvance.new(@wrestler, @last_match).bracket_advancement if @tournament.tournament_type.include? "Modified 16 Man Double Elimination"
|
||||||
|
|||||||
@@ -4,11 +4,8 @@ class GenerateTournamentMatches
|
|||||||
end
|
end
|
||||||
|
|
||||||
def generate
|
def generate
|
||||||
if Rails.env.production?
|
# Use perform_later which will execute based on centralized adapter config
|
||||||
self.delay(:job_owner_id => @tournament.id, :job_owner_type => "Generate matches for all weights").generate_raw
|
GenerateTournamentMatchesJob.perform_later(@tournament)
|
||||||
else
|
|
||||||
self.generate_raw
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_raw
|
def generate_raw
|
||||||
|
|||||||
@@ -5,11 +5,8 @@ class TournamentBackupService
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_backup
|
def create_backup
|
||||||
if Rails.env.production?
|
# Use perform_later which will execute based on centralized adapter config
|
||||||
self.delay(:job_owner_id => @tournament.id, :job_owner_type => "Create a backup").create_backup_raw
|
TournamentBackupJob.perform_later(@tournament, @reason)
|
||||||
else
|
|
||||||
self.create_backup_raw
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_backup_raw
|
def create_backup_raw
|
||||||
|
|||||||
@@ -1,19 +1,24 @@
|
|||||||
class WrestlingdevImporter
|
class WrestlingdevImporter
|
||||||
|
|
||||||
##### Note, the json contains id's for each row in the tables as well as its associations
|
##### Note, the json contains id's for each row in the tables as well as its associations
|
||||||
##### this ignores those ids and uses this tournament id and then looks up associations based on name
|
##### this ignores those ids and uses this tournament id and then looks up associations based on name
|
||||||
##### and this tournament id
|
##### and this tournament id
|
||||||
def initialize(tournament, backup)
|
attr_accessor :import_data
|
||||||
|
|
||||||
|
# Support both parameter styles for backward compatibility
|
||||||
|
# Old: initialize(tournament, backup)
|
||||||
|
# New: initialize(tournament) with import_data setter
|
||||||
|
def initialize(tournament, backup = nil)
|
||||||
@tournament = tournament
|
@tournament = tournament
|
||||||
@import_data = JSON.parse(Base64.decode64(backup.backup_data))
|
|
||||||
|
# Handle the old style where backup was passed directly
|
||||||
|
if backup.present?
|
||||||
|
@import_data = JSON.parse(Base64.decode64(backup.backup_data)) rescue nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def import
|
def import
|
||||||
if Rails.env.production?
|
# Use perform_later which will execute based on centralized adapter config
|
||||||
self.delay(job_owner_id: @tournament.id, job_owner_type: "Importing a backup").import_raw
|
WrestlingdevImportJob.perform_later(@tournament, @import_data)
|
||||||
else
|
|
||||||
import_raw
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def import_raw
|
def import_raw
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
<h2>Resend confirmation instructions</h2>
|
|
||||||
|
|
||||||
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
|
|
||||||
<%= devise_error_messages! %>
|
|
||||||
|
|
||||||
<div><%= f.label :email %><br />
|
|
||||||
<%= f.email_field :email, :autofocus => true %></div>
|
|
||||||
|
|
||||||
<div><%= f.submit "Resend confirmation instructions" %></div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= render "devise/shared/links" %>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<p>Welcome <%= @email %>!</p>
|
|
||||||
|
|
||||||
<p>You can confirm your account email through the link below:</p>
|
|
||||||
|
|
||||||
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token) %></p>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<p>Hello <%= @resource.email %>!</p>
|
|
||||||
|
|
||||||
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
|
||||||
|
|
||||||
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %></p>
|
|
||||||
|
|
||||||
<p>If you didn't request this, please ignore this email.</p>
|
|
||||||
<p>Your password won't change until you access the link above and create a new one.</p>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<p>Hello <%= @resource.email %>!</p>
|
|
||||||
|
|
||||||
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
|
|
||||||
|
|
||||||
<p>Click the link below to unlock your account:</p>
|
|
||||||
|
|
||||||
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @token) %></p>
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<h2>Change your password</h2>
|
|
||||||
|
|
||||||
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
|
|
||||||
<%= devise_error_messages! %>
|
|
||||||
<%= f.hidden_field :reset_password_token %>
|
|
||||||
|
|
||||||
<div><%= f.label :password, "New password" %><br />
|
|
||||||
<%= f.password_field :password, :autofocus => true %></div>
|
|
||||||
|
|
||||||
<div><%= f.label :password_confirmation, "Confirm new password" %><br />
|
|
||||||
<%= f.password_field :password_confirmation %></div>
|
|
||||||
|
|
||||||
<div><%= f.submit "Change my password", :class=>"btn btn-success"%></div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= render "devise/shared/links" %>
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<h2>Forgot your password?</h2>
|
|
||||||
|
|
||||||
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
|
|
||||||
<%= devise_error_messages! %>
|
|
||||||
|
|
||||||
<div><%= f.label :email %><br />
|
|
||||||
<%= f.email_field :email, :autofocus => true %></div>
|
|
||||||
<br>
|
|
||||||
<div><%= f.submit "Send me reset password instructions",:class=>"btn btn-success" %></div>
|
|
||||||
<% end %>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<%= render "devise/shared/links" %>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
|
||||||
|
|
||||||
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
|
|
||||||
<%= devise_error_messages! %>
|
|
||||||
|
|
||||||
<div><%= f.label :email %><br />
|
|
||||||
<%= f.email_field :email, :autofocus => true %></div>
|
|
||||||
|
|
||||||
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
|
||||||
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
|
||||||
<%= f.password_field :password, :autocomplete => "off" %></div>
|
|
||||||
|
|
||||||
<div><%= f.label :password_confirmation %><br />
|
|
||||||
<%= f.password_field :password_confirmation %></div>
|
|
||||||
|
|
||||||
<div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
|
||||||
<%= f.password_field :current_password %></div>
|
|
||||||
<br>
|
|
||||||
<div><%= f.submit "Update",:class=>"btn btn-success" %></div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<h3>Cancel my account</h3>
|
|
||||||
|
|
||||||
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete, :class=>"btn btn-danger" %></p>
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<h2>Sign up</h2>
|
|
||||||
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
|
|
||||||
<%= devise_error_messages! %>
|
|
||||||
|
|
||||||
<div><%= f.label :email %><br />
|
|
||||||
<%= f.email_field :email, :autofocus => true %></div>
|
|
||||||
|
|
||||||
<div><%= f.label :password %><br />
|
|
||||||
<%= f.password_field :password %></div>
|
|
||||||
|
|
||||||
<div><%= f.label :password_confirmation %><br />
|
|
||||||
<%= f.password_field :password_confirmation %></div>
|
|
||||||
|
|
||||||
<div><%= f.submit "Sign up" %></div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= render "devise/shared/links" %>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<h2 class="form-signin-heading">Sign in</h2>
|
|
||||||
|
|
||||||
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
|
|
||||||
<div><%= f.label :email ,:class=>"sr-only"%><br />
|
|
||||||
<%= f.email_field :email, :autofocus => true,:class=>"form-control",:placeholder=>"Email Address" %></div>
|
|
||||||
|
|
||||||
<div><%= f.label :password,:class=>"sr-only" %><br />
|
|
||||||
<%= f.password_field :password,:class=>"form-control",:placeholder=>"Password" %></div>
|
|
||||||
|
|
||||||
<% if devise_mapping.rememberable? -%>
|
|
||||||
<div class="checkbox"><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<div><%= f.submit "Sign in" ,:class=>"btn btn-lg btn-primary btn-block" %></div>
|
|
||||||
<% end %>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<%= render "devise/shared/links" %>
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
<%- if controller_name != 'sessions' %>
|
|
||||||
<%= link_to "Sign in", new_session_path(resource_name) %><br />
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
|
||||||
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
|
||||||
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
|
||||||
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
|
||||||
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<%- if devise_mapping.omniauthable? %>
|
|
||||||
<%- resource_class.omniauth_providers.each do |provider| %>
|
|
||||||
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<h2>Resend unlock instructions</h2>
|
|
||||||
|
|
||||||
<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
|
|
||||||
<%= devise_error_messages! %>
|
|
||||||
|
|
||||||
<div><%= f.label :email %><br />
|
|
||||||
<%= f.email_field :email, :autofocus => true %></div>
|
|
||||||
|
|
||||||
<div><%= f.submit "Resend unlock instructions" %></div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= render "devise/shared/links" %>
|
|
||||||
@@ -19,13 +19,13 @@
|
|||||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><%= current_user.email %>
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><%= current_user.email %>
|
||||||
<span class="caret"></span></a>
|
<span class="caret"></span></a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><%=link_to "Log out", destroy_user_session_url ,:method => 'delete' %></li>
|
<li><%= link_to "Log out", logout_path, method: :delete %></li>
|
||||||
<li><%=link_to "Edit user", edit_user_registration_path %></li>
|
<li><%= link_to "Edit profile", edit_user_path(current_user) %></li>
|
||||||
<li><%=link_to "My tournaments and schools","/static_pages/my_tournaments" %></li>
|
<li><%= link_to "My tournaments and schools", "/static_pages/my_tournaments" %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li><%= link_to "Log In" , new_user_session_path %></li>
|
<li><%= link_to "Log In", login_path %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div><!--/.nav-collapse -->
|
</div><!--/.nav-collapse -->
|
||||||
|
|||||||
34
app/views/password_resets/edit.html.erb
Normal file
34
app/views/password_resets/edit.html.erb
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<h1>Reset password</h1>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 col-md-offset-3">
|
||||||
|
<%= form_with(model: @user, url: password_reset_path(params[:id]), local: true) do |f| %>
|
||||||
|
<% if @user.errors.any? %>
|
||||||
|
<div class="error_explanation">
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
The form contains <%= pluralize(@user.errors.count, "error") %>.
|
||||||
|
</div>
|
||||||
|
<ul>
|
||||||
|
<% @user.errors.full_messages.each do |msg| %>
|
||||||
|
<li><%= msg %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= hidden_field_tag :email, @user.email %>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :password %>
|
||||||
|
<%= f.password_field :password, class: 'form-control' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :password_confirmation, "Confirmation" %>
|
||||||
|
<%= f.password_field :password_confirmation, class: 'form-control' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= f.submit "Update password", class: "btn btn-primary" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
14
app/views/password_resets/new.html.erb
Normal file
14
app/views/password_resets/new.html.erb
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<h1>Forgot password</h1>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 col-md-offset-3">
|
||||||
|
<%= form_with(url: password_resets_path, scope: :password_reset, local: true) do |f| %>
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :email %>
|
||||||
|
<%= f.email_field :email, class: 'form-control' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= f.submit "Submit", class: "btn btn-primary" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
21
app/views/sessions/new.html.erb
Normal file
21
app/views/sessions/new.html.erb
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<h1>Log in</h1>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 col-md-offset-3">
|
||||||
|
<%= form_with(url: login_path, scope: :session, local: true) do |f| %>
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :email %>
|
||||||
|
<%= f.email_field :email, class: 'form-control' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :password %>
|
||||||
|
<%= f.password_field :password, class: 'form-control' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= f.submit "Log in", class: "btn btn-primary" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<p>New user? <%= link_to "Sign up now!", signup_path %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,6 +1,14 @@
|
|||||||
<h3>
|
<h3>
|
||||||
Info
|
Info
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
|
<% if (can? :manage, @tournament) && @tournament.curently_generating_matches == 1 %>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<strong>Match Generation In Progress</strong>
|
||||||
|
<p>Tournament bracket generation is currently running. Please refresh the page to check progress.</p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<strong>Address:</strong>
|
<strong>Address:</strong>
|
||||||
<%= @tournament.address %>
|
<%= @tournament.address %>
|
||||||
@@ -118,34 +126,4 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if can? :manage, @tournament %>
|
|
||||||
<br><br>
|
|
||||||
<h3>Background Jobs</h3>
|
|
||||||
<p>This is a list of queued or running background jobs. Match generation, bracket advancement, team score calculation, etc.</p>
|
|
||||||
<table class="table table-hover table-condensed">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Name of Job</th>
|
|
||||||
<th>Job Status</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% @tournament.deferred_jobs.each do |job| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= job.job_owner_type %></td>
|
|
||||||
<td>
|
|
||||||
<% if job.locked_at %>
|
|
||||||
Running
|
|
||||||
<% elsif job.last_error %>
|
|
||||||
Error
|
|
||||||
<% elsif job.attempts == 0 and !job.locked_at %>
|
|
||||||
Pending
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<% end %>
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|||||||
12
app/views/user_mailer/password_reset.html.erb
Normal file
12
app/views/user_mailer/password_reset.html.erb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<h1>Password reset</h1>
|
||||||
|
|
||||||
|
<p>To reset your password click the link below:</p>
|
||||||
|
|
||||||
|
<%= link_to "Reset password", edit_password_reset_url(@user.reset_token, email: @user.email) %>
|
||||||
|
|
||||||
|
<p>This link will expire in two hours.</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If you did not request your password to be reset, please ignore this email and
|
||||||
|
your password will stay as it is.
|
||||||
|
</p>
|
||||||
8
app/views/user_mailer/password_reset.text.erb
Normal file
8
app/views/user_mailer/password_reset.text.erb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
To reset your password click the link below:
|
||||||
|
|
||||||
|
<%= edit_password_reset_url(@user.reset_token, email: @user.email) %>
|
||||||
|
|
||||||
|
This link will expire in two hours.
|
||||||
|
|
||||||
|
If you did not request your password to be reset, please ignore this email and
|
||||||
|
your password will stay as it is.
|
||||||
38
app/views/users/edit.html.erb
Normal file
38
app/views/users/edit.html.erb
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<h1>Edit profile</h1>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 col-md-offset-3">
|
||||||
|
<%= form_with(model: @user, local: true) do |f| %>
|
||||||
|
<% if @user.errors.any? %>
|
||||||
|
<div class="error_explanation">
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
The form contains <%= pluralize(@user.errors.count, "error") %>.
|
||||||
|
</div>
|
||||||
|
<ul>
|
||||||
|
<% @user.errors.full_messages.each do |msg| %>
|
||||||
|
<li><%= msg %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :email %>
|
||||||
|
<%= f.email_field :email, class: 'form-control' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :password %>
|
||||||
|
<%= f.password_field :password, class: 'form-control' %>
|
||||||
|
<small class="text-muted">Leave blank if you don't want to change it</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :password_confirmation, "Confirmation" %>
|
||||||
|
<%= f.password_field :password_confirmation, class: 'form-control' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= f.submit "Save changes", class: "btn btn-primary" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
39
app/views/users/new.html.erb
Normal file
39
app/views/users/new.html.erb
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<h1>Sign up</h1>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 col-md-offset-3">
|
||||||
|
<%= form_with(model: @user, url: signup_path, local: true) do |f| %>
|
||||||
|
<% if @user.errors.any? %>
|
||||||
|
<div class="error_explanation">
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
The form contains <%= pluralize(@user.errors.count, "error") %>.
|
||||||
|
</div>
|
||||||
|
<ul>
|
||||||
|
<% @user.errors.full_messages.each do |msg| %>
|
||||||
|
<li><%= msg %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :email %>
|
||||||
|
<%= f.email_field :email, class: 'form-control' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :password %>
|
||||||
|
<%= f.password_field :password, class: 'form-control' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :password_confirmation, "Confirmation" %>
|
||||||
|
<%= f.password_field :password_confirmation, class: 'form-control' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= f.submit "Create account", class: "btn btn-primary" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<p>Already have an account? <%= link_to "Log in", login_path %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
4
bin/dev
Executable file
4
bin/dev
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
# Start Rails server with defaults
|
||||||
|
exec "bin/rails", "server", *ARGV
|
||||||
6
bin/jobs
Executable file
6
bin/jobs
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require_relative "../config/environment"
|
||||||
|
require "solid_queue/cli"
|
||||||
|
|
||||||
|
SolidQueue::Cli.start(ARGV)
|
||||||
@@ -2,14 +2,19 @@
|
|||||||
project_dir="$(dirname $( dirname $(readlink -f ${BASH_SOURCE[0]})))"
|
project_dir="$(dirname $( dirname $(readlink -f ${BASH_SOURCE[0]})))"
|
||||||
|
|
||||||
USER_ID=$(id -u ${USER})
|
USER_ID=$(id -u ${USER})
|
||||||
# Get group id for username
|
# Get group id for username - fixed to correctly retrieve numeric GID
|
||||||
GROUP_ID=$(cut -d: -f3 < <(getent group ${USER}))
|
GROUP_ID=$(id -g ${USER})
|
||||||
|
|
||||||
if [ $# != 1 ]; then
|
if [ $# != 1 ]; then
|
||||||
echo "Please enter docker image name for the rails development environment"
|
echo "Please enter docker image name for the rails development environment"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker build -t $1 -f ${project_dir}/deploy/rails-dev-Dockerfile ${project_dir}
|
docker build -t $1 -f ${project_dir}/deploy/rails-dev-Dockerfile \
|
||||||
docker run --rm -it -p 3000:3000 -v ${project_dir}:/rails $1 /bin/bash
|
--build-arg USER_ID=$USER_ID \
|
||||||
sudo chown -R ${USER_ID}:${USER_ID} ${project_dir}
|
--build-arg GROUP_ID=$GROUP_ID \
|
||||||
|
${project_dir}
|
||||||
|
|
||||||
|
docker run --rm -it -p 3000:3000 \
|
||||||
|
-v ${project_dir}:/rails \
|
||||||
|
$1 /bin/bash
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
|
|
||||||
# path to your application root.
|
|
||||||
APP_ROOT = File.expand_path("..", __dir__)
|
APP_ROOT = File.expand_path("..", __dir__)
|
||||||
|
|
||||||
def system!(*args)
|
def system!(*args)
|
||||||
@@ -14,7 +13,6 @@ FileUtils.chdir APP_ROOT do
|
|||||||
# Add necessary setup steps to this file.
|
# Add necessary setup steps to this file.
|
||||||
|
|
||||||
puts "== Installing dependencies =="
|
puts "== Installing dependencies =="
|
||||||
system! "gem install bundler --conservative"
|
|
||||||
system("bundle check") || system!("bundle install")
|
system("bundle check") || system!("bundle install")
|
||||||
|
|
||||||
# puts "\n== Copying sample files =="
|
# puts "\n== Copying sample files =="
|
||||||
@@ -28,6 +26,9 @@ FileUtils.chdir APP_ROOT do
|
|||||||
puts "\n== Removing old logs and tempfiles =="
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
system! "bin/rails log:clear tmp:clear"
|
system! "bin/rails log:clear tmp:clear"
|
||||||
|
|
||||||
puts "\n== Restarting application server =="
|
unless ARGV.include?("--skip-server")
|
||||||
system! "bin/rails restart"
|
puts "\n== Starting development server =="
|
||||||
|
STDOUT.flush # flush the output before exec(2) so that it displays
|
||||||
|
exec "bin/dev"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
5
bin/thrust
Executable file
5
bin/thrust
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
require "rubygems"
|
||||||
|
require "bundler/setup"
|
||||||
|
|
||||||
|
load Gem.bin_path("thruster", "thrust")
|
||||||
@@ -4,37 +4,56 @@ require 'rails/all'
|
|||||||
|
|
||||||
# Require the gems listed in Gemfile, including any gems
|
# Require the gems listed in Gemfile, including any gems
|
||||||
# you've limited to :test, :development, or :production.
|
# you've limited to :test, :development, or :production.
|
||||||
Bundler.require(:default, Rails.env)
|
Bundler.require(*Rails.groups)
|
||||||
|
|
||||||
module Wrestling
|
module Wrestling
|
||||||
|
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
# Settings in config/environments/* take precedence over those specified here.
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
# Application configuration should go into files in config/initializers
|
# Application configuration should go into files in config/initializers
|
||||||
# -- all .rb files in that directory are automatically loaded.
|
# -- all .rb files in that directory are automatically loaded.
|
||||||
|
|
||||||
|
|
||||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||||
# config.time_zone = 'Central Time (US & Canada)'
|
config.time_zone = 'Eastern Time (US & Canada)'
|
||||||
|
|
||||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||||
# config.i18n.default_locale = :de
|
# config.i18n.default_locale = :de
|
||||||
|
|
||||||
#gzip assets
|
# Configure schema dumping for multiple databases
|
||||||
|
config.active_record.schema_format = :ruby
|
||||||
|
config.active_record.dump_schemas = :individual
|
||||||
|
|
||||||
|
# Fix deprecation warning for to_time in Rails 8.1
|
||||||
|
config.active_support.to_time_preserves_timezone = :zone
|
||||||
|
|
||||||
|
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
||||||
|
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
||||||
|
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
||||||
|
config.autoload_lib(ignore: %w[assets tasks])
|
||||||
|
|
||||||
|
# Configuration for the application, engines, and railties goes here.
|
||||||
|
#
|
||||||
|
# These settings can be overridden in specific environments using the files
|
||||||
|
# in config/environments, which are processed later.
|
||||||
|
#
|
||||||
|
# config.time_zone = "Central Time (US & Canada)"
|
||||||
|
# config.eager_load_paths << Rails.root.join("extras")
|
||||||
|
|
||||||
|
# Restored custom settings from original application.rb
|
||||||
|
|
||||||
|
# gzip assets
|
||||||
config.middleware.use Rack::Deflater
|
config.middleware.use Rack::Deflater
|
||||||
|
|
||||||
config.active_job.queue_adapter = :delayed_job
|
config.active_job.queue_adapter = :solid_queue
|
||||||
|
|
||||||
config.to_prepare do
|
|
||||||
DeviseController.respond_to :html, :json
|
|
||||||
end
|
|
||||||
|
|
||||||
# Add all folders under app/services to the autoload paths
|
# Add all folders under app/services to the autoload paths
|
||||||
config.autoload_paths += Dir[Rails.root.join('app', 'services', '**', '*')]
|
config.autoload_paths += Dir[Rails.root.join('app', 'services', '**', '*')]
|
||||||
# config.add_autoload_paths_to_load_path = false
|
# config.add_autoload_paths_to_load_path = false
|
||||||
|
|
||||||
config.active_support.cache_format_version = 7.2
|
# Set cache format version to a value supported by Rails 8.0
|
||||||
config.load_defaults 7.2
|
# Valid values are 7.0 or 7.1
|
||||||
|
config.active_support.cache_format_version = 7.1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||||
|
|
||||||
require "bundler/setup" # Set up gems listed in the Gemfile.
|
require "bundler/setup" # Set up gems listed in the Gemfile.
|
||||||
|
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
|
||||||
|
|||||||
@@ -1,10 +1,18 @@
|
|||||||
|
# Async adapter only works within the same process, so for manually triggering cable updates from a console,
|
||||||
|
# and seeing results in the browser, you must do so from the web console (running inside the dev process),
|
||||||
|
# not a terminal started via bin/rails console! Add "console" to any action or any ERB template view
|
||||||
|
# to make the web console appear.
|
||||||
development:
|
development:
|
||||||
adapter: async
|
adapter: solid_cable
|
||||||
|
database: cable
|
||||||
|
polling_interval: 0.1.seconds
|
||||||
|
message_retention: 1.day
|
||||||
|
|
||||||
test:
|
test:
|
||||||
adapter: test
|
adapter: test
|
||||||
|
|
||||||
production:
|
production:
|
||||||
adapter: redis
|
adapter: solid_cable
|
||||||
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
|
database: cable
|
||||||
channel_prefix: wrestling_production
|
polling_interval: 0.1.seconds
|
||||||
|
message_retention: 1.day
|
||||||
18
config/cache.yml
Normal file
18
config/cache.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
default: &default
|
||||||
|
store_options:
|
||||||
|
# Cap age of oldest cache entry to fulfill retention policies
|
||||||
|
# max_age: <%= 60.days.to_i %>
|
||||||
|
max_size: <%= 256.megabytes %>
|
||||||
|
namespace: <%= Rails.env %>
|
||||||
|
|
||||||
|
development:
|
||||||
|
database: cache
|
||||||
|
<<: *default
|
||||||
|
|
||||||
|
test:
|
||||||
|
database: cache
|
||||||
|
<<: *default
|
||||||
|
|
||||||
|
production:
|
||||||
|
database: cache
|
||||||
|
<<: *default
|
||||||
@@ -3,34 +3,84 @@
|
|||||||
#
|
#
|
||||||
# Ensure the SQLite 3 gem is defined in your Gemfile
|
# Ensure the SQLite 3 gem is defined in your Gemfile
|
||||||
# gem 'sqlite3'
|
# gem 'sqlite3'
|
||||||
development:
|
|
||||||
|
default: &default
|
||||||
adapter: sqlite3
|
adapter: sqlite3
|
||||||
database: db/development.sqlite3
|
pool: <%=
|
||||||
pool: 5
|
if ENV["DATABASE_POOL_SIZE"].present?
|
||||||
|
ENV["DATABASE_POOL_SIZE"]
|
||||||
|
else
|
||||||
|
# Calculate based on max threads and estimated workers
|
||||||
|
# Default to threads*workers or at least 5 connections
|
||||||
|
max_threads = ENV.fetch("RAILS_MAX_THREADS", 12).to_i
|
||||||
|
workers = ENV.fetch("WEB_CONCURRENCY", 2).to_i
|
||||||
|
[max_threads * workers, 5].max
|
||||||
|
end
|
||||||
|
%>
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
|
|
||||||
|
development:
|
||||||
#adapter: mysql
|
primary:
|
||||||
#encoding: utf8
|
<<: *default
|
||||||
#database: wrestlingtourney
|
database: db/development.sqlite3
|
||||||
#pool: 5
|
queue:
|
||||||
#username: root
|
<<: *default
|
||||||
#password: password
|
database: db/development-queue.sqlite3
|
||||||
|
cache:
|
||||||
|
<<: *default
|
||||||
|
database: db/development-cache.sqlite3
|
||||||
|
cable:
|
||||||
|
<<: *default
|
||||||
|
database: db/development-cable.sqlite3
|
||||||
|
|
||||||
# Warning: The database defined as "test" will be erased and
|
# Warning: The database defined as "test" will be erased and
|
||||||
# re-generated from your development database when you run "rake".
|
# re-generated from your development database when you run "rake".
|
||||||
# Do not set this db to the same as development or production.
|
# Do not set this db to the same as development or production.
|
||||||
test:
|
test:
|
||||||
adapter: sqlite3
|
primary:
|
||||||
database: db/test.sqlite3
|
<<: *default
|
||||||
pool: 5
|
database: db/test.sqlite3
|
||||||
timeout: 5000
|
queue:
|
||||||
|
<<: *default
|
||||||
|
database: db/test-queue.sqlite3
|
||||||
|
cache:
|
||||||
|
<<: *default
|
||||||
|
database: db/test-cache.sqlite3
|
||||||
|
cable:
|
||||||
|
<<: *default
|
||||||
|
database: db/test-cable.sqlite3
|
||||||
|
|
||||||
production:
|
production:
|
||||||
adapter: mysql2
|
primary:
|
||||||
encoding: utf8
|
adapter: mysql2
|
||||||
database: <%= ENV['WRESTLINGDEV_DB_NAME'] %>
|
encoding: utf8
|
||||||
username: <%= ENV['WRESTLINGDEV_DB_USR'] %>
|
database: <%= ENV['WRESTLINGDEV_DB_NAME'] %>
|
||||||
password: <%= ENV['WRESTLINGDEV_DB_PWD'] %>
|
username: <%= ENV['WRESTLINGDEV_DB_USR'] %>
|
||||||
host: <%= ENV['WRESTLINGDEV_DB_HOST'] %>
|
password: <%= ENV['WRESTLINGDEV_DB_PWD'] %>
|
||||||
port: <%= ENV['WRESTLINGDEV_DB_PORT'] %>
|
host: <%= ENV['WRESTLINGDEV_DB_HOST'] %>
|
||||||
|
port: <%= ENV['WRESTLINGDEV_DB_PORT'] %>
|
||||||
|
queue:
|
||||||
|
adapter: mysql2
|
||||||
|
encoding: utf8
|
||||||
|
database: <%= ENV['WRESTLINGDEV_DB_NAME'] %>-queue
|
||||||
|
username: <%= ENV['WRESTLINGDEV_DB_USR'] %>
|
||||||
|
password: <%= ENV['WRESTLINGDEV_DB_PWD'] %>
|
||||||
|
host: <%= ENV['WRESTLINGDEV_DB_HOST'] %>
|
||||||
|
port: <%= ENV['WRESTLINGDEV_DB_PORT'] %>
|
||||||
|
cache:
|
||||||
|
adapter: mysql2
|
||||||
|
encoding: utf8
|
||||||
|
database: <%= ENV['WRESTLINGDEV_DB_NAME'] %>-cache
|
||||||
|
username: <%= ENV['WRESTLINGDEV_DB_USR'] %>
|
||||||
|
password: <%= ENV['WRESTLINGDEV_DB_PWD'] %>
|
||||||
|
host: <%= ENV['WRESTLINGDEV_DB_HOST'] %>
|
||||||
|
port: <%= ENV['WRESTLINGDEV_DB_PORT'] %>
|
||||||
|
cable:
|
||||||
|
adapter: mysql2
|
||||||
|
encoding: utf8
|
||||||
|
database: <%= ENV['WRESTLINGDEV_DB_NAME'] %>-cable
|
||||||
|
username: <%= ENV['WRESTLINGDEV_DB_USR'] %>
|
||||||
|
password: <%= ENV['WRESTLINGDEV_DB_PWD'] %>
|
||||||
|
host: <%= ENV['WRESTLINGDEV_DB_HOST'] %>
|
||||||
|
port: <%= ENV['WRESTLINGDEV_DB_PORT'] %>
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,101 @@
|
|||||||
Wrestling::Application.configure do
|
require "active_support/core_ext/integer/time"
|
||||||
|
|
||||||
|
Rails.application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# allow all hostnames
|
# allow all hostnames
|
||||||
config.hosts.clear
|
config.hosts.clear
|
||||||
|
|
||||||
# In the development environment your application's code is reloaded on
|
# Make code changes take effect immediately without server restart.
|
||||||
# every request. This slows down response time but is perfect for development
|
config.enable_reloading = true
|
||||||
# since you don't have to restart the web server when you make code changes.
|
|
||||||
config.cache_classes = false
|
|
||||||
|
|
||||||
# Do not eager load code on boot.
|
# Do not eager load code on boot.
|
||||||
config.eager_load = false
|
config.eager_load = false
|
||||||
|
|
||||||
# Show full error reports and disable caching.
|
# Show full error reports.
|
||||||
config.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
config.action_controller.perform_caching = false
|
|
||||||
|
# Enable server timing.
|
||||||
|
config.server_timing = true
|
||||||
|
|
||||||
|
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
|
||||||
|
# Run rails dev:cache to toggle Action Controller caching.
|
||||||
|
if Rails.root.join("tmp/caching-dev.txt").exist?
|
||||||
|
config.action_controller.perform_caching = true
|
||||||
|
config.action_controller.enable_fragment_cache_logging = true
|
||||||
|
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
|
||||||
|
else
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
end
|
||||||
|
|
||||||
|
# Replace the default in-process memory cache store with a durable alternative.
|
||||||
|
# Using Solid Cache with MySQL
|
||||||
|
config.cache_store = :solid_cache_store
|
||||||
|
# Don't use connects_to here since it's configured via cache.yml
|
||||||
|
# config.solid_cache.connects_to = { database: { writing: :cache } }
|
||||||
|
|
||||||
|
# Configure path for cache migrations
|
||||||
|
config.paths["db/migrate"] << "db/cache/migrate"
|
||||||
|
|
||||||
|
# Configure Solid Queue as the ActiveJob queue adapter
|
||||||
|
config.active_job.queue_adapter = :solid_queue
|
||||||
|
# Don't use connects_to here since it's configured via queue.yml
|
||||||
|
# config.solid_queue.connects_to = { database: { writing: :queue } }
|
||||||
|
|
||||||
|
# Configure path for queue migrations
|
||||||
|
config.paths["db/migrate"] << "db/queue/migrate"
|
||||||
|
|
||||||
|
# Configure ActionCable to use its own database
|
||||||
|
# Don't use connects_to here since it's configured via cable.yml
|
||||||
|
# config.action_cable.connects_to = { database: { writing: :cable } }
|
||||||
|
|
||||||
|
# Configure path for cable migrations
|
||||||
|
config.paths["db/migrate"] << "db/cable/migrate"
|
||||||
|
|
||||||
|
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||||
|
config.active_storage.service = :local
|
||||||
|
|
||||||
# Don't care if the mailer can't send.
|
# Don't care if the mailer can't send.
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Make template changes take effect immediately.
|
||||||
|
config.action_mailer.perform_caching = false
|
||||||
|
|
||||||
|
# Set localhost to be used by links generated in mailer templates.
|
||||||
|
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
|
||||||
|
|
||||||
# Print deprecation notices to the Rails logger.
|
# Print deprecation notices to the Rails logger.
|
||||||
config.active_support.deprecation = :log
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
# Raise an error on page load if there are pending migrations
|
# Raise an error on page load if there are pending migrations.
|
||||||
config.active_record.migration_error = :page_load
|
config.active_record.migration_error = :page_load
|
||||||
|
|
||||||
|
# Highlight code that triggered database queries in logs.
|
||||||
|
config.active_record.verbose_query_logs = true
|
||||||
|
|
||||||
|
# Append comments with runtime information tags to SQL queries in logs.
|
||||||
|
config.active_record.query_log_tags_enabled = true
|
||||||
|
|
||||||
|
# Highlight code that enqueued background job in logs.
|
||||||
|
config.active_job.verbose_enqueue_logs = true
|
||||||
|
|
||||||
|
# Raises error for missing translations.
|
||||||
|
# config.i18n.raise_on_missing_translations = true
|
||||||
|
|
||||||
|
# Annotate rendered view with file names.
|
||||||
|
config.action_view.annotate_rendered_view_with_filenames = true
|
||||||
|
|
||||||
|
# Uncomment if you wish to allow Action Cable access from any origin.
|
||||||
|
# config.action_cable.disable_request_forgery_protection = true
|
||||||
|
|
||||||
|
# Raise error when a before_action's only/except options reference missing actions.
|
||||||
|
config.action_controller.raise_on_missing_callback_actions = true
|
||||||
|
|
||||||
|
# Restore Bullet configuration
|
||||||
config.after_initialize do
|
config.after_initialize do
|
||||||
#Bullet.enable = true
|
#Bullet.enable = true
|
||||||
#Bullet.alert = true
|
#Bullet.alert = true
|
||||||
#Bullet.console = true
|
#Bullet.console = true
|
||||||
#Bullet.bullet_logger = true
|
#Bullet.bullet_logger = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,78 +1,118 @@
|
|||||||
Wrestling::Application.configure do
|
require "active_support/core_ext/integer/time"
|
||||||
|
|
||||||
|
Rails.application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# Code is not reloaded between requests.
|
# Code is not reloaded between requests.
|
||||||
config.cache_classes = true
|
config.enable_reloading = false
|
||||||
|
|
||||||
# Eager load code on boot. This eager loads most of Rails and
|
# Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
|
||||||
# your application in memory, allowing both thread web servers
|
|
||||||
# and those relying on copy on write to perform better.
|
|
||||||
# Rake tasks automatically ignore this option for performance.
|
|
||||||
config.eager_load = true
|
config.eager_load = true
|
||||||
|
|
||||||
# Full error reports are disabled and caching is turned on.
|
# Full error reports are disabled.
|
||||||
config.consider_all_requests_local = false
|
config.consider_all_requests_local = false
|
||||||
|
|
||||||
|
# Turn on fragment caching in view templates.
|
||||||
config.action_controller.perform_caching = true
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
# Cache assets for far-future expiry since they are all digest stamped.
|
||||||
# Add `rack-cache` to your Gemfile before enabling this.
|
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
|
||||||
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
|
||||||
# config.action_dispatch.rack_cache = true
|
|
||||||
|
|
||||||
# Specifies the header that your server uses for sending files.
|
|
||||||
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
|
||||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
|
||||||
|
|
||||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
||||||
# config.force_ssl = true
|
|
||||||
|
|
||||||
# Set to :debug to see everything in the log.
|
|
||||||
config.log_level = :info
|
|
||||||
|
|
||||||
# Prepend all log lines with the following tags.
|
|
||||||
# config.log_tags = [ :subdomain, :uuid ]
|
|
||||||
|
|
||||||
# Use a different logger for distributed setups.
|
|
||||||
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
|
||||||
|
|
||||||
# Use a different cache store in production.
|
|
||||||
# config.cache_store = :mem_cache_store
|
|
||||||
config.cache_store = :mem_cache_store,
|
|
||||||
(ENV["MEMCACHIER_SERVERS"] || "").split(","),
|
|
||||||
{:username => ENV["MEMCACHIER_USERNAME"],
|
|
||||||
:password => ENV["MEMCACHIER_PASSWORD"],
|
|
||||||
:failover => true,
|
|
||||||
:socket_timeout => 1.5,
|
|
||||||
:socket_failure_delay => 0.2
|
|
||||||
}
|
|
||||||
|
|
||||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||||
# config.action_controller.asset_host = "http://assets.example.com"
|
# config.asset_host = "http://assets.example.com"
|
||||||
|
|
||||||
# Precompile additional assets.
|
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
config.active_storage.service = :local
|
||||||
# config.assets.precompile += %w( search.js )
|
|
||||||
|
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
||||||
|
# This is needed to prevent origin errors in login
|
||||||
|
config.assume_ssl = ENV["REVERSE_PROXY_SSL_TERMINATION"] == "true"
|
||||||
|
|
||||||
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
|
# Force SSL in production when RAILS_SSL_TERMINATION is true
|
||||||
|
config.force_ssl = ENV["RAILS_SSL_TERMINATION"] == "true"
|
||||||
|
|
||||||
|
# Skip http-to-https redirect for the default health check endpoint.
|
||||||
|
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
||||||
|
|
||||||
|
# Log to STDOUT with the current request id as a default log tag.
|
||||||
|
config.log_tags = [ :request_id ]
|
||||||
|
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
|
||||||
|
|
||||||
|
# Change to "debug" to log everything (including potentially personally-identifiable information!)
|
||||||
|
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
||||||
|
|
||||||
|
# Prevent health checks from clogging up the logs.
|
||||||
|
config.silence_healthcheck_path = "/up"
|
||||||
|
|
||||||
|
# Don't log any deprecations.
|
||||||
|
config.active_support.report_deprecations = false
|
||||||
|
|
||||||
|
# Replace the default in-process memory cache store with a durable alternative.
|
||||||
|
# Using Solid Cache with MySQL
|
||||||
|
config.cache_store = :solid_cache_store
|
||||||
|
# Don't use connects_to here since it's configured via cache.yml
|
||||||
|
# config.solid_cache.connects_to = { database: { writing: :cache } }
|
||||||
|
|
||||||
|
# Configure path for cache migrations
|
||||||
|
config.paths["db/migrate"] << "db/cache/migrate"
|
||||||
|
|
||||||
|
# Replace the default in-process and non-durable queuing backend for Active Job.
|
||||||
|
config.active_job.queue_adapter = :solid_queue
|
||||||
|
# Don't use connects_to here since it's configured via queue.yml
|
||||||
|
# config.solid_queue.connects_to = { database: { writing: :queue } }
|
||||||
|
|
||||||
|
# Configure path for queue migrations
|
||||||
|
config.paths["db/migrate"] << "db/queue/migrate"
|
||||||
|
|
||||||
|
# Configure ActionCable to use its own database
|
||||||
|
# Don't use connects_to here since it's configured via cable.yml
|
||||||
|
# config.action_cable.connects_to = { database: { writing: :cable } }
|
||||||
|
|
||||||
|
# Configure path for cable migrations
|
||||||
|
config.paths["db/migrate"] << "db/cable/migrate"
|
||||||
|
|
||||||
# Ignore bad email addresses and do not raise email delivery errors.
|
# Ignore bad email addresses and do not raise email delivery errors.
|
||||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||||
# config.action_mailer.raise_delivery_errors = false
|
# config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Set host to be used by links generated in mailer templates.
|
||||||
|
config.action_mailer.default_url_options = { host: "wrestlingdev.com" }
|
||||||
|
|
||||||
|
# Restore custom SMTP settings
|
||||||
|
config.action_mailer.smtp_settings = {
|
||||||
|
:address => "smtp.gmail.com",
|
||||||
|
:port => 587,
|
||||||
|
:domain => "gmail.com",
|
||||||
|
:user_name => ENV["WRESTLINGDEV_EMAIL"],
|
||||||
|
:password => ENV["WRESTLINGDEV_EMAIL_PWD"],
|
||||||
|
:authentication => :plain,
|
||||||
|
:enable_starttls_auto => true
|
||||||
|
}
|
||||||
|
config.action_mailer.perform_deliveries = true
|
||||||
|
# Login needs origin of email
|
||||||
|
Rails.application.routes.default_url_options[:host] = 'https://wrestlingdev.com'
|
||||||
|
|
||||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||||
# the I18n.default_locale when a translation can not be found).
|
# the I18n.default_locale when a translation cannot be found).
|
||||||
config.i18n.fallbacks = true
|
config.i18n.fallbacks = true
|
||||||
|
|
||||||
# Send deprecation notices to registered listeners.
|
# Do not dump schema after migrations.
|
||||||
config.active_support.deprecation = :notify
|
config.active_record.dump_schema_after_migration = false
|
||||||
|
|
||||||
# Disable automatic flushing of the log to improve performance.
|
# Only use :id for inspections in production.
|
||||||
# config.autoflush_log = false
|
config.active_record.attributes_for_inspect = [ :id ]
|
||||||
|
|
||||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
# Enable DNS rebinding protection and other `Host` header attacks.
|
||||||
config.log_formatter = ::Logger::Formatter.new
|
# config.hosts = [
|
||||||
|
# "example.com", # Allow requests from example.com
|
||||||
|
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
||||||
|
# ]
|
||||||
|
#
|
||||||
|
# Skip DNS rebinding protection for the default health check endpoint.
|
||||||
|
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
||||||
|
|
||||||
|
# Restore asset compilation settings
|
||||||
#THESE ADDED BY ME TO GET RAILS 4 WORKING IN HEROKU
|
|
||||||
config.cache_classes = true
|
|
||||||
config.public_file_server.enabled = true
|
config.public_file_server.enabled = true
|
||||||
|
|
||||||
## Using default asset pipeline sprockets
|
## Using default asset pipeline sprockets
|
||||||
@@ -80,24 +120,4 @@ Wrestling::Application.configure do
|
|||||||
config.assets.compile = true
|
config.assets.compile = true
|
||||||
# Generate digests for assets URLs.
|
# Generate digests for assets URLs.
|
||||||
config.assets.digest = true
|
config.assets.digest = true
|
||||||
|
|
||||||
#Added by me to force SSL in production on heroku
|
|
||||||
if ENV["IS_HEROKU"] == "true"
|
|
||||||
config.force_ssl = true
|
|
||||||
end
|
|
||||||
|
|
||||||
#MAIL
|
|
||||||
config.action_mailer.smtp_settings = {
|
|
||||||
:address => "smtp.gmail.com",
|
|
||||||
:port => 587,
|
|
||||||
:domain => "gmail.com",
|
|
||||||
:user_name => ENV["WRESTLINGDEV_EMAIL"],
|
|
||||||
:password => ENV["WRESTLINGDEV_EMAIL_PWD"],
|
|
||||||
:authentication => :plain,
|
|
||||||
:enable_starttls_auto => true
|
|
||||||
}
|
|
||||||
config.action_mailer.perform_deliveries = true
|
|
||||||
#Devise needs origin of email
|
|
||||||
Rails.application.routes.default_url_options[:host] = 'https://wrestlingdev.com'
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,38 +1,77 @@
|
|||||||
Wrestling::Application.configure do
|
# The test environment is used exclusively to run your application's
|
||||||
|
# test suite. You never need to work with it otherwise. Remember that
|
||||||
|
# your test database is "scratch space" for the test suite and is wiped
|
||||||
|
# and recreated between test runs. Don't rely on the data there!
|
||||||
|
|
||||||
|
Rails.application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# The test environment is used exclusively to run your application's
|
# While tests run files are not watched, reloading is not necessary.
|
||||||
# test suite. You never need to work with it otherwise. Remember that
|
config.enable_reloading = false
|
||||||
# your test database is "scratch space" for the test suite and is wiped
|
|
||||||
# and recreated between test runs. Don't rely on the data there!
|
|
||||||
config.cache_classes = true
|
|
||||||
|
|
||||||
# Do not eager load code on boot. This avoids loading your whole application
|
# Eager loading loads your entire application. When running a single test locally,
|
||||||
# just for the purpose of running a single test. If you are using a tool that
|
# this is usually not necessary, and can slow down your test suite. However, it's
|
||||||
# preloads Rails for running tests, you may have to set it to true.
|
# recommended that you enable it in continuous integration systems to ensure eager
|
||||||
config.eager_load = false
|
# loading is working properly before deploying your code.
|
||||||
|
config.eager_load = ENV["CI"].present?
|
||||||
|
|
||||||
# Configure static asset server for tests with Cache-Control for performance.
|
# Configure public file server for tests with cache-control for performance.
|
||||||
config.public_file_server.enabled = true
|
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
|
||||||
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
|
||||||
|
|
||||||
# Show full error reports and disable caching.
|
# Show full error reports.
|
||||||
config.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
config.action_controller.perform_caching = false
|
|
||||||
|
|
||||||
# Raise exceptions instead of rendering exception templates.
|
# Use solid cache store for testing
|
||||||
config.action_dispatch.show_exceptions = false
|
config.cache_store = :solid_cache_store
|
||||||
|
# Don't use connects_to here since it's configured via cache.yml
|
||||||
|
# config.solid_cache.connects_to = { database: { writing: :cache } }
|
||||||
|
|
||||||
|
# Configure path for cache migrations
|
||||||
|
config.paths["db/migrate"] << "db/cache/migrate"
|
||||||
|
|
||||||
|
# Configure ActiveJob to execute jobs immediately in tests
|
||||||
|
# The test adapter will execute jobs inline immediately
|
||||||
|
config.active_job.queue_adapter = :test
|
||||||
|
|
||||||
|
# Configure path for queue migrations
|
||||||
|
config.paths["db/migrate"] << "db/queue/migrate"
|
||||||
|
|
||||||
|
# Configure ActionCable to use its own database for testing
|
||||||
|
# Don't use connects_to here since it's configured via cable.yml
|
||||||
|
# config.action_cable.connects_to = { database: { writing: :cable } }
|
||||||
|
|
||||||
|
# Configure path for cable migrations
|
||||||
|
config.paths["db/migrate"] << "db/cable/migrate"
|
||||||
|
|
||||||
|
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
||||||
|
config.action_dispatch.show_exceptions = :rescuable
|
||||||
|
|
||||||
# Disable request forgery protection in test environment.
|
# Disable request forgery protection in test environment.
|
||||||
config.action_controller.allow_forgery_protection = false
|
config.action_controller.allow_forgery_protection = false
|
||||||
|
|
||||||
|
# Store uploaded files on the local file system in a temporary directory.
|
||||||
|
config.active_storage.service = :test
|
||||||
|
|
||||||
# Tell Action Mailer not to deliver emails to the real world.
|
# Tell Action Mailer not to deliver emails to the real world.
|
||||||
# The :test delivery method accumulates sent emails in the
|
# The :test delivery method accumulates sent emails in the
|
||||||
# ActionMailer::Base.deliveries array.
|
# ActionMailer::Base.deliveries array.
|
||||||
config.action_mailer.delivery_method = :test
|
config.action_mailer.delivery_method = :test
|
||||||
|
|
||||||
|
# Set host to be used by links generated in mailer templates.
|
||||||
|
config.action_mailer.default_url_options = { host: "example.com" }
|
||||||
|
|
||||||
# Print deprecation notices to the stderr.
|
# Print deprecation notices to the stderr.
|
||||||
config.active_support.deprecation = :stderr
|
config.active_support.deprecation = :stderr
|
||||||
|
|
||||||
|
# Set test order to random as in previous configuration
|
||||||
config.active_support.test_order = :random
|
config.active_support.test_order = :random
|
||||||
|
|
||||||
|
# Raises error for missing translations.
|
||||||
|
# config.i18n.raise_on_missing_translations = true
|
||||||
|
|
||||||
|
# Annotate rendered view with file names.
|
||||||
|
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||||
|
|
||||||
|
# Raise error when a before_action's only/except options reference missing actions.
|
||||||
|
config.action_controller.raise_on_missing_callback_actions = true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,257 +0,0 @@
|
|||||||
# Use this hook to configure devise mailer, warden hooks and so forth.
|
|
||||||
# Many of these configuration options can be set straight in your model.
|
|
||||||
Devise.setup do |config|
|
|
||||||
# The secret key used by Devise. Devise uses this key to generate
|
|
||||||
# random tokens. Changing this key will render invalid all existing
|
|
||||||
# confirmation, reset password and unlock tokens in the database.
|
|
||||||
if Rails.env.production?
|
|
||||||
config.secret_key = ENV['WRESTLINGDEV_DEVISE_SECRET_KEY']
|
|
||||||
else
|
|
||||||
config.secret_key = "2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa"
|
|
||||||
end
|
|
||||||
|
|
||||||
# ==> Mailer Configuration
|
|
||||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
|
||||||
# note that it will be overwritten if you use your own mailer class
|
|
||||||
# with default "from" parameter.
|
|
||||||
config.mailer_sender = 'NOREPLY@wrestlingdev.com'
|
|
||||||
|
|
||||||
# Configure the class responsible to send e-mails.
|
|
||||||
# config.mailer = 'Devise::Mailer'
|
|
||||||
# ==> ORM configuration
|
|
||||||
# Load and configure the ORM. Supports :active_record (default) and
|
|
||||||
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
|
||||||
# available as additional gems.
|
|
||||||
require 'devise/orm/active_record'
|
|
||||||
|
|
||||||
# ==> Configuration for any authentication mechanism
|
|
||||||
# Configure which keys are used when authenticating a user. The default is
|
|
||||||
# just :email. You can configure it to use [:username, :subdomain], so for
|
|
||||||
# authenticating a user, both parameters are required. Remember that those
|
|
||||||
# parameters are used only when authenticating and not when retrieving from
|
|
||||||
# session. If you need permissions, you should implement that in a before filter.
|
|
||||||
# You can also supply a hash where the value is a boolean determining whether
|
|
||||||
# or not authentication should be aborted when the value is not present.
|
|
||||||
# config.authentication_keys = [ :email ]
|
|
||||||
|
|
||||||
# Configure parameters from the request object used for authentication. Each entry
|
|
||||||
# given should be a request method and it will automatically be passed to the
|
|
||||||
# find_for_authentication method and considered in your model lookup. For instance,
|
|
||||||
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
|
||||||
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
|
||||||
# config.request_keys = []
|
|
||||||
|
|
||||||
# Configure which authentication keys should be case-insensitive.
|
|
||||||
# These keys will be downcased upon creating or modifying a user and when used
|
|
||||||
# to authenticate or find a user. Default is :email.
|
|
||||||
config.case_insensitive_keys = [ :email ]
|
|
||||||
|
|
||||||
# Configure which authentication keys should have whitespace stripped.
|
|
||||||
# These keys will have whitespace before and after removed upon creating or
|
|
||||||
# modifying a user and when used to authenticate or find a user. Default is :email.
|
|
||||||
config.strip_whitespace_keys = [ :email ]
|
|
||||||
|
|
||||||
# Tell if authentication through request.params is enabled. True by default.
|
|
||||||
# It can be set to an array that will enable params authentication only for the
|
|
||||||
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
|
||||||
# enable it only for database (email + password) authentication.
|
|
||||||
# config.params_authenticatable = true
|
|
||||||
|
|
||||||
# Tell if authentication through HTTP Auth is enabled. False by default.
|
|
||||||
# It can be set to an array that will enable http authentication only for the
|
|
||||||
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
|
||||||
# enable it only for database authentication. The supported strategies are:
|
|
||||||
# :database = Support basic authentication with authentication key + password
|
|
||||||
# config.http_authenticatable = false
|
|
||||||
|
|
||||||
# If http headers should be returned for AJAX requests. True by default.
|
|
||||||
# config.http_authenticatable_on_xhr = true
|
|
||||||
|
|
||||||
# The realm used in Http Basic Authentication. 'Application' by default.
|
|
||||||
# config.http_authentication_realm = 'Application'
|
|
||||||
|
|
||||||
# It will change confirmation, password recovery and other workflows
|
|
||||||
# to behave the same regardless if the e-mail provided was right or wrong.
|
|
||||||
# Does not affect registerable.
|
|
||||||
# config.paranoid = true
|
|
||||||
|
|
||||||
# By default Devise will store the user in session. You can skip storage for
|
|
||||||
# particular strategies by setting this option.
|
|
||||||
# Notice that if you are skipping storage for all authentication paths, you
|
|
||||||
# may want to disable generating routes to Devise's sessions controller by
|
|
||||||
# passing :skip => :sessions to `devise_for` in your config/routes.rb
|
|
||||||
config.skip_session_storage = [:http_auth]
|
|
||||||
|
|
||||||
# By default, Devise cleans up the CSRF token on authentication to
|
|
||||||
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
|
||||||
# requests for sign in and sign up, you need to get a new CSRF token
|
|
||||||
# from the server. You can disable this option at your own risk.
|
|
||||||
# config.clean_up_csrf_token_on_authentication = true
|
|
||||||
|
|
||||||
# ==> Configuration for :database_authenticatable
|
|
||||||
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
|
||||||
# using other encryptors, it sets how many times you want the password re-encrypted.
|
|
||||||
#
|
|
||||||
# Limiting the stretches to just one in testing will increase the performance of
|
|
||||||
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
|
||||||
# a value less than 10 in other environments.
|
|
||||||
config.stretches = Rails.env.test? ? 1 : 10
|
|
||||||
|
|
||||||
# Setup a pepper to generate the encrypted password.
|
|
||||||
# config.pepper = '84f10eecb0c3d505539ed5b410d6bf98c223257c43f2ad2a301c130286809fee566d6ba222f5792bc435d99e56d89303ec709de335b87eb2a10583b4864054a5'
|
|
||||||
|
|
||||||
# ==> Configuration for :confirmable
|
|
||||||
# A period that the user is allowed to access the website even without
|
|
||||||
# confirming his account. For instance, if set to 2.days, the user will be
|
|
||||||
# able to access the website for two days without confirming his account,
|
|
||||||
# access will be blocked just in the third day. Default is 0.days, meaning
|
|
||||||
# the user cannot access the website without confirming his account.
|
|
||||||
# config.allow_unconfirmed_access_for = 2.days
|
|
||||||
|
|
||||||
# A period that the user is allowed to confirm their account before their
|
|
||||||
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
|
||||||
# their account within 3 days after the mail was sent, but on the fourth day
|
|
||||||
# their account can't be confirmed with the token any more.
|
|
||||||
# Default is nil, meaning there is no restriction on how long a user can take
|
|
||||||
# before confirming their account.
|
|
||||||
# config.confirm_within = 3.days
|
|
||||||
|
|
||||||
# If true, requires any email changes to be confirmed (exactly the same way as
|
|
||||||
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
|
||||||
# db field (see migrations). Until confirmed new email is stored in
|
|
||||||
# unconfirmed email column, and copied to email column on successful confirmation.
|
|
||||||
config.reconfirmable = true
|
|
||||||
|
|
||||||
# Defines which key will be used when confirming an account
|
|
||||||
# config.confirmation_keys = [ :email ]
|
|
||||||
|
|
||||||
# ==> Configuration for :rememberable
|
|
||||||
# The time the user will be remembered without asking for credentials again.
|
|
||||||
# config.remember_for = 2.weeks
|
|
||||||
|
|
||||||
# If true, extends the user's remember period when remembered via cookie.
|
|
||||||
# config.extend_remember_period = false
|
|
||||||
|
|
||||||
# Options to be passed to the created cookie. For instance, you can set
|
|
||||||
# :secure => true in order to force SSL only cookies.
|
|
||||||
# config.rememberable_options = {}
|
|
||||||
|
|
||||||
# ==> Configuration for :validatable
|
|
||||||
# Range for password length. Default is 8..128.
|
|
||||||
config.password_length = 8..128
|
|
||||||
|
|
||||||
# Email regex used to validate email formats. It simply asserts that
|
|
||||||
# one (and only one) @ exists in the given string. This is mainly
|
|
||||||
# to give user feedback and not to assert the e-mail validity.
|
|
||||||
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
|
||||||
|
|
||||||
# ==> Configuration for :timeoutable
|
|
||||||
# The time you want to timeout the user session without activity. After this
|
|
||||||
# time the user will be asked for credentials again. Default is 30 minutes.
|
|
||||||
# config.timeout_in = 30.minutes
|
|
||||||
|
|
||||||
# If true, expires auth token on session timeout.
|
|
||||||
# config.expire_auth_token_on_timeout = false
|
|
||||||
|
|
||||||
# ==> Configuration for :lockable
|
|
||||||
# Defines which strategy will be used to lock an account.
|
|
||||||
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
|
||||||
# :none = No lock strategy. You should handle locking by yourself.
|
|
||||||
# config.lock_strategy = :failed_attempts
|
|
||||||
|
|
||||||
# Defines which key will be used when locking and unlocking an account
|
|
||||||
# config.unlock_keys = [ :email ]
|
|
||||||
|
|
||||||
# Defines which strategy will be used to unlock an account.
|
|
||||||
# :email = Sends an unlock link to the user email
|
|
||||||
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
|
||||||
# :both = Enables both strategies
|
|
||||||
# :none = No unlock strategy. You should handle unlocking by yourself.
|
|
||||||
# config.unlock_strategy = :both
|
|
||||||
|
|
||||||
# Number of authentication tries before locking an account if lock_strategy
|
|
||||||
# is failed attempts.
|
|
||||||
# config.maximum_attempts = 20
|
|
||||||
|
|
||||||
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
|
||||||
# config.unlock_in = 1.hour
|
|
||||||
|
|
||||||
# Warn on the last attempt before the account is locked.
|
|
||||||
# config.last_attempt_warning = false
|
|
||||||
|
|
||||||
# ==> Configuration for :recoverable
|
|
||||||
#
|
|
||||||
# Defines which key will be used when recovering the password for an account
|
|
||||||
# config.reset_password_keys = [ :email ]
|
|
||||||
|
|
||||||
# Time interval you can reset your password with a reset password key.
|
|
||||||
# Don't put a too small interval or your users won't have the time to
|
|
||||||
# change their passwords.
|
|
||||||
config.reset_password_within = 6.hours
|
|
||||||
|
|
||||||
# ==> Configuration for :encryptable
|
|
||||||
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
|
||||||
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
|
||||||
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
|
||||||
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
|
||||||
# REST_AUTH_SITE_KEY to pepper).
|
|
||||||
#
|
|
||||||
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
|
||||||
# config.encryptor = :sha512
|
|
||||||
|
|
||||||
# ==> Scopes configuration
|
|
||||||
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
|
||||||
# "users/sessions/new". It's turned off by default because it's slower if you
|
|
||||||
# are using only default views.
|
|
||||||
# config.scoped_views = false
|
|
||||||
|
|
||||||
# Configure the default scope given to Warden. By default it's the first
|
|
||||||
# devise role declared in your routes (usually :user).
|
|
||||||
# config.default_scope = :user
|
|
||||||
|
|
||||||
# Set this configuration to false if you want /users/sign_out to sign out
|
|
||||||
# only the current scope. By default, Devise signs out all scopes.
|
|
||||||
# config.sign_out_all_scopes = true
|
|
||||||
|
|
||||||
# ==> Navigation configuration
|
|
||||||
# Lists the formats that should be treated as navigational. Formats like
|
|
||||||
# :html, should redirect to the sign in page when the user does not have
|
|
||||||
# access, but formats like :xml or :json, should return 401.
|
|
||||||
#
|
|
||||||
# If you have any extra navigational formats, like :iphone or :mobile, you
|
|
||||||
# should add them to the navigational formats lists.
|
|
||||||
#
|
|
||||||
# The "*/*" below is required to match Internet Explorer requests.
|
|
||||||
# config.navigational_formats = ['*/*', :html]
|
|
||||||
|
|
||||||
# The default HTTP method used to sign out a resource. Default is :delete.
|
|
||||||
config.sign_out_via = :delete
|
|
||||||
|
|
||||||
# ==> OmniAuth
|
|
||||||
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
|
||||||
# up on your models and hooks.
|
|
||||||
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
|
||||||
|
|
||||||
# ==> Warden configuration
|
|
||||||
# If you want to use other strategies, that are not supported by Devise, or
|
|
||||||
# change the failure app, you can configure them inside the config.warden block.
|
|
||||||
#
|
|
||||||
# config.warden do |manager|
|
|
||||||
# manager.intercept_401 = false
|
|
||||||
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
|
||||||
# end
|
|
||||||
|
|
||||||
# ==> Mountable engine configurations
|
|
||||||
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
|
||||||
# is mountable, there are some extra configurations to be taken into account.
|
|
||||||
# The following options are available, assuming the engine is mounted as:
|
|
||||||
#
|
|
||||||
# mount MyEngine, at: '/my_engine'
|
|
||||||
#
|
|
||||||
# The router that invoked `devise_for`, in the example above, would be:
|
|
||||||
# config.router_name = :my_engine
|
|
||||||
#
|
|
||||||
# When using omniauth, Devise cannot automatically set Omniauth path,
|
|
||||||
# so you need to do it manually. For the users scope, it would be:
|
|
||||||
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
|
||||||
end
|
|
||||||
@@ -4,5 +4,5 @@
|
|||||||
# Use this to limit dissemination of sensitive information.
|
# Use this to limit dissemination of sensitive information.
|
||||||
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
||||||
Rails.application.config.filter_parameters += [
|
Rails.application.config.filter_parameters += [
|
||||||
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
|
||||||
]
|
]
|
||||||
|
|||||||
66
config/initializers/solid_queue.rb
Normal file
66
config/initializers/solid_queue.rb
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
# Configuration for Solid Queue in Rails 8
|
||||||
|
# Documentation: https://github.com/rails/solid_queue
|
||||||
|
|
||||||
|
# Configure ActiveJob queue adapter based on environment
|
||||||
|
if ! Rails.env.test?
|
||||||
|
# In production and development, use solid_queue with async execution
|
||||||
|
Rails.application.config.active_job.queue_adapter = :solid_queue
|
||||||
|
|
||||||
|
# Configure for regular async processing
|
||||||
|
Rails.application.config.active_job.queue_adapter_options = {
|
||||||
|
execution_mode: :async,
|
||||||
|
logger: Rails.logger
|
||||||
|
}
|
||||||
|
else
|
||||||
|
# In test, use inline adapter for simplicity
|
||||||
|
Rails.application.config.active_job.queue_adapter = :inline
|
||||||
|
end
|
||||||
|
|
||||||
|
# Register the custom attributes we want to track
|
||||||
|
module SolidQueueConfig
|
||||||
|
mattr_accessor :job_owner_tracking_enabled, default: true
|
||||||
|
end
|
||||||
|
|
||||||
|
# Define ActiveJobExtensions - this should match what's already being used in ApplicationJob
|
||||||
|
module ActiveJobExtensions
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
attr_accessor :job_owner_id, :job_owner_type
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Solid Queue adapter hooks to save job owner info to columns
|
||||||
|
module SolidQueueAdapterExtensions
|
||||||
|
def enqueue(job)
|
||||||
|
job_data = job.serialize
|
||||||
|
job_id = super
|
||||||
|
|
||||||
|
# Store job owner info after job is created
|
||||||
|
if defined?(SolidQueue::Job) && job_data["job_owner_id"].present?
|
||||||
|
Rails.logger.info("Setting job_owner for SolidQueue job #{job_id}: #{job_data["job_owner_id"]}, #{job_data["job_owner_type"]}")
|
||||||
|
begin
|
||||||
|
# Use execute_query for direct SQL to bypass any potential ActiveRecord issues
|
||||||
|
ActiveRecord::Base.connection.execute(
|
||||||
|
"UPDATE solid_queue_jobs SET job_owner_id = #{ActiveRecord::Base.connection.quote(job_data["job_owner_id"])}, " +
|
||||||
|
"job_owner_type = #{ActiveRecord::Base.connection.quote(job_data["job_owner_type"])} " +
|
||||||
|
"WHERE id = #{job_id}"
|
||||||
|
)
|
||||||
|
Rails.logger.info("Successfully updated job_owner info for job #{job_id}")
|
||||||
|
rescue => e
|
||||||
|
Rails.logger.error("Error updating job_owner info: #{e.message}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
job_id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Apply extensions
|
||||||
|
Rails.application.config.after_initialize do
|
||||||
|
# Add extensions to ActiveJob::QueueAdapters::SolidQueueAdapter if defined
|
||||||
|
if defined?(ActiveJob::QueueAdapters::SolidQueueAdapter)
|
||||||
|
Rails.logger.info("Applying SolidQueueAdapterExtensions")
|
||||||
|
ActiveJob::QueueAdapters::SolidQueueAdapter.prepend(SolidQueueAdapterExtensions)
|
||||||
|
end
|
||||||
|
end
|
||||||
79
config/initializers/sqlite_config.rb
Normal file
79
config/initializers/sqlite_config.rb
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
# Configure SQLite for better concurrency handling
|
||||||
|
# This applies only in development mode with SQLite
|
||||||
|
|
||||||
|
Rails.application.config.after_initialize do
|
||||||
|
if Rails.env.development? && ActiveRecord::Base.connection.adapter_name == "SQLite"
|
||||||
|
connection = ActiveRecord::Base.connection
|
||||||
|
|
||||||
|
# 1. Configure SQLite behavior for better concurrency
|
||||||
|
# Increase the busy timeout to 30 seconds (in milliseconds)
|
||||||
|
connection.execute("PRAGMA busy_timeout = 30000;")
|
||||||
|
|
||||||
|
# Set journal mode to WAL for better concurrency
|
||||||
|
connection.execute("PRAGMA journal_mode = WAL;")
|
||||||
|
|
||||||
|
# Configure synchronous mode for better performance
|
||||||
|
connection.execute("PRAGMA synchronous = NORMAL;")
|
||||||
|
|
||||||
|
# Temp store in memory for better performance
|
||||||
|
connection.execute("PRAGMA temp_store = MEMORY;")
|
||||||
|
|
||||||
|
# Use a larger cache size (8MB)
|
||||||
|
connection.execute("PRAGMA cache_size = -8000;")
|
||||||
|
|
||||||
|
# Set locking mode to NORMAL
|
||||||
|
connection.execute("PRAGMA locking_mode = NORMAL;")
|
||||||
|
|
||||||
|
# 2. Patch SQLite adapter with retry logic for development only
|
||||||
|
if defined?(ActiveRecord::ConnectionAdapters::SQLite3Adapter)
|
||||||
|
module SQLite3RetryLogic
|
||||||
|
MAX_RETRIES = 5
|
||||||
|
RETRY_DELAY = 0.5 # seconds
|
||||||
|
RETRIABLE_EXCEPTIONS = [
|
||||||
|
SQLite3::BusyException,
|
||||||
|
ActiveRecord::StatementInvalid,
|
||||||
|
ActiveRecord::StatementTimeout
|
||||||
|
]
|
||||||
|
|
||||||
|
def self.included(base)
|
||||||
|
base.class_eval do
|
||||||
|
alias_method :original_execute, :execute
|
||||||
|
alias_method :original_exec_query, :exec_query
|
||||||
|
|
||||||
|
def execute(*args)
|
||||||
|
with_retries { original_execute(*args) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def exec_query(*args)
|
||||||
|
with_retries { original_exec_query(*args) }
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def with_retries
|
||||||
|
retry_count = 0
|
||||||
|
begin
|
||||||
|
yield
|
||||||
|
rescue *RETRIABLE_EXCEPTIONS => e
|
||||||
|
if e.to_s.include?('database is locked') && retry_count < MAX_RETRIES
|
||||||
|
retry_count += 1
|
||||||
|
delay = RETRY_DELAY * retry_count
|
||||||
|
Rails.logger.warn "SQLite database locked, retry #{retry_count}/#{MAX_RETRIES} after #{delay}s: #{e.message}"
|
||||||
|
sleep(delay)
|
||||||
|
retry
|
||||||
|
else
|
||||||
|
raise
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Apply the patch only in development
|
||||||
|
ActiveRecord::ConnectionAdapters::SQLite3Adapter.include(SQLite3RetryLogic)
|
||||||
|
Rails.logger.info "SQLite adapter patched with retry logic for database locks"
|
||||||
|
end
|
||||||
|
|
||||||
|
Rails.logger.info "SQLite configured for improved concurrency in development"
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
|
|
||||||
|
|
||||||
en:
|
|
||||||
devise:
|
|
||||||
confirmations:
|
|
||||||
confirmed: "Your account was successfully confirmed."
|
|
||||||
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
|
|
||||||
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
|
|
||||||
failure:
|
|
||||||
already_authenticated: "You are already signed in."
|
|
||||||
inactive: "Your account is not activated yet."
|
|
||||||
invalid: "Invalid email or password."
|
|
||||||
locked: "Your account is locked."
|
|
||||||
last_attempt: "You have one more attempt before your account will be locked."
|
|
||||||
not_found_in_database: "Invalid email or password."
|
|
||||||
timeout: "Your session expired. Please sign in again to continue."
|
|
||||||
unauthenticated: "You need to sign in or sign up before continuing."
|
|
||||||
unconfirmed: "You have to confirm your account before continuing."
|
|
||||||
mailer:
|
|
||||||
confirmation_instructions:
|
|
||||||
subject: "Confirmation instructions"
|
|
||||||
reset_password_instructions:
|
|
||||||
subject: "Reset password instructions"
|
|
||||||
unlock_instructions:
|
|
||||||
subject: "Unlock Instructions"
|
|
||||||
omniauth_callbacks:
|
|
||||||
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
|
||||||
success: "Successfully authenticated from %{kind} account."
|
|
||||||
passwords:
|
|
||||||
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
|
||||||
send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes."
|
|
||||||
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
|
||||||
updated: "Your password was changed successfully. You are now signed in."
|
|
||||||
updated_not_active: "Your password was changed successfully."
|
|
||||||
registrations:
|
|
||||||
destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
|
|
||||||
signed_up: "Welcome! You have signed up successfully."
|
|
||||||
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
|
||||||
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
|
||||||
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
|
|
||||||
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
|
|
||||||
updated: "You updated your account successfully."
|
|
||||||
sessions:
|
|
||||||
signed_in: "Signed in successfully."
|
|
||||||
signed_out: "Signed out successfully."
|
|
||||||
unlocks:
|
|
||||||
send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
|
|
||||||
send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
|
|
||||||
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
|
||||||
errors:
|
|
||||||
messages:
|
|
||||||
already_confirmed: "was already confirmed, please try signing in"
|
|
||||||
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
|
||||||
expired: "has expired, please request a new one"
|
|
||||||
not_found: "not found"
|
|
||||||
not_locked: "was not locked"
|
|
||||||
not_saved:
|
|
||||||
one: "1 error prohibited this %{resource} from being saved:"
|
|
||||||
other: "%{count} errors prohibited this %{resource} from being saved:"
|
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
# This configuration file will be evaluated by Puma. The top-level methods that
|
# This configuration file will be evaluated by Puma. The top-level methods that
|
||||||
# are invoked here are part of Puma's configuration DSL. For more information
|
# are invoked here are part of Puma's configuration DSL. For more information
|
||||||
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
||||||
|
#
|
||||||
# Puma starts a configurable number of processes (workers) and each process
|
# Puma starts a configurable number of processes (workers) and each process
|
||||||
# serves each request in a thread from an internal thread pool.
|
# serves each request in a thread from an internal thread pool.
|
||||||
#
|
#
|
||||||
|
# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
|
||||||
|
# should only set this value when you want to run 2 or more workers. The
|
||||||
|
# default is already 1.
|
||||||
|
#
|
||||||
# The ideal number of threads per worker depends both on how much time the
|
# The ideal number of threads per worker depends both on how much time the
|
||||||
# application spends waiting for IO operations and on how much you wish to
|
# application spends waiting for IO operations and on how much you wish to
|
||||||
# to prioritize throughput over latency.
|
# prioritize throughput over latency.
|
||||||
#
|
#
|
||||||
# As a rule of thumb, increasing the number of threads will increase how much
|
# As a rule of thumb, increasing the number of threads will increase how much
|
||||||
# traffic a given process can handle (throughput), but due to CRuby's
|
# traffic a given process can handle (throughput), but due to CRuby's
|
||||||
@@ -20,8 +24,56 @@
|
|||||||
# Any libraries that use a connection pool or another resource pool should
|
# Any libraries that use a connection pool or another resource pool should
|
||||||
# be configured to provide at least as many connections as the number of
|
# be configured to provide at least as many connections as the number of
|
||||||
# threads. This includes Active Record's `pool` parameter in `database.yml`.
|
# threads. This includes Active Record's `pool` parameter in `database.yml`.
|
||||||
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
|
|
||||||
threads threads_count, threads_count
|
# Calculate available memory for Ruby process sizing (in MB)
|
||||||
|
available_memory_mb = if RUBY_PLATFORM =~ /darwin/
|
||||||
|
# Default to a reasonable amount on macOS where memory detection is difficult
|
||||||
|
8192 # 8GB default
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
# Try to get memory from /proc/meminfo on Linux
|
||||||
|
mem_total_kb = `grep MemTotal /proc/meminfo`.to_s.strip.split(/\s+/)[1].to_i
|
||||||
|
mem_total_mb = mem_total_kb / 1024
|
||||||
|
# If we couldn't detect memory, use a safe default
|
||||||
|
mem_total_mb > 0 ? mem_total_mb : 4096
|
||||||
|
rescue
|
||||||
|
4096 # 4GB fallback if detection fails
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Calculate workers based on available CPUs and memory
|
||||||
|
# Each worker uses ~300-500MB of RAM, so we scale based on available memory
|
||||||
|
# If WEB_CONCURRENCY is set, use that value instead
|
||||||
|
cpu_count = begin
|
||||||
|
require 'etc'
|
||||||
|
Etc.nprocessors
|
||||||
|
rescue
|
||||||
|
2 # Default to 2 if we can't detect
|
||||||
|
end
|
||||||
|
|
||||||
|
# Default worker calculation:
|
||||||
|
# - With ample memory: Use CPU count
|
||||||
|
# - With limited memory: Use memory-based calculation with a min of 2 and max based on CPUs
|
||||||
|
# This automatically adapts to the environment
|
||||||
|
default_workers = if ENV["RAILS_ENV"] == "development"
|
||||||
|
1 # Use 1 worker in development for simplicity
|
||||||
|
else
|
||||||
|
# Calculate based on available memory, assuming ~400MB per worker
|
||||||
|
memory_based_workers = (available_memory_mb / 400).to_i
|
||||||
|
# Ensure at least 2 workers for production (for zero-downtime restarts)
|
||||||
|
# and cap at CPU count to avoid excessive context switching
|
||||||
|
[memory_based_workers, 2].max
|
||||||
|
end
|
||||||
|
default_workers = [default_workers, cpu_count].min
|
||||||
|
|
||||||
|
workers_count = ENV.fetch("WEB_CONCURRENCY") { default_workers }
|
||||||
|
|
||||||
|
# Configure thread count for optimal throughput
|
||||||
|
# More threads = better for IO-bound applications
|
||||||
|
# Fewer threads = better for CPU-bound applications
|
||||||
|
min_threads_count = ENV.fetch("RAILS_MIN_THREADS", 5)
|
||||||
|
max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 12)
|
||||||
|
threads min_threads_count, max_threads_count
|
||||||
|
|
||||||
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
||||||
port ENV.fetch("PORT", 3000)
|
port ENV.fetch("PORT", 3000)
|
||||||
@@ -29,6 +81,28 @@ port ENV.fetch("PORT", 3000)
|
|||||||
# Allow puma to be restarted by `bin/rails restart` command.
|
# Allow puma to be restarted by `bin/rails restart` command.
|
||||||
plugin :tmp_restart
|
plugin :tmp_restart
|
||||||
|
|
||||||
|
# Run the Solid Queue supervisor inside of Puma for single-server deployments
|
||||||
|
# Enable by default in development for convenience, can be disabled with SOLID_QUEUE_IN_PUMA=false
|
||||||
|
if (Rails.env.development? && ENV["SOLID_QUEUE_IN_PUMA"] != "false") || ENV["SOLID_QUEUE_IN_PUMA"] == "true"
|
||||||
|
plugin :solid_queue
|
||||||
|
end
|
||||||
|
|
||||||
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
||||||
# In other environments, only set the PID file if requested.
|
# In other environments, only set the PID file if requested.
|
||||||
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
||||||
|
|
||||||
|
# Set reasonable timeouts - these prevent hanging requests from consuming resources
|
||||||
|
worker_timeout 60
|
||||||
|
worker_boot_timeout 60
|
||||||
|
|
||||||
|
# Preload the application to reduce memory footprint in production
|
||||||
|
preload_app! if ENV["RAILS_ENV"] == "production"
|
||||||
|
|
||||||
|
# When using preload_app, ensure that connections are properly handled
|
||||||
|
on_worker_boot do
|
||||||
|
ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Log the configuration
|
||||||
|
puts "Puma starting with #{workers_count} worker(s), #{min_threads_count}-#{max_threads_count} threads per worker"
|
||||||
|
puts "Available system resources: #{cpu_count} CPU(s), #{available_memory_mb}MB RAM"
|
||||||
|
|||||||
21
config/queue.yml
Normal file
21
config/queue.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
default: &default
|
||||||
|
dispatchers:
|
||||||
|
- polling_interval: 1
|
||||||
|
batch_size: 500
|
||||||
|
workers:
|
||||||
|
- queues: "*"
|
||||||
|
threads: 3
|
||||||
|
processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %>
|
||||||
|
polling_interval: 0.1
|
||||||
|
|
||||||
|
development:
|
||||||
|
database: queue
|
||||||
|
<<: *default
|
||||||
|
|
||||||
|
test:
|
||||||
|
database: queue
|
||||||
|
<<: *default
|
||||||
|
|
||||||
|
production:
|
||||||
|
database: queue
|
||||||
|
<<: *default
|
||||||
10
config/recurring.yml
Normal file
10
config/recurring.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# production:
|
||||||
|
# periodic_cleanup:
|
||||||
|
# class: CleanSoftDeletedRecordsJob
|
||||||
|
# queue: background
|
||||||
|
# args: [ 1000, { batch_size: 500 } ]
|
||||||
|
# schedule: every hour
|
||||||
|
# periodic_command:
|
||||||
|
# command: "SoftDeletedRecord.due.delete_all"
|
||||||
|
# priority: 2
|
||||||
|
# schedule: at 5am every day
|
||||||
@@ -4,7 +4,18 @@ Wrestling::Application.routes.draw do
|
|||||||
|
|
||||||
resources :matches
|
resources :matches
|
||||||
|
|
||||||
devise_for :users
|
# Replace devise_for :users with custom routes
|
||||||
|
get '/login', to: 'sessions#new'
|
||||||
|
post '/login', to: 'sessions#create'
|
||||||
|
delete '/logout', to: 'sessions#destroy'
|
||||||
|
get '/signup', to: 'users#new'
|
||||||
|
post '/signup', to: 'users#create'
|
||||||
|
|
||||||
|
# Password reset routes
|
||||||
|
resources :password_resets, only: [:new, :create, :edit, :update]
|
||||||
|
|
||||||
|
# User resources for account management
|
||||||
|
resources :users, only: [:show, :edit, :update]
|
||||||
|
|
||||||
resources :tournaments do
|
resources :tournaments do
|
||||||
resources :mat_assignment_rules, only: [:index, :new, :create, :edit, :update, :show, :destroy]
|
resources :mat_assignment_rules, only: [:index, :new, :create, :edit, :update, :show, :destroy]
|
||||||
@@ -78,8 +89,6 @@ Wrestling::Application.routes.draw do
|
|||||||
get "/api/index" => "api#index"
|
get "/api/index" => "api#index"
|
||||||
post "/api/tournaments/new" => "newTournament"
|
post "/api/tournaments/new" => "newTournament"
|
||||||
|
|
||||||
match "/delayed_job" => DelayedJobWeb, :anchor => false, :via => [:get, :post]
|
|
||||||
|
|
||||||
get "/matches/:id/stat" => "matches#stat", :as => :stat_match_path
|
get "/matches/:id/stat" => "matches#stat", :as => :stat_match_path
|
||||||
|
|
||||||
resources :tournaments do
|
resources :tournaments do
|
||||||
@@ -89,6 +98,7 @@ Wrestling::Application.routes.draw do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# Example of regular route:
|
# Example of regular route:
|
||||||
# get 'products/:id' => 'catalog#view'
|
# get 'products/:id' => 'catalog#view'
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
test:
|
||||||
|
service: Disk
|
||||||
|
root: <%= Rails.root.join("tmp/storage") %>
|
||||||
|
|
||||||
|
local:
|
||||||
|
service: Disk
|
||||||
|
root: <%= Rails.root.join("storage") %>
|
||||||
|
|
||||||
|
# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
||||||
|
# amazon:
|
||||||
|
# service: S3
|
||||||
|
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
||||||
|
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
||||||
|
# region: us-east-1
|
||||||
|
# bucket: your_own_bucket
|
||||||
|
|
||||||
|
# Remember not to checkin your GCS keyfile to a repository
|
||||||
|
# google:
|
||||||
|
# service: GCS
|
||||||
|
# project: your_project
|
||||||
|
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
||||||
|
# bucket: your_own_bucket
|
||||||
|
|
||||||
|
# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
||||||
|
# microsoft:
|
||||||
|
# service: AzureStorage
|
||||||
|
# storage_account_name: your_account_name
|
||||||
|
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
||||||
|
# container: your_container_name
|
||||||
|
|||||||
13
db/cable/migrate/20250404153541_add_solid_cable_tables.rb
Normal file
13
db/cable/migrate/20250404153541_add_solid_cable_tables.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
class AddSolidCableTables < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
create_table "solid_cable_messages", force: :cascade do |t|
|
||||||
|
t.binary "channel", limit: 1024, null: false
|
||||||
|
t.binary "payload", limit: 536870912, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.integer "channel_hash", limit: 8, null: false
|
||||||
|
t.index ["channel"], name: "index_solid_cable_messages_on_channel"
|
||||||
|
t.index ["channel_hash"], name: "index_solid_cable_messages_on_channel_hash"
|
||||||
|
t.index ["created_at"], name: "index_solid_cable_messages_on_created_at"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
315
db/cable_schema.rb
Normal file
315
db/cable_schema.rb
Normal file
@@ -0,0 +1,315 @@
|
|||||||
|
# This file is auto-generated from the current state of the database. Instead
|
||||||
|
# of editing this file, please use the migrations feature of Active Record to
|
||||||
|
# incrementally modify your database, and then regenerate this schema definition.
|
||||||
|
#
|
||||||
|
# This file is the source Rails uses to define your schema when running `bin/rails
|
||||||
|
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
||||||
|
# be faster and is potentially less error prone than running all of your
|
||||||
|
# migrations from scratch. Old migrations may fail to apply correctly if those
|
||||||
|
# migrations use external dependencies or application code.
|
||||||
|
#
|
||||||
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
|
ActiveRecord::Schema[8.0].define(version: 2025_04_05_160115) do
|
||||||
|
create_table "mat_assignment_rules", force: :cascade do |t|
|
||||||
|
t.integer "tournament_id", null: false
|
||||||
|
t.integer "mat_id", null: false
|
||||||
|
t.string "weight_classes"
|
||||||
|
t.string "bracket_positions"
|
||||||
|
t.string "rounds"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["mat_id"], name: "index_mat_assignment_rules_on_mat_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "matches", force: :cascade do |t|
|
||||||
|
t.integer "w1"
|
||||||
|
t.integer "w2"
|
||||||
|
t.text "w1_stat"
|
||||||
|
t.text "w2_stat"
|
||||||
|
t.integer "winner_id"
|
||||||
|
t.string "win_type"
|
||||||
|
t.string "score"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.integer "round"
|
||||||
|
t.integer "finished"
|
||||||
|
t.integer "bout_number"
|
||||||
|
t.integer "weight_id"
|
||||||
|
t.string "bracket_position"
|
||||||
|
t.integer "bracket_position_number"
|
||||||
|
t.string "loser1_name"
|
||||||
|
t.string "loser2_name"
|
||||||
|
t.integer "mat_id"
|
||||||
|
t.string "overtime_type"
|
||||||
|
t.datetime "finished_at"
|
||||||
|
t.index ["mat_id"], name: "index_matches_on_mat_id"
|
||||||
|
t.index ["tournament_id"], name: "index_matches_on_tournament_id"
|
||||||
|
t.index ["w1", "w2"], name: "index_matches_on_w1_and_w2"
|
||||||
|
t.index ["weight_id"], name: "index_matches_on_weight_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "mats", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.index ["tournament_id"], name: "index_mats_on_tournament_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "school_delegates", force: :cascade do |t|
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "school_id"
|
||||||
|
t.datetime "created_at", precision: nil, null: false
|
||||||
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "schools", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.decimal "score", precision: 15, scale: 1
|
||||||
|
t.string "permission_key"
|
||||||
|
t.index ["permission_key"], name: "index_schools_on_permission_key", unique: true
|
||||||
|
t.index ["tournament_id"], name: "index_schools_on_tournament_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_cable_messages", force: :cascade do |t|
|
||||||
|
t.binary "channel", limit: 1024, null: false
|
||||||
|
t.binary "payload", limit: 536870912, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.integer "channel_hash", limit: 8, null: false
|
||||||
|
t.index ["channel"], name: "index_solid_cable_messages_on_channel"
|
||||||
|
t.index ["channel_hash"], name: "index_solid_cable_messages_on_channel_hash"
|
||||||
|
t.index ["created_at"], name: "index_solid_cable_messages_on_created_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_cache_entries", force: :cascade do |t|
|
||||||
|
t.binary "key", limit: 1024, null: false
|
||||||
|
t.binary "value", limit: 536870912, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.integer "key_hash", limit: 8, null: false
|
||||||
|
t.integer "byte_size", limit: 4, null: false
|
||||||
|
t.index ["byte_size"], name: "index_solid_cache_entries_on_byte_size"
|
||||||
|
t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
|
||||||
|
t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "concurrency_key", null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["concurrency_key", "priority", "job_id"], name: "index_solid_queue_blocked_executions_for_release"
|
||||||
|
t.index ["expires_at", "concurrency_key"], name: "index_solid_queue_blocked_executions_for_maintenance"
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_claimed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.bigint "process_id"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
|
||||||
|
t.index ["process_id", "job_id"], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_failed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.text "error"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_failed_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_jobs", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.string "class_name", null: false
|
||||||
|
t.text "arguments"
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "active_job_id"
|
||||||
|
t.datetime "scheduled_at"
|
||||||
|
t.datetime "finished_at"
|
||||||
|
t.string "concurrency_key"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["active_job_id"], name: "index_solid_queue_jobs_on_active_job_id"
|
||||||
|
t.index ["class_name"], name: "index_solid_queue_jobs_on_class_name"
|
||||||
|
t.index ["finished_at"], name: "index_solid_queue_jobs_on_finished_at"
|
||||||
|
t.index ["queue_name", "finished_at"], name: "index_solid_queue_jobs_for_filtering"
|
||||||
|
t.index ["scheduled_at", "finished_at"], name: "index_solid_queue_jobs_for_alerting"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_pauses", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["queue_name"], name: "index_solid_queue_pauses_on_queue_name", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_processes", force: :cascade do |t|
|
||||||
|
t.string "kind", null: false
|
||||||
|
t.datetime "last_heartbeat_at", null: false
|
||||||
|
t.bigint "supervisor_id"
|
||||||
|
t.integer "pid", null: false
|
||||||
|
t.string "hostname"
|
||||||
|
t.text "metadata"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.string "name", null: false
|
||||||
|
t.index ["last_heartbeat_at"], name: "index_solid_queue_processes_on_last_heartbeat_at"
|
||||||
|
t.index ["name", "supervisor_id"], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true
|
||||||
|
t.index ["supervisor_id"], name: "index_solid_queue_processes_on_supervisor_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_ready_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_ready_executions_on_job_id", unique: true
|
||||||
|
t.index ["priority", "job_id"], name: "index_solid_queue_poll_all"
|
||||||
|
t.index ["queue_name", "priority", "job_id"], name: "index_solid_queue_poll_by_queue"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_recurring_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "task_key", null: false
|
||||||
|
t.datetime "run_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
|
||||||
|
t.index ["task_key", "run_at"], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_recurring_tasks", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.string "schedule", null: false
|
||||||
|
t.string "command", limit: 2048
|
||||||
|
t.string "class_name"
|
||||||
|
t.text "arguments"
|
||||||
|
t.string "queue_name"
|
||||||
|
t.integer "priority", default: 0
|
||||||
|
t.boolean "static", default: true, null: false
|
||||||
|
t.text "description"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["key"], name: "index_solid_queue_recurring_tasks_on_key", unique: true
|
||||||
|
t.index ["static"], name: "index_solid_queue_recurring_tasks_on_static"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_scheduled_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "scheduled_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
|
||||||
|
t.index ["scheduled_at", "priority", "job_id"], name: "index_solid_queue_dispatch_all"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_semaphores", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.integer "value", default: 1, null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["expires_at"], name: "index_solid_queue_semaphores_on_expires_at"
|
||||||
|
t.index ["key", "value"], name: "index_solid_queue_semaphores_on_key_and_value"
|
||||||
|
t.index ["key"], name: "index_solid_queue_semaphores_on_key", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "teampointadjusts", force: :cascade do |t|
|
||||||
|
t.integer "points"
|
||||||
|
t.integer "wrestler_id"
|
||||||
|
t.datetime "created_at", precision: nil, null: false
|
||||||
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
|
t.integer "school_id"
|
||||||
|
t.index ["wrestler_id"], name: "index_teampointadjusts_on_wrestler_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "tournament_backups", force: :cascade do |t|
|
||||||
|
t.integer "tournament_id", null: false
|
||||||
|
t.text "backup_data", limit: 4294967295, null: false
|
||||||
|
t.string "backup_reason"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "tournament_delegates", force: :cascade do |t|
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.datetime "created_at", precision: nil, null: false
|
||||||
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "tournaments", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.string "address"
|
||||||
|
t.string "director"
|
||||||
|
t.string "director_email"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.text "tournament_type"
|
||||||
|
t.text "weigh_in_ref"
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "curently_generating_matches"
|
||||||
|
t.date "date"
|
||||||
|
t.boolean "is_public"
|
||||||
|
t.index ["user_id"], name: "index_tournaments_on_user_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "users", force: :cascade do |t|
|
||||||
|
t.string "email", default: "", null: false
|
||||||
|
t.string "encrypted_password", default: "", null: false
|
||||||
|
t.string "reset_password_token"
|
||||||
|
t.datetime "reset_password_sent_at", precision: nil
|
||||||
|
t.datetime "remember_created_at", precision: nil
|
||||||
|
t.integer "sign_in_count", default: 0, null: false
|
||||||
|
t.datetime "current_sign_in_at", precision: nil
|
||||||
|
t.datetime "last_sign_in_at", precision: nil
|
||||||
|
t.string "current_sign_in_ip"
|
||||||
|
t.string "last_sign_in_ip"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.string "password_digest"
|
||||||
|
t.string "reset_digest"
|
||||||
|
t.datetime "reset_sent_at", precision: nil
|
||||||
|
t.index ["email"], name: "index_users_on_email", unique: true
|
||||||
|
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "weights", force: :cascade do |t|
|
||||||
|
t.decimal "max", precision: 15, scale: 1
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.index ["tournament_id"], name: "index_weights_on_tournament_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "wrestlers", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.integer "school_id"
|
||||||
|
t.integer "weight_id"
|
||||||
|
t.integer "bracket_line"
|
||||||
|
t.integer "original_seed"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.integer "season_win"
|
||||||
|
t.integer "season_loss"
|
||||||
|
t.string "criteria"
|
||||||
|
t.boolean "extra"
|
||||||
|
t.decimal "offical_weight"
|
||||||
|
t.integer "pool"
|
||||||
|
t.integer "pool_placement"
|
||||||
|
t.string "pool_placement_tiebreaker"
|
||||||
|
t.index ["school_id"], name: "index_wrestlers_on_school_id"
|
||||||
|
t.index ["weight_id"], name: "index_wrestlers_on_weight_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
end
|
||||||
14
db/cache/migrate/20250404153535_add_solid_cache_tables.rb
vendored
Normal file
14
db/cache/migrate/20250404153535_add_solid_cache_tables.rb
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
class AddSolidCacheTables < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
create_table "solid_cache_entries", force: :cascade do |t|
|
||||||
|
t.binary "key", limit: 1024, null: false
|
||||||
|
t.binary "value", limit: 536870912, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.integer "key_hash", limit: 8, null: false
|
||||||
|
t.integer "byte_size", limit: 4, null: false
|
||||||
|
t.index ["byte_size"], name: "index_solid_cache_entries_on_byte_size"
|
||||||
|
t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
|
||||||
|
t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
315
db/cache_schema.rb
Normal file
315
db/cache_schema.rb
Normal file
@@ -0,0 +1,315 @@
|
|||||||
|
# This file is auto-generated from the current state of the database. Instead
|
||||||
|
# of editing this file, please use the migrations feature of Active Record to
|
||||||
|
# incrementally modify your database, and then regenerate this schema definition.
|
||||||
|
#
|
||||||
|
# This file is the source Rails uses to define your schema when running `bin/rails
|
||||||
|
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
||||||
|
# be faster and is potentially less error prone than running all of your
|
||||||
|
# migrations from scratch. Old migrations may fail to apply correctly if those
|
||||||
|
# migrations use external dependencies or application code.
|
||||||
|
#
|
||||||
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
|
ActiveRecord::Schema[8.0].define(version: 2025_04_05_160115) do
|
||||||
|
create_table "mat_assignment_rules", force: :cascade do |t|
|
||||||
|
t.integer "tournament_id", null: false
|
||||||
|
t.integer "mat_id", null: false
|
||||||
|
t.string "weight_classes"
|
||||||
|
t.string "bracket_positions"
|
||||||
|
t.string "rounds"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["mat_id"], name: "index_mat_assignment_rules_on_mat_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "matches", force: :cascade do |t|
|
||||||
|
t.integer "w1"
|
||||||
|
t.integer "w2"
|
||||||
|
t.text "w1_stat"
|
||||||
|
t.text "w2_stat"
|
||||||
|
t.integer "winner_id"
|
||||||
|
t.string "win_type"
|
||||||
|
t.string "score"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.integer "round"
|
||||||
|
t.integer "finished"
|
||||||
|
t.integer "bout_number"
|
||||||
|
t.integer "weight_id"
|
||||||
|
t.string "bracket_position"
|
||||||
|
t.integer "bracket_position_number"
|
||||||
|
t.string "loser1_name"
|
||||||
|
t.string "loser2_name"
|
||||||
|
t.integer "mat_id"
|
||||||
|
t.string "overtime_type"
|
||||||
|
t.datetime "finished_at"
|
||||||
|
t.index ["mat_id"], name: "index_matches_on_mat_id"
|
||||||
|
t.index ["tournament_id"], name: "index_matches_on_tournament_id"
|
||||||
|
t.index ["w1", "w2"], name: "index_matches_on_w1_and_w2"
|
||||||
|
t.index ["weight_id"], name: "index_matches_on_weight_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "mats", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.index ["tournament_id"], name: "index_mats_on_tournament_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "school_delegates", force: :cascade do |t|
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "school_id"
|
||||||
|
t.datetime "created_at", precision: nil, null: false
|
||||||
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "schools", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.decimal "score", precision: 15, scale: 1
|
||||||
|
t.string "permission_key"
|
||||||
|
t.index ["permission_key"], name: "index_schools_on_permission_key", unique: true
|
||||||
|
t.index ["tournament_id"], name: "index_schools_on_tournament_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_cable_messages", force: :cascade do |t|
|
||||||
|
t.binary "channel", limit: 1024, null: false
|
||||||
|
t.binary "payload", limit: 536870912, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.integer "channel_hash", limit: 8, null: false
|
||||||
|
t.index ["channel"], name: "index_solid_cable_messages_on_channel"
|
||||||
|
t.index ["channel_hash"], name: "index_solid_cable_messages_on_channel_hash"
|
||||||
|
t.index ["created_at"], name: "index_solid_cable_messages_on_created_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_cache_entries", force: :cascade do |t|
|
||||||
|
t.binary "key", limit: 1024, null: false
|
||||||
|
t.binary "value", limit: 536870912, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.integer "key_hash", limit: 8, null: false
|
||||||
|
t.integer "byte_size", limit: 4, null: false
|
||||||
|
t.index ["byte_size"], name: "index_solid_cache_entries_on_byte_size"
|
||||||
|
t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
|
||||||
|
t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "concurrency_key", null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["concurrency_key", "priority", "job_id"], name: "index_solid_queue_blocked_executions_for_release"
|
||||||
|
t.index ["expires_at", "concurrency_key"], name: "index_solid_queue_blocked_executions_for_maintenance"
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_claimed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.bigint "process_id"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
|
||||||
|
t.index ["process_id", "job_id"], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_failed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.text "error"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_failed_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_jobs", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.string "class_name", null: false
|
||||||
|
t.text "arguments"
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "active_job_id"
|
||||||
|
t.datetime "scheduled_at"
|
||||||
|
t.datetime "finished_at"
|
||||||
|
t.string "concurrency_key"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["active_job_id"], name: "index_solid_queue_jobs_on_active_job_id"
|
||||||
|
t.index ["class_name"], name: "index_solid_queue_jobs_on_class_name"
|
||||||
|
t.index ["finished_at"], name: "index_solid_queue_jobs_on_finished_at"
|
||||||
|
t.index ["queue_name", "finished_at"], name: "index_solid_queue_jobs_for_filtering"
|
||||||
|
t.index ["scheduled_at", "finished_at"], name: "index_solid_queue_jobs_for_alerting"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_pauses", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["queue_name"], name: "index_solid_queue_pauses_on_queue_name", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_processes", force: :cascade do |t|
|
||||||
|
t.string "kind", null: false
|
||||||
|
t.datetime "last_heartbeat_at", null: false
|
||||||
|
t.bigint "supervisor_id"
|
||||||
|
t.integer "pid", null: false
|
||||||
|
t.string "hostname"
|
||||||
|
t.text "metadata"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.string "name", null: false
|
||||||
|
t.index ["last_heartbeat_at"], name: "index_solid_queue_processes_on_last_heartbeat_at"
|
||||||
|
t.index ["name", "supervisor_id"], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true
|
||||||
|
t.index ["supervisor_id"], name: "index_solid_queue_processes_on_supervisor_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_ready_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_ready_executions_on_job_id", unique: true
|
||||||
|
t.index ["priority", "job_id"], name: "index_solid_queue_poll_all"
|
||||||
|
t.index ["queue_name", "priority", "job_id"], name: "index_solid_queue_poll_by_queue"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_recurring_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "task_key", null: false
|
||||||
|
t.datetime "run_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
|
||||||
|
t.index ["task_key", "run_at"], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_recurring_tasks", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.string "schedule", null: false
|
||||||
|
t.string "command", limit: 2048
|
||||||
|
t.string "class_name"
|
||||||
|
t.text "arguments"
|
||||||
|
t.string "queue_name"
|
||||||
|
t.integer "priority", default: 0
|
||||||
|
t.boolean "static", default: true, null: false
|
||||||
|
t.text "description"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["key"], name: "index_solid_queue_recurring_tasks_on_key", unique: true
|
||||||
|
t.index ["static"], name: "index_solid_queue_recurring_tasks_on_static"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_scheduled_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "scheduled_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
|
||||||
|
t.index ["scheduled_at", "priority", "job_id"], name: "index_solid_queue_dispatch_all"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_semaphores", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.integer "value", default: 1, null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["expires_at"], name: "index_solid_queue_semaphores_on_expires_at"
|
||||||
|
t.index ["key", "value"], name: "index_solid_queue_semaphores_on_key_and_value"
|
||||||
|
t.index ["key"], name: "index_solid_queue_semaphores_on_key", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "teampointadjusts", force: :cascade do |t|
|
||||||
|
t.integer "points"
|
||||||
|
t.integer "wrestler_id"
|
||||||
|
t.datetime "created_at", precision: nil, null: false
|
||||||
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
|
t.integer "school_id"
|
||||||
|
t.index ["wrestler_id"], name: "index_teampointadjusts_on_wrestler_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "tournament_backups", force: :cascade do |t|
|
||||||
|
t.integer "tournament_id", null: false
|
||||||
|
t.text "backup_data", limit: 4294967295, null: false
|
||||||
|
t.string "backup_reason"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "tournament_delegates", force: :cascade do |t|
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.datetime "created_at", precision: nil, null: false
|
||||||
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "tournaments", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.string "address"
|
||||||
|
t.string "director"
|
||||||
|
t.string "director_email"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.text "tournament_type"
|
||||||
|
t.text "weigh_in_ref"
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "curently_generating_matches"
|
||||||
|
t.date "date"
|
||||||
|
t.boolean "is_public"
|
||||||
|
t.index ["user_id"], name: "index_tournaments_on_user_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "users", force: :cascade do |t|
|
||||||
|
t.string "email", default: "", null: false
|
||||||
|
t.string "encrypted_password", default: "", null: false
|
||||||
|
t.string "reset_password_token"
|
||||||
|
t.datetime "reset_password_sent_at", precision: nil
|
||||||
|
t.datetime "remember_created_at", precision: nil
|
||||||
|
t.integer "sign_in_count", default: 0, null: false
|
||||||
|
t.datetime "current_sign_in_at", precision: nil
|
||||||
|
t.datetime "last_sign_in_at", precision: nil
|
||||||
|
t.string "current_sign_in_ip"
|
||||||
|
t.string "last_sign_in_ip"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.string "password_digest"
|
||||||
|
t.string "reset_digest"
|
||||||
|
t.datetime "reset_sent_at", precision: nil
|
||||||
|
t.index ["email"], name: "index_users_on_email", unique: true
|
||||||
|
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "weights", force: :cascade do |t|
|
||||||
|
t.decimal "max", precision: 15, scale: 1
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.index ["tournament_id"], name: "index_weights_on_tournament_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "wrestlers", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.integer "school_id"
|
||||||
|
t.integer "weight_id"
|
||||||
|
t.integer "bracket_line"
|
||||||
|
t.integer "original_seed"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.integer "season_win"
|
||||||
|
t.integer "season_loss"
|
||||||
|
t.string "criteria"
|
||||||
|
t.boolean "extra"
|
||||||
|
t.decimal "offical_weight"
|
||||||
|
t.integer "pool"
|
||||||
|
t.integer "pool_placement"
|
||||||
|
t.string "pool_placement_tiebreaker"
|
||||||
|
t.index ["school_id"], name: "index_wrestlers_on_school_id"
|
||||||
|
t.index ["weight_id"], name: "index_wrestlers_on_weight_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
end
|
||||||
32
db/migrate/20250405160115_remove_delayed_job.rb
Normal file
32
db/migrate/20250405160115_remove_delayed_job.rb
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
class RemoveDelayedJob < ActiveRecord::Migration[8.0]
|
||||||
|
def up
|
||||||
|
# Check if delayed_jobs table exists before trying to drop it
|
||||||
|
if table_exists?(:delayed_jobs)
|
||||||
|
drop_table :delayed_jobs
|
||||||
|
puts "Dropped delayed_jobs table"
|
||||||
|
else
|
||||||
|
puts "delayed_jobs table doesn't exist, skipping"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
# Recreate delayed_jobs table if needed in the future
|
||||||
|
create_table :delayed_jobs, force: true do |table|
|
||||||
|
table.integer :priority, default: 0, null: false
|
||||||
|
table.integer :attempts, default: 0, null: false
|
||||||
|
table.text :handler, limit: 4294967295
|
||||||
|
table.text :last_error
|
||||||
|
table.datetime :run_at, precision: nil
|
||||||
|
table.datetime :locked_at, precision: nil
|
||||||
|
table.datetime :failed_at, precision: nil
|
||||||
|
table.string :locked_by
|
||||||
|
table.string :queue
|
||||||
|
table.datetime :created_at, precision: nil
|
||||||
|
table.datetime :updated_at, precision: nil
|
||||||
|
table.integer :job_owner_id
|
||||||
|
table.string :job_owner_type
|
||||||
|
|
||||||
|
table.index [:priority, :run_at], name: "delayed_jobs_priority"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
21
db/migrate/2025040700001_add_password_digest_to_users.rb
Normal file
21
db/migrate/2025040700001_add_password_digest_to_users.rb
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
class AddPasswordDigestToUsers < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
# Add password_digest column if it doesn't already exist
|
||||||
|
add_column :users, :password_digest, :string unless column_exists?(:users, :password_digest)
|
||||||
|
|
||||||
|
# If we're migrating from Devise, we need to convert encrypted_password to password_digest
|
||||||
|
# This is a data migration that will preserve the passwords
|
||||||
|
reversible do |dir|
|
||||||
|
dir.up do
|
||||||
|
# Only perform if both columns exist
|
||||||
|
if column_exists?(:users, :encrypted_password) && column_exists?(:users, :password_digest)
|
||||||
|
execute <<-SQL
|
||||||
|
-- Copy over the encrypted_password to password_digest column for all users
|
||||||
|
-- Devise uses the same bcrypt format that has_secure_password expects
|
||||||
|
UPDATE users SET password_digest = encrypted_password WHERE password_digest IS NULL;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
6
db/migrate/2025040700002_add_reset_columns_to_users.rb
Normal file
6
db/migrate/2025040700002_add_reset_columns_to_users.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
class AddResetColumnsToUsers < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
add_column :users, :reset_digest, :string unless column_exists?(:users, :reset_digest)
|
||||||
|
add_column :users, :reset_sent_at, :datetime unless column_exists?(:users, :reset_sent_at)
|
||||||
|
end
|
||||||
|
end
|
||||||
144
db/queue/migrate/20250404153529_add_solid_queue_tables.rb
Normal file
144
db/queue/migrate/20250404153529_add_solid_queue_tables.rb
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
class AddSolidQueueTables < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
# Set MySQL engine to InnoDB for foreign key support
|
||||||
|
if connection.adapter_name =~ /mysql|maria/i
|
||||||
|
execute "SET FOREIGN_KEY_CHECKS=0;"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Create the main jobs table first
|
||||||
|
create_table "solid_queue_jobs", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.string "class_name", null: false
|
||||||
|
t.text "arguments"
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "active_job_id"
|
||||||
|
t.datetime "scheduled_at"
|
||||||
|
t.datetime "finished_at"
|
||||||
|
t.string "concurrency_key"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index [ "active_job_id" ], name: "index_solid_queue_jobs_on_active_job_id"
|
||||||
|
t.index [ "class_name" ], name: "index_solid_queue_jobs_on_class_name"
|
||||||
|
t.index [ "finished_at" ], name: "index_solid_queue_jobs_on_finished_at"
|
||||||
|
t.index [ "queue_name", "finished_at" ], name: "index_solid_queue_jobs_for_filtering"
|
||||||
|
t.index [ "scheduled_at", "finished_at" ], name: "index_solid_queue_jobs_for_alerting"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Then create all dependent tables
|
||||||
|
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "concurrency_key", null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "concurrency_key", "priority", "job_id" ], name: "index_solid_queue_blocked_executions_for_release"
|
||||||
|
t.index [ "expires_at", "concurrency_key" ], name: "index_solid_queue_blocked_executions_for_maintenance"
|
||||||
|
t.index [ "job_id" ], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_claimed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.bigint "process_id"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "job_id" ], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
|
||||||
|
t.index [ "process_id", "job_id" ], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_failed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.text "error"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "job_id" ], name: "index_solid_queue_failed_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_pauses", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "queue_name" ], name: "index_solid_queue_pauses_on_queue_name", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_processes", force: :cascade do |t|
|
||||||
|
t.string "kind", null: false
|
||||||
|
t.datetime "last_heartbeat_at", null: false
|
||||||
|
t.bigint "supervisor_id"
|
||||||
|
t.integer "pid", null: false
|
||||||
|
t.string "hostname"
|
||||||
|
t.text "metadata"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.string "name", null: false
|
||||||
|
t.index [ "last_heartbeat_at" ], name: "index_solid_queue_processes_on_last_heartbeat_at"
|
||||||
|
t.index [ "name", "supervisor_id" ], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true
|
||||||
|
t.index [ "supervisor_id" ], name: "index_solid_queue_processes_on_supervisor_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_ready_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "job_id" ], name: "index_solid_queue_ready_executions_on_job_id", unique: true
|
||||||
|
t.index [ "priority", "job_id" ], name: "index_solid_queue_poll_all"
|
||||||
|
t.index [ "queue_name", "priority", "job_id" ], name: "index_solid_queue_poll_by_queue"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_recurring_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "task_key", null: false
|
||||||
|
t.datetime "run_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "job_id" ], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
|
||||||
|
t.index [ "task_key", "run_at" ], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_recurring_tasks", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.string "schedule", null: false
|
||||||
|
t.string "command", limit: 2048
|
||||||
|
t.string "class_name"
|
||||||
|
t.text "arguments"
|
||||||
|
t.string "queue_name"
|
||||||
|
t.integer "priority", default: 0
|
||||||
|
t.boolean "static", default: true, null: false
|
||||||
|
t.text "description"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index [ "key" ], name: "index_solid_queue_recurring_tasks_on_key", unique: true
|
||||||
|
t.index [ "static" ], name: "index_solid_queue_recurring_tasks_on_static"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_scheduled_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "scheduled_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "job_id" ], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
|
||||||
|
t.index [ "scheduled_at", "priority", "job_id" ], name: "index_solid_queue_dispatch_all"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_semaphores", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.integer "value", default: 1, null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index [ "expires_at" ], name: "index_solid_queue_semaphores_on_expires_at"
|
||||||
|
t.index [ "key", "value" ], name: "index_solid_queue_semaphores_on_key_and_value"
|
||||||
|
t.index [ "key" ], name: "index_solid_queue_semaphores_on_key", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
# Add all foreign keys at the end
|
||||||
|
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
|
||||||
|
# Re-enable foreign key checks if needed
|
||||||
|
if connection.adapter_name =~ /mysql|maria/i
|
||||||
|
execute "SET FOREIGN_KEY_CHECKS=1;"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
315
db/queue_schema.rb
Normal file
315
db/queue_schema.rb
Normal file
@@ -0,0 +1,315 @@
|
|||||||
|
# This file is auto-generated from the current state of the database. Instead
|
||||||
|
# of editing this file, please use the migrations feature of Active Record to
|
||||||
|
# incrementally modify your database, and then regenerate this schema definition.
|
||||||
|
#
|
||||||
|
# This file is the source Rails uses to define your schema when running `bin/rails
|
||||||
|
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
||||||
|
# be faster and is potentially less error prone than running all of your
|
||||||
|
# migrations from scratch. Old migrations may fail to apply correctly if those
|
||||||
|
# migrations use external dependencies or application code.
|
||||||
|
#
|
||||||
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
|
ActiveRecord::Schema[8.0].define(version: 2025_04_05_160115) do
|
||||||
|
create_table "mat_assignment_rules", force: :cascade do |t|
|
||||||
|
t.integer "tournament_id", null: false
|
||||||
|
t.integer "mat_id", null: false
|
||||||
|
t.string "weight_classes"
|
||||||
|
t.string "bracket_positions"
|
||||||
|
t.string "rounds"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["mat_id"], name: "index_mat_assignment_rules_on_mat_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "matches", force: :cascade do |t|
|
||||||
|
t.integer "w1"
|
||||||
|
t.integer "w2"
|
||||||
|
t.text "w1_stat"
|
||||||
|
t.text "w2_stat"
|
||||||
|
t.integer "winner_id"
|
||||||
|
t.string "win_type"
|
||||||
|
t.string "score"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.integer "round"
|
||||||
|
t.integer "finished"
|
||||||
|
t.integer "bout_number"
|
||||||
|
t.integer "weight_id"
|
||||||
|
t.string "bracket_position"
|
||||||
|
t.integer "bracket_position_number"
|
||||||
|
t.string "loser1_name"
|
||||||
|
t.string "loser2_name"
|
||||||
|
t.integer "mat_id"
|
||||||
|
t.string "overtime_type"
|
||||||
|
t.datetime "finished_at"
|
||||||
|
t.index ["mat_id"], name: "index_matches_on_mat_id"
|
||||||
|
t.index ["tournament_id"], name: "index_matches_on_tournament_id"
|
||||||
|
t.index ["w1", "w2"], name: "index_matches_on_w1_and_w2"
|
||||||
|
t.index ["weight_id"], name: "index_matches_on_weight_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "mats", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.index ["tournament_id"], name: "index_mats_on_tournament_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "school_delegates", force: :cascade do |t|
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "school_id"
|
||||||
|
t.datetime "created_at", precision: nil, null: false
|
||||||
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "schools", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.decimal "score", precision: 15, scale: 1
|
||||||
|
t.string "permission_key"
|
||||||
|
t.index ["permission_key"], name: "index_schools_on_permission_key", unique: true
|
||||||
|
t.index ["tournament_id"], name: "index_schools_on_tournament_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_cable_messages", force: :cascade do |t|
|
||||||
|
t.binary "channel", limit: 1024, null: false
|
||||||
|
t.binary "payload", limit: 536870912, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.integer "channel_hash", limit: 8, null: false
|
||||||
|
t.index ["channel"], name: "index_solid_cable_messages_on_channel"
|
||||||
|
t.index ["channel_hash"], name: "index_solid_cable_messages_on_channel_hash"
|
||||||
|
t.index ["created_at"], name: "index_solid_cable_messages_on_created_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_cache_entries", force: :cascade do |t|
|
||||||
|
t.binary "key", limit: 1024, null: false
|
||||||
|
t.binary "value", limit: 536870912, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.integer "key_hash", limit: 8, null: false
|
||||||
|
t.integer "byte_size", limit: 4, null: false
|
||||||
|
t.index ["byte_size"], name: "index_solid_cache_entries_on_byte_size"
|
||||||
|
t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
|
||||||
|
t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "concurrency_key", null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["concurrency_key", "priority", "job_id"], name: "index_solid_queue_blocked_executions_for_release"
|
||||||
|
t.index ["expires_at", "concurrency_key"], name: "index_solid_queue_blocked_executions_for_maintenance"
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_claimed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.bigint "process_id"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
|
||||||
|
t.index ["process_id", "job_id"], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_failed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.text "error"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_failed_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_jobs", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.string "class_name", null: false
|
||||||
|
t.text "arguments"
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "active_job_id"
|
||||||
|
t.datetime "scheduled_at"
|
||||||
|
t.datetime "finished_at"
|
||||||
|
t.string "concurrency_key"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["active_job_id"], name: "index_solid_queue_jobs_on_active_job_id"
|
||||||
|
t.index ["class_name"], name: "index_solid_queue_jobs_on_class_name"
|
||||||
|
t.index ["finished_at"], name: "index_solid_queue_jobs_on_finished_at"
|
||||||
|
t.index ["queue_name", "finished_at"], name: "index_solid_queue_jobs_for_filtering"
|
||||||
|
t.index ["scheduled_at", "finished_at"], name: "index_solid_queue_jobs_for_alerting"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_pauses", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["queue_name"], name: "index_solid_queue_pauses_on_queue_name", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_processes", force: :cascade do |t|
|
||||||
|
t.string "kind", null: false
|
||||||
|
t.datetime "last_heartbeat_at", null: false
|
||||||
|
t.bigint "supervisor_id"
|
||||||
|
t.integer "pid", null: false
|
||||||
|
t.string "hostname"
|
||||||
|
t.text "metadata"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.string "name", null: false
|
||||||
|
t.index ["last_heartbeat_at"], name: "index_solid_queue_processes_on_last_heartbeat_at"
|
||||||
|
t.index ["name", "supervisor_id"], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true
|
||||||
|
t.index ["supervisor_id"], name: "index_solid_queue_processes_on_supervisor_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_ready_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_ready_executions_on_job_id", unique: true
|
||||||
|
t.index ["priority", "job_id"], name: "index_solid_queue_poll_all"
|
||||||
|
t.index ["queue_name", "priority", "job_id"], name: "index_solid_queue_poll_by_queue"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_recurring_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "task_key", null: false
|
||||||
|
t.datetime "run_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
|
||||||
|
t.index ["task_key", "run_at"], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_recurring_tasks", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.string "schedule", null: false
|
||||||
|
t.string "command", limit: 2048
|
||||||
|
t.string "class_name"
|
||||||
|
t.text "arguments"
|
||||||
|
t.string "queue_name"
|
||||||
|
t.integer "priority", default: 0
|
||||||
|
t.boolean "static", default: true, null: false
|
||||||
|
t.text "description"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["key"], name: "index_solid_queue_recurring_tasks_on_key", unique: true
|
||||||
|
t.index ["static"], name: "index_solid_queue_recurring_tasks_on_static"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_scheduled_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "scheduled_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
|
||||||
|
t.index ["scheduled_at", "priority", "job_id"], name: "index_solid_queue_dispatch_all"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_semaphores", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.integer "value", default: 1, null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["expires_at"], name: "index_solid_queue_semaphores_on_expires_at"
|
||||||
|
t.index ["key", "value"], name: "index_solid_queue_semaphores_on_key_and_value"
|
||||||
|
t.index ["key"], name: "index_solid_queue_semaphores_on_key", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "teampointadjusts", force: :cascade do |t|
|
||||||
|
t.integer "points"
|
||||||
|
t.integer "wrestler_id"
|
||||||
|
t.datetime "created_at", precision: nil, null: false
|
||||||
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
|
t.integer "school_id"
|
||||||
|
t.index ["wrestler_id"], name: "index_teampointadjusts_on_wrestler_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "tournament_backups", force: :cascade do |t|
|
||||||
|
t.integer "tournament_id", null: false
|
||||||
|
t.text "backup_data", limit: 4294967295, null: false
|
||||||
|
t.string "backup_reason"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "tournament_delegates", force: :cascade do |t|
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.datetime "created_at", precision: nil, null: false
|
||||||
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "tournaments", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.string "address"
|
||||||
|
t.string "director"
|
||||||
|
t.string "director_email"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.text "tournament_type"
|
||||||
|
t.text "weigh_in_ref"
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "curently_generating_matches"
|
||||||
|
t.date "date"
|
||||||
|
t.boolean "is_public"
|
||||||
|
t.index ["user_id"], name: "index_tournaments_on_user_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "users", force: :cascade do |t|
|
||||||
|
t.string "email", default: "", null: false
|
||||||
|
t.string "encrypted_password", default: "", null: false
|
||||||
|
t.string "reset_password_token"
|
||||||
|
t.datetime "reset_password_sent_at", precision: nil
|
||||||
|
t.datetime "remember_created_at", precision: nil
|
||||||
|
t.integer "sign_in_count", default: 0, null: false
|
||||||
|
t.datetime "current_sign_in_at", precision: nil
|
||||||
|
t.datetime "last_sign_in_at", precision: nil
|
||||||
|
t.string "current_sign_in_ip"
|
||||||
|
t.string "last_sign_in_ip"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.string "password_digest"
|
||||||
|
t.string "reset_digest"
|
||||||
|
t.datetime "reset_sent_at", precision: nil
|
||||||
|
t.index ["email"], name: "index_users_on_email", unique: true
|
||||||
|
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "weights", force: :cascade do |t|
|
||||||
|
t.decimal "max", precision: 15, scale: 1
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.integer "tournament_id"
|
||||||
|
t.index ["tournament_id"], name: "index_weights_on_tournament_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "wrestlers", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.integer "school_id"
|
||||||
|
t.integer "weight_id"
|
||||||
|
t.integer "bracket_line"
|
||||||
|
t.integer "original_seed"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.integer "season_win"
|
||||||
|
t.integer "season_loss"
|
||||||
|
t.string "criteria"
|
||||||
|
t.boolean "extra"
|
||||||
|
t.decimal "offical_weight"
|
||||||
|
t.integer "pool"
|
||||||
|
t.integer "pool_placement"
|
||||||
|
t.string "pool_placement_tiebreaker"
|
||||||
|
t.index ["school_id"], name: "index_wrestlers_on_school_id"
|
||||||
|
t.index ["weight_id"], name: "index_wrestlers_on_weight_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
end
|
||||||
171
db/schema.rb
171
db/schema.rb
@@ -10,24 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.2].define(version: 2025_01_30_172404) do
|
ActiveRecord::Schema[8.0].define(version: 2025_04_05_160115) do
|
||||||
create_table "delayed_jobs", force: :cascade do |t|
|
|
||||||
t.integer "priority", default: 0, null: false
|
|
||||||
t.integer "attempts", default: 0, null: false
|
|
||||||
t.text "handler", limit: 4294967295
|
|
||||||
t.text "last_error"
|
|
||||||
t.datetime "run_at", precision: nil
|
|
||||||
t.datetime "locked_at", precision: nil
|
|
||||||
t.datetime "failed_at", precision: nil
|
|
||||||
t.string "locked_by"
|
|
||||||
t.string "queue"
|
|
||||||
t.datetime "created_at", precision: nil
|
|
||||||
t.datetime "updated_at", precision: nil
|
|
||||||
t.integer "job_owner_id"
|
|
||||||
t.string "job_owner_type"
|
|
||||||
t.index ["priority", "run_at"], name: "delayed_jobs_priority"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "mat_assignment_rules", force: :cascade do |t|
|
create_table "mat_assignment_rules", force: :cascade do |t|
|
||||||
t.integer "tournament_id", null: false
|
t.integer "tournament_id", null: false
|
||||||
t.integer "mat_id", null: false
|
t.integer "mat_id", null: false
|
||||||
@@ -93,6 +76,148 @@ ActiveRecord::Schema[7.2].define(version: 2025_01_30_172404) do
|
|||||||
t.index ["tournament_id"], name: "index_schools_on_tournament_id"
|
t.index ["tournament_id"], name: "index_schools_on_tournament_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "solid_cable_messages", force: :cascade do |t|
|
||||||
|
t.binary "channel", limit: 1024, null: false
|
||||||
|
t.binary "payload", limit: 536870912, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.integer "channel_hash", limit: 8, null: false
|
||||||
|
t.index ["channel"], name: "index_solid_cable_messages_on_channel"
|
||||||
|
t.index ["channel_hash"], name: "index_solid_cable_messages_on_channel_hash"
|
||||||
|
t.index ["created_at"], name: "index_solid_cable_messages_on_created_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_cache_entries", force: :cascade do |t|
|
||||||
|
t.binary "key", limit: 1024, null: false
|
||||||
|
t.binary "value", limit: 536870912, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.integer "key_hash", limit: 8, null: false
|
||||||
|
t.integer "byte_size", limit: 4, null: false
|
||||||
|
t.index ["byte_size"], name: "index_solid_cache_entries_on_byte_size"
|
||||||
|
t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
|
||||||
|
t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "concurrency_key", null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["concurrency_key", "priority", "job_id"], name: "index_solid_queue_blocked_executions_for_release"
|
||||||
|
t.index ["expires_at", "concurrency_key"], name: "index_solid_queue_blocked_executions_for_maintenance"
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_claimed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.bigint "process_id"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
|
||||||
|
t.index ["process_id", "job_id"], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_failed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.text "error"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_failed_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_jobs", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.string "class_name", null: false
|
||||||
|
t.text "arguments"
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "active_job_id"
|
||||||
|
t.datetime "scheduled_at"
|
||||||
|
t.datetime "finished_at"
|
||||||
|
t.string "concurrency_key"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["active_job_id"], name: "index_solid_queue_jobs_on_active_job_id"
|
||||||
|
t.index ["class_name"], name: "index_solid_queue_jobs_on_class_name"
|
||||||
|
t.index ["finished_at"], name: "index_solid_queue_jobs_on_finished_at"
|
||||||
|
t.index ["queue_name", "finished_at"], name: "index_solid_queue_jobs_for_filtering"
|
||||||
|
t.index ["scheduled_at", "finished_at"], name: "index_solid_queue_jobs_for_alerting"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_pauses", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["queue_name"], name: "index_solid_queue_pauses_on_queue_name", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_processes", force: :cascade do |t|
|
||||||
|
t.string "kind", null: false
|
||||||
|
t.datetime "last_heartbeat_at", null: false
|
||||||
|
t.bigint "supervisor_id"
|
||||||
|
t.integer "pid", null: false
|
||||||
|
t.string "hostname"
|
||||||
|
t.text "metadata"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.string "name", null: false
|
||||||
|
t.index ["last_heartbeat_at"], name: "index_solid_queue_processes_on_last_heartbeat_at"
|
||||||
|
t.index ["name", "supervisor_id"], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true
|
||||||
|
t.index ["supervisor_id"], name: "index_solid_queue_processes_on_supervisor_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_ready_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_ready_executions_on_job_id", unique: true
|
||||||
|
t.index ["priority", "job_id"], name: "index_solid_queue_poll_all"
|
||||||
|
t.index ["queue_name", "priority", "job_id"], name: "index_solid_queue_poll_by_queue"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_recurring_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "task_key", null: false
|
||||||
|
t.datetime "run_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
|
||||||
|
t.index ["task_key", "run_at"], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_recurring_tasks", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.string "schedule", null: false
|
||||||
|
t.string "command", limit: 2048
|
||||||
|
t.string "class_name"
|
||||||
|
t.text "arguments"
|
||||||
|
t.string "queue_name"
|
||||||
|
t.integer "priority", default: 0
|
||||||
|
t.boolean "static", default: true, null: false
|
||||||
|
t.text "description"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["key"], name: "index_solid_queue_recurring_tasks_on_key", unique: true
|
||||||
|
t.index ["static"], name: "index_solid_queue_recurring_tasks_on_static"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_scheduled_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "scheduled_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
|
||||||
|
t.index ["scheduled_at", "priority", "job_id"], name: "index_solid_queue_dispatch_all"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_semaphores", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.integer "value", default: 1, null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["expires_at"], name: "index_solid_queue_semaphores_on_expires_at"
|
||||||
|
t.index ["key", "value"], name: "index_solid_queue_semaphores_on_key_and_value"
|
||||||
|
t.index ["key"], name: "index_solid_queue_semaphores_on_key", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
create_table "teampointadjusts", force: :cascade do |t|
|
create_table "teampointadjusts", force: :cascade do |t|
|
||||||
t.integer "points"
|
t.integer "points"
|
||||||
t.integer "wrestler_id"
|
t.integer "wrestler_id"
|
||||||
@@ -146,6 +271,9 @@ ActiveRecord::Schema[7.2].define(version: 2025_01_30_172404) do
|
|||||||
t.string "last_sign_in_ip"
|
t.string "last_sign_in_ip"
|
||||||
t.datetime "created_at", precision: nil
|
t.datetime "created_at", precision: nil
|
||||||
t.datetime "updated_at", precision: nil
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.string "password_digest"
|
||||||
|
t.string "reset_digest"
|
||||||
|
t.datetime "reset_sent_at", precision: nil
|
||||||
t.index ["email"], name: "index_users_on_email", unique: true
|
t.index ["email"], name: "index_users_on_email", unique: true
|
||||||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||||
end
|
end
|
||||||
@@ -177,4 +305,11 @@ ActiveRecord::Schema[7.2].define(version: 2025_01_30_172404) do
|
|||||||
t.index ["school_id"], name: "index_wrestlers_on_school_id"
|
t.index ["school_id"], name: "index_wrestlers_on_school_id"
|
||||||
t.index ["weight_id"], name: "index_wrestlers_on_weight_id"
|
t.index ["weight_id"], name: "index_wrestlers_on_weight_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
project_dir="$(dirname $( dirname $(readlink -f ${BASH_SOURCE[0]})))"
|
project_dir="$(dirname $( dirname $(readlink -f ${BASH_SOURCE[0]})))"
|
||||||
RAM_KB=$(grep MemTotal /proc/meminfo | awk '{print $2}')
|
|
||||||
RAM_MB=$(expr $RAM_KB / 1024)
|
|
||||||
RAM_GB=$(expr $RAM_MB / 1024)
|
|
||||||
RAM_WITHOUT_OTHER_SERVICES=$(expr $RAM_MB - 1024) # other services use ~1024MB of RAM
|
|
||||||
PASSENGER_POOL_FACTOR=$(expr $RAM_WITHOUT_OTHER_SERVICES / 256) # 1 pool worker uses ~256MB of RAM
|
|
||||||
export PASSENGER_POOL_SIZE=$(expr $PASSENGER_POOL_FACTOR '*' 1)
|
|
||||||
|
|
||||||
#docker build -t wrestlingdev:test -f ${project_dir}/deploy/rails-prod-Dockerfile ${project_dir}
|
#docker build -t wrestlingdev:test -f ${project_dir}/deploy/rails-prod-Dockerfile ${project_dir}
|
||||||
docker-compose -f ${project_dir}/deploy/docker-compose-test.yml kill
|
docker-compose -f ${project_dir}/deploy/docker-compose-test.yml kill
|
||||||
@@ -13,6 +7,7 @@ docker-compose -f ${project_dir}/deploy/docker-compose-test.yml build
|
|||||||
docker-compose -f ${project_dir}/deploy/docker-compose-test.yml up -d
|
docker-compose -f ${project_dir}/deploy/docker-compose-test.yml up -d
|
||||||
sleep 30s
|
sleep 30s
|
||||||
# echo Make sure your local mysql database has a wrestlingtourney db
|
# echo Make sure your local mysql database has a wrestlingtourney db
|
||||||
|
# docker-compose -f ${project_dir}/deploy/docker-compose-test.yml exec -T app bash -c "DISABLE_DATABASE_ENVIRONMENT_CHECK=1 rake db:drop"
|
||||||
docker-compose -f ${project_dir}/deploy/docker-compose-test.yml exec -T app rake db:create
|
docker-compose -f ${project_dir}/deploy/docker-compose-test.yml exec -T app rake db:create
|
||||||
docker-compose -f ${project_dir}/deploy/docker-compose-test.yml exec -T app rake db:migrate
|
docker-compose -f ${project_dir}/deploy/docker-compose-test.yml exec -T app rake db:migrate
|
||||||
|
|
||||||
|
|||||||
@@ -21,14 +21,13 @@ services:
|
|||||||
- WRESTLINGDEV_DB_PWD=password
|
- WRESTLINGDEV_DB_PWD=password
|
||||||
- WRESTLINGDEV_DB_HOST=db
|
- WRESTLINGDEV_DB_HOST=db
|
||||||
- WRESTLINGDEV_DB_PORT=3306
|
- WRESTLINGDEV_DB_PORT=3306
|
||||||
- MEMCACHIER_SERVERS=memcached:11211
|
|
||||||
- MEMCACHIER_PASSWORD=
|
|
||||||
- WRESTLINGDEV_DEVISE_SECRET_KEY=2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa
|
- WRESTLINGDEV_DEVISE_SECRET_KEY=2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa
|
||||||
- WRESTLINGDEV_SECRET_KEY_BASE=077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2
|
- WRESTLINGDEV_SECRET_KEY_BASE=077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2
|
||||||
- WRESTLINGDEV_INFLUXDB_DATABASE=wrestlingdev
|
- WRESTLINGDEV_INFLUXDB_DATABASE=wrestlingdev
|
||||||
- WRESTLINGDEV_INFLUXDB_HOST=influxdb
|
- WRESTLINGDEV_INFLUXDB_HOST=influxdb
|
||||||
- WRESTLINGDEV_INFLUXDB_PORT=8086
|
- WRESTLINGDEV_INFLUXDB_PORT=8086
|
||||||
- PASSENGER_POOL_SIZE=${PASSENGER_POOL_SIZE}
|
- PASSENGER_POOL_SIZE=${PASSENGER_POOL_SIZE}
|
||||||
|
- SOLID_QUEUE_IN_PUMA=true
|
||||||
networks:
|
networks:
|
||||||
database:
|
database:
|
||||||
caching:
|
caching:
|
||||||
@@ -58,30 +57,6 @@ services:
|
|||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
|
|
||||||
worker:
|
|
||||||
image: wrestlingdev
|
|
||||||
environment:
|
|
||||||
- RAILS_ENV=production
|
|
||||||
- WRESTLINGDEV_DB_NAME=wrestlingtourney
|
|
||||||
- WRESTLINGDEV_DB_USR=root
|
|
||||||
- WRESTLINGDEV_DB_PWD=password
|
|
||||||
- WRESTLINGDEV_DB_HOST=db
|
|
||||||
- WRESTLINGDEV_DB_PORT=3306
|
|
||||||
- MEMCACHIER_SERVERS=memcached:11211
|
|
||||||
- MEMCACHIER_PASSWORD=
|
|
||||||
- WRESTLINGDEV_DEVISE_SECRET_KEY=2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa
|
|
||||||
- WRESTLINGDEV_SECRET_KEY_BASE=077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2
|
|
||||||
- WRESTLINGDEV_INFLUXDB_DATABASE=wrestlingdev
|
|
||||||
- WRESTLINGDEV_INFLUXDB_HOST=influxdb
|
|
||||||
- WRESTLINGDEV_INFLUXDB_PORT=8086
|
|
||||||
- PASSENGER_POOL_SIZE=${PASSENGER_POOL_SIZE}
|
|
||||||
networks:
|
|
||||||
database:
|
|
||||||
caching:
|
|
||||||
metrics:
|
|
||||||
restart: always
|
|
||||||
command: bundle exec bin/delayed_job -n 1 run
|
|
||||||
|
|
||||||
influxdb:
|
influxdb:
|
||||||
image: influxdb:1.8-alpine
|
image: influxdb:1.8-alpine
|
||||||
environment:
|
environment:
|
||||||
@@ -92,10 +67,3 @@ services:
|
|||||||
metrics:
|
metrics:
|
||||||
volumes:
|
volumes:
|
||||||
- influxdb:/var/lib/influxdb
|
- influxdb:/var/lib/influxdb
|
||||||
|
|
||||||
memcached:
|
|
||||||
image: memcached:1.5
|
|
||||||
mem_limit: "64000000"
|
|
||||||
restart: always
|
|
||||||
networks:
|
|
||||||
caching:
|
|
||||||
@@ -11,7 +11,7 @@ spec:
|
|||||||
image: jcwimer/wrestlingdev:prod
|
image: jcwimer/wrestlingdev:prod
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
command: ["/bin/sh","-c"]
|
command: ["/bin/sh","-c"]
|
||||||
args: ["bundle exec rake db:create; bundle exec rake db:migrate"]
|
args: ["bundle exec rake db:create; bundle exec rake db:migrate;"]
|
||||||
env:
|
env:
|
||||||
- name: RAILS_ENV
|
- name: RAILS_ENV
|
||||||
value: production
|
value: production
|
||||||
|
|||||||
@@ -13,16 +13,20 @@ spec:
|
|||||||
clusterIP: None
|
clusterIP: None
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
# Use a statefulset instead of a deployment because we need to have a unique identity for each pod
|
||||||
|
# for solid queue to work properly and solid queue is running with puma threads
|
||||||
|
kind: StatefulSet
|
||||||
metadata:
|
metadata:
|
||||||
name: wrestlingdev-app-deployment
|
name: wrestlingdev-app
|
||||||
labels:
|
labels:
|
||||||
app: wrestlingdev
|
app: wrestlingdev
|
||||||
spec:
|
spec:
|
||||||
replicas: 2
|
replicas: 2
|
||||||
|
serviceName: wrestlingdev-app
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: wrestlingdev
|
app: wrestlingdev
|
||||||
|
tier: frontend
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -34,12 +38,16 @@ spec:
|
|||||||
image: jcwimer/wrestlingdev:prod
|
image: jcwimer/wrestlingdev:prod
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
command: ["bundle"]
|
command: ["bundle"]
|
||||||
args: ["exec", "passenger", "start", "-p", "80", "--max-pool-size", "2","--environment", "production"]
|
args: ["exec", "rails", "server", "-e", "production", "-p", "80", "-b", "0.0.0.0"]
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
env:
|
env:
|
||||||
- name: RAILS_ENV
|
- name: RAILS_ENV
|
||||||
value: production
|
value: production
|
||||||
|
- name: SOLID_QUEUE_IN_PUMA
|
||||||
|
value: "true"
|
||||||
|
- name: REVERSE_PROXY_SSL_TERMINATION
|
||||||
|
value: "true"
|
||||||
- name: PASSENGER_POOL_SIZE
|
- name: PASSENGER_POOL_SIZE
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
@@ -135,94 +143,4 @@ spec:
|
|||||||
# resource:
|
# resource:
|
||||||
# name: memory
|
# name: memory
|
||||||
# targetAverageValue: 100Mi
|
# targetAverageValue: 100Mi
|
||||||
---
|
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: StatefulSet
|
|
||||||
metadata:
|
|
||||||
name: wrestlingdev-worker
|
|
||||||
labels:
|
|
||||||
app: wrestlingdev
|
|
||||||
spec:
|
|
||||||
replicas: 2
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: wrestlingdev
|
|
||||||
serviceName: wrestlingdev-worker
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: wrestlingdev
|
|
||||||
tier: worker
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: wrestlingdev-worker
|
|
||||||
image: jcwimer/wrestlingdev:prod
|
|
||||||
imagePullPolicy: Always
|
|
||||||
env:
|
|
||||||
- name: RAILS_ENV
|
|
||||||
value: production
|
|
||||||
- name: WRESTLINGDEV_DB_NAME
|
|
||||||
value: wrestlingdev
|
|
||||||
- name: WRESTLINGDEV_DB_USR
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: wrestlingdev-secrets
|
|
||||||
key: dbusername
|
|
||||||
- name: WRESTLINGDEV_DB_PWD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: wrestlingdev-secrets
|
|
||||||
key: dbpassword
|
|
||||||
- name: WRESTLINGDEV_DB_PORT
|
|
||||||
value: "3306"
|
|
||||||
- name: MEMCACHIER_SERVERS
|
|
||||||
value: wrestlingdev-memcached:11211
|
|
||||||
- name: WRESTLINGDEV_DB_HOST
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: wrestlingdev-secrets
|
|
||||||
key: dbhost
|
|
||||||
- name: WRESTLINGDEV_DEVISE_SECRET_KEY
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: wrestlingdev-secrets
|
|
||||||
key: devisesecretkey
|
|
||||||
- name: WRESTLINGDEV_SECRET_KEY_BASE
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: wrestlingdev-secrets
|
|
||||||
key: railssecretkey
|
|
||||||
- name: WRESTLINGDEV_EMAIL_PWD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: wrestlingdev-secrets
|
|
||||||
key: gmailpassword
|
|
||||||
- name: WRESTLINGDEV_EMAIL
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: wrestlingdev-secrets
|
|
||||||
key: gmailemail
|
|
||||||
- name: WRESTLINGDEV_INFLUXDB_DATABASE
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: wrestlingdev-secrets
|
|
||||||
key: influxdb_database
|
|
||||||
- name: WRESTLINGDEV_INFLUXDB_HOST
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: wrestlingdev-secrets
|
|
||||||
key: influxdb_hostname
|
|
||||||
- name: WRESTLINGDEV_INFLUXDB_PORT
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: wrestlingdev-secrets
|
|
||||||
key: influxdb_port
|
|
||||||
command: ["bundle"]
|
|
||||||
args: ["exec", "bin/delayed_job", "-n", "1", "run"]
|
|
||||||
# resources:
|
|
||||||
# limits:
|
|
||||||
# memory: "512Mi"
|
|
||||||
# requests:
|
|
||||||
# memory: "200Mi"
|
|
||||||
# cpu: "0.2"
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
FROM ruby:3.2.0
|
FROM ruby:3.2.0
|
||||||
|
|
||||||
|
# Accept build arguments for user/group IDs
|
||||||
|
ARG USER_ID=1000
|
||||||
|
ARG GROUP_ID=1000
|
||||||
|
|
||||||
RUN apt-get -qq update \
|
RUN apt-get -qq update \
|
||||||
&& apt-get -qq install -y \
|
&& apt-get -qq install -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
@@ -17,21 +21,62 @@ RUN echo "America/New_York" > /etc/timezone \
|
|||||||
&& rm /etc/localtime \
|
&& rm /etc/localtime \
|
||||||
&& ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
|
&& ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
|
||||||
|
|
||||||
RUN echo 'gem: --no-rdoc --no-ri' > /root/.gemrc
|
# Install gems as root first
|
||||||
RUN gem install bundler
|
RUN gem install bundler
|
||||||
RUN gem update --system
|
RUN gem update --system
|
||||||
|
|
||||||
|
# Add Gemfile before creating user (still as root)
|
||||||
ADD Gemfile* /tmp/
|
ADD Gemfile* /tmp/
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
RUN bundle config set without 'production'
|
|
||||||
RUN bundle install --jobs 4
|
|
||||||
|
|
||||||
RUN mkdir /rails
|
# Create a non-root user with the provided user/group IDs
|
||||||
|
# Use existing group if GID already exists
|
||||||
|
RUN if grep -q ":${GROUP_ID}:" /etc/group; then \
|
||||||
|
GROUP_NAME=$(getent group ${GROUP_ID} | cut -d: -f1); \
|
||||||
|
else \
|
||||||
|
GROUP_NAME=devuser; \
|
||||||
|
groupadd -g $GROUP_ID $GROUP_NAME; \
|
||||||
|
fi && \
|
||||||
|
useradd -u $USER_ID -g $GROUP_ID -m -s /bin/bash devuser \
|
||||||
|
&& echo "devuser ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/devuser \
|
||||||
|
&& chmod 0440 /etc/sudoers.d/devuser
|
||||||
|
|
||||||
|
# Now that user exists, set up permissions
|
||||||
|
RUN echo 'gem: --no-rdoc --no-ri' > /home/devuser/.gemrc \
|
||||||
|
&& mkdir -p /home/devuser/.bundle \
|
||||||
|
&& chown -R ${USER_ID}:${GROUP_ID} /home/devuser /tmp/Gemfile* \
|
||||||
|
&& chmod -R 777 /usr/local/bundle
|
||||||
|
|
||||||
|
# Switch to the non-root user for all subsequent commands
|
||||||
|
USER devuser
|
||||||
|
|
||||||
|
# Pre-install gems from Gemfile
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN bundle config set --local without 'production' && \
|
||||||
|
bundle install --jobs 4
|
||||||
|
|
||||||
|
# Create the rails directory with correct ownership
|
||||||
|
RUN sudo mkdir -p /rails && sudo chown ${USER_ID}:${GROUP_ID} /rails
|
||||||
WORKDIR /rails
|
WORKDIR /rails
|
||||||
|
|
||||||
ADD . /rails
|
# Add helper script to initialize the project
|
||||||
|
RUN echo '#!/bin/bash\n\
|
||||||
|
if [ ! -f "bin/rails" ]; then\n\
|
||||||
|
echo "Setting up Rails binstubs..."\n\
|
||||||
|
bundle binstubs --all\n\
|
||||||
|
echo "Rails setup complete. You can now use bin/rails."\n\
|
||||||
|
else\n\
|
||||||
|
echo "Rails binstubs already exist."\n\
|
||||||
|
fi\n\
|
||||||
|
exec "$@"\n\
|
||||||
|
' > /home/devuser/init_rails.sh \
|
||||||
|
&& chmod +x /home/devuser/init_rails.sh
|
||||||
|
|
||||||
VOLUME ["/rails"]
|
VOLUME ["/rails"]
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
ENV SOLID_QUEUE_IN_PUMA=true
|
||||||
|
|
||||||
CMD /bin/bash
|
# Use the init script as entrypoint
|
||||||
|
ENTRYPOINT ["/home/devuser/init_rails.sh"]
|
||||||
|
CMD ["/bin/bash"]
|
||||||
|
|||||||
@@ -52,10 +52,8 @@ EXPOSE 443
|
|||||||
# Tini solves the zombie PID problem
|
# Tini solves the zombie PID problem
|
||||||
ENTRYPOINT ["/tini", "--"]
|
ENTRYPOINT ["/tini", "--"]
|
||||||
|
|
||||||
CMD bundle exec passenger start --max-pool-size ${PASSENGER_POOL_SIZE} --min-instances ${PASSENGER_POOL_SIZE} --environment production -p 80
|
# Enable Solid Queue to run inside Puma
|
||||||
# Higher max pool uses more ram
|
ENV SOLID_QUEUE_IN_PUMA=true
|
||||||
# Followed recommendation from: https://blog.phusion.nl/2015/11/10/heroku-and-passenger-focus-on-the-app-performance/
|
|
||||||
|
|
||||||
#CMD bundle exec puma -w 3 -t 5:5 -b 'tcp://0.0.0.0:80' -e production
|
# Use rails server instead of Puma directly to ensure Rails environment is loaded
|
||||||
#CMD bundle exec puma -w 3 -t 5:5 -b 'ssl://0.0.0.0:443?key=/ssl/server.key&verify_mode=none&cert=/ssl/server.crt' -e production
|
CMD bundle exec rails server -e production -p 80 -b '0.0.0.0'
|
||||||
#CMD bundle exec passenger start --max-pool-size 3 --environment production --ssl --ssl-certificate /ssl/server.crt --ssl-certificate-key /ssl/server.key
|
|
||||||
|
|||||||
35
lib/tasks/auth_migration.rake
Normal file
35
lib/tasks/auth_migration.rake
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
namespace :auth do
|
||||||
|
desc "Migrate from Devise to Rails Authentication"
|
||||||
|
task migrate: :environment do
|
||||||
|
puts "Running Authentication Migration"
|
||||||
|
puts "================================"
|
||||||
|
|
||||||
|
# Run the migrations
|
||||||
|
Rake::Task["db:migrate"].invoke
|
||||||
|
|
||||||
|
# Ensure all existing users have a password_digest value
|
||||||
|
users_without_digest = User.where(password_digest: nil)
|
||||||
|
|
||||||
|
if users_without_digest.any?
|
||||||
|
puts "Setting password_digest for #{users_without_digest.count} users..."
|
||||||
|
|
||||||
|
ActiveRecord::Base.transaction do
|
||||||
|
users_without_digest.each do |user|
|
||||||
|
if user.encrypted_password.present?
|
||||||
|
# Copy Devise's encrypted_password to password_digest
|
||||||
|
# This works because both use bcrypt in the same format
|
||||||
|
user.update_column(:password_digest, user.encrypted_password)
|
||||||
|
print "."
|
||||||
|
else
|
||||||
|
puts "\nWARNING: User #{user.id} (#{user.email}) has no encrypted_password!"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
puts "\nDone!"
|
||||||
|
else
|
||||||
|
puts "All users already have a password_digest."
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "Migration complete."
|
||||||
|
end
|
||||||
|
end
|
||||||
506
lib/tasks/job_testing.rake
Normal file
506
lib/tasks/job_testing.rake
Normal file
@@ -0,0 +1,506 @@
|
|||||||
|
namespace :jobs do
|
||||||
|
desc "Create a test running job for the first tournament"
|
||||||
|
task create_running: :environment do
|
||||||
|
# Find the first tournament
|
||||||
|
tournament = Tournament.first
|
||||||
|
|
||||||
|
unless tournament
|
||||||
|
puts "No tournaments found. Please create a tournament first."
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# Create a process record
|
||||||
|
process = SolidQueue::Process.create!(
|
||||||
|
kind: 'worker',
|
||||||
|
last_heartbeat_at: Time.now,
|
||||||
|
pid: Process.pid,
|
||||||
|
name: 'test_worker',
|
||||||
|
created_at: Time.now,
|
||||||
|
hostname: 'test'
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create a job for the tournament
|
||||||
|
job = SolidQueue::Job.create!(
|
||||||
|
queue_name: 'default',
|
||||||
|
class_name: 'TournamentBackupJob',
|
||||||
|
arguments: JSON.generate([tournament.id, "Test job", tournament.id, "Test running job"]),
|
||||||
|
priority: 0,
|
||||||
|
active_job_id: SecureRandom.uuid,
|
||||||
|
created_at: Time.now,
|
||||||
|
updated_at: Time.now,
|
||||||
|
job_owner_id: tournament.id,
|
||||||
|
job_owner_type: "Test running job"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create a claimed execution to mark it as running
|
||||||
|
SolidQueue::ClaimedExecution.create!(
|
||||||
|
job_id: job.id,
|
||||||
|
process_id: process.id,
|
||||||
|
created_at: Time.now
|
||||||
|
)
|
||||||
|
|
||||||
|
puts "Created running job for tournament #{tournament.id} - #{tournament.name}"
|
||||||
|
puts "Job ID: #{job.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Create a test completed job for the first tournament"
|
||||||
|
task create_completed: :environment do
|
||||||
|
# Find the first tournament
|
||||||
|
tournament = Tournament.first
|
||||||
|
|
||||||
|
unless tournament
|
||||||
|
puts "No tournaments found. Please create a tournament first."
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# Create a job for the tournament
|
||||||
|
job = SolidQueue::Job.create!(
|
||||||
|
queue_name: 'default',
|
||||||
|
class_name: 'TournamentBackupJob',
|
||||||
|
arguments: JSON.generate([tournament.id, "Test job", tournament.id, "Test completed job"]),
|
||||||
|
priority: 0,
|
||||||
|
active_job_id: SecureRandom.uuid,
|
||||||
|
created_at: Time.now,
|
||||||
|
updated_at: Time.now,
|
||||||
|
finished_at: Time.now - 5.minutes,
|
||||||
|
job_owner_id: tournament.id,
|
||||||
|
job_owner_type: "Test completed job"
|
||||||
|
)
|
||||||
|
|
||||||
|
puts "Created completed job for tournament #{tournament.id} - #{tournament.name}"
|
||||||
|
puts "Job ID: #{job.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Create a test failed job for the first tournament"
|
||||||
|
task create_failed: :environment do
|
||||||
|
# Find the first tournament
|
||||||
|
tournament = Tournament.first
|
||||||
|
|
||||||
|
unless tournament
|
||||||
|
puts "No tournaments found. Please create a tournament first."
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# Create a job for the tournament
|
||||||
|
job = SolidQueue::Job.create!(
|
||||||
|
queue_name: 'default',
|
||||||
|
class_name: 'TournamentBackupJob',
|
||||||
|
arguments: JSON.generate([tournament.id, "Test job", tournament.id, "Test failed job"]),
|
||||||
|
priority: 0,
|
||||||
|
active_job_id: SecureRandom.uuid,
|
||||||
|
created_at: Time.now,
|
||||||
|
updated_at: Time.now,
|
||||||
|
finished_at: Time.now - 5.minutes,
|
||||||
|
job_owner_id: tournament.id,
|
||||||
|
job_owner_type: "Test failed job"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create a failed execution record
|
||||||
|
SolidQueue::FailedExecution.create!(
|
||||||
|
job_id: job.id,
|
||||||
|
error: "Test error message",
|
||||||
|
created_at: Time.now
|
||||||
|
)
|
||||||
|
|
||||||
|
puts "Created failed job for tournament #{tournament.id} - #{tournament.name}"
|
||||||
|
puts "Job ID: #{job.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Test job owner metadata persistence"
|
||||||
|
task test_metadata: :environment do
|
||||||
|
# Find the first tournament
|
||||||
|
tournament = Tournament.first
|
||||||
|
|
||||||
|
unless tournament
|
||||||
|
puts "No tournaments found. Please create a tournament first."
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# Create a job with the new method
|
||||||
|
puts "Creating a test job with job_owner_id: #{tournament.id} and job_owner_type: 'Test metadata job'"
|
||||||
|
|
||||||
|
# Create a direct ActiveJob
|
||||||
|
job = TournamentBackupJob.new(tournament, "Test metadata job")
|
||||||
|
job.job_owner_id = tournament.id
|
||||||
|
job.job_owner_type = "Test metadata job"
|
||||||
|
|
||||||
|
# Enqueue it
|
||||||
|
job_id = job.enqueue
|
||||||
|
|
||||||
|
# Wait a moment for it to be saved
|
||||||
|
sleep(1)
|
||||||
|
|
||||||
|
# Find the job in SolidQueue
|
||||||
|
sq_job = SolidQueue::Job.find_by(active_job_id: job.job_id)
|
||||||
|
|
||||||
|
if sq_job
|
||||||
|
puts "Job created and found in SolidQueue table:"
|
||||||
|
puts " ID: #{sq_job.id}"
|
||||||
|
puts " Active Job ID: #{sq_job.active_job_id}"
|
||||||
|
|
||||||
|
# Extract metadata
|
||||||
|
begin
|
||||||
|
job_data = JSON.parse(sq_job.serialized_arguments)
|
||||||
|
puts " Raw serialized_arguments: #{sq_job.serialized_arguments}"
|
||||||
|
|
||||||
|
if job_data.is_a?(Hash) && job_data["job_data"]
|
||||||
|
puts " Job data found:"
|
||||||
|
puts " job_owner_id: #{job_data["job_data"]["job_owner_id"]}"
|
||||||
|
puts " job_owner_type: #{job_data["job_data"]["job_owner_type"]}"
|
||||||
|
else
|
||||||
|
puts " No job_data found in serialized arguments"
|
||||||
|
end
|
||||||
|
rescue JSON::ParserError
|
||||||
|
puts " Error parsing serialized arguments: #{sq_job.serialized_arguments}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test the metadata method
|
||||||
|
metadata = SolidQueueJobExtensions.instance_methods.include?(:metadata) ?
|
||||||
|
sq_job.metadata :
|
||||||
|
"metadata method not available"
|
||||||
|
puts " Metadata method result: #{metadata.inspect}"
|
||||||
|
|
||||||
|
# Test the individual accessors
|
||||||
|
if SolidQueueJobExtensions.instance_methods.include?(:job_owner_id) &&
|
||||||
|
SolidQueueJobExtensions.instance_methods.include?(:job_owner_type)
|
||||||
|
puts " job_owner_id method: #{sq_job.job_owner_id}"
|
||||||
|
puts " job_owner_type method: #{sq_job.job_owner_type}"
|
||||||
|
else
|
||||||
|
puts " Job owner accessor methods not available"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
puts "Job not found in SolidQueue table. Check for errors."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Check existing job metadata"
|
||||||
|
task check_jobs: :environment do
|
||||||
|
puts "Checking existing jobs in SolidQueue table"
|
||||||
|
|
||||||
|
# Find recent jobs
|
||||||
|
jobs = SolidQueue::Job.order(created_at: :desc).limit(5)
|
||||||
|
|
||||||
|
if jobs.empty?
|
||||||
|
puts "No jobs found in SolidQueue table."
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "Found #{jobs.count} jobs:"
|
||||||
|
|
||||||
|
jobs.each_with_index do |job, index|
|
||||||
|
puts "\nJob ##{index + 1}:"
|
||||||
|
puts " ID: #{job.id}"
|
||||||
|
puts " Class: #{job.class_name}"
|
||||||
|
puts " Created at: #{job.created_at}"
|
||||||
|
|
||||||
|
# Display the raw serialized arguments
|
||||||
|
puts " Raw arguments:"
|
||||||
|
puts " #{job.arguments.to_s[0..200]}..."
|
||||||
|
|
||||||
|
# Parse the serialized arguments to extract relevant parts
|
||||||
|
begin
|
||||||
|
args_data = job.arguments.is_a?(Hash) ? job.arguments : JSON.parse(job.arguments)
|
||||||
|
if args_data.is_a?(Hash) && args_data["arguments"].is_a?(Array)
|
||||||
|
puts " Arguments array:"
|
||||||
|
args_data["arguments"].each_with_index do |arg, i|
|
||||||
|
puts " [#{i}]: #{arg.inspect}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rescue JSON::ParserError
|
||||||
|
puts " Error: Could not parse arguments"
|
||||||
|
rescue => e
|
||||||
|
puts " Error: #{e.message}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test the metadata extraction method
|
||||||
|
metadata = job.respond_to?(:metadata) ? job.metadata : nil
|
||||||
|
puts " Extracted metadata: #{metadata.inspect}"
|
||||||
|
|
||||||
|
if job.respond_to?(:job_owner_id) && job.respond_to?(:job_owner_type)
|
||||||
|
puts " job_owner_id: #{job.job_owner_id}"
|
||||||
|
puts " job_owner_type: #{job.job_owner_type}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Test create a tournament backup job with metadata"
|
||||||
|
task create_test_backup_job: :environment do
|
||||||
|
puts "Creating a test TournamentBackupJob with job owner metadata"
|
||||||
|
|
||||||
|
# Find a tournament to use
|
||||||
|
tournament = Tournament.first
|
||||||
|
|
||||||
|
if tournament.nil?
|
||||||
|
puts "No tournament found in the database. Creating a test tournament."
|
||||||
|
tournament = Tournament.create!(name: "Test Tournament", tournament_type: 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "Using tournament ##{tournament.id}: #{tournament.name}"
|
||||||
|
|
||||||
|
# Set test job owner metadata
|
||||||
|
job_owner_id = 999
|
||||||
|
job_owner_type = "Test Backup Creation"
|
||||||
|
|
||||||
|
# Create the job with owner metadata
|
||||||
|
job = TournamentBackupJob.perform_later(tournament, "Test backup", job_owner_id, job_owner_type)
|
||||||
|
puts "Created job with ID: #{job.job_id}"
|
||||||
|
|
||||||
|
# Retrieve the job from the database to verify metadata
|
||||||
|
puts "\nChecking job in the database:"
|
||||||
|
sleep(1) # Give a moment for the job to be persisted
|
||||||
|
|
||||||
|
solid_job = SolidQueue::Job.order(created_at: :desc).first
|
||||||
|
|
||||||
|
if solid_job
|
||||||
|
puts "Found job ##{solid_job.id} (#{solid_job.class_name})"
|
||||||
|
|
||||||
|
begin
|
||||||
|
# Parse the arguments
|
||||||
|
arg_data = solid_job.arguments
|
||||||
|
if arg_data.is_a?(String)
|
||||||
|
begin
|
||||||
|
arg_data = JSON.parse(arg_data)
|
||||||
|
rescue JSON::ParserError => e
|
||||||
|
puts "Failed to parse arguments as JSON: #{e.message}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if arg_data.is_a?(Hash) && arg_data["arguments"].is_a?(Array)
|
||||||
|
puts "Arguments:"
|
||||||
|
arg_data["arguments"].each_with_index do |arg, i|
|
||||||
|
puts " [#{i}]: #{arg.inspect.truncate(100)}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Check if we can extract metadata
|
||||||
|
metadata = solid_job.metadata rescue nil
|
||||||
|
if metadata
|
||||||
|
puts "Extracted metadata: #{metadata.inspect}"
|
||||||
|
puts "job_owner_id: #{metadata['job_owner_id']}"
|
||||||
|
puts "job_owner_type: #{metadata['job_owner_type']}"
|
||||||
|
else
|
||||||
|
puts "No metadata method available"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
puts "No arguments array found in job data"
|
||||||
|
end
|
||||||
|
rescue => e
|
||||||
|
puts "Error inspecting job: #{e.message}"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
puts "No job found in the database"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Debug tournament job detection for a specific tournament"
|
||||||
|
task debug_tournament_jobs: :environment do
|
||||||
|
tournament_id = ENV['TOURNAMENT_ID']
|
||||||
|
|
||||||
|
if tournament_id.blank?
|
||||||
|
puts "Usage: rake jobs:debug_tournament_jobs TOURNAMENT_ID=123"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
tournament = Tournament.find_by(id: tournament_id)
|
||||||
|
|
||||||
|
if tournament.nil?
|
||||||
|
puts "Tournament not found with id: #{tournament_id}"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "== Debugging job detection for Tournament ##{tournament.id}: #{tournament.name} =="
|
||||||
|
|
||||||
|
# Get all jobs
|
||||||
|
all_jobs = SolidQueue::Job.all
|
||||||
|
puts "Total jobs in system: #{all_jobs.count}"
|
||||||
|
|
||||||
|
# Test each condition independently to see which jobs match
|
||||||
|
condition1_jobs = all_jobs.select do |job|
|
||||||
|
if job.respond_to?(:job_owner_id) && job.job_owner_id.present?
|
||||||
|
job.job_owner_id.to_s == tournament.id.to_s
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
condition2_jobs = all_jobs.select do |job|
|
||||||
|
if job.respond_to?(:metadata)
|
||||||
|
metadata = job.metadata
|
||||||
|
metadata["job_owner_id"].present? && metadata["job_owner_id"].to_s == tournament.id.to_s
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
condition3_jobs = all_jobs.select do |job|
|
||||||
|
if job.arguments.present?
|
||||||
|
begin
|
||||||
|
args_data = job.arguments.is_a?(Hash) ? job.arguments : JSON.parse(job.arguments.to_s)
|
||||||
|
if args_data.is_a?(Hash) && args_data["arguments"].is_a?(Array) && args_data["arguments"][0].present?
|
||||||
|
args_data["arguments"][0].to_s == tournament.id.to_s
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
rescue
|
||||||
|
false
|
||||||
|
end
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "Jobs matching condition 1 (direct job_owner_id): #{condition1_jobs.count}"
|
||||||
|
puts "Jobs matching condition 2 (metadata method): #{condition2_jobs.count}"
|
||||||
|
puts "Jobs matching condition 3 (first argument): #{condition3_jobs.count}"
|
||||||
|
|
||||||
|
# Test the actual method
|
||||||
|
tournament_jobs = tournament.deferred_jobs
|
||||||
|
puts "Jobs returned by tournament.deferred_jobs: #{tournament_jobs.count}"
|
||||||
|
|
||||||
|
# Show details about each job
|
||||||
|
if tournament_jobs.any?
|
||||||
|
puts "\nDetails of jobs found by tournament.deferred_jobs:"
|
||||||
|
tournament_jobs.each_with_index do |job, index|
|
||||||
|
puts "\nJob ##{index + 1} (ID: #{job.id}):"
|
||||||
|
puts " Class: #{job.class_name}"
|
||||||
|
|
||||||
|
# Try to get metadata
|
||||||
|
if job.respond_to?(:metadata)
|
||||||
|
metadata = job.metadata
|
||||||
|
puts " Metadata: #{metadata.inspect}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Display raw arguments
|
||||||
|
begin
|
||||||
|
if job.arguments.is_a?(String) && job.arguments.present?
|
||||||
|
parsed = JSON.parse(job.arguments)
|
||||||
|
args = parsed["arguments"] if parsed.is_a?(Hash)
|
||||||
|
puts " Arguments: #{args.inspect}" if args
|
||||||
|
elsif job.arguments.is_a?(Hash) && job.arguments["arguments"].present?
|
||||||
|
puts " Arguments: #{job.arguments["arguments"].inspect}"
|
||||||
|
end
|
||||||
|
rescue => e
|
||||||
|
puts " Error parsing arguments: #{e.message}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Scan all jobs to detect job owner IDs"
|
||||||
|
task scan_jobs: :environment do
|
||||||
|
puts "Scanning all SolidQueue jobs to detect job owner information"
|
||||||
|
|
||||||
|
all_jobs = SolidQueue::Job.all.order(created_at: :desc)
|
||||||
|
puts "Found #{all_jobs.count} total jobs"
|
||||||
|
|
||||||
|
# Group by job type
|
||||||
|
job_types = all_jobs.group_by(&:class_name)
|
||||||
|
puts "\nJobs by type:"
|
||||||
|
job_types.each do |type, jobs|
|
||||||
|
puts " #{type}: #{jobs.count} jobs"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Go through each job and extract job owner info
|
||||||
|
owner_info = {}
|
||||||
|
|
||||||
|
all_jobs.each do |job|
|
||||||
|
owner_id = nil
|
||||||
|
owner_type = nil
|
||||||
|
tournament_id = nil
|
||||||
|
|
||||||
|
# Method 1: Check direct job_owner_id attribute
|
||||||
|
if job.respond_to?(:job_owner_id) && job.job_owner_id.present?
|
||||||
|
owner_id = job.job_owner_id
|
||||||
|
end
|
||||||
|
|
||||||
|
# Method 2: Check metadata method
|
||||||
|
if job.respond_to?(:metadata)
|
||||||
|
metadata = job.metadata
|
||||||
|
if metadata.is_a?(Hash) && metadata["job_owner_id"].present?
|
||||||
|
owner_id ||= metadata["job_owner_id"]
|
||||||
|
owner_type = metadata["job_owner_type"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Method 3: Extract tournament ID from the arguments
|
||||||
|
if job.arguments.present?
|
||||||
|
arg_data = job.arguments
|
||||||
|
|
||||||
|
# Handle hash arguments
|
||||||
|
if arg_data.is_a?(Hash) && arg_data["arguments"].is_a?(Array) && arg_data["arguments"].first.present?
|
||||||
|
first_arg = arg_data["arguments"].first
|
||||||
|
|
||||||
|
# Check if the first argument is a Tournament global ID
|
||||||
|
if first_arg.is_a?(Hash) && first_arg["_aj_globalid"].present?
|
||||||
|
global_id = first_arg["_aj_globalid"]
|
||||||
|
if global_id.to_s.include?("/Tournament/")
|
||||||
|
tournament_id = global_id.to_s.split("/Tournament/").last
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# Direct ID - assume it's a tournament ID
|
||||||
|
tournament_id = first_arg.to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# If it's a string, try to parse
|
||||||
|
if arg_data.is_a?(String)
|
||||||
|
begin
|
||||||
|
parsed = JSON.parse(arg_data)
|
||||||
|
if parsed.is_a?(Hash) && parsed["arguments"].is_a?(Array) && parsed["arguments"].first.present?
|
||||||
|
first_arg = parsed["arguments"].first
|
||||||
|
|
||||||
|
# Check if the first argument is a Tournament global ID
|
||||||
|
if first_arg.is_a?(Hash) && first_arg["_aj_globalid"].present?
|
||||||
|
global_id = first_arg["_aj_globalid"]
|
||||||
|
if global_id.to_s.include?("/Tournament/")
|
||||||
|
tournament_id = global_id.to_s.split("/Tournament/").last
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# Direct ID - assume it's a tournament ID
|
||||||
|
tournament_id = first_arg.to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rescue
|
||||||
|
# Ignore parsing errors
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Record what we found
|
||||||
|
owner_info[job.id] = {
|
||||||
|
job_id: job.id,
|
||||||
|
class_name: job.class_name,
|
||||||
|
owner_id: owner_id,
|
||||||
|
owner_type: owner_type,
|
||||||
|
tournament_id: tournament_id,
|
||||||
|
created_at: job.created_at
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Group by tournament ID
|
||||||
|
tournament_groups = owner_info.values.group_by { |info| info[:tournament_id] }
|
||||||
|
|
||||||
|
puts "\nJobs by tournament ID:"
|
||||||
|
tournament_groups.each do |tournament_id, jobs|
|
||||||
|
next if tournament_id.nil?
|
||||||
|
tournament = Tournament.find_by(id: tournament_id) rescue nil
|
||||||
|
tournament_name = tournament ? tournament.name : "Unknown"
|
||||||
|
puts " Tournament ##{tournament_id} (#{tournament_name}): #{jobs.count} jobs"
|
||||||
|
|
||||||
|
# Sample job details
|
||||||
|
sample = jobs.first
|
||||||
|
puts " Sample job: #{sample[:class_name]} (ID: #{sample[:job_id]})"
|
||||||
|
puts " Created at: #{sample[:created_at]}"
|
||||||
|
puts " Owner ID: #{sample[:owner_id]}"
|
||||||
|
puts " Owner Type: #{sample[:owner_type]}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Orphaned jobs
|
||||||
|
orphaned = owner_info.values.select { |info| info[:tournament_id].nil? }
|
||||||
|
if orphaned.any?
|
||||||
|
puts "\nOrphaned jobs (no tournament ID detected): #{orphaned.count} jobs"
|
||||||
|
orphaned.first(5).each do |job|
|
||||||
|
puts " #{job[:class_name]} (ID: #{job[:job_id]}) created at #{job[:created_at]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
114
public/400.html
Normal file
114
public/400.html
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
<!doctype html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<title>The server cannot process the request due to a client error (400 Bad Request)</title>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="initial-scale=1, width=device-width">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
*, *::before, *::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: #FFF;
|
||||||
|
color: #261B23;
|
||||||
|
display: grid;
|
||||||
|
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
|
font-size: clamp(1rem, 2.5vw, 2rem);
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
letter-spacing: -0.0025em;
|
||||||
|
line-height: 1.4;
|
||||||
|
min-height: 100vh;
|
||||||
|
place-items: center;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
font-weight: 700;
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 0.0925em;
|
||||||
|
}
|
||||||
|
|
||||||
|
b, strong {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
i, em {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
display: grid;
|
||||||
|
gap: 1em;
|
||||||
|
padding: 2em;
|
||||||
|
place-items: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
main header {
|
||||||
|
width: min(100%, 12em);
|
||||||
|
}
|
||||||
|
|
||||||
|
main header svg {
|
||||||
|
height: auto;
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
main article {
|
||||||
|
width: min(100%, 30em);
|
||||||
|
}
|
||||||
|
|
||||||
|
main article p {
|
||||||
|
font-size: 75%;
|
||||||
|
}
|
||||||
|
|
||||||
|
main article br {
|
||||||
|
|
||||||
|
display: none;
|
||||||
|
|
||||||
|
@media(min-width: 48em) {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- This file lives in public/400.html -->
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<header>
|
||||||
|
<svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm140.456 133.2831c-40.823 0-64.884-35.146-64.884-85.7015 0-50.5554 24.061-85.700907 64.884-85.700907 40.822 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.062 85.7015-64.884 85.7015zm0-133.2831c-17.573 0-22.71 21.8984-22.71 47.5816 0 25.6835 5.137 47.5815 22.71 47.5815 17.302 0 22.709-21.898 22.709-47.5815 0-25.6832-5.407-47.5816-22.709-47.5816z" fill="#f0eff0"/><path d="m123.606 85.4445c3.212 1.0523 5.538 4.2089 5.538 8.0301 0 6.1472-4.209 9.5254-11.298 9.5254h-15.617v-34.0033h14.565c7.089 0 11.353 3.1566 11.353 9.2484 0 3.6551-2.049 6.3134-4.541 7.1994zm-12.904-2.9905h5.095c2.603 0 3.988-.9968 3.988-3.1013 0-2.1044-1.385-3.0459-3.988-3.0459h-5.095zm0 6.6456v6.5902h5.981c2.492 0 3.877-1.3291 3.877-3.2674 0-2.049-1.385-3.3228-3.877-3.3228zm43.786 13.9004h-8.362v-1.274c-.831.831-3.323 1.717-5.981 1.717-4.929 0-9.083-2.769-9.083-8.0301 0-4.818 4.154-7.9193 9.581-7.9193 2.049 0 4.486.6646 5.483 1.3845v-1.606c0-1.606-.942-2.9905-3.046-2.9905-1.606 0-2.548.7199-2.935 1.8275h-8.197c.72-4.8181 4.985-8.6393 11.409-8.6393 7.088 0 11.131 3.7659 11.131 10.2453zm-8.362-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.434.7199-3.434 2.3813 0 1.7168 1.717 2.4367 3.434 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm27.996 6.9779v-1.994c-1.163 1.329-3.599 2.548-6.147 2.548-7.199 0-11.131-5.8151-11.131-13.0145s3.932-13.0143 11.131-13.0143c2.548 0 4.984 1.2184 6.147 2.5475v-13.0697h8.695v35.997zm0-9.1931v-6.5902c-.664-1.3291-2.159-2.326-3.821-2.326-2.99 0-4.763 2.4368-4.763 5.6488s1.773 5.5934 4.763 5.5934c1.717 0 3.157-.9415 3.821-2.326zm35.471-2.049h-3.101v11.2421h-8.806v-34.0033h15.285c7.31 0 12.35 4.1535 12.35 11.5744 0 5.1503-2.603 8.6947-6.757 10.2453l7.975 12.1836h-9.858zm-3.101-15.2849v8.1962h5.538c3.156 0 4.596-1.606 4.596-4.0981s-1.44-4.0981-4.596-4.0981zm36.957 17.8323h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm30.98 27.5234v-10.799c-1.163 1.329-3.6 2.548-6.147 2.548-7.2 0-11.132-5.9259-11.132-13.0145 0-7.144 3.932-13.0143 11.132-13.0143 2.547 0 4.984 1.2184 6.147 2.5475v-1.9937h8.695v33.726zm0-17.9981v-6.5902c-.665-1.3291-2.105-2.326-3.821-2.326-2.991 0-4.763 2.4368-4.763 5.6488s1.772 5.5934 4.763 5.5934c1.661 0 3.156-.9415 3.821-2.326zm36.789-15.7279v24.921h-8.695v-2.16c-1.329 1.551-3.821 2.714-6.646 2.714-5.482 0-8.75-3.5999-8.75-9.1379v-16.3371h8.64v14.288c0 2.1045.996 3.5997 3.212 3.5997 1.606 0 3.101-1.0522 3.544-2.769v-15.1187zm19.084 16.2263h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.963 5.095 11.963 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm13.428 11.0206h8.474c.387 1.3845 1.606 2.1598 3.156 2.1598 1.44 0 2.548-.5538 2.548-1.7168 0-.9414-.72-1.2737-1.939-1.5506l-4.873-.9969c-4.154-.886-6.867-2.8797-6.867-7.2547 0-5.3165 4.762-8.4178 10.633-8.4178 6.812 0 10.522 3.1567 11.297 8.0855h-8.03c-.277-1.0522-1.052-1.9937-3.046-1.9937-1.273 0-2.326.5538-2.326 1.6614 0 .7753.554 1.163 1.717 1.3845l4.929 1.163c4.541 1.0522 6.978 3.4335 6.978 7.4763 0 5.3168-4.818 8.2518-10.91 8.2518-6.369 0-10.965-2.88-11.741-8.2518zm27.538-.8861v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.993-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.871 0-9.193-2.769-9.193-9.0819z" fill="#d30001"/></svg>
|
||||||
|
</header>
|
||||||
|
<article>
|
||||||
|
<p><strong>The server cannot process the request due to a client error.</strong> Please check the request and try again. If you’re the application owner check the logs for more information.</p>
|
||||||
|
</article>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
162
public/404.html
162
public/404.html
@@ -1,58 +1,114 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>The page you were looking for doesn't exist (404)</title>
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
background-color: #EFEFEF;
|
|
||||||
color: #2E2F30;
|
|
||||||
text-align: center;
|
|
||||||
font-family: arial, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.dialog {
|
<html lang="en">
|
||||||
width: 25em;
|
|
||||||
margin: 4em auto 0 auto;
|
|
||||||
border: 1px solid #CCC;
|
|
||||||
border-right-color: #999;
|
|
||||||
border-left-color: #999;
|
|
||||||
border-bottom-color: #BBB;
|
|
||||||
border-top: #B00100 solid 4px;
|
|
||||||
border-top-left-radius: 9px;
|
|
||||||
border-top-right-radius: 9px;
|
|
||||||
background-color: white;
|
|
||||||
padding: 7px 4em 0 4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
<head>
|
||||||
font-size: 100%;
|
|
||||||
color: #730E15;
|
|
||||||
line-height: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
body > p {
|
<title>The page you were looking for doesn’t exist (404 Not found)</title>
|
||||||
width: 33em;
|
|
||||||
margin: 0 auto 1em;
|
<meta charset="utf-8">
|
||||||
padding: 1em 0;
|
<meta name="viewport" content="initial-scale=1, width=device-width">
|
||||||
background-color: #F7F7F7;
|
<meta name="robots" content="noindex, nofollow">
|
||||||
border: 1px solid #CCC;
|
|
||||||
border-right-color: #999;
|
<style>
|
||||||
border-bottom-color: #999;
|
|
||||||
border-bottom-left-radius: 4px;
|
*, *::before, *::after {
|
||||||
border-bottom-right-radius: 4px;
|
box-sizing: border-box;
|
||||||
border-top-color: #DADADA;
|
}
|
||||||
color: #666;
|
|
||||||
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
* {
|
||||||
}
|
margin: 0;
|
||||||
</style>
|
}
|
||||||
</head>
|
|
||||||
|
html {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: #FFF;
|
||||||
|
color: #261B23;
|
||||||
|
display: grid;
|
||||||
|
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
|
font-size: clamp(1rem, 2.5vw, 2rem);
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
letter-spacing: -0.0025em;
|
||||||
|
line-height: 1.4;
|
||||||
|
min-height: 100vh;
|
||||||
|
place-items: center;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
font-weight: 700;
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 0.0925em;
|
||||||
|
}
|
||||||
|
|
||||||
|
b, strong {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
i, em {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
display: grid;
|
||||||
|
gap: 1em;
|
||||||
|
padding: 2em;
|
||||||
|
place-items: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
main header {
|
||||||
|
width: min(100%, 12em);
|
||||||
|
}
|
||||||
|
|
||||||
|
main header svg {
|
||||||
|
height: auto;
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
main article {
|
||||||
|
width: min(100%, 30em);
|
||||||
|
}
|
||||||
|
|
||||||
|
main article p {
|
||||||
|
font-size: 75%;
|
||||||
|
}
|
||||||
|
|
||||||
|
main article br {
|
||||||
|
|
||||||
|
display: none;
|
||||||
|
|
||||||
|
@media(min-width: 48em) {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- This file lives in public/404.html -->
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<header>
|
||||||
|
<svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm165.328-35.41581-45.689 100.02991h26.224v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.184v-31.901l50.285-103.27391z" fill="#f0eff0"/><path d="m157.758 68.9967v34.0033h-7.199l-14.233-19.8814v19.8814h-8.584v-34.0033h8.307l13.125 18.7184v-18.7184zm28.454 21.5428c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.528 0c0-3.4336-1.496-5.8703-4.209-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.209-2.3813 4.209-5.8149zm13.184 3.8766v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm37.027 8.5839h-8.806v-34.0033h23.924v7.6978h-15.118v6.7564h13.9v7.5316h-13.9zm41.876-12.4605c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm35.337-12.4605v24.921h-8.695v-2.16c-1.329 1.551-3.821 2.714-6.646 2.714-5.482 0-8.75-3.5999-8.75-9.1379v-16.3371h8.64v14.288c0 2.1045.997 3.5997 3.212 3.5997 1.606 0 3.101-1.0522 3.544-2.769v-15.1187zm4.076 24.921v-24.921h8.694v2.1598c1.385-1.5506 3.822-2.7136 6.701-2.7136 5.538 0 8.806 3.5997 8.806 9.1377v16.3371h-8.639v-14.2327c0-2.049-1.053-3.5443-3.268-3.5443-1.717 0-3.156.9969-3.6 2.7136v15.0634zm44.113 0v-1.994c-1.163 1.329-3.6 2.548-6.147 2.548-7.2 0-11.132-5.8151-11.132-13.0145s3.932-13.0143 11.132-13.0143c2.547 0 4.984 1.2184 6.147 2.5475v-13.0697h8.695v35.997zm0-9.1931v-6.5902c-.665-1.3291-2.16-2.326-3.821-2.326-2.991 0-4.763 2.4368-4.763 5.6488s1.772 5.5934 4.763 5.5934c1.717 0 3.156-.9415 3.821-2.326z" fill="#d30001"/></svg>
|
||||||
|
</header>
|
||||||
|
<article>
|
||||||
|
<p><strong>The page you were looking for doesn’t exist.</strong> You may have mistyped the address or the page may have moved. If you’re the application owner check the logs for more information.</p>
|
||||||
|
</article>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
<body>
|
|
||||||
<!-- This file lives in public/404.html -->
|
|
||||||
<div class="dialog">
|
|
||||||
<h1>The page you were looking for doesn't exist.</h1>
|
|
||||||
<p>You may have mistyped the address or the page may have moved.</p>
|
|
||||||
</div>
|
|
||||||
<p>If you are the application owner check the logs for more information.</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,66 +1,114 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Your browser is not supported (406)</title>
|
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
||||||
<style>
|
|
||||||
.rails-default-error-page {
|
|
||||||
background-color: #EFEFEF;
|
|
||||||
color: #2E2F30;
|
|
||||||
text-align: center;
|
|
||||||
font-family: arial, sans-serif;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rails-default-error-page div.dialog {
|
<html lang="en">
|
||||||
width: 95%;
|
|
||||||
max-width: 33em;
|
|
||||||
margin: 4em auto 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rails-default-error-page div.dialog > div {
|
<head>
|
||||||
border: 1px solid #CCC;
|
|
||||||
border-right-color: #999;
|
|
||||||
border-left-color: #999;
|
|
||||||
border-bottom-color: #BBB;
|
|
||||||
border-top: #B00100 solid 4px;
|
|
||||||
border-top-left-radius: 9px;
|
|
||||||
border-top-right-radius: 9px;
|
|
||||||
background-color: white;
|
|
||||||
padding: 7px 12% 0;
|
|
||||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
||||||
}
|
|
||||||
|
|
||||||
.rails-default-error-page h1 {
|
<title>Your browser is not supported (406 Not Acceptable)</title>
|
||||||
font-size: 100%;
|
|
||||||
color: #730E15;
|
|
||||||
line-height: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rails-default-error-page div.dialog > p {
|
<meta charset="utf-8">
|
||||||
margin: 0 0 1em;
|
<meta name="viewport" content="initial-scale=1, width=device-width">
|
||||||
padding: 1em;
|
<meta name="robots" content="noindex, nofollow">
|
||||||
background-color: #F7F7F7;
|
|
||||||
border: 1px solid #CCC;
|
<style>
|
||||||
border-right-color: #999;
|
|
||||||
border-left-color: #999;
|
*, *::before, *::after {
|
||||||
border-bottom-color: #999;
|
box-sizing: border-box;
|
||||||
border-bottom-left-radius: 4px;
|
}
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
border-top-color: #DADADA;
|
* {
|
||||||
color: #666;
|
margin: 0;
|
||||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
}
|
||||||
}
|
|
||||||
</style>
|
html {
|
||||||
</head>
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: #FFF;
|
||||||
|
color: #261B23;
|
||||||
|
display: grid;
|
||||||
|
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
|
font-size: clamp(1rem, 2.5vw, 2rem);
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
letter-spacing: -0.0025em;
|
||||||
|
line-height: 1.4;
|
||||||
|
min-height: 100vh;
|
||||||
|
place-items: center;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
font-weight: 700;
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 0.0925em;
|
||||||
|
}
|
||||||
|
|
||||||
|
b, strong {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
i, em {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
display: grid;
|
||||||
|
gap: 1em;
|
||||||
|
padding: 2em;
|
||||||
|
place-items: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
main header {
|
||||||
|
width: min(100%, 12em);
|
||||||
|
}
|
||||||
|
|
||||||
|
main header svg {
|
||||||
|
height: auto;
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
main article {
|
||||||
|
width: min(100%, 30em);
|
||||||
|
}
|
||||||
|
|
||||||
|
main article p {
|
||||||
|
font-size: 75%;
|
||||||
|
}
|
||||||
|
|
||||||
|
main article br {
|
||||||
|
|
||||||
|
display: none;
|
||||||
|
|
||||||
|
@media(min-width: 48em) {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- This file lives in public/406-unsupported-browser.html -->
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<header>
|
||||||
|
<svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm202.906 9.7326h-41.093c-2.433-7.2994-7.84-12.4361-17.302-12.4361-16.221 0-25.413 17.5728-25.954 34.8752v1.3517c5.137-7.0291 16.221-12.4361 30.82-12.4361 33.524 0 54.881 24.0612 54.881 53.7998 0 33.253-23.791 58.396-61.64 58.396-21.628 0-39.741-10.003-50.825-27.576-9.733-14.599-13.788-32.442-13.788-54.3406 0-51.9072 24.331-89.485807 66.236-89.485807 32.712 0 53.258 18.654107 58.665 47.851907zm-82.727 66.2355c0 13.247 9.463 22.439 22.71 22.439 12.977 0 22.439-9.192 22.439-22.439 0-13.517-9.462-22.7091-22.439-22.7091-13.247 0-22.71 9.1921-22.71 22.7091z" fill="#f0eff0"/><path d="m100.761 68.9967v34.0033h-7.1991l-14.2326-19.8814v19.8814h-8.5839v-34.0033h8.307l13.125 18.7184v-18.7184zm28.454 21.5428c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm13.185 3.8766v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm39.02-25.4194h9.083l12.958 34.0033h-9.027l-2.436-6.5902h-12.35l-2.381 6.5902h-8.806zm4.431 10.5222-3.489 9.5807h6.978zm17.44 11.0206c0-7.6978 5.095-13.0143 12.572-13.0143 6.701 0 10.854 3.9874 11.574 9.8023h-8.418c-.221-1.4953-1.384-2.6029-3.156-2.6029-2.437 0-3.988 2.2706-3.988 5.8149s1.551 5.7595 3.988 5.7595c1.772 0 2.935-1.0522 3.156-2.5475h8.418c-.72 5.7596-4.873 9.8025-11.574 9.8025-7.477 0-12.572-5.3167-12.572-13.0145zm25.676 0c0-7.6978 5.095-13.0143 12.572-13.0143 6.701 0 10.854 3.9874 11.574 9.8023h-8.418c-.221-1.4953-1.384-2.6029-3.156-2.6029-2.437 0-3.988 2.2706-3.988 5.8149s1.551 5.7595 3.988 5.7595c1.772 0 2.935-1.0522 3.156-2.5475h8.418c-.72 5.7596-4.873 9.8025-11.574 9.8025-7.477 0-12.572-5.3167-12.572-13.0145zm42.013 3.7658h8.031c-.887 5.7597-5.206 9.2487-11.686 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.317-13.0143 12.516-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.319 4.5965 1.773 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm23.4 16.7244v10.799h-8.694v-33.726h8.694v1.9937c1.163-1.3291 3.6-2.5475 6.148-2.5475 7.199 0 11.131 5.8703 11.131 13.0143 0 7.0886-3.932 13.0145-11.131 13.0145-2.548 0-4.985-1.219-6.148-2.548zm0-13.7893v6.5902c.665 1.3845 2.16 2.326 3.822 2.326 2.99 0 4.762-2.3814 4.762-5.5934s-1.772-5.6488-4.762-5.6488c-1.717 0-3.157.9969-3.822 2.326zm21.892 7.1994v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.206v6.7564h-5.206v8.307c0 1.9383.941 2.769 2.658 2.769.942 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm39.458 8.5839h-8.363v-1.274c-.83.831-3.322 1.717-5.981 1.717-4.928 0-9.082-2.769-9.082-8.0301 0-4.818 4.154-7.9193 9.581-7.9193 2.049 0 4.486.6646 5.482 1.3845v-1.606c0-1.606-.941-2.9905-3.045-2.9905-1.606 0-2.548.7199-2.936 1.8275h-8.196c.72-4.8181 4.984-8.6393 11.408-8.6393 7.089 0 11.132 3.7659 11.132 10.2453zm-8.363-6.9779v-1.4399c-.553-1.0522-2.049-1.7167-3.655-1.7167-1.716 0-3.433.7199-3.433 2.3813 0 1.7168 1.717 2.4367 3.433 2.4367 1.606 0 3.102-.6645 3.655-1.6614zm20.742 4.9839v1.994h-8.694v-35.997h8.694v13.0697c1.163-1.3291 3.6-2.5475 6.148-2.5475 7.199 0 11.131 5.8149 11.131 13.0143s-3.932 13.0145-11.131 13.0145c-2.548 0-4.985-1.219-6.148-2.548zm0-13.7893v6.5902c.665 1.3845 2.105 2.326 3.822 2.326 2.99 0 4.762-2.3814 4.762-5.5934s-1.772-5.6488-4.762-5.6488c-1.662 0-3.157.9969-3.822 2.326zm28.759-20.2137v35.997h-8.695v-35.997zm19.172 27.3023h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.516-13.0143 7.642 0 11.962 5.095 11.962 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.434 1.2737-3.988 3.5997h7.532c-.111-2.0491-1.384-3.5997-3.544-3.5997z" fill="#d30001"/></svg>
|
||||||
|
</header>
|
||||||
|
<article>
|
||||||
|
<p><strong>Your browser is not supported.</strong><br> Please upgrade your browser to continue.</p>
|
||||||
|
</article>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
<body class="rails-default-error-page">
|
|
||||||
<!-- This file lives in public/406-unsupported-browser.html -->
|
|
||||||
<div class="dialog">
|
|
||||||
<div>
|
|
||||||
<h1>Your browser is not supported.</h1>
|
|
||||||
<p>Please upgrade your browser to continue.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
162
public/422.html
162
public/422.html
File diff suppressed because one or more lines are too long
161
public/500.html
161
public/500.html
File diff suppressed because one or more lines are too long
BIN
public/icon.png
BIN
public/icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 4.1 KiB |
@@ -1,3 +1,3 @@
|
|||||||
<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
|
<svg width="512" height="512" xmlns="http://www.w3.org/2000/svg">
|
||||||
<rect width="100%" height="100%" fill="red"/>
|
<circle cx="256" cy="256" r="256" fill="red"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 122 B |
@@ -1,5 +1 @@
|
|||||||
# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
|
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
||||||
#
|
|
||||||
# To ban all spiders from the entire site uncomment the next two lines:
|
|
||||||
# User-agent: *
|
|
||||||
# Disallow: /
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class MatAssignmentRulesControllerTest < ActionController::TestCase
|
class MatAssignmentRulesControllerTest < ActionController::TestCase
|
||||||
include Devise::Test::ControllerHelpers
|
# Remove Devise helpers since we're no longer using Devise
|
||||||
|
# include Devise::Test::ControllerHelpers
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@tournament = tournaments(:one) # Existing fixture
|
@tournament = tournaments(:one) # Existing fixture
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class MatchesControllerTest < ActionController::TestCase
|
class MatchesControllerTest < ActionController::TestCase
|
||||||
include Devise::Test::ControllerHelpers # Needed to sign in
|
# Remove Devise helpers since we're no longer using Devise
|
||||||
|
# include Devise::Test::ControllerHelpers # Needed to sign in
|
||||||
include ActionView::Helpers::DateHelper # Needed for time ago in words
|
include ActionView::Helpers::DateHelper # Needed for time ago in words
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user