简体   繁体   English

使用厨师食谱进行Rails应用程序部署

[英]Rails application deployment using chef cookbook

I am trying to deploy rails application using chef cookbooks, git . 我正在尝试使用厨师食谱git部署Rails应用程序。

Here is the example of the code I use to clone private repo from the github. 这是我用来从github克隆私人仓库的代码示例。

git "/var/www/hello_app" do
  repository "git://github.com/MyUser/MyProject.git"
  reference "master"
  action "sync"
  user "gituser"
end

My concern is how do I run bundle update/bundle install and rake precompile. 我关心的是如何运行捆绑包更新/捆绑包安装和进行预编译。

Also start the unicorn web server, I checked deploy resource of the chef docs also. 还要启动unicorn Web服务器,我还检查了厨师文档的部署资源。

I am exploring the other ways to get it done, 我正在探索完成它的其他方法,

kindly help me out 请帮我

My best get would be to use notifications, but its not rock solid (as any failure would involve modifying the app dir so the git resource get updated at next run). 最好的办法是使用通知,但通知不是很可靠(因为任何失败都涉及修改应用程序目录,以便在下次运行时更新git资源)。

something like : 就像是 :

execute "bundle_install" do
 cwd "/var/www/hello_app"
 command "bundle install"
 action :nothing #To avoid executing at each run
end

git [....] do 
 [...]
 notifies :run,"execute[bundle_install]", :immediately
end

each execute can notifies in turn another one and the last can notify a service to restart for exemple. 每个执行可以依次通知另一个执行,最后一个可以通知服务重启,例如。

You may have a better chance with application cookbook and application_ruby (see the README in the link). 您可能有更好的机会使用应用程序 cookbook和application_ruby(请参阅链接中的自述文件)。

Thoose cookbooks have pre and post deploy hooks and a restart command hook too, they are (IIRC) resilisient to steps failures and may retry on next run if one failed. 那些菜谱也具有部署前和部署后钩子以及重新启动命令钩子,它们(IIRC)可以适应步骤失败,并且如果失败则可以在下一次运行时重试。

I'd go with the deploy resource or the application cookbook. 我将使用部署资源或应用程序指南。 In either case, the bundle install goes into your hooks. 在任何一种情况下, bundle install都将引起您的注意。 I believe the deploy resource actually has an attribute for precompile_command . 我相信deploy资源实际上具有precompile_command的属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM