I was using carrierwave 0.10.0 gem with RMagic to upload images on AWS S3. Everything was working fine except it was taking too much time to upload on AWS S3. So thought using carrierwave backgrounder to upload images in background. I set up carrierwave backgrounder (0.4.2) but In this one My original file is always get upload to S3 but versions of that image is never gets uploaded on S3.
Here is my carrierwave_backgrounder.rb
CarrierWave::Backgrounder.configure do |c|
c.backend :sidekiq, queue: :carrierwave
end
I have defined my queue in sidekiq.rb
Sidekiq.configure_server do |config|
config.redis = { :url => "redis://#{ENV['REDIS_ENDPOINT']}:6379", :namespace=> "#{ENV['REDIS_NAMESPACE']}" }
config.options =
queues: %w{
critical
carrierwave
}
})
end
Here is my photo_uploader.rb
class PhotoUploader < CarrierWave::Uploader::Base
include ::CarrierWave::Backgrounder::Delay
include CarrierWave::RMagick
storage :fog
def store_dir
"uploads/images/"
end
def filename
"#{secure_token}.#{file.extension}" if original_filename.present?
end
def orient_image
manipulate! do |img|
img.auto_orient
img
end
end
# Create different versions of your uploaded files:
version :thumb_small do
process :resize_to_fill => [100,100]
process :strip
end
def strip
manipulate! do |img|
img.strip!
img = yield(img) if block_given?
img
end
end
def extension_white_list
%w(jpg jpeg gif png)
end
def get_version_dimensions
model.width, model.height = `identify -format "%wx%h " #{file.path}`.split(/x/)
end
protected
def secure_token
var = :"@#{mounted_as}_secure_token"
model.instance_variable_get(var) || model.instance_variable_set(var, SecureRandom.hex(5))
end
end
Here is my profile.rb file
mount_uploader :image_url, PhotoUploader
process_in_background :image_url
I have started the sidekiq worker using this command
bundle exec sidekiq -d -L log/sidekiq.log -C config/sidekiq.yml -e development
When I upload image_url only the original image is uploaded. This is sidekiq log after uploading original file. But I don't see any version file uploaded. I checked the S3 bucket also(No version file only the original file)
2016-01-11T08:52:20.772Z 3983 TID-ownpyrrxk CarrierWave::Workers::ProcessAsset JID-91e3803d50defb2d1419cef1 INFO: start
2016-01-11T08:52:31.119Z 3983 TID-ownpyrrxk CarrierWave::Workers::ProcessAsset JID-91e3803d50defb2d1419cef1 INFO: done: 10.347 sec
Is There something I am missing. Please Help Thanks in Advance