我正在尝试使用delayed_paperclip 在后台处理图像调整大小。这个过程在开发中有效,但在生产中,我在延迟工作的最后一个错误中得到了这个。
missing required :bucket option\n/home/server_username/project_folder_name/shared/bundle/ruby/2.2.0/gems/paperclip-4.3.0/lib/paperclip/storage/s3.rb:218:in 'bucket_name'...etc
在应用程序.rb
config.paperclip_defaults = {
:storage => :s3,
:url =>':s3_domain_url',
:s3_protocol => 'https',
:path => '/:class/:attachment/:id_partition/:style/:filename',
:bucket => ENV['s3_bucket_name'],
:s3_credentials => {
:access_key_id => ENV['s3_id'],
:secret_access_key => ENV['s3_key']
}
}
在我的班级文件中
has_attached_file :uploaded_file,
:styles => { original: "990x990#",large: "300x300#", medium: "200x200#", thumb: "100x100#"},
only_process: [:medium]
process_in_background :uploaded_file, queue: "queue_name",
only_process: [:original, :large, :thumb]
上传到 s3 无需使用 delay_paperclip。我只是想使用这个库,这样人们就不必等待这些被上传/调整。我正在开发 Ubuntu14.04。使用 Capistrano 进行部署。
我看到存储桶应该在 s3_credentials 之外的几个地方,所以我把它移到了现在的位置。所以我已经在那里和 s3_credentials 内部进行了尝试——无论哪种方式都没有改变。
中等图像会立即上传并调整大小并且可以正常工作。
如果有一些我没有提供的信息,请告诉我。