如何强制Capistrano部署的应用程序使用我的开发数据库?

时间:2021-09-07 07:26:06

I have a app that I'm deploying to a development server using Capistrano. I'd like to force this deployment to use the development database. So far the only way I've managed to do it is to make my production database info in database.yml equal to the development info. But this is a complete hack.

我有一个应用程序,我正在使用Capistrano部署到开发服务器。我想强制这个部署使用开发数据库。到目前为止,我设法做到的唯一方法是使我在database.yml中的生产数据库信息等于开发信息。但这是一个彻底的黑客攻击。

I've tried setting rails_env to development in deploy.rb but that hasn't worked.

我已经尝试将rails_env设置为deploy.rb中的开发但是没有用。

Thoughts?

2 个解决方案

#1


4  

I ended up using the solution over here. Basically a recipe to replace a line in environment.rb after deploy but before restart.

我最终在这里使用了解决方案。基本上是在部署之后但在重新启动之前替换environment.rb中的一行的配方。

The problems seems to be with DreamHost's Passenger config. It assumes you're running in production mode.

问题似乎与DreamHost的Passenger配置有关。它假设您正在生产模式下运行。

#2


2  

I'd use Capistrano Ext in order to define multiple deployment environments. I have used this in the past to deply staging and production installations of my apps, so I think it'd work well for you.

我使用Capistrano Ext来定义多个部署环境。我过去曾经使用过这个来dep我的应用程序的暂存和生产安装,所以我认为它适合你。

Jamis Buck has a writeup if you'd like an overview on how to use it.

如果你想了解如何使用它,Jamis Buck有一篇文章。

#1


4  

I ended up using the solution over here. Basically a recipe to replace a line in environment.rb after deploy but before restart.

我最终在这里使用了解决方案。基本上是在部署之后但在重新启动之前替换environment.rb中的一行的配方。

The problems seems to be with DreamHost's Passenger config. It assumes you're running in production mode.

问题似乎与DreamHost的Passenger配置有关。它假设您正在生产模式下运行。

#2


2  

I'd use Capistrano Ext in order to define multiple deployment environments. I have used this in the past to deply staging and production installations of my apps, so I think it'd work well for you.

我使用Capistrano Ext来定义多个部署环境。我过去曾经使用过这个来dep我的应用程序的暂存和生产安装,所以我认为它适合你。

Jamis Buck has a writeup if you'd like an overview on how to use it.

如果你想了解如何使用它,Jamis Buck有一篇文章。