rails 6 actioncable/redis生产配置

zzwlnbp8  于 2021-06-10  发布在  Redis
关注(0)|答案(1)|浏览(262)

我目前正在我的应用程序中集成和电缆就绪,并希望将其部署到我的生产服务器。关于如何将actioncable部署到产品中的指南似乎非常过时,它们主要是为Rails5编写的。
我在这个主题上找到了不同的教程,但大多数都是针对Rails4/5的。关于 cable.yml 配置文件:如果我在我的web服务器上安装redis,那么生产url必须指向localhost还是指向我的域?

url: redis://localhost:6379/1

url: redis://redis.mydomain.com:6379/1
polhcujo

polhcujo1#

配置/environments/production.rb

Rails.application.configure do
  config.cache_store = :redis_cache_store, { url: "redis://localhost:6379/0" }
end

配置/cable.yml

production:
  adapter: redis
  url: <%= ENV.fetch("redis://127.0.0.1") %>/<%= ENV.fetch("6379") %>
  channel_prefix: app_production

为了更好的理解你可以关注这个网站。https://hixonrails.com/ruby-on-rails-tutorials/ruby-on-rails-redis-installation-and-configuration/

相关问题