use jobs to devise emails delivery
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
rails: bundle exec rails server
|
rails: bundle exec rails server
|
||||||
|
sidekiq: bundle exec sidekiq
|
||||||
webpack: yarn dev
|
webpack: yarn dev
|
||||||
relay: yarn relay:watch
|
relay: yarn relay:watch
|
||||||
1
Gemfile
1
Gemfile
@@ -19,6 +19,7 @@ gem "devise"
|
|||||||
gem "devise-i18n"
|
gem "devise-i18n"
|
||||||
gem "paper_trail"
|
gem "paper_trail"
|
||||||
gem "slack-notifier"
|
gem "slack-notifier"
|
||||||
|
gem "sidekiq", "~> 6.2"
|
||||||
gem "administrate-field-active_storage"
|
gem "administrate-field-active_storage"
|
||||||
gem "administrate-field-enumerize"
|
gem "administrate-field-enumerize"
|
||||||
gem "tailwindcss-rails"
|
gem "tailwindcss-rails"
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ GEM
|
|||||||
choice (0.2.0)
|
choice (0.2.0)
|
||||||
coderay (1.1.3)
|
coderay (1.1.3)
|
||||||
concurrent-ruby (1.1.9)
|
concurrent-ruby (1.1.9)
|
||||||
|
connection_pool (2.2.5)
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
datetime_picker_rails (0.0.7)
|
datetime_picker_rails (0.0.7)
|
||||||
momentjs-rails (>= 2.8.1)
|
momentjs-rails (>= 2.8.1)
|
||||||
@@ -237,6 +238,7 @@ GEM
|
|||||||
rb-fsevent (0.11.0)
|
rb-fsevent (0.11.0)
|
||||||
rb-inotify (0.10.1)
|
rb-inotify (0.10.1)
|
||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
|
redis (4.4.0)
|
||||||
regexp_parser (2.1.1)
|
regexp_parser (2.1.1)
|
||||||
request_store (1.5.0)
|
request_store (1.5.0)
|
||||||
rack (>= 1.4)
|
rack (>= 1.4)
|
||||||
@@ -302,6 +304,10 @@ GEM
|
|||||||
semantic_range (3.0.0)
|
semantic_range (3.0.0)
|
||||||
shoulda-matchers (5.0.0)
|
shoulda-matchers (5.0.0)
|
||||||
activesupport (>= 5.2.0)
|
activesupport (>= 5.2.0)
|
||||||
|
sidekiq (6.2.1)
|
||||||
|
connection_pool (>= 2.2.2)
|
||||||
|
rack (~> 2.0)
|
||||||
|
redis (>= 4.2.0)
|
||||||
slack-notifier (2.4.0)
|
slack-notifier (2.4.0)
|
||||||
spring (2.1.1)
|
spring (2.1.1)
|
||||||
sprockets (4.0.2)
|
sprockets (4.0.2)
|
||||||
@@ -374,6 +380,7 @@ DEPENDENCIES
|
|||||||
rubocop-shopify
|
rubocop-shopify
|
||||||
sass-rails (>= 6)
|
sass-rails (>= 6)
|
||||||
shoulda-matchers (~> 5.0)
|
shoulda-matchers (~> 5.0)
|
||||||
|
sidekiq (~> 6.2)
|
||||||
slack-notifier
|
slack-notifier
|
||||||
spring
|
spring
|
||||||
tailwindcss-rails
|
tailwindcss-rails
|
||||||
|
|||||||
@@ -21,4 +21,10 @@
|
|||||||
class AdminUser < ApplicationRecord
|
class AdminUser < ApplicationRecord
|
||||||
devise :database_authenticatable, :recoverable,
|
devise :database_authenticatable, :recoverable,
|
||||||
:rememberable, :validatable
|
:rememberable, :validatable
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def send_devise_notification(notification, *args)
|
||||||
|
devise_mailer.send(notification, self, *args).deliver_later
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -51,4 +51,8 @@ class User < ApplicationRecord
|
|||||||
def notification_message
|
def notification_message
|
||||||
"🎉 New user: #{email} 🎉"
|
"🎉 New user: #{email} 🎉"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_devise_notification(notification, *args)
|
||||||
|
devise_mailer.send(notification, self, *args).deliver_later
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,15 +27,9 @@ module XStake
|
|||||||
# Initialize configuration defaults for originally generated Rails version.
|
# Initialize configuration defaults for originally generated Rails version.
|
||||||
config.load_defaults(6.1)
|
config.load_defaults(6.1)
|
||||||
|
|
||||||
# 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")
|
|
||||||
|
|
||||||
# Don't generate system test files.
|
# Don't generate system test files.
|
||||||
config.generators.system_tests = nil
|
config.generators.system_tests = nil
|
||||||
|
|
||||||
|
config.active_job.queue_adapter = :sidekiq
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
require "sidekiq/web"
|
||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
devise_for :users
|
devise_for :users
|
||||||
devise_for :admin_users
|
devise_for :admin_users
|
||||||
@@ -16,9 +18,15 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
root to: "home#index"
|
root to: "home#index"
|
||||||
get "*all" => "home#index", constraints: lambda { |req|
|
get "*all" => "home#index", constraints: lambda { |req|
|
||||||
req.path.exclude?("playground") && req.path.exclude?("rails")
|
["playground", "rails", "sidekiq"].filter do |path|
|
||||||
|
req.path != path
|
||||||
|
end.blank?
|
||||||
}
|
}
|
||||||
|
|
||||||
post "/graphql", to: "graphql#execute"
|
post "/graphql", to: "graphql#execute"
|
||||||
mount GraphqlPlayground::Rails::Engine, at: "/playground", graphql_path: "/graphql" if Rails.env.development?
|
|
||||||
|
if Rails.env.development?
|
||||||
|
mount GraphqlPlayground::Rails::Engine, at: "/playground", graphql_path: "/graphql"
|
||||||
|
mount Sidekiq::Web => "/sidekiq"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,9 +5,11 @@ services:
|
|||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
environment:
|
environment:
|
||||||
- DATABASE_URL=postgres://postgres:postgres@db:5432/postgres
|
- DATABASE_URL=postgres://postgres:postgres@db:5432/postgres
|
||||||
|
- REDIS_URL=redis://redis
|
||||||
image: xstake
|
image: xstake
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
- redis
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/usr/src/app/
|
- ./:/usr/src/app/
|
||||||
db:
|
db:
|
||||||
@@ -19,5 +21,8 @@ services:
|
|||||||
- "5432:5432"
|
- "5432:5432"
|
||||||
volumes:
|
volumes:
|
||||||
- "data:/var/lib/postgresql/data"
|
- "data:/var/lib/postgresql/data"
|
||||||
|
db:
|
||||||
|
image: redis:6.2-alpine
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
data:
|
data:
|
||||||
|
|||||||
Reference in New Issue
Block a user