2013-03-19 31 views
0

几乎没有跟我让AWS S3为我的Heroku的应用程式的静态资产获得Heroku的资产预编译亚马逊AWS s3的

一切本地工作,我跑我的rake任务,然后将资产获得预编译到AWS的问题(虽然有从未在终端的任何输出?)

然后Heroku的,在这里我把我的ENV变量,像这样

heroku config:add aws_access_key=mysecretkey aws_secret_key=mypublickey aws_bucket=mybucketname 

我有两个桶,一个用于开发,一个用于生产。我需要在heroku:config中设置其他任何内容吗?

继承人是我迄今为止

config.rb

AssetSync.configure do |con| 
con.fog_provider = 'AWS' 
con.fog_region = 'eu-west-1' 
con.fog_directory = ENV['aws_bucket'] 
con.aws_access_key_id = ENV['aws_access_key'] 
con.aws_secret_access_key = ENV['aws_secret_key'] 
con.prefix = "assets" 
con.public_path = Pathname("./public") 
end 

的问题在这里,其中有多少会Heroku的阅读和使用,我知道我必须在Heroku上明确设置ENV,但会它读取其余部分并执行其余的任务,即它会读取前缀,public_path等?

Rake文件

require 'bundler/setup' 
Bundler.require(:default) 
require 'active_support/core_ext' 
require './config/env' if File.exists?('config/env.rb') 
require './config/config' 

namespace :assets do 
desc "Precompile assets" 
task :precompile do 
AssetSync.sync 
end 

当运行

heroku run rake assets:precompile 

我得到的输出

`rake assets:precompile` attached to terminal...up, run.2942 The source :rubygems is deprecated because HTTP requests are insecure. Please change your source to 'https://rubygems.org (in /app) 

那么它只是返回到终端,我期待的名单所有的资产在哪里被列为正在进行的任务。在检查我的水桶在AWS,它是空的

输出后编辑Heroku的日志 - 尾

2013-03-19T10:55:50+00:00 heroku[api]: Starting process with command `bundle exec rake assets:precompile` by [email protected] 
2013-03-19T10:55:52+00:00 heroku[run.6701]: State changed from starting to up 
2013-03-19T10:55:53+00:00 heroku[run.6701]: Awaiting client 
2013-03-19T10:55:53+00:00 heroku[run.6701]: Starting process with command `bundle exec rake assets:precompile` 
2013-03-19T10:55:59+00:00 heroku[run.6701]: Client connection closed. Sending SIGHUP to all processes 
2013-03-19T10:56:00+00:00 heroku[run.6701]: Process exited with status 0 
2013-03-19T10:56:00+00:00 heroku[run.6701]: State changed from up to complete 

更多是约15分钟

! Heroku client internal error. 
! Search for help at: https://help.heroku.com 
! Or report a bug at: https://github.com/heroku/heroku/issues/new 

Error:  An existing connection was forcibly closed by the remote host 
(Errno::ECONNRESET) 

    Command:  heroku logs --tail 
    Version:  heroku-gem/2.35.0 (i386-mingw32) ruby/1.9.3 

回答

1

后增加这是一个由于在Gemfile中声明的源代码而导致的bundler错误。这与资产编制本身无关。

在你的Gemfile顶部指定

source 'https://rubygems.org' 

+0

确定这样bundler错误现在消失了,但仍然没有编译 – Richlewis 2013-03-19 09:41:08

+1

有更多的错误?对于这些错误,Herku有点安静。你可以尝试在本地模拟你的资产编译。创建一个gemset或其他东西,并尝试完成任务。我最近有问题heroku没有编译资产,因为我有一些自定义rake任务,因为缺少宝石不能在heroku上加载 – ben 2013-03-19 10:12:50

+0

不是我可以看到,资产编译在本地工作,它将它们编译为heroku,这是问题 – Richlewis 2013-03-19 10:25:40