我一直在嘗試開始在AWS的Elastic Beanstalk上運行Rails,但我遇到了一個看似不可逾越的障礙:雖然我能夠啓動一個運行示例應用程序的新Elastic Beanstalk,我似乎無法讓EB實例成功運行我自己的代碼。Rails應用程序無法在AWS Elastic Beanstalk上運行,sqlite3錯誤
這裏是我所採取的步驟:
- 上本地OSX 10.9.3
- 安裝AWS-EB客戶端工具運行紅寶石1.9.3p545。
- 恪守以下來自Amazon的教程:Deploying a Rails Application to AWS Elastic Beanstalk(tl; dnr:使用'rails new'創建一個新的rails應用程序,提交git然後使用'eb init'創建類型爲'64bit的EB實例Amazon Linux 2014.03 v1.0.3運行Ruby 1.9.3',然後運行'eb start')
- 等待看起來永恆的EB實例創建後,我瀏覽到Amazon提供的URL。
- 不是看到我的Rails應用程序(其中,順便說一句,在本地運行正常)的,我得到了可怕的「很抱歉,但出事了」頁面:
我嘗試了這些步驟多次,結果相同。我曾嘗試過使用不同的環境(例如Ruby 2.0.0 Puma和Passenger),並根據需要通過rvm更新我的ruby。
在此之前被標記爲重複,請允許我馬上,我看着下面的問題,發現他們並沒有解決我的問題:
AWS Elastic Beanstalk: Launching a new Rails App
Deploying an existing Rails app to AWS Elastic Beanstalk
繼在問題「AWS Elastic Beanstalk:啓動一個新的Rails應用程序」這個問題上的建議,這看起來與我的問題非常相似,我讓應用程序運行了一個晚上,我仍然收到錯誤。
我已經ssh進入實例。有趣的是,production.log和development.log似乎都是空的(無論如何,它們都在/ var/app/support/logs中)。不過,我覺得在passenger.log如下:
********* *********剪斷
[2014年6月12日21:42:38.8400 5133/7fe66aee4700 agents/HelperAgent/RequestHandler.h:2210]:[Client 20]無法簽出會話。 錯誤頁面: 無法加載這樣的文件 - sqlite3/sqlite3_native(LoadError) /usr/local/share/gems1.9/gems/sqlite3-1.3.9/lib/sqlite3.rb:6:in require' /usr/local/share/gems1.9/gems/sqlite3-1.3.9/lib/sqlite3.rb:6:in
rescue in' /usr/local/share/gems1.9/gems/sqlite3-1.3.9/lib/sqlite3.rb:2:in <top (required)>' /usr/local/share/gems1.9/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in
require' /usr/local/share/gems1.9/gems/bundler-1.6。 2/lib/bundler/runtime.rb:76:在block (2 levels) in require' /usr/local/share/gems1.9/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in
每個' /usr/local/share/gems1.9/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in block in require' /usr/local/share/gems1.9/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in
each' /usr/local/share/gems1.9/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in require' /usr/local/share/gems1.9/gems/bundler-1.6.2/lib/bundler.rb:132:in
require' /var/app/current/config/application.rb:7:在<top (required)>' /var/app/current/config/environment.rb:2:in
要求' /var/app/current /config/environment.rb:2:in <top (required)>' config.ru:3:in
要求' config.ru:3:in block in <main>' /usr/local/share/gems1.9/gems/rack-1.5.2/lib/rack/builder.rb:55:in
instance_eval' /usr/local/share/gems1.9/gems/rack-1.5。2/lib/rack/builder.rb:55:in initialize' config.ru:1:in
new' config.ru:1:in <main>' /usr/local/share/gems1.9/gems/passenger-4.0.41/helper-scripts/rack-preloader.rb:112:in
eval' /usr/local/share/gems1.9/gems/passenger-4.0.41/helper-scripts /rack-preloader.rb:112:in preload_app' /usr/local/share/gems1.9/gems/passenger-4.0.41/helper-scripts/rack-preloader.rb:158:in
' /usr/local/share/gems1.9/gems/passenger-4.0.41/helper-scripts/rack-preloader.rb:29:in <module:PhusionPassenger>' /usr/local/share/gems1.9/gems/passenger-4.0.41/helper-scripts/rack-preloader.rb:28:in
'
App 5241 stdout: App 5241 stdout: [2014-06-12 21:45:26.2512 5133/7fe66d1ef700 Pool2/Implementation.cpp:883]:無法爲組/ var/app/current#spawn創建進程default:An錯誤發生在'void Passenger :: ApplicationPool2 :: SmartSpawner :: handleErrorResponse(Passenger :: ApplicationPool2 :: SmartSpawner :: StartupDetails 0)中啓動$ '(SmartSpawner.h:566) '(SmartSpawner.h:455) in'std :: string Passenger :: ApplicationPool2 :: SmartSpawner :: negotiatePreloaderStartup(Passenger :: ApplicationPool2 :: SmartSpawner :: StartupDetails &)'(SmartSpawner.h:566) in 'void Passenger :: ApplicationPool2 :: SmartSpawner :: startPreloader()'(SmartSpawner.h:206) in'虛擬Passenger :: ApplicationPool2 :: ProcessPtr Passenger :: ApplicationPool2 :: SmartSpawner :: spawn(const Passenger :: ApplicationPool2: :選項&)'(SmartSpawner.h:752) in'void Passenger :: ApplicationPool2 :: Group :: spawnThreadRealMain(const Passenger :: ApplicationPool2 :: SpawnerPtr &,const Passenger :: ApplicationPool2 :: Options &,unsigned in $
******** end snip ********
不確定sqlite3是否存在問題,但它似乎確實安裝在實例上。以防萬一,我再次安裝了sqlite3 gem。
這裏的乘客狀態輸出:
Version : 4.0.41
Date : 2014-06-13 13:25:52 +0000
Instance: 5148
----------- General information -----------
Max pool size : 6
Processes : 0
Requests in top-level queue : 0
----------- Application groups -----------
/var/app/current#default:
App root: /var/app/current
Requests in queue: 0
我不是專家,但它似乎是乘客沒有運行(進程== 0)。
我錯過了什麼?有沒有一些「JUST_WORK_DARNIT」配置,我忽略了設置爲true?
如果實際上sqlite3安裝出現問題(如下面所示),我該如何解決該問題?
任何想獲得正確安裝sqlite3 gem的想法?我認爲只是重新運行gem install是不夠的,因爲我已經嘗試過了。 – seanicus
對不起,我不熟悉Elastic Beanstalk來回答這個問題。 – Hongli