Capistrano部署擦除数据库? [英] Capistrano Deploy Wipes Database?
问题描述
我已经设法使用Capistrano将我的应用程式部署到生产中,但我不明白如何处理我的资料库。我使用颠覆和乘客。
I've managed to deploy my app to production using Capistrano, but I don't understand how to deal with my database. I'm using subversion and passenger.
当我运行cap部署时,新的部署开始一切新鲜。它会清除添加到数据库的数据。显然,必须有一个解决方案,但我很惊讶,没有找到任何在线的如何处理这一点。我已经阅读了Capistrano文档和许多教程。
When I run cap deploy, the new deployment starts everything fresh. It wipes out the data that was added to the database. Obviously, there must be a solution, but I'm very surprised not to find anything online about how to deal with this. I've read the Capistrano documentation and many tutorials.
我可以找到的最好的是高级Rails食谱书,其中涉及将用户生成的内容放入共享目录,但它不是准确的点。
The best I can find is the Advanced Rails recipes books, which talks about putting user-generated content into the shared directory, but it's not exactly on point.
在使用Capistrano部署时如何处理数据库?
How do you deal with your database when deploying with Capistrano?
推荐答案
p>您正在使用SQLite,您正在将数据库保留在默认位置。
Chances are you are using SQLite, and you are keeping the database in the default location. Your database is not being deleted, more just left behind.
您需要编辑您的database.yml并指定它将您的生产数据库保存在共享位置。 /../shared/database.yml或类似的(你可以更好地使用绝对路径,或为奖金点MySQL)。
You need to edit your database.yml and tell it to keep your production database in a shared location "../../shared/database.yml" or similar (you may be better off using an absolute path, or for bonus points MySQL).
当你通过capistrano它会在带时间戳的目录中创建应用程序的新副本。您的数据库会留在旧的时间戳记目录中。
When you deploy via capistrano it creates a new copy of your app in a timestamped directory. Your database is being left behind in the old timestamped dir.
这篇关于Capistrano部署擦除数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!