# Capistrano :update\_code problem

**URL:** <https://www.ruby-forum.com/t/capistrano-update-code-problem/82588>\
**Category:** Rails\
**Created:** [March 16, 2006, 4:24pm UTC](https://www.ruby-forum.com/t/capistrano-update-code-problem/82588 "2006-03-16T16:24:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![henster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a183cd/32.png) [@henster](https://www.ruby-forum.com/u/henster)\
**Post date:** [March 16, 2006, 4:24pm UTC](https://www.ruby-forum.com/t/capistrano-update-code-problem/82588/1 "2006-03-16T16:24:27Z")

</div>

Hi all,

I want to love capistrano and I’m so close.

My error is occuring while running the update\_code task… (apologies  
for the shell spew)

* * *

- executing “rm -rf  
/home/henster29/sites/glitter/releases/20060316143447/log  
/home/henster29/sites/glitter/releases/20060316143447/public/system  
&&\n ln -nfs /home/henster29/sites/glitter/shared/log  
/home/henster29/sites/glitter/releases/20060316143447/log &&\n ln  
-nfs /home/henster29/sites/glitter/shared/system  
/home/henster29/sites/glitter/releases/20060316143447/public/system”  
servers: [“[aidlife.textdriven.com](http://aidlife.textdriven.com)”]  
[[aidlife.textdriven.com](http://aidlife.textdriven.com)] executing command  
\*\* [out :: [aidlife.textdriven.com](http://aidlife.textdriven.com)] ln:  
/home/henster29/sites/glitter/releases/20060316143447/public/system:  
No such file or directory  
command finished

* * *

Ah, so its trying to make a symbolic link to a dir that doesnt exist…  
I checked the gems/capistrano-1.1.0/lib/capistrano/recipes/standard.rb  
which seems to be the source and found this…

* * *

task :update\_code, :roles =\> [:app, :db, :web] do  
on\_rollback { delete release\_path, :recursive =\> true }

source.checkout(self)

run \<\<-CMD  
rm -rf #{release\_path}/log #{release\_path}/public/system &&  
ln -nfs #{shared\_path}/log #{release\_path}/log &&  
ln -nfs #{shared\_path}/system #{release\_path}/public/system  
CMD  
end

* * *

Which looks like (to me) that it blows away  
#{release\_path}/public/system and then tries to make a link in there.

I must be talking crap since this works for everyone else… Any ideas?

Thanks  
-henry

---

<div class="post-metadata">

**Author:** ![henster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a183cd/32.png) [@henster](https://www.ruby-forum.com/u/henster)\
**Post date:** [March 16, 2006, 5:03pm UTC](https://www.ruby-forum.com/t/capistrano-update-code-problem/82588/2 "2006-03-16T17:03:25Z")

</div>

Henry,

Did you set up your machines using the ‘setup’ task, or did you build  
the directories manually?

The directory structure ought to look like this:

/deploy\_to  
/deploy\_to/releases  
/deploy\_to/releases/…  
/deploy\_to/shared  
/deploy\_to/shared/log  
/deploy\_to/shared/system  
/deploy\_to/current -\> /deploy\_to/releases/…

- Jamis

---

<div class="post-metadata">

**Author:** ![henster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a183cd/32.png) [@henster](https://www.ruby-forum.com/u/henster)\
**Post date:** [March 16, 2006, 9:50pm UTC](https://www.ruby-forum.com/t/capistrano-update-code-problem/82588/3 "2006-03-16T21:50:56Z")

</div>

Thanks for the help guys, you led me down the right track.

I was trying to deploy a single file,“test.txt”, to see if I could get  
it to work… rather than a whole rails app.  
/deploy\_to/releases/public isnt made in setup but rather checked out  
from your repos. So public wasnt there… Oops.

It might be nice to have /deploy\_to/releases/public created during  
setup… but I may be in the minority using full blown capistrano to  
upload a text file 😉

beers  
-h

---

<div class="post-metadata">

**Author:** ![henster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a183cd/32.png) [@henster](https://www.ruby-forum.com/u/henster)\
**Post date:** [March 16, 2006, 7:01pm UTC](https://www.ruby-forum.com/t/capistrano-update-code-problem/82588/4 "2006-03-16T19:01:47Z")

</div>

Henry T. wrote:

> My error is occuring while running the update\_code task… (apologies  
> for the shell spew)

Shell spew is helpful. Give us more!

> \*\* [out :: [aidlife.textdriven.com](http://aidlife.textdriven.com)] ln:  
> task :update\_code, :roles =\> [:app, :db, :web] do  
> on\_rollback { delete release\_path, :recursive =\> true }
> 
> source.checkout(self)
> 
> run \<\<-CMD  
> rm -rf #{release\_path}/log #{release\_path}/public/system &&

If you want to trouble shoot this, change the rm -rf to rm -r. Then if  
the #{release\_path}/log or #{release\_path}/public/system do not exist,  
you will get an error. The -f option causes rm not to complain about  
directories that don’t exist, in addition to forcing removal of files  
that have restrictive permissions.

As Jamis points out in a parallel response, if you run the setup tasks  
these directories should have been created, but is possible that they  
don’t.

Ray
