Forum: Ruby on Rails Virtual hosts not using their own databases

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F745d7fbe0dbe947aa1082aabb2b6a4f?d=identicon&s=25 Redd Vinylene (reddvinylene)
on 2008-12-11 14:38
Hi there!

I just set up 3 instances of the same Rails app (nginx+mongrel_cluster)
-- http://pastie.org/336677 -- but for some reason site1 and site2
(despite their own database.yml) end up using site3's database.

What on earth is going on here?

Thanks y'all,
RV
46f52c33235283752423837b91c581dd?d=identicon&s=25 Norm (Guest)
on 2008-12-11 21:05
(Received via mailing list)
Redd Vinylene wrote:
>
Does each virtual host have its own instance of the database server
running?
F745d7fbe0dbe947aa1082aabb2b6a4f?d=identicon&s=25 Redd Vinylene (reddvinylene)
on 2008-12-11 23:55
Norm wrote:
> Does each virtual host have its own instance of the database server
> running?

No actually I'm only running one MySQL 5.1 server instance. The OS is
FreeBSD.

Thank you.
46f52c33235283752423837b91c581dd?d=identicon&s=25 Norm (Guest)
on 2008-12-12 00:44
(Received via mailing list)
Redd Vinylene wrote:
>
When you say "their own database.yml" do you mean that you have
differently named databases in each database.yml?  Stupid question but
stuff happens.
F745d7fbe0dbe947aa1082aabb2b6a4f?d=identicon&s=25 Redd Vinylene (reddvinylene)
on 2008-12-12 10:07
Norm wrote:
> Redd Vinylene wrote:
>>
> When you say "their own database.yml" do you mean that you have
> differently named databases in each database.yml?  Stupid question but
> stuff happens.

Yes, exactly, like site1_production, site2_production and so on.
2385b29add40becb0a3eb1ec72dc5d46?d=identicon&s=25 John Yerhot (joyerhot)
on 2008-12-12 22:36
Redd Vinylene wrote:
> Norm wrote:
>> Redd Vinylene wrote:
>>>
>> When you say "their own database.yml" do you mean that you have
>> differently named databases in each database.yml?  Stupid question but
>> stuff happens.
>
> Yes, exactly, like site1_production, site2_production and so on.

So if you start only site2's mongrel cluster it actually uses the data
site3_production, though it's database.yml specifies site2_production?

also, I think you forgot the 't.' in your rake tasks

task :install_site3 => :environment do |t|
  t.load_database
  t.create_keys
  t.create_preferences
  t.create_admin
end
F745d7fbe0dbe947aa1082aabb2b6a4f?d=identicon&s=25 Redd Vinylene (reddvinylene)
on 2008-12-14 12:01
John Yerhot wrote:
>
> So if you start only site2's mongrel cluster it actually uses the data
> site3_production, though it's database.yml specifies site2_production?
>
> also, I think you forgot the 't.' in your rake tasks
>
> task :install_site3 => :environment do |t|
>   t.load_database
>   t.create_keys
>   t.create_preferences
>   t.create_admin
> end

Actually I fixed it now though. It turned out running "rake
install_site1 RAILS_ENV=production" also ran rake install_site2 and rake
install_site3 since they were all in the same directory. Deleting the
other rake scripts for each instance of my Rails app made everything
work just fine.

Much obliged everyone!
This topic is locked and can not be replied to.