Rails app deployment challenge, not finding database table in production.log
Posted
by
Stefan M
on Server Fault
See other posts from Server Fault
or by Stefan M
Published on 2012-06-10T08:25:26Z
Indexed on
2012/06/10
10:41 UTC
Read the original article
Hit count: 333
I'm trying to setup PasswordPusher as my first ruby app ever. Building and running the webrick server as instructed in README works fine.
It was only when I tried to add Apache ProxyPass and ProxyPassReverse that the page load slowed down to several minutes.
So I gave mod_passenger a whirl but now it's unable to find the password table. Here's what I get in log/production.log.
Started GET "/" for 10.10.2.13 at Sun Jun 10 08:07:19 +0200 2012
Processing by PasswordsController#new as HTML
Completed 500 Internal Server Error in 1ms
ActiveRecord::StatementInvalid (Could not find table 'passwords'):
app/controllers/passwords_controller.rb:77:in `new'
app/controllers/passwords_controller.rb:77:in `new'
While in log/private.log I get a lot more output so here's just a snippet but it looks to me like it's working with the database. Edit: This was actually old log output, maybe from db:create.
Migrating to AddUserToPassword (20120220172426)
(0.3ms) ALTER TABLE "passwords" ADD "user_id" integer
(0.0ms) PRAGMA index_list("passwords")
(0.2ms) CREATE INDEX "index_passwords_on_user_id" ON "passwords" ("user_id")
(0.7ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120220172426')
(0.1ms) select sqlite_version(*)
(0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
(0.0ms) PRAGMA index_list("passwords")
(0.0ms) PRAGMA index_info('index_passwords_on_user_id')
(4.6ms) PRAGMA index_list("rails_admin_histories")
(0.0ms) PRAGMA index_info('index_rails_admin_histories')
(0.0ms) PRAGMA index_list("users")
(4.8ms) PRAGMA index_info('index_users_on_unlock_token')
(0.0ms) PRAGMA index_info('index_users_on_reset_password_token')
(0.0ms) PRAGMA index_info('index_users_on_email')
(0.0ms) PRAGMA index_list("views")
In my vhost I have it set to use RailsEnv private.
<VirtualHost *:80>
# ProxyPreserveHost on
#
# ProxyPass / http://10.220.100.209:180/
# ProxyPassReverse / http://10.220.100.209:180/
DocumentRoot /var/www/pwpusher/public
<Directory /var/www/pwpusher/public>
allow from all
Options -MultiViews
</Directory>
RailsEnv private
ServerName pwpush.intranet
ErrorLog /var/log/apache2/error.log
LogLevel debug
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
My passenger.conf in mods-enabled is default for Debian.
<IfModule mod_passenger.c>
PassengerRoot /usr
PassengerRuby /usr/bin/ruby
</IfModule>
In the apache error.log I get something more cryptic to me.
[Sun Jun 10 06:25:07 2012] [notice] Apache/2.2.16 (Debian) Phusion_Passenger/2.2.11 PHP/5.3.3-7+squeeze9 with Suhosin-Patch mod_ssl/2.2.16 OpenSSL/0.9.8o configured -- resuming normal operations
/var/www/pwpusher/vendor/bundle/ruby/1.8/bundler/gems/modernizr-rails-09e9e6a92d67/lib/modernizr/rails/version.rb:3: warning: already initialized constant VERSION
cache: [GET /] miss
[Sun Jun 10 08:07:19 2012] [debug] mod_deflate.c(615): [client 10.10.2.13] Zlib: Compressed 728 to 423 : URL /
/var/www/pwpusher/vendor/bundle/ruby/1.8/bundler/gems/modernizr-rails-09e9e6a92d67/lib/modernizr/rails/version.rb:3: warning: already initialized constant VERSION
cache: [GET /] miss
[Sun Jun 10 10:17:16 2012] [debug] mod_deflate.c(615): [client 10.10.2.13] Zlib: Compressed 728 to 423 : URL /
Maybe that's routine stuff. I can see the rake command create files in the relative app root db/. I have private.sqlite3, production.sqlite3 among others. And here's my config/database.yml.
base: &base
adapter: sqlite3
timeout: 5000
development:
database: db/development.sqlite3
<<: *base
test:
database: db/test.sqlite3
<<: *base
private:
database: db/private.sqlite3
<<: *base
production:
database: db/production.sqlite3
<<: *base
I've tried setting absolute paths in it but that did not help.
© Server Fault or respective owner