Multi stage deployments and databases

7 views
Skip to first unread message

Drinkingbird

unread,
Aug 17, 2007, 1:45:35 AM8/17/07
to Capistrano
I'm using the cap extension outlined at http://weblog.jamisbuck.org/2007/7/23/capistrano-multistage
to deploy to either staging or production environments.

The staging and production deployments are both on the same database,
so when set to the same environment (in this case production), they
both refer to the same database.

Since it's not practical for me to have the staging release run in
development mode, can anyone recommend a good way to switch the
configuration to a different database?

I suppose I can do it a few different ways, moving files around after
code update, but I was wondering if anyone had a really neat solution.

- Chris

Alex Grigorovich

unread,
Aug 17, 2007, 3:21:13 AM8/17/07
to capis...@googlegroups.com
On 8/17/07, Drinkingbird <drinki...@gmail.com> wrote:
> I'm using the cap extension outlined at http://weblog.jamisbuck.org/2007/7/23/capistrano-multistage
> to deploy to either staging or production environments.
>
> The staging and production deployments are both on the same database,
> so when set to the same environment (in this case production), they
> both refer to the same database.
>
> Since it's not practical for me to have the staging release run in
> development mode, can anyone recommend a good way to switch the
> configuration to a different database?

Create a new "staging" section in config/database.yml, copy
config/environments/production.rb to config/environments/staging.rb
and put a line containing

set :rails_env, "staging"

in config/deploy/staging.rb.

--
Alex

Drinkingbird

unread,
Aug 17, 2007, 3:33:35 AM8/17/07
to Capistrano
Hmm, I hadn't realised it was that easy to create new environments.

Thanks.

On Aug 17, 5:21 pm, "Alex Grigorovich" <alex.grigorov...@gmail.com>
wrote:
> On 8/17/07, Drinkingbird <drinkingb...@gmail.com> wrote:
>
> > I'm using the cap extension outlined athttp://weblog.jamisbuck.org/2007/7/23/capistrano-multistage

Reply all
Reply to author
Forward
0 new messages