Locally everything works as expected, I use the :file storage and it is working.
But my deployed version uses the :fog storage and it is not working. Everytime that i try to upload a image there I face the following error:
Permission denied - /mnt/foo/releases/20130607190757/public/uploads
My uploader configuration is the following:
class ImageUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
And my initializer is defined as following:
CarrierWave.configure do |config|
unless Rails.env.test?
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
config.fog_directory = Rails.configuration.fog_directory
config.fog_public = false
end
if Rails.env.test? or Rails.env.cucumber?
config.enable_processing = false
config.storage = :file
# We may want to changes storage to 'file' after initial testing
elsif Rails.env.development?
config.storage = :file
elsif Rails.env.staging? or Rails.env.pilot? or Rails.env.production?
config.storage = :fog
end
end
Anyone knows what can be causing that error? It looks like it is storing as a file, since it shows the whole file's path.
Regards
尝试将权限扩展到此文件夹
I discovered that the problem is that I was not creating the folder during the rubber deployment. After creating the folder I was able to finish my deployment.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.