Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capistrano - How to put files in the shared folder?

I am new to Capistranoand I saw there is shared folder and also option :linked_files. I think shared folder is used to keep files between releases. But my question is, how do files end up being in the shared folder?

Also, if I want to symlink another directory to the current directory e.g. static folder at some path, how do I put it at the linked_dirs ?

Lastly how to set chmod 755 to linked_files and linked_dirs.

Thank you.

like image 903
Fajarmf Avatar asked Sep 28 '13 20:09

Fajarmf


1 Answers

Folders inside your app are symlinks to folders in the shared directory. If your app writes to log/production.log, it will actually write to ../shared/log/production.log. That's how the files end up being in the shared folder.

You can see how this works by looking at the feature specs or tests in Capistrano.

If you want to chmod these shared files, you can just do it once directly over ssh since they won't ever be modified by Capistrano after they've been created.

To add a linked directory, in your deploy.rb:

set :linked_dirs, %w{bin log tmp/backup tmp/pids tmp/cache tmp/sockets vendor/bundle} 

or

set :linked_dirs, fetch(:linked_dirs) + %w{public/system} 
like image 76
Michael Avatar answered Sep 23 '22 21:09

Michael