Capistrano-如何将文件放在共享文件夹中? [英] Capistrano - How to put files in the shared folder?

查看:85
本文介绍了Capistrano-如何将文件放在共享文件夹中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Capistrano 的新手,我看到有共享文件夹以及选项:linked_files 。我认为共享文件夹用于在版本之间保留文件。但是我的问题是,文件最终如何位于共享文件夹中?

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?

此外,如果我想将另一个目录符号链接到当前目录,例如静态文件夹的某个路径,如何将其放在 linked_dirs 上?

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 ?

最后如何设置 chmod 755 链接到链接文件和链接目录。

Lastly how to set chmod 755 to linked_files and linked_dirs.

谢谢。

推荐答案

应用程序内的文件夹是指向共享目录中文件夹的符号链接。如果您的应用程序写入 log / production.log ,它实际上将写入 ../ shared / log / production.log 。这就是文件最终位于共享文件夹中的方式。

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.

您可以通过查看 Capistrano中的功能规格或测试

如果要更改这些共享文件,您只需直接在ssh上执行一次操作,因为创建后就不会被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.

要添加链接目录,请在 deploy.rb

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}

set :linked_dirs, fetch(:linked_dirs) + %w{public/system}

这篇关于Capistrano-如何将文件放在共享文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆