Capistrano Deploy Wipes Database?

試著忘記壹切 提交于 2019-12-22 03:33:15

问题


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.

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.

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.

How do you deal with your database when deploying with Capistrano?


回答1:


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.

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).

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.



来源:https://stackoverflow.com/questions/1593159/capistrano-deploy-wipes-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!