Add Redis and Sidekiq
This commit is contained in:
parent
e3a44ca0d5
commit
c49ffa6445
4 changed files with 40 additions and 0 deletions
6
Gemfile
6
Gemfile
|
|
@ -47,6 +47,12 @@ gem 'email_validator'
|
|||
# pg_search builds ActiveRecord named scopes that take advantage of PostgreSQL’s full text search
|
||||
gem 'pg_search'
|
||||
|
||||
# A Ruby client library for Redis
|
||||
gem 'redis'
|
||||
|
||||
# Simple, efficient background processing for Ruby
|
||||
gem 'sidekiq'
|
||||
|
||||
# scheduler for Ruby (at, in, cron and every jobs)
|
||||
gem 'rufus-scheduler'
|
||||
|
||||
|
|
|
|||
11
Gemfile.lock
11
Gemfile.lock
|
|
@ -299,6 +299,10 @@ GEM
|
|||
rbs (2.8.4)
|
||||
rdoc (6.10.0)
|
||||
psych (>= 4.0.0)
|
||||
redis (5.3.0)
|
||||
redis-client (>= 0.22.0)
|
||||
redis-client (0.23.2)
|
||||
connection_pool
|
||||
regexp_parser (2.10.0)
|
||||
reline (0.6.0)
|
||||
io-console (~> 0.5)
|
||||
|
|
@ -351,6 +355,11 @@ GEM
|
|||
securerandom (0.4.1)
|
||||
shoulda-matchers (6.4.0)
|
||||
activesupport (>= 5.2.0)
|
||||
sidekiq (7.3.7)
|
||||
connection_pool (>= 2.3.0)
|
||||
logger
|
||||
rack (>= 2.2.4)
|
||||
redis-client (>= 0.22.2)
|
||||
simplecov (0.22.0)
|
||||
docile (~> 1.1)
|
||||
simplecov-html (~> 0.11)
|
||||
|
|
@ -444,6 +453,7 @@ DEPENDENCIES
|
|||
puma
|
||||
rack-cors
|
||||
rails
|
||||
redis
|
||||
responders
|
||||
rspec-rails
|
||||
rspec_junit_formatter
|
||||
|
|
@ -451,6 +461,7 @@ DEPENDENCIES
|
|||
rufus-scheduler
|
||||
sdoc
|
||||
shoulda-matchers
|
||||
sidekiq
|
||||
simplecov
|
||||
solargraph
|
||||
spring
|
||||
|
|
|
|||
9
config/initializers/redis.rb
Normal file
9
config/initializers/redis.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Fetch environment variables with defaults if not set
|
||||
redis_url = ENV.fetch('REDIS_URL', 'redis://localhost')
|
||||
redis_port = ENV.fetch('REDISPORT', '6379')
|
||||
|
||||
# Combine URL and port (adjust the path/DB as needed)
|
||||
full_redis_url = "#{redis_url}/0"
|
||||
|
||||
# Initialize Redis using the constructed URL
|
||||
$redis = Redis.new(url: full_redis_url)
|
||||
14
config/initializers/sidekiq.rb
Normal file
14
config/initializers/sidekiq.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Fetch environment variables with defaults if not set
|
||||
redis_url = ENV.fetch('REDIS_URL', 'redis://localhost')
|
||||
redis_port = ENV.fetch('REDISPORT', '6379')
|
||||
|
||||
# Combine URL and port (adjust the path/DB as needed)
|
||||
full_redis_url = "#{redis_url}/0"
|
||||
|
||||
Sidekiq.configure_server do |config|
|
||||
config.redis = { url: full_redis_url }
|
||||
end
|
||||
|
||||
Sidekiq.configure_client do |config|
|
||||
config.redis = { url: full_redis_url }
|
||||
end
|
||||
Loading…
Reference in a new issue