错误我说,我正在尝试使用docker构建容器,但无法连接sidekiq + redis,sidekiq_1 | Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)似乎sidekiq正在尝试连接至本地主机,但是由于我正在构建“理论上” redis + sidekiq + rails + postgres容器,因此无法使用本地主机,它应该在redis映像中。
我的docker-compose.yml文件是这样的:
version: '3'
services:
postgres:
image: postgres:10.5
volumes:
- my_app-postgres:/var/lib/postgresql/data
redis:
image: redis:4.0.11
volumes:
- my_app-redis:/var/lib/redis/data
web:
build: .
command: bundle exec rails server -p 3000 -b '0.0.0.0'
ports:
- '3000:3000'
depends_on:
- postgres
- redis
volumes:
- .:/my_app
env_file:
- .env
sidekiq:
build: .
command: bundle exec sidekiq -C config/sidekiq.yml
volumes:
- .:/my_app
depends_on:
- postgres
- redis
env_file: …Run Code Online (Sandbox Code Playgroud) 我试图在我的User对象被销毁之前挂钩邮件程序.
我正在使用Sidekiq发送电子邮件,但是当用户被销毁时会出现此错误.
ActiveJob::DeserializationError: Error while trying to deserialize arguments: Couldn't find User with id [id]
在我的模型中,我有这个:
class User < ApplicationRecord
before_destroy :goodbye_user
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable, :lockable
private
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
end
def goodbye_user
GoodbyeUser.goodbye_user(self).deliver_later
end
end
Run Code Online (Sandbox Code Playgroud)
告别用户邮件永远不会发送.
任何的想法?
我试图让它在 EC2 AWS 内的 Rails dockerized 项目容器中工作,但我运行但没有成功。
RoR 项目依赖于 sidekiq、postgres 和 redis,因此我使用 docker for Rails(Web 服务)和 sidekiq(sidekiq 服务)构建了一个“生产映像”,目前我尝试使其与 docker-compose 一起用于生产
我不得不说,我本地机器上的一切都工作正常。开发和“生产”映像按预期工作,在 EC2 AWS 计算机中组成“生产”映像(Web 和 sidekiq)时出现问题。
我收到此错误:
production_sidekiq | No such file or directory @ rb_sysopen - /my_app/tmp/pids/sidekiq.pid
production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/lib/sidekiq/cli.rb:370:in `initialize'
production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/lib/sidekiq/cli.rb:370:in `open'
production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/lib/sidekiq/cli.rb:370:in `write_pid'
production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/lib/sidekiq/cli.rb:43:in `parse'
production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/bin/sidekiq:11:in `<top (required)>'
production_sidekiq | /usr/local/bundle/bin/sidekiq:23:in `load'
production_sidekiq | /usr/local/bundle/bin/sidekiq:23:in `<top (required)>'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:74:in `load'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:28:in `run' …Run Code Online (Sandbox Code Playgroud) ruby-on-rails amazon-web-services sidekiq docker docker-compose