如何填写用于storage.yml的AWS数据

问题描述

我想将Ruby on Rails应用程序推送到heroku。但这卡住了。

remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Some gems seem to be missing from your vendor/cache directory.
remote:        Could not find aws-eventstream-1.1.0 in any of the sources
remote:        Bundler Output: Some gems seem to be missing from your vendor/cache directory.
remote:        Could not find aws-eventstream-1.1.0 in any of the sources
remote:
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected,Failed to compile Ruby app.
remote:
remote:  !     Push Failed
remote: Verifying deploy...
remote:
remote: !   Push rejected to pure-crag-52432.
remote:
To https://git.heroku.com/pure-crag-52432.git
 ! [remote rejected] user-microposts -> master (pre-receive hook declined)
error: Failed to push some refs to 'https://git.heroku.com/pure-crag-52432.git'

除了我不知道为什么heroku要求aws-eventstream-1.1.0 gem(因为它不在Gemfile中)这一事实之外。我不确定如何填写以下guide中所给的storage.yml字段:

amazon:
  service: S3
  access_key_id:     <%= ENV['AWS_ACCESS_KEY_ID'] %>
  secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
  region:            <%= ENV['AWS_REGION'] %>
  bucket:            <%= ENV['AWS_BUCKET'] %>

我应该保持原样,并且将heroku配置自动链接到此文件吗?

我尝试了这一点(当然,我对所有答案都做了些修改):

amazon:
  service: S3
  access_key_id:     AKIAXOOFZZFFKMQD3CFD
  secret_access_key: Cj8BcL452tDer5ryTPBRlan5LHOq76WXgvTDHmvc
  region:            region=eu-east-3
  bucket:            rails-tutorial-joost

这些是我的Heroku配置:

➜  sample_app git:(user-microposts) heroku config
 ›   Warning: heroku update available from 7.42.2 to 7.42.6.
=== pure-crag-52432 Config Vars
AWS_ACCESS_KEY_ID:        AKIAXOOFOGFKKMQD3CFE
AWS_BUCKET:               rails-tutorial-joost
AWS_REGION:               region=eu-east-3
AWS_SECRET_ACCESS_KEY:    Ci8BcL452tcxDer5ryTPBRlan5LHOq76WXgvTDHmvc
DATABASE_URL:             postgres://blohftwliwefcg:6cfd2ccz2cc27301f86a1fe3c4686bb77784e67a62312d55c7e5751dfd61331c156@ec2-34-192-173-173.compute-1.amazonaws.com:5432/davr7msm9qlqh1
LANG:                     en_US.UTF-8
RACK_ENV:                 production
RAILS_ENV:                production
RAILS_LOG_TO_STDOUT:      enabled
RAILS_MASTER_KEY:         ./config/credentials/production.key
RAILS_SERVE_STATIC_FILES: enabled
SECRET_KEY_BASE:          32c6c8d057cc6c61071f18429e64zxczxc337d795bfa81abd04ed3e74377eff9e6cddb024967e6a0ffb9bc7de55b408ad71291ab5e518bcfe20bb5a7b44871d570cc61
SENDGRID_PASSWORD:        bdsk6q67625964
SENDGRID_USERNAME:        [email protected]

我在heroku helpcenter站点上找到了解决方案:

  1. 如果在升级时得到以下输出: remote:Bundler输出:您尝试在更改后以部署模式安装 远程:您的Gemfile。在其他地方运行bundle install添加 远程:将Gemfile.lock更新为版本控制。 但是在本地运行捆绑软件安装不会更改您的Gemfile.lock,请确保您在本地使用的是最新版本的捆绑软件。我们建议使用1.13.7或更高版本。升级本地捆绑程序版本后,请重新运行捆绑程序安装并将结果提交到git,然后再进行再次部署。 如果运行软件包安装并提交结果不能解决问题,请检查是否有使用ENV变量的自定义gem来源。例如: 来源“ https://#{ENV ['GEMFURY_URL'} @ gem.fury.io / some-value-here /“ 如果您使用ENV变量在Gemfile中为源指定用户名密码,请确保您使用相同的ENV变量在本地运行捆绑安装。还要在捆绑后验证Gemfile.lock中是否存在完整的URL(包括任何用户名密码)。 如果您不希望将用户名密码检入git,请考虑使用捆绑程序的内置支持,通过特殊的ENV变量配置用户名密码。 使用相对路径指定BUNDLE_GEMFILE可能不起作用https://github.com/bundler/bundler/pull/5815。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)