diff --git a/Gemfile b/Gemfile index 2e375fa..64ceb73 100644 --- a/Gemfile +++ b/Gemfile @@ -74,3 +74,5 @@ end gem "tailwindcss-rails", "~> 2.0" gem "font-awesome-sass" gem "httparty" + +gem "sidekiq" diff --git a/Gemfile.lock b/Gemfile.lock index ceae68b..6e12f9c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -82,6 +82,7 @@ GEM regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) concurrent-ruby (1.2.2) + connection_pool (2.4.1) crass (1.0.6) date (3.3.3) debug (1.8.0) @@ -177,6 +178,8 @@ GEM rdoc (6.5.0) psych (>= 4.0.0) redis (4.8.1) + redis-client (0.17.0) + connection_pool regexp_parser (2.8.1) reline (0.3.8) io-console (~> 0.5) @@ -188,6 +191,11 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) + sidekiq (7.1.4) + concurrent-ruby (< 2) + connection_pool (>= 2.3.0) + rack (>= 2.2.4) + redis-client (>= 0.14.0) sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) @@ -241,6 +249,7 @@ DEPENDENCIES rails (~> 7.0.7, >= 7.0.7.2) redis (~> 4.0) selenium-webdriver + sidekiq sprockets-rails stimulus-rails tailwindcss-rails (~> 2.0) diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..6868ac8 --- /dev/null +++ b/Procfile @@ -0,0 +1,3 @@ +css: bin/rails tailwindcss:watch +redis: /opt/homebrew/opt/redis/bin/redis-server /opt/homebrew/etc/redis.conf +sidekiq: bundle exec sidekiq -C config/sidekiq.yml diff --git a/Procfile.dev b/Procfile.dev deleted file mode 100644 index 023e98a..0000000 --- a/Procfile.dev +++ /dev/null @@ -1,2 +0,0 @@ -web: bin/rails server -p 3000 -css: bin/rails tailwindcss:watch diff --git a/config/application.rb b/config/application.rb index 5f68675..72bc127 100644 --- a/config/application.rb +++ b/config/application.rb @@ -11,6 +11,8 @@ module LectureAttendanceManager # Initialize configuration defaults for originally generated Rails version. config.load_defaults 7.0 + config.active_job.queue_adapter = :sidekiq + # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb new file mode 100644 index 0000000..b061805 --- /dev/null +++ b/config/initializers/sidekiq.rb @@ -0,0 +1,7 @@ +Sidekiq.configure_server do |config| + config.redis = { url: ENV['REDIS_URL'] } +end + +Sidekiq.configure_client do |config| + config.redis = { url: ENV['REDIS_URL'] } +end diff --git a/config/sidekiq.yml b/config/sidekiq.yml new file mode 100644 index 0000000..0803d7d --- /dev/null +++ b/config/sidekiq.yml @@ -0,0 +1,13 @@ +--- +:concurrency: 5 +staging: + :concurrency: 10 +production: + :concurrency: 20 +:queues: + - default + - mailers + +# These are the cron jobs +:scheduler: + :schedule: