Production vs Development

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

[email protected]

On Fri, Jan 24, 2014 at 8:37 AM, BeeRich [email protected] 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. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan

On Jan 24, 2014, at 11:48 AM, Hassan S.
[email protected] 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:ininitialize’
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:inmysql2_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:incheckout_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:inblock 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:incheckout’
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:inmon_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:inretrieve_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:inconnection’
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:inrescue 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:incall’
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:incall’
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:incall’
actionpack (4.0.2)
lib/action_dispatch/middleware/show_exceptions.rb:30:in call' railties (4.0.2) lib/rails/rack/logger.rb:38:incall_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:inblock 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:intagged’
railties (4.0.2) lib/rails/rack/logger.rb:20:in call' actionpack (4.0.2) lib/action_dispatch/middleware/request_id.rb:21:incall’
rack (1.5.2) lib/rack/methodoverride.rb:21:in call' rack (1.5.2) lib/rack/runtime.rb:17:incall’
activesupport (4.0.2)
lib/active_support/cache/strategy/local_cache.rb:83:in call' rack (1.5.2) lib/rack/sendfile.rb:112:incall’
railties (4.0.2) lib/rails/engine.rb:511:in call' railties (4.0.2) lib/rails/application.rb:97:incall’
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:inaccept_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:inblock (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.

[email protected]

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

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

On Jan 24, 2014, at 12:54 PM, Walter Lee D. [email protected]
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

[email protected]

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. [email protected]
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.

[email protected]

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

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.
[email protected] 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

[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs