Capistrano和Github网站的部署

时间:2010-06-11 15:01:12

标签: deployment capistrano web-deployment

所以,我有一个我认为是一个相当简单的Capistrano用例:我想从Github部署一个PHP站点。但是我遇到了很多问题。当我运行cap deploy时,Capistrano能够克隆Github仓库(deploy:update_code步骤),但随后在deploy:finalize_update步骤中显示

executing "rm -rf /var/www/sitename.com/releases/20100611144519/log /var/www/sitename.com/releases/20100611144519/public/system /var/www/sitename.com/releases/20100611144519/tmp/pids &&\\\n      mkdir -p /var/www/sitename.com/releases/20100611144519/public &&\\\n      mkdir -p /var/www/sitename.com/releases/20100611144519/tmp &&\\\n      ln -s /var/www/sitename.com/shared/log /var/www/sitename.com/releases/20100611144519/log &&\\\n      ln -s /var/www/sitename.com/shared/system /var/www/sitename.com/releases/20100611144519/public/system &&\\\n      ln -s /var/www/sitename.com/shared/pids /var/www/sitename.com/releases/20100611144519/tmp/pids"

接着是

executing "find /var/www/sitename.com/releases/20100611144519/public/images /var/www/sitename.com/releases/20100611144519/public/stylesheets /var/www/sitename.com/releases/20100611144519/public/javascripts -exec touch -t 201006111445.23 {} ';'; true"

我真的不明白这里发生了什么。然后它会出错:

*** [err :: sitename.com] find: `/var/www/sitename.com/releases/20100611144519/public/images': No such file or directory

以及每个stylesheetsjavascripts目录的另一个错误。

发生了什么事?我意识到Capistrano主要用于部署Rails和其他Ruby应用程序,但我正在使用capistrano-php gem。我很感激任何帮助。

1 个答案:

答案 0 :(得分:37)

Capistrano默认行为是“触摸”所有资产文件。 (确保任何缓存获取部署日期)。资产是图像,样式表等。

如果您的PHP应用程序没有使用这些目录,那么capistrano会以一种丑陋的方式抱怨。

要禁用资产时间戳更新,只需添加:

 set :normalize_asset_timestamps, false

到你的deploy.rb