capistrano deploy_symlink失败 [英] capistrano deploy_symlink fails
问题描述
这是我的第一次部署。我做了一个上限 deploy:setup
,效果很好。
This is my first deployment. I did a cap deploy:setup
which worked fine.
然后,当我尝试执行 cap deploy:update
我遇到了错误消息。类似于
Then, when I try to execute cap deploy:update
I run into error messages. Something along the lines of
rm: cannot remove `/var/www/app_name/current': Is a directory
这是我的capfile和目录权限。
Here is my capfile and directory permissions.
< a href = http://pastie.org/1189919 rel = nofollow> http://pastie.org/1189919
,就部署用户和权限而言,最佳实践是什么?我应该使用root还是创建其他用户。如果其他用户需要什么确切权限?
In general, what is the best practice as far as deployment user and permissions are concerned? Should I use root or create a different user. If a different user what exact permissions does it need?
谢谢
推荐答案
您是在 / var / www / app_name
中创建目录还是由capistrano创建的?
Did you create the directories within /var/www/app_name
, or were they created by capistrano?
无论如何,您遇到的问题是 / var / www / app_name / current
不应该是目录-它应该是 / var / www / app_name / releases /
。当capistrano在 / var / www / app_name / releases /
中完成新发行文件夹的创建并尝试对 / var进行符号链接时,导致失败/ www / app_name / current
。
Regardless, the issue you have is that /var/www/app_name/current
should not be a directory - it should be a symlink to the current release within /var/www/app_name/releases/
. The failure is caused when capistrano has finished creating the new release folder within /var/www/app_name/releases/
, and is trying to symlink /var/www/app_name/current
to it.
您也许可以通过重命名 / var /来解决问题www / app_name / current
(以便在出现问题时进行备份),并从 / var / www / app_name / current
创建符号链接到 / var / www / app_name / releases /
中的最新版本,然后进行 cap部署
。 (如果可行,请删除当前的备份。)
You might be able to fix your issues by renaming /var/www/app_name/current
(so you have a backup if things go wrong), and creating a symlink from /var/www/app_name/current
to the most recent release within /var/www/app_name/releases/
, and then doing a cap deploy
. (Delete your backup of current if this works).
就最佳实践而言,请勿使用root 。而是设置仅对所需目录具有权限的用户(或使用现有用户)(不会仔细阅读脚本,而可能只是 / var / www / app_name
。
As far as best practice goes whatever you do, do not use root. Instead, set up a user (or use an existing user) that has only permissions to the required directories (didn't read your scripts closely, but probably just /var/www/app_name
.
这篇关于capistrano deploy_symlink失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!