Trying to start rails server in production environment - ruby-on-rails

Rails server doesn't starting in production environment, i think that there is a conflict with databases, should i migrate them or smth else?
=> Booting Puma
=> Rails 5.0.6 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Exiting
/home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_adapters/connection_specification.rb:170:in
`spec': database configuration does not specify adapter
(ActiveRecord::AdapterNotSpecified)
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_handling.rb:53:in `establish_connection'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.6/lib/active_record/railtie.rb:125:in `block (2 levels) in <class:Railtie>'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:41:in `block in on_load'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:40:in `each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:40:in `on_load'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.6/lib/active_record/railtie.rb:121:in `block in <class:Railtie>'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in `instance_exec'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in `run'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `call'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:54:in `run_initializers'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/application.rb:352:in `initialize!'
from /home/user/Desktop/upgraded-carnival/config/environment.rb:5:in `<top (required)>'
from /home/user/Desktop/upgraded-carnival/config.ru:3:in `require_relative'
from /home/user/Desktop/upgraded-carnival/config.ru:3:in `block in <main>'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
from /home/user/Desktop/upgraded-carnival/config.ru:in `new'
from /home/user/Desktop/upgraded-carnival/config.ru:in `<main>'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/server.rb:84:in `app'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:283:in `start'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/server.rb:104:in `start'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:90:in `block in server'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `tap'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `server'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
My database.yml :
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
production:
host: localhost
database: magnetcoin_production
pool: 10
timeout: 10000
username: magnetcoin
password:
magnetcoin template: template0
development: <<: *default
database: magnetcoin_development
test: <<: *default
database: magnetcoin_test

As per you logs you did not define the adaptor for your production env database config. You added the adaptor in default block but did not import default to production block. Just import default block in production block and every thing works fine.
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
production: <<: *default
host: localhost
database: magnetcoin_production
pool: 10
timeout: 10000
username: magnetcoin
password: magnetcoin
template: template0
development: <<: *default
database: magnetcoin_development
test: <<: *default
database: magnetcoin_test

Related

I'm using Rails 5, but Rails is still requiring a database.yml file

I'm using Rails 5 and I access my credentials by using RAILS_ENV=production EDITOR=vim rails credentials:edit. However, when I run rails c -e production, it gives me this error:
/usr/local/rvm/gems/ruby-2.5.8/gems/railties-5.2.4/lib/rails/application/configuration.rb:185:in `database_configuration': Cannot load database configuration:
Could not load database configuration. No such file - ["config/database.yml"] (RuntimeError)
from /usr/local/rvm/gems/ruby-2.5.8/gems/activerecord-5.2.4/lib/active_record/railtie.rb:133:in `block (2 levels) in <class:Railtie>'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activesupport-5.2.4/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activesupport-5.2.4/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activesupport-5.2.4/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activesupport-5.2.4/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activesupport-5.2.4/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activesupport-5.2.4/lib/active_support/lazy_load_hooks.rb:51:in `each'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activesupport-5.2.4/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activerecord-5.2.4/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activerecord-5.2.4/lib/active_record/base.rb:27:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.5.8/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
from /usr/local/rvm/gems/ruby-2.5.8/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
Why is this file being required? How do I ignore it? Just for kicks, I set up a config/database.yml file that looks like this:
default: &default
adapter: postgresql
encoding: unicode
pool: 200
port: 25060
production:
<<: *default
host: <%= Rails.application.credentials.production[:host] %>
username: <%= Rails.application.credentials.production[:username] %>
password: <%= Rails.application.credentials.production[:password] %>
database: <%= Rails.application.credentials.production[:database] %>
development:
<<: *default
host: <%= Rails.application.credentials.development[:host] %>
username: <%= Rails.application.credentials.development[:username] %>
password: <%= Rails.application.credentials.development[:password] %>
database: <%= Rails.application.credentials.development[:database] %>
However, when I run rails c -e production, I still get this error:
(erb):14:in `<main>': Cannot load database configuration:
undefined method `[]' for nil:NilClass (NoMethodError)
from /usr/local/rvm/rubies/ruby-2.5.8/lib/ruby/2.5.0/erb.rb:876:in `eval'
from /usr/local/rvm/rubies/ruby-2.5.8/lib/ruby/2.5.0/erb.rb:876:in `result'
from /usr/local/rvm/gems/ruby-2.5.8/gems/railties-5.2.4/lib/rails/application/configuration.rb:172:in `database_configuration'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activerecord-5.2.4/lib/active_record/railtie.rb:133:in `block (2 levels) in <class:Railtie>'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activesupport-5.2.4/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activesupport-5.2.4/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activesupport-5.2.4/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activesupport-5.2.4/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
from /usr/local/rvm/gems/ruby-2.5.8/gems/activesupport-5.2.4/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
I can access the development instance just fine, but not production. Not quite sure why this file is required if Rails 5 is supposedly moving away from it.

rescue in check_for_missing_columns': uninitialized constant ActiveRecord::NoDatabaseError (NameError)

I'm trying to run this application via cloud9.io. I'm not a programmer. Tried everything I could comprehend, but hit a dead end. I try to run the app, but it throw an error. Here is the output:
Digest::Digest is deprecated; use Digest
Auto-loading of `.env.development` will be removed in 1.0. See https://github.com/bkeepers/dotenv-deployment if you would like to continue using this feature.
=> Booting WEBrick
=> Rails 3.2.22 application starting in development on http://0.0.0.0:8080
=> Call with -d to detach
=> Ctrl-C to shutdown server
Connecting to database specified by database.yml
Exiting
/usr/local/rvm/gems/ruby-2.1.3/gems/doorkeeper-2.0.1/lib/doorkeeper/config.rb:29:in `rescue in check_for_missing_columns': uninitialized constant ActiveRecord::NoDatabaseError (NameError)
from /usr/local/rvm/gems/ruby-2.1.3/gems/doorkeeper-2.0.1/lib/doorkeeper/config.rb:21:in `check_for_missing_columns'
from /usr/local/rvm/gems/ruby-2.1.3/gems/doorkeeper-2.0.1/lib/doorkeeper/config.rb:11:in `configure'
from /home/ubuntu/workspace/config/initializers/doorkeeper.rb:6:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/engine.rb:593:in `block (2 levels) in <class:Engine>'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/engine.rb:592:in `each'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/engine.rb:592:in `block in <class:Engine>'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/initializable.rb:54:in `each'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/application.rb:136:in `initialize!'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/ubuntu/workspace/config/environment.rb:5:in `<top (required)>'
from /home/ubuntu/workspace/config.ru:17:in `block in <main>'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/builder.rb:51:in `instance_eval'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/builder.rb:51:in `initialize'
from /home/ubuntu/workspace/config.ru:in `new'
from /home/ubuntu/workspace/config.ru:in `<main>'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/builder.rb:40:in `eval'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/server.rb:200:in `app'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands/server.rb:46:in `app'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/server.rb:304:in `wrapped_app'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/server.rb:254:in `start'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands/server.rb:70:in `start'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands.rb:55:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands.rb:50:in `tap'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Process exited with code: 1
[K
Process exited with code: 1
Here's the contents of database.yml
development:
adapter: postgresql
encoding: utf8
database: bikereg
username: postgres
password: !q2w3e4r5t
pool: 5
test:
adapter: postgresql
database: bikereg_test
staging:
adapter: postgresql
database: bikereg_staging
production:
adapter: postgresql
database: bikereg_production
pool: 25
Any idea how to fix it?

use mysql as persistence motor in ruby on rails

I need to change sqlite to mysql for work with ruby on rails, but as I am a newbie in this, I have a problem
The first that I did was to go a GemFile and include the mysql gem. I am working in local
localhost:3306 using LAMP
source 'https://rubygems.org'
gem 'rails', '3.2.19'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'hirb'
After I configurate the file database.yml
development:
adapter: mysql2
encoding: utf8
database: blog_development
pool: 5
username: root
password: strlen12
socket: /tmp/mysql.sock
test:
adapter: mysql2
encoding: utf8
database: blog_development
pool: 5
username: root
password: strlen12
socket: /tmp/mysql.sock
production:
adapter: mysql2
encoding: utf8
database: blog_development
pool: 5
username: root
password: strlen12
socket: /tmp/mysql.sock
but when I try to run rake db:migrate this error is triggered
fernando#fernando:~/ProyectoTicketMaster/TicketMaster$ rake db:migrate
rake aborted!
Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/mysql2-0.3.17/lib/mysql2/client.rb:70:in `connect'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/mysql2-0.3.17/lib/mysql2/client.rb:70:in `initialize'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/model_schema.rb:310:in `clear_cache!'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/railtie.rb:103:in `block (2 levels) in <class:Railtie>'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:418:in `_run__875551666__prepare__678451887__callbacks'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/actionpack-3.2.19/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/actionpack-3.2.19/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/initializable.rb:30:in `instance_exec'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/initializable.rb:30:in `run'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/initializable.rb:54:in `each'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/initializable.rb:54:in `run_initializers'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/application.rb:136:in `initialize!'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/fernando/ProyectoTicketMaster/TicketMaster/config/environment.rb:5:in `<top (required)>'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `block in require'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/application.rb:103:in `require_environment!'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Version of Mysql installed in my pc
fernando#fernando:~/ProyectoTicketMaster/TicketMaster$ mysql --version
mysql Ver 14.14 Distrib 5.5.38, for debian-linux-gnu (i686) using readline 6.2
Check the socket path for MySQL in your file my.cnf (usually in the /etc/mysql/ folder) :
socket=/var/lib/mysql/mysql.sock
you can check if mysql is running with the following command:
mysqladmin -u root -p status
If you make any changes make sure you restart your server. Also you could use the localhost connection:
development:
adapter: mysql2
encoding: utf8
database: my_db_name
username: root
password: my_password
host: 127.0.0.1
port: 3306

bundle exec rake db:schema:load not working in codeship.io

I am using codeship.io for testing my Ruby on Rails app. In the 10th step I am getting the following error. What changes should I make in the database.yml file
rake aborted!
ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:52:in `resolve_hash_connection'
/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:46:in `resolve_string_connection'
/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:30:in `spec'
/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_handling.rb:39:in `establish_connection'
/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.0.0/lib/active_record/railtie.rb:175:in `block (2 levels) in <class:Railtie>'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:27:in `each'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.0.0/lib/active_record/railtie.rb:173:in `block in <class:Railtie>'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/rof/src/bitbucket.org/rahulv/luckily-beta/config/environment.rb:5:in `<top (required)>'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
Tasks: TOP => db:schema:load => environment
(See full trace by running task with --trace)
database.yml
development:
adapter: mysql2
database: test_database
username: test_user
password: password
host: localhost
pool: 5
timeout: 5000
production:
adapter: mysql2
database: test_database
username: test_user
password: password
host: localhost
pool: 5
timeout: 5000
test:
adapter: mysql2
database: test_database
username: test_user
password: password
host: localhost
pool: 5
timeout: 5000

Rails server exiting immediately after starting

I'm new to rails and I downloaded a repo from github which I'm trying to work on.
When I try to start rails s this happen, same thing happens for rails c:
=> Booting WEBrick
=> Rails 3.2.12 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application/configuration.rb:115:in `read': No such file or directory - /Users/falk/Desktop/parkbuddy/config/database.yml (Errno::ENOENT)
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application/configuration.rb:115:in `database_configuration'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.12/lib/active_record/railtie.rb:78:in `block (2 levels) in <class:Railtie>'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:25:in `each'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.12/lib/active_record/railtie.rb:74:in `block in <class:Railtie>'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/falk/Desktop/parkbuddy/config/environment.rb:5:in `<top (required)>'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
from /Users/falk/Desktop/parkbuddy/config.ru:3:in `block in <main>'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /Users/falk/Desktop/parkbuddy/config.ru:in `new'
from /Users/falk/Desktop/parkbuddy/config.ru:in `<main>'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands/server.rb:46:in `app'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in `start'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands.rb:55:in `block in <top (required)>'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap'
from /Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I have tried googling a solution but I can't find anything.
Your first line of errors says you don't have config/database.yml file.
create a database.yml file inside you applications config directory and
in database.yml file
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
The first line is showing you your problem:
/Users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application/configuration.rb:115:in `read': No such file or directory - /Users/falk/Desktop/parkbuddy/config/database.yml (Errno::ENOENT)
The config/database.yml file is not present in your Rails app. Check with the app's documentation to see what it suggest you do about database configuration.
I hava the same problem but with a different answer...
fabio#ubuntu:~/Desktop/teste/foo$ rails server
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/var/lib/gems/1.9.1/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:191:in `normalize_conditions!': You should not use the `match` method in your router without specifying an HTTP method. (RuntimeError)
If you want to expose your action to both GET and POST, add `via: [:get, :post]` option.
If you want to expose your action to GET, use `get` in the router:
Instead of: match "controller#action"
Do: get "controller#action"
from /var/lib/gems/1.9.1/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:67:in `initialize'
from /var/lib/gems/1.9.1/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `new'
...

Resources