Richard Sandilands
2006-Oct-31 12:05 UTC
Trouble with Capistrano and custom symlink from shared directory
Hi there I have a Rails app which requires the client to upload image files to a certain directory. I''m using capistrano to deploy and have created a directory in shared: shared/book_images I want to symlink this to my_rails_app/public/images/book_images and have this task in my deploy.rb file: desc "Link to the book images directory where uploads go" task :after_symlink do run "ln -nfs #{shared_dir}/book_images #{release_path}/public/images/book_images" end However, iif I ssh into the current release, I see that the symlink above is incorrect: the symlink to the shared book_images directory is _inside_ of public/images/book_images that is, I end up with public/images/book_images/book_images Any clues on how to resolve this would be appreciated. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Jamey Cribbs
2006-Oct-31 17:37 UTC
Re: Trouble with Capistrano and custom symlink from shared directory
Richard Sandilands wrote:> Hi there > > I have a Rails app which requires the client to upload image files to > a certain directory. > > I''m using capistrano to deploy and have created a directory in shared: > shared/book_images > > I want to symlink this to my_rails_app/public/images/book_images and > have this task in my deploy.rb file: > > desc "Link to the book images directory where uploads go" > task :after_symlink do > run "ln -nfs #{shared_dir}/book_images > #{release_path}/public/images/book_images" > end > > > However, iif I ssh into the current release, I see that the symlink > above is incorrect: the symlink to the shared book_images directory is > _inside_ of public/images/book_images > > that is, I end up with public/images/book_images/book_images > > Any clues on how to resolve this would be appreciated. >Does your release_path/public already contain an images/book_images directory *before* you symlink? I seem to remember having a similar problem and it was because I already had a public/photos directory in subversion and so when I deployed the app and then tried to link public/photos to shared/photos, I remember something screwy happening. My quicky hack workaround was to delete the real directory before I did the symlink, i.e.: task :after_update_code, :roles => :app do run "rm -rf #{release_path}/public/photos" run "ln -nfs #{shared_path}/photos #{release_path}/public/photos" end HTH, Jamey Confidentiality Notice: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. If you are not the intended recipient(s), you are hereby notified that any dissemination, unauthorized review, use, disclosure or distribution of this email and any materials contained in any attachments is prohibited. If you receive this message in error, or are not the intended recipient(s), please immediately notify the sender by email and destroy all copies of the original message, including attachments. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Richard Sandilands
2006-Oct-31 20:03 UTC
Re: Trouble with Capistrano and custom symlink from shared directory
On 11/1/06, Jamey Cribbs <jcribbs-5tZyCCM3m2VWk0Htik3J/w@public.gmane.org> wrote:> Does your release_path/public already contain an images/book_images > directory *before* you symlink?Yes and adding ''rm -rf'' to the task fixes the issue. Many thanks Jamey. -- Richard Sandilands --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Richard Sandilands
2006-Oct-31 22:19 UTC
Re: Trouble with Capistrano and custom symlink from shared directory
Upon closer inspection, the sylink is created fine, but for some reason I can''t access the symlinked directory. It''s permissions are the same as other directories but if I try and cd into it, I get ''no such file or directory''. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
antti.hakala-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Nov-01 11:16 UTC
Re: Trouble with Capistrano and custom symlink from shared directory
You could link the book_images/ backwards to ../../shared/book_images and keep the link under version control. Just an idea. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
ebeard
2006-Nov-01 12:36 UTC
Re: Trouble with Capistrano and custom symlink from shared directory
don''t you mean #{shared_path} I do the same thing and it looks like this in my config/deploy.rb : <code> desc "Create the #{shared_dir}/files/production|development|test dirs " + "if they don''t exists and add symlink to #{shared_dir}/files from " + "the current release path" task :symlink_files_dir, :roles => :app do [''production'',''development'',''test''].each do |env| run "mkdir -p #{shared_path}/files/#{env}" unless File.exists?("#{shared_path}/files/#{env}") end # change owner and permission of files sudo "chown --recursive #{user}:#{apache_group} #{shared_path}/files" sudo "chmod --recursive 774 #{shared_path}/files" run "mv #{release_path}/files #{release_path}/files.local" run "ln -s #{shared_path}/files #{release_path}/files" end desc "Do these tasks after you update the code" task :after_update_code do symlink_files_dir end </code> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Richard Sandilands
2006-Nov-04 09:33 UTC
Re: Trouble with Capistrano and custom symlink from shared directory
Yeah - all is working fine now. Many thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---