WebFaction
Community site: login faq
0
1

Hi,

After deploying my Ruby on Rails web application (using Capistrano), I just get an error message ("We're sorry, but something went wrong.") when I visit the deployed site, even though it works locally on my machine. I was having some issues with sqlite3, but I managed to resolve that by following this installation guide.

I have been searching around, and found this question on StackOverflow, which seems to indicate that there is something wrong with sqlite3-ruby, but as far as I can tell I am now using the normal sqlite gem. I also noticed this question which seemed related, but I am not using RVM on the server (only locally, on my Mac). I am positive that the code on the client and server is the same and I have run bundle install etc.

I'm using Ruby 1.9.3p125, Rails 3.2.2 and Passenger version 3.0.11.

My production.log gives me these error messages, but I am unable to figure out what is broken/missing:

Started GET "/" for 184.144.171.84 at 2012-03-02 22:17:34 -0600

ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished):
  activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `retrieve_connection'
  activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
  activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection'
  activerecord (3.2.1) lib/active_record/query_cache.rb:67:in `rescue in call'
  activerecord (3.2.1) lib/active_record/query_cache.rb:61:in `call'
  activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
  actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__564718838__call__747762965__callbacks'
  activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  rack-cache (1.1) lib/rack/cache/context.rb:132:in `forward'
  rack-cache (1.1) lib/rack/cache/context.rb:241:in `fetch'
  rack-cache (1.1) lib/rack/cache/context.rb:181:in `lookup'
  rack-cache (1.1) lib/rack/cache/context.rb:65:in `call!'
  rack-cache (1.1) lib/rack/cache/context.rb:50:in `call'
  railties (3.2.1) lib/rails/engine.rb:479:in `call'
  railties (3.2.1) lib/rails/application.rb:220:in `call'
  railties (3.2.1) lib/rails/railtie/configurable.rb:30:in `method_missing'
  passenger (3.0.11) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
  passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
  passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
  passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
  passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:79:in `block in spawn_application'
  passenger (3.0.11) lib/phusion_passenger/utils.rb:479:in `safe_fork'
  passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:64:in `spawn_application'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:264:in `spawn_rack_application'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  passenger (3.0.11) helper-scripts/passenger-spawn-server:99:in `<main>'

Has anyone else encountered these issues and been able to resolve them somehow? I am not sure if I am providing enough information here or what other information would be useful (I am pretty new to RoR), so please let me know how I can provide more relevant information!

Thanks in advance for any help and advice.

Update

Here's the contents of my database.yml:

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: mysql
  database: lef_irleif_rails
  host: localhost
  username: lef_irleif_rails
  password: ******

I was under the impression/assumption that my app would automatically use development locally, and then switch to the production database (the MySQL database) once deployed to the server. I followed the instructions on Webfaction's RoR documentation page to set this up. I also tried changing the production database from localhost to webXXX.webfaction.com, but this didn't seem to make any difference.

asked 02 Mar '12, 22:32

Leif
11169
accept rate: 0%

edited 03 Mar '12, 10:03

This error seems to suggest that the application can't successfully connect to the sqlite database even though the gem is installed. Can you ensure that the paths in config/database.yml are correct (maybe try absolute paths?).

If that doesn't work, can you rule out the database connection issue by temporarily using a MySQL database in place of a sqlite database for the development application? If that works, it means that the problem is indeed related to the sqlite connection.

(02 Mar '12, 23:14) ryans ♦♦

Thanks for the help, @ryans! I think you're right, but I'm not sure how to correct it. I updated my question above with the contents of my database.yml (I was already trying to use MySQL for production database).

(03 Mar '12, 09:57) Leif

Can you try providing the full system path to the SQLite database? If this doesn't help, please open a ticket, so we can take a look at it.

(03 Mar '12, 10:35) todork

You mean, instead of "database: db/development.sqlite3" I should try to use "database: /home/lef/webapps/irleif_rails/current/db/development.sqlite3" ? Edit: I just tried this, and it doesn't seem to work either. I'll try a few other things before I make a ticket; it's probably just me not understanding how this is supposed to work.

(03 Mar '12, 10:46) Leif

Yes, that's what I meant (too bad it didn't work). Can you open a ticket so we can take a closer look?

(03 Mar '12, 10:58) todork

Will do! Thanks for the help :)

(03 Mar '12, 11:00) Leif

I opened a ticket :)

(03 Mar '12, 11:40) Leif

I'm currently experiencing the same issue. My app uses only sqlite. Any news on this?

(16 Jul '12, 14:34) Juan Hoyos

My fault... haven't pushed things to scm before deploying and it was using mysql. Things are now working.

(16 Jul '12, 15:01) Juan Hoyos
showing 5 of 9 show 4 more comments
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×81
×28
×11
×7

question asked: 02 Mar '12, 22:32

question was seen: 4,680 times

last updated: 16 Jul '12, 15:01

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM