简体   繁体   English

Clockwork gem正在尝试访问生产环境中的开发数据库

[英]Clockwork gem is trying to access development db in production

I am trying to start the clockwork with following command sudo bundle exec clockwork config/clock.rb in production. 我正在尝试在生产中使用以下命令sudo bundle exec clockwork config/clock.rb启动发条。 But it throws the following error ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: ["production"] 但是它引发以下错误ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: ["production"] ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: ["production"] . ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: ["production"] It works correctly in local. 它在本地可以正常工作。 We have Puma server and JRuby setup in server. 我们在服务器中有Puma服务器和JRuby设置。

Add the RAILS_ENV variable: 添加RAILS_ENV变量:

RAILS_ENV=production sudo bundle exec clockwork config/clock.rb 

Or, set the RAILS_ENV variable in your .bashrc : 或者,在.bashrc设置RAILS_ENV变量:

echo 'export RAILS_ENV=production' >> ~/.bashrc

And then exit the shell, and login again. 然后退出外壳程序,然后再次登录。 From then on, clockwork (and all other rails related things) should be in production mode. 从那时起,发条(以及所有其他与铁轨有关的东西)应处于生产模式。 You can use the command you were using originally. 您可以使用最初使用的命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM