# Production vs Development

**URL:** <https://www.ruby-forum.com/t/production-vs-development/238709>\
**Category:** Rails\
**Created:** [January 24, 2014, 5:39pm UTC](https://www.ruby-forum.com/t/production-vs-development/238709 "2014-01-24T17:39:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [January 24, 2014, 5:39pm UTC](https://www.ruby-forum.com/t/production-vs-development/238709/1 "2014-01-24T17:39:25Z")

</div>

Hi folks. New to Rails.

Got the following coming up using Passenger:

We’re sorry, but something went wrong.  
If you are the application owner check the logs for more information.

Turns out mysql is barfing. My database.yml has my local mysql using a  
username and password set for all three modes (development, test, and  
production). I am not sure why this isnt being used as the log says its  
using the production database. It is currently using root, which isnt  
set anywhere.

Where can I change this?

Cheers

removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![BeeRich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@BeeRich](https://www.ruby-forum.com/u/BeeRich)\
**Post date:** [January 24, 2014, 5:49pm UTC](https://www.ruby-forum.com/t/production-vs-development/238709/2 "2014-01-24T17:49:52Z")

</div>

On Fri, Jan 24, 2014 at 8:37 AM, BeeRich [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Turns out mysql is barfing.

That’s so sad; maybe some ginger ale and a bit of bed rest will help?

OR maybe post the actual error message/stack trace here?

> My database.yml has my local mysql using a username and password set for all  
> three modes (development, test, and production). I am not sure why this isnt  
> being used as the log says its using the production database. It is currently  
> using root, which isnt set anywhere.

That paragraph doesn’t really make sense.

The main question is: can you log into your production database  
using the credentials in database.yml? If so, then can you start up  
a console in production mode and access the DB?

–  
Hassan S. ------------------------ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[Hassan Schroeder | about.me](http://about.me/hassanschroeder)  
twitter: @hassan

---

<div class="post-metadata">

**Author:** ![BeeRich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@BeeRich](https://www.ruby-forum.com/u/BeeRich)\
**Post date:** [January 24, 2014, 6:51pm UTC](https://www.ruby-forum.com/t/production-vs-development/238709/3 "2014-01-24T18:51:50Z")

</div>

On Jan 24, 2014, at 11:48 AM, Hassan S.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Turns out mysql is barfing.
> 
> That’s so sad; maybe some ginger ale and a bit of bed rest will help?

Hey that’s funny.

> OR maybe post the actual error message/stack trace here?

> > My database.yml has my local mysql using a username and password set for all  
> > three modes (development, test, and production). I am not sure why this isn’t  
> > being used as the log says it’s using the production database. It is currently  
> > using root, which isn’t set anywhere.
> 
> That paragraph doesn’t really make sense.

- I am not in production mode. I have merely started a new project, so  
it should be in development.

- The development.log has nothing in it. Because, like I said above  
where you didn’t understand, it isn’t posting to the development log  
because it isn’t using the development database, because it isn’t using  
the development database. It is posting to the production database as  
demonstrated by the following in the production log:

I, [2014-01-24T11:46:55.334391 #8884] INFO – : Started GET “/” for  
127.0.0.1 at 2014-01-24 11:46:55 -0500  
F, [2014-01-24T11:46:55.338134 #8884] FATAL – :  
Mysql2::Error (Unknown database ‘rortest\_production’):  
mysql2 (0.3.14) lib/mysql2/client.rb:67:in `connect' mysql2 (0.3.14) lib/mysql2/client.rb:67:in `initialize’  
activerecord (4.0.2)  
lib/active\_record/connection\_adapters/mysql2\_adapter.rb:18:in `new' activerecord (4.0.2) lib/active_record/connection_adapters/mysql2_adapter.rb:18:in `mysql2\_connection’  
activerecord (4.0.2)  
lib/active\_record/connection\_adapters/abstract/connection\_pool.rb:440:in  
`new_connection' activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout\_new\_connection’  
activerecord (4.0.2)  
lib/active\_record/connection\_adapters/abstract/connection\_pool.rb:421:in  
`acquire_connection' activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `block in checkout’  
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/monitor.rb:211:in  
`mon_synchronize' activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout’  
activerecord (4.0.2)  
lib/active\_record/connection\_adapters/abstract/connection\_pool.rb:265:in  
`block in connection' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/monitor.rb:211:in `mon\_synchronize’  
activerecord (4.0.2)  
lib/active\_record/connection\_adapters/abstract/connection\_pool.rb:264:in  
`connection' activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve\_connection’  
activerecord (4.0.2) lib/active\_record/connection\_handling.rb:79:in  
`retrieve_connection' activerecord (4.0.2) lib/active_record/connection_handling.rb:53:in `connection’  
activerecord (4.0.2) lib/active\_record/query\_cache.rb:51:in  
`restore_query_cache_settings' activerecord (4.0.2) lib/active_record/query_cache.rb:43:in `rescue in  
call’  
activerecord (4.0.2) lib/active\_record/query\_cache.rb:32:in `call' activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call’  
actionpack (4.0.2) lib/action\_dispatch/middleware/callbacks.rb:29:in  
`block in call' activesupport (4.0.2) lib/active_support/callbacks.rb:373:in `\_run\_\_3639985778722734772\_\_call\_\_callbacks’  
activesupport (4.0.2) lib/active\_support/callbacks.rb:80:in  
`run_callbacks' actionpack (4.0.2) lib/action_dispatch/middleware/callbacks.rb:27:in `call’  
actionpack (4.0.2) lib/action\_dispatch/middleware/remote\_ip.rb:76:in  
`call' actionpack (4.0.2) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call’  
actionpack (4.0.2)  
lib/action\_dispatch/middleware/show\_exceptions.rb:30:in `call' railties (4.0.2) lib/rails/rack/logger.rb:38:in `call\_app’  
railties (4.0.2) lib/rails/rack/logger.rb:20:in `block in call' activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `block in tagged’  
activesupport (4.0.2) lib/active\_support/tagged\_logging.rb:25:in  
`tagged' activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `tagged’  
railties (4.0.2) lib/rails/rack/logger.rb:20:in `call' actionpack (4.0.2) lib/action_dispatch/middleware/request_id.rb:21:in `call’  
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call' rack (1.5.2) lib/rack/runtime.rb:17:in `call’  
activesupport (4.0.2)  
lib/active\_support/cache/strategy/local\_cache.rb:83:in `call' rack (1.5.2) lib/rack/sendfile.rb:112:in `call’  
railties (4.0.2) lib/rails/engine.rb:511:in `call' railties (4.0.2) lib/rails/application.rb:97:in `call’  
passenger (4.0.35)  
lib/phusion\_passenger/rack/thread\_handler\_extension.rb:77:in  
`process_request' passenger (4.0.35) lib/phusion_passenger/request_handler/thread_handler.rb:142:in `accept\_and\_process\_next\_request’  
passenger (4.0.35)  
lib/phusion\_passenger/request\_handler/thread\_handler.rb:110:in  
`main_loop' passenger (4.0.35) lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start\_threads’

As stated, it has logged the following in the production log:

Mysql2::Error (Unknown database ‘rortest\_production’):

There is no such thing as the production database because it hasn’t been  
generated. I had to manually generate the development database.

> The main question is: can you log into your production database  
> using the credentials in database.yml? If so, then can you start up  
> a console in production mode and access the DB?

I can log into any current database using the credentials in  
database.yml. For all three environments, they are the same username  
and password. The manual rortest\_development is the only database  
that’s there because it’s the only one that I have made. Regardless, as  
stated above, it is looking for the production database and not the  
development database.

My question is, how do I change this? I have no clue why it’s asking  
for production when I’m clearly in development.

[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![BeeRich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@BeeRich](https://www.ruby-forum.com/u/BeeRich)\
**Post date:** [January 24, 2014, 6:56pm UTC](https://www.ruby-forum.com/t/production-vs-development/238709/4 "2014-01-24T18:56:39Z")

</div>

On Jan 24, 2014, at 12:50 PM, BeeRich wrote:

> > The main question is: can you log into your production database  
> > using the credentials in database.yml? If so, then can you start up  
> > a console in production mode and access the DB?
> 
> I can log into any current database using the credentials in database.yml. For  
> all three environments, they are the same username and password. The manual  
> rortest\_development is the only database that’s there because it’s the only one  
> that I have made. Regardless, as stated above, it is looking for the production  
> database and not the development database.
> 
> My question is, how do I change this? I have no clue why it’s asking for  
> production when I’m clearly in development.

If you’re clearly in development, why are you hitting passenger? What  
does your passenger configuration (in Apache or Nginx) look like? Did  
you set an environment flag explicitly to development? If not, I believe  
that passenger always defaults to production.

Walter

---

<div class="post-metadata">

**Author:** ![BeeRich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@BeeRich](https://www.ruby-forum.com/u/BeeRich)\
**Post date:** [January 24, 2014, 7:07pm UTC](https://www.ruby-forum.com/t/production-vs-development/238709/5 "2014-01-24T19:07:52Z")

</div>

On Jan 24, 2014, at 12:59 PM, BeeRich wrote:

> PassengerDefaultRuby  
> /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
> 
> In the VHost directive:  
> AllowOverride all  
> Options -MultiViews
> 
> Other than that I don’t know where to find other Passenger parameters. Is there  
> no way to use Passenger for a local development environment?

Sure. You just need to read through the passenger docs to find the  
proper flag to add inside the block. It’s  
something simple like `RailsEnvironment development` or something like  
that.

Walter

---

<div class="post-metadata">

**Author:** ![BeeRich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@BeeRich](https://www.ruby-forum.com/u/BeeRich)\
**Post date:** [January 24, 2014, 7:01pm UTC](https://www.ruby-forum.com/t/production-vs-development/238709/6 "2014-01-24T19:01:27Z")

</div>

On Jan 24, 2014, at 12:54 PM, Walter Lee D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> If you’re clearly in development, why are you hitting passenger? What does your  
> passenger configuration (in Apache or Nginx) look like? Did you set an environment  
> flag explicitly to development? If not, I believe that passenger always defaults  
> to production.

I have no clue. I installed Passenger to use Apache instead of WEBrick.  
Heres what I have:

LoadModule passenger\_module  
/Library/Ruby/Gems/2.0.0/gems/passenger-4.0.35/buildout/apache2/mod\_passenger.so  
  
PassengerRoot /Library/Ruby/Gems/2.0.0/gems/passenger-4.0.35  
PassengerDefaultRuby  
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby

In the VHost directive:  
AllowOverride all  
Options -MultiViews

Other than that I dont know where to find other Passenger parameters.  
Is there no way to use Passenger for a local development environment?

Cheers

[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![BeeRich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@BeeRich](https://www.ruby-forum.com/u/BeeRich)\
**Post date:** [January 24, 2014, 9:45pm UTC](https://www.ruby-forum.com/t/production-vs-development/238709/7 "2014-01-24T21:45:02Z")

</div>

OK, with some reading I think I’ll uninstall Passenger until I have some  
time to dedicate time to it. I thought it was a simple solution for  
apache.

Thanks for the heads up.

On Jan 24, 2014, at 1:05 PM, Walter Lee D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Sure. You just need to read through the passenger docs to find the proper flag  
> to add inside the block. It’s something simple like  
> `RailsEnvironment development` or something like that.

[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![BeeRich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@BeeRich](https://www.ruby-forum.com/u/BeeRich)\
**Post date:** [January 25, 2014, 2:16pm UTC](https://www.ruby-forum.com/t/production-vs-development/238709/8 "2014-01-25T14:16:02Z")

</div>

On Friday, January 24, 2014 7:05:43 PM UTC+1, Walter Lee D. wrote:

> > 
> 
> > Other than that I don’t know where to find other Passenger parameters. Is  
> > there no way to use Passenger for a local development environment?
> 
> Sure. You just need to read through the passenger docs to find the proper flag  
> to add inside the block. It’s something simple like  
> `RailsEnvironment development` or something like that.

It’s RackEnv (which is an alias for PassengerAppEnv) and it defaults to  
production.  
I used passenger in development for a long time but I switched to pow.cx  
a while back - partly because i didn’t have to keep adding vhosts for  
new apps

Fred

---

<div class="post-metadata">

**Author:** ![BeeRich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@BeeRich](https://www.ruby-forum.com/u/BeeRich)\
**Post date:** [January 25, 2014, 3:35pm UTC](https://www.ruby-forum.com/t/production-vs-development/238709/9 "2014-01-25T15:35:29Z")

</div>

Thats good information. Thanks for that. I got Passenger working but  
as you have indicated, managing vhosts would be much easier with a  
single local domain reference. I will check it out.

Cheers

On Jan 25, 2014, at 8:14 AM, Frederick C.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> It’s RackEnv (which is an alias for PassengerAppEnv) and it defaults to  
> production.  
> I used passenger in development for a long time but I switched to pow.cx a while  
> back - partly because i didn’t have to keep adding vhosts for new apps
> 
> Fred

[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
