捆绑包执行修复了 Rake 错误,但部署不起作用

发布于 2024-12-05 14:03:51 字数 799 浏览 1 评论 0 原文

我向 Rails 应用程序生产服务器推送了更新,更新中包含新的数据库迁移。我运行了 rake db:migrate 并看到了常见错误 此处。我在 bundle exec bash 中再次运行了 rake,并且成功了。但重新启动我的 apache 服务器后,我现在收到 500 错误页面。此更新在我的本地主机上运行良好,主要是对数据库的更新,支持相应视图和控制器/路由中的更改。

我什至不知道为什么这次会出现这个错误,因为我在仅使用rake之前已经成功推送了数据库更新。尽管如此,耙子还是成功了。 500 错误页面仅显示在需要特定新 ActiveRecord 的页面上。关于如何调试有什么想法吗?

编辑:我的问题非常简单。我只是忘记将环境包含在 rake 中:

bundle exec rake db:migrate RAILS_ENV=production

不幸的是,我花了相当长的时间来缩小范围,因为我无法使用 IRB 来检查数据库条目,直到我按照这些 步骤

I pushed an update to my Rails app production server, and in the update there was a new database migration. I ran rake db:migrate and got the common error seen here. I ran the rake again in bundle exec bash and it was successful. But after restarting my apache server, I'm now getting the 500 Error page. This update worked fine on my localhost, and was mostly this update to the db with supporting changes in the according view and controller/routing.

I don't even know why this error appeared this time, as I have pushed db updates successfully before using only rake. Nonetheless, the rake was successful. The 500 error page only shows on pages that require that specific new ActiveRecord. Any ideas on how to debug?

EDIT: My problem was an extremely simple one. I merely forgot to include the environment with the rake:

bundle exec rake db:migrate RAILS_ENV=production

Unfortunately, it took quite a while to narrow that down, as I couldn't use IRB to check the db entries until I followed these steps.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

桃酥萝莉 2024-12-12 14:03:51

您是否在服务器上运行了 rake db:migrate ?还要确保设置 RAILS_ENV 标志,以便更新您的生产数据库:

rake db:migrate RAILS_ENV=production

Did you run rake db:migrate on your server? Also be sure to set the RAILS_ENV flag so your production database is updated:

rake db:migrate RAILS_ENV=production
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文