我是一名初学程序员,试图部署我的第一个使用位于db / production.sqlite3的本地sqlite3数据库的Rails应用程序
但是,当我将它部署到Elastic Beanstalk时,它似乎无法加载,因为我的所有内容(存储在数据库中)都不会出现。日志中没有错误,似乎它只是忽略了数据库。
这是我的database.yml文件
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
我的数据库位于db / production.sqlite3(这是db / development.sqlite3的副本 - 我在开发环境中填充的数据库),当我运行带有乘客的本地服务器时,一切看起来都很好。内容加载没有问题:
Started HEAD "/" for 127.0.0.1 at 2015-05-13 13:52:19 +0100
ActiveRecord::SchemaMigration Load (0.8ms) SELECT "schema_migrations".* FROM "schema_migrations"
Processing by HomepageController#index as HTML
Book Load (4.9ms) SELECT "books".* FROM "books" WHERE ("books"."release" BETWEEN '2015-04-18 12:52:19.924691' AND '2015-06-12 12:52:19.925430')
(0.8ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 30]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 42]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 45]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 48]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 50]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 52]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 53]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 32]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 34]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 40]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 26]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 33]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 36]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 37]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 47]]
Video Load (2.8ms) SELECT "videos".* FROM "videos" WHERE ("videos"."uploaded" BETWEEN '2015-04-18 12:52:20.065837' AND '2015-05-13 12:52:20.066244')
(1.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 55]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 58]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 60]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 64]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 66]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 71]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 73]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 74]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 75]]
(0.3ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 76]]
(0.3ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 77]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 78]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 56]]
(0.3ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 61]]
(0.7ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 62]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 63]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 65]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 67]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 68]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 69]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 70]]
(0.2ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 72]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 79]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 80]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 82]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 83]]
(0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 84]]
Rendered shared/_navbar.html.erb (0.5ms)
Rendered shared/_logobanner.html.erb (0.5ms)
Rendered shared/_newsletterform.html.erb (0.5ms)
Rendered shared/_anchornavbar.html.erb (0.5ms)
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 55]]
CACHE (0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 64]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 60]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 58]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 66]]
Rendered videos/_operatortalks.html.erb (64.8ms)
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 75]]
CACHE (0.1ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 77]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 71]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 74]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 76]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 73]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 78]]
Rendered videos/_investortalks.html.erb (8.9ms)
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 56]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 61]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 69]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 63]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 65]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 67]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 68]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 62]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 70]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 72]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 79]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 80]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 82]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 83]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."video_id" = ? [["video_id", 84]]
Rendered videos/_othertalks.html.erb (15.9ms)
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 53]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 42]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 50]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 48]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 45]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 52]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 30]]
Rendered books/_operatorbooks.html.erb (32.3ms)
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 40]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 34]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 32]]
Rendered books/_investorbooks.html.erb (14.4ms)
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 37]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 36]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 33]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 26]]
CACHE (0.0ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."book_id" = ? [["book_id", 47]]
Rendered books/_otherbooks.html.erb (21.5ms)
Rendered shared/_footer.html.erb (0.5ms)
Rendered homepage/index.html.erb within layouts/application (255.7ms)
Completed 200 OK in 1377ms (Views: 1134.8ms | ActiveRecord: 18.5ms)
但是,当我将其部署到Elastic Beanstalk时,我的内容应该出现的位置是空白的。我的日志如下:
=== puma startup: 2015-05-11 21:44:43 +0000 ===
=== puma startup: 2015-05-11 21:44:43 +0000 ===
[20699] + Gemfile in context: /var/app/current/Gemfile
[20696] - Worker 0 (pid: 20699) booted, phase: 0
[20696] - Gracefully shutting down workers...
[20696] === puma shutdown: 2015-05-11 21:46:22 +0000 ===
[20696] - Goodbye!
=== puma startup: 2015-05-11 21:46:25 +0000 ===
=== puma startup: 2015-05-11 21:46:25 +0000 ===
[20777] + Gemfile in context: /var/app/current/Gemfile
[20774] - Worker 0 (pid: 20777) booted, phase: 0
Started GET "/" for 85.243.198.164 at 2015-05-11 21:47:16 +0000
Processing by HomepageController#index as HTML
Rendered shared/_navbar.html.erb (0.4ms)
Rendered shared/_logobanner.html.erb (0.4ms)
Rendered shared/_newsletterform.html.erb (0.4ms)
Rendered shared/_anchornavbar.html.erb (0.4ms)
Rendered videos/_operatortalks.html.erb (0.9ms)
Rendered videos/_investortalks.html.erb (0.8ms)
Rendered videos/_othertalks.html.erb (0.8ms)
Rendered books/_operatorbooks.html.erb (0.8ms)
Rendered books/_investorbooks.html.erb (0.9ms)
Rendered books/_otherbooks.html.erb (0.8ms)
Rendered shared/_footer.html.erb (0.3ms)
Rendered homepage/index.html.erb within layouts/application (17.2ms)
Completed 200 OK in 52ms (Views: 24.0ms | ActiveRecord: 1.9ms)
我已经看到其他人有类似的问题,并通过ssh连接到实例并运行&#34; yum install sqlite-devel&#34;但也无济于事。
有人知道如何解决这个问题吗?我更不希望不使用RDS。