3

By default, Capistrano's deploy task creates symlinks from the shared/log, shared/system and shared/pids directory into the release directory. How can I prevent this?

mjs
  • 63,493
  • 27
  • 91
  • 122

2 Answers2

7

If you look at the source code for the deploy recipe at line 52, you can see:

=========================================================================
These variables should NOT be changed unless you are very confident in
what you are doing. Make sure you understand all the implications of your
changes if you do decide to muck with these!
=========================================================================
...
_cset :shared_children,   %w(system log pids)
...

This is how the shared folders are defined. I suppose you could add the following line to your capistrano recipe to prevent these directories from being symlinked:

set :shared_children, %w()

Update: Regarding the comments below: With the edge version of capistrano this should now be working. See this pull request to make the symlinks less hard-coded.

HectorMalot
  • 1,120
  • 1
  • 6
  • 13
  • Following your tip, I checked out the source, and it seems that although `:shared_children` allows you to change the directories that are created, the actual symlinking bit is done by some crude hardcoding: https://github.com/capistrano/capistrano/blob/2fd9180125daa4e8dda299bb90e946f2405900e9/lib/capistrano/recipes/deploy.rb#L246 – mjs Nov 10 '11 at 14:50
  • Good catch! Teaches me that I should've tested my suggestion before submitting. I suppose you can override the `finalize_update` task to prevent symlinking these directories, but it doesn't seem like the right way. – HectorMalot Nov 11 '11 at 11:18
  • 1
    Just a note that this pull request made it into version 2.10 (and is not in version 2.9) You may need to update your capistrano with: bundle update capistrano – Mike Schroll May 23 '12 at 00:36
-1

It's impossible to avoid these symlinks; it's done by some pretty crude (!) hard-coding in deploy.rb

May have been fixed in capistrano 2.10; see How to prevent Capistrano generating symlinks in the `shared` directory on deployment?.

Community
  • 1
  • 1
mjs
  • 63,493
  • 27
  • 91
  • 122