部署 capistrano 之外的选择,用 mina 部署果然快

lidashuang · February 02, 2013 · Last by linjunhalida replied at June 16, 2014 · 7954 hits

mina

Mina works really fast because it’s a deploy Bash script generator. It generates an entire procedure as a Bash script and runs it remotely in the server.

直接生成 bash 脚本在服务端运行,比 capistrano 快多了

这两天刚用它部署了 prd 用了个好东西 share 一下 https://github.com/alfuken/mina-rails-unicorn-nginx-god

awesome! 和 capistrano 讲再见了

刚测试了一下,capistrano 通过 ssh 运行命令没有想象的那么慢啊。 在 deploy.rb 尾部加了 10 个 task

after "deploy:update_code", :test1
task :test1 do
    run "echo 1"
end
after "deploy:update_code", :test2
task :test2 do
    run "echo 2"
end
after "deploy:update_code", :test3
task :test3 do
    run "echo 3"
end
after "deploy:update_code", :test4
task :test4 do
    run "echo 4"
end
after "deploy:update_code", :test5
task :test5 do
    run "echo 5"
end
after "deploy:update_code", :test6
task :test6 do
    run "echo 6"
end
after "deploy:update_code", :test7
task :test7 do
    run "echo 7"
end
after "deploy:update_code", :test8
task :test8 do
    run "echo 8"
end
after "deploy:update_code", :test9
task :test9 do
    run "echo 9"
end
after "deploy:update_code", :test10
task :test10 do
    run "echo 10"
end

然后运行这 10 个 task 共用去了 3 秒左右,每个 task 大约 0.3 秒 (美国 vps)

 * 2013-02-03 00:05:42 executing `test1'
 * executing "echo 1"
   servers: ["blog.bccn.net"]
   [blog.bccn.net] executing command
** [out :: blog.bccn.net] 1
   command finished in 351ms
 * 2013-02-03 00:05:42 executing `test2'
 * executing "echo 2"
   servers: ["blog.bccn.net"]
   [blog.bccn.net] executing command
** [out :: blog.bccn.net] 2
   command finished in 367ms
 * 2013-02-03 00:05:42 executing `test3'
 * executing "echo 3"
   servers: ["blog.bccn.net"]
   [blog.bccn.net] executing command
** [out :: blog.bccn.net] 3
   command finished in 3

粗略算了一下,用 mina 大约能节省三分之一的时间,30 秒的部署任务缩短到 20 秒

Java 里面有个 socket 框架也叫 mina

capistrano 问题是文档没做好,我部署两个网站了要新开的话还是一头雾水。

mina 和 vlad 都在直逼 坎普思戳娜

awesome, good share!

我有点不打算换了,一开始我看了 vlad 的介绍,没用 capistrano,用 vlad,结果用了一段时间感觉各种不舒服,最终还是转回 capistrano,发现挺好用的,也明白了一点,啥东西,还是要用的人多的才保险一点,@Rei 说的没错,capistrano 的问题不是没文档,而是文档太乱

一直手动搞…也许用一个能增加部署频率…

作者听说是 菲律宾人。

capistrano3 现在也是用生成脚本在远端执行的方法了。

You need to Sign in before reply, if you don't have an account, please Sign up first.