rails assets:在slug期间为s3错误预编译:当设置env时,雾提供程序和目录不能为空
我决定通过S3提供rails资产; heroku有很好的教程如何做到这一点。 该网站现在提供来自我的亚马逊桶的资产,但我不确定为什么我必须手动运行heroku run rake assets:precompile
在heroku run rake assets:precompile
的git push heroku master
之后rake assets:precompile
。
运行git push heroku master
后, git push heroku master
了不在我的桶中的资产以及预编译内容的输出:
AssetSync: using default configuration from built-in initializer AssetSync: using default configuration from built-in initializer rake aborted! Fog provider can't be blank, Fog directory can't be blank /tmp/build_3vtwfg15g8ajx/vendor/bundle/ruby/1.9.1/gems/asset_sync-0.5.0/lib/asset_sync/asset_sync.rb:29:in `sync' /tmp/build_3vtwfg15g8ajx/vendor/bundle/ruby/1.9.1/gems/asset_sync-0.5.0/lib/tasks/asset_sync.rake:3:in `block in ' Tasks: TOP => assets:precompile:nondigest (See full trace by running task with --trace) Precompiling assets failed, enabling runtime asset compilation Injecting rails31_enable_runtime_asset_compilation
我确实设置了雾提供程序和目录: heroku config:add FOG_DIRECTORY=XXX FOD_PROVIDER=AWS
并调用heroku config –app确认这个…所以我没有得到这些错误。
资产没有显示在我的存储桶中,所以我运行: heroku run rake assets:precompile
,一切都有警告:
AssetSync: using default configuration from built-in initializer AssetSync: Syncing. [WARNING] fog: the specified s3 bucket name(ss_assets) is not a valid dns name, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/Bucket Restrictions.html
我是否总是必须在之后运行预编译任务,并且只是对推送失败感到满意? 我将检查目录名称的警告是否导致推送时出现空白FOG错误
EDIT再次在资产中调用asset_sync似乎没有ENV变量:heroku push的预编译任务。 推送后运行该任务,但它“烦人”。
仍然没有为我工作,最新的尝试是(每asset_sync github项目 ):
LIB /任务/ asset_sync.rake。
Rake::Task['assets:precompile'].enhance do AssetSync.sync end Rake::Task["assets:precompile:nondigest"].enhance do AssetSync.sync end
我还尝试在我的production.rb文件中添加行,例如:
config.asset_sync.aws_bucket = ENV['FOG_DIRECTORY'] config.asset_sync.fog_provider = ENV['FOG_PROVIDER']
对我来说也没用。
从asset_sync docs Labs部分下面运行
heroku labs:enable user-env-compile -a myapp
还没有成为标准的平台!