How to ignore a folder with svn and capistrano

Hi

I have a site with an uploads folder ‘public/uploads’ and whenever I
deploy previous uploads disappear. I figure it’s one of two things svn
is deleting them (but it’s supposed to leave files it doesn’t know
about alone) or the uploads are getting left behind in the old
release.

Any ideas on what could be going wrong? How can I set the folder to be
ignored or the files moved to the new release?

thanks!

I have a site with an uploads folder ‘public/uploads’ and whenever I
deploy previous uploads disappear. I figure it’s one of two things svn
is deleting them (but it’s supposed to leave files it doesn’t know
about alone) or the uploads are getting left behind in the old
release.

Any ideas on what could be going wrong? How can I set the folder to be
ignored or the files moved to the new release?

Your best bet is to create a symlink from ‘public/uploads’ to the
‘shared’
directory. That is…

current/public/uploads -> shared/public/uploads

Then modify the capistrano task to make sure that symlink is there after
a
deploy.

Something like this:

task :after_update_code, :roles => :app do
run “ln -nfs ‘#{shared_path}/public/uploads’
‘#{release_path}/public/uploads’”
end

-philip

Your uploads are probably being left in the old release. You should
move them to a shared folder and symlink to them from your release
directory. Something like this in your deploy recipe should work:

task :after_update_code, :roles => :app do
run “ln -sf #{deploy_to}/shared/uploads #{release_path}/public/
uploads”
end

I successfully created the symlink from public/uploads to
shared/uploads, but my images don’t appear when I browse the site. My
image src tags are correct, but the symlink doesn’t resolve. Any ideas?

Thx
Greg

On Feb 12, 2:54 pm, “Vixiom” [email protected] wrote:

I have a site with an uploads folder ‘public/uploads’ and whenever I
deploy previous uploads disappear. I figure it’s one of two things svn
is deleting them (but it’s supposed to leave files it doesn’t know
about alone) or the uploads are getting left behind in the old
release.

The previous posters are correct that your uploads are being left in
the old release.

I prefer, and encourage my customers, to symlink public/uploads to
public/system/uploads. public/system is created by Capistrano on
every deploy and points to RAILS_ROOT/…/shared/system, so the
symlink above will place photos in shared/system/uploads.

symlinks can be added to Subversion. :slight_smile:

You’ll likely want to set svn:ignore to ‘system’ in Subversion as
well, as you’ll need a public/system on your development system
to exist, but you should not add the system directory to your
repository.


– Tom M., CTO
– Engine Y.

Greg wrote:

I successfully created the symlink from public/uploads to
shared/uploads, but my images don’t appear when I browse the site. My
image src tags are correct, but the symlink doesn’t resolve. Any ideas?

Thx
Greg

Nevermind, got it. Just a corrupt symlink.