
我已經能夠使用 Passenger 成功地讓我的應用程式在 Beanstalk 上運行,但是我在 Puma 上卻沒有成功。每當我部署到 Puma 堆疊時,我都會收到 502 錯誤,我的日誌檔案表明它找不到 sock 檔案:
2014/05/15 21:00:15 [crit] 1684#0: *4 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 10.184.156.117, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "app-env-89spnxpcai.elasticbeanstalk.com"
我的應用程式是使用 Ruby ruby 2.0.0p451 和 Rails 4.1.1 建立的
我的 .ebextensions 配置如下圖所示
packages:
yum:
git: []
commands:
add_bundle_exec:
test: test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete
cwd: /opt/elasticbeanstalk/hooks/appdeploy/pre
command: perl -pi -e 's/(rake)/bundle exec $1/' 11_asset_compilation.sh 12_db_migration.sh
add_deployment_flag:
test: test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete
cwd: /opt/elasticbeanstalk/hooks/appdeploy/pre
command: perl -pi -e 's/(bundle install)/$1 --deployment/' 10_bundle_install.sh
make_vendor_bundle_dir:
test: test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete
command: mkdir /var/app/support/vendor_bundle
set_vendor_bundle_var:
test: test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete
cwd: /opt/elasticbeanstalk/support
command: sed -i '12iexport EB_CONFIG_APP_VENDOR_BUNDLE=$EB_CONFIG_APP_SUPPORT/vendor_bundle' envvars
symlink_vendor_bundle:
test: test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete
cwd: /opt/elasticbeanstalk/hooks/appdeploy/pre
command: sed -i 's/\(^cd $EB_CONFIG_APP_ONDECK\)/\1\nln -s $EB_CONFIG_APP_VENDOR_BUNDLE .\/vendor\/bundle/' 10_bundle_install.sh
z_write_post_provisioning_complete_file:
cwd: /opt/elasticbeanstalk/support
command: touch .post-provisioning-complete
我做錯了什麼,我需要一些特殊的東西才能讓它與 Puma 一起工作嗎?
答案1
最新版本 - 運行 Ruby 2.0 (Puma) 的 64 位元 Amazon Linux 2014.03 v1.0.5 不會出現此問題
答案2
更改config.force_ssl = true
以false
解決我的問題