Pas*_*uby 5 redis sidekiq devise-async amazon-elastic-beanstalk ruby-on-rails-5
Ruby版本:2.3.1
Sidekiq/Pro/Enterprise版本:5.0
Rails:5.0.2
我已经按照本教程进行操作,因此我可以使用sidekiq在我的rails api应用程序中发送电子邮件.该应用程序使用Puma在AWS ElasticBeanstalk上发布.
当用户注册时,他们应该收到一封电子邮件(通过设计).没有显示错误,没有生成sidekiq.log的日志.我不知道发生了什么,电子邮件根本没有发送.
初始化/ devise_async.rb
Devise::Async.setup do |config|
config.enabled = true
config.backend = :sidekiq
config.queue = :default
end
Run Code Online (Sandbox Code Playgroud)
初始化/ sidekiq.rb
rails_root = Rails.root || File.dirname(__FILE__) + '/../..'
rails_env = Rails.env || 'development'
redis_config = YAML.load_file(rails_root.to_s + '/config/redis.yml')
redis_config.merge! redis_config.fetch(Rails.env, {})
redis_config.symbolize_keys!
Sidekiq.configure_server do |config|
config.redis = { url: "redis://#{redis_config[:host]}:#{redis_config[:port]}/12" }
end
Sidekiq.configure_client do |config|
config.redis = { url: "redis://#{redis_config[:host]}:#{redis_config[:port]}/12" }
end
Run Code Online (Sandbox Code Playgroud)
配置/ redis.yml
development:
host: 'localhost'
port: '6379'
test:
host: 'localhost'
port: '6379'
production:
host: 'xxxxx-xxxx-xxx.xxxxxx.xx.0001.sae1.cache.amazonaws.com'
port: '6379'
Run Code Online (Sandbox Code Playgroud)
配置/ sidekiq.yml
:concurrency: 5
:queues:
- default
Run Code Online (Sandbox Code Playgroud)
最后的sidekiq日志行:
2017-05-06T02:16:10.579Z 8388 TID-grwqwpuzw INFO: Received USR1, no longer accepting new work
2017-05-06T02:16:10.584Z 8399 TID-gp30plzqo INFO: Received USR1, no longer accepting new work
Run Code Online (Sandbox Code Playgroud)
最后的nginx日志行:
172.31.14.103 - - [06/May/2017:02:20:51 +0000] "POST /v1/auth/ HTTP/1.1" 200 271 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36"
2017/05/06 02:16:22 [warn] 15902#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2017/05/06 02:16:22 [warn] 15909#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2017/05/06 02:16:22 [warn] 15950#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2017/05/06 02:16:22 [warn] 15957#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
Run Code Online (Sandbox Code Playgroud)
最后的美洲狮日志行:
[11765] - Gracefully shutting down workers...
[11765] === puma shutdown: 2017-05-06 02:16:23 +0000 ===
[11765] - Goodbye!
=== puma startup: 2017-05-06 02:16:26 +0000 ===
=== puma startup: 2017-05-06 02:16:26 +0000 ===
/var/app/current/app/serializers/notification_serializer.rb:20: warning: redefining `object_id' may cause serious problems
[16011] - Worker 0 (pid: 16014) booted, phase: 0
Run Code Online (Sandbox Code Playgroud)
它在本地机器上工作正常.
你有什么想法吗?
| 归档时间: |
|
| 查看次数: |
394 次 |
| 最近记录: |