I have setup carrierwave on a softlayer VPS. Carrierwave gives an option to save files on local storage.
If I use symlink for public/images
to shared_path/images
then images gets uploaded but doesn't get rendered.
And when I remove the symlink and directly store images in public/images
, then am able to see the images, but its of least use as the later release wont have those images.
My uploader class app/uploader/image_uploader.rb
looks like this
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
def default_url
"/assets/default.gif"
end
def extension_white_list
%w(jpg jpeg gif png)
end
def store_dir
"images"
end
end
I have used symlinks in my deploy scripts
set :shared_children, shared_children + %w{public/images}
desc "Symbolic Link for Uploads"
task :symlink_uploads, :roles => [:app, :web] do
run "rm -rf #{release_path}/public/images &&
ln -nfs #{shared_path}/images #{release_path}/public/images"
end
after 'deploy:update_code', 'deploy:symlink_uploads'
Tried setting permissions too. But still I don't see my uploaded images.
I get following message when I try to access images from browser
Forbidden
You don't have permission to access /images/my_profile.jpg on this server.
Apache/2.2.14 (Ubuntu) Server at example.com Port 80
Have also searched through Capistrano and Carrierwave, Carrierwave files with Capistrano
Do I need to set specific permissions for the directories to be accessible ? for example:
chmod 755 shared_path/images
Unable to find any working solution on it. Highly appreciate a help.
Thanks in advance.