情況是這個(gè)樣子:
"A"是開(kāi)發(fā)機(jī),
"B"是用來(lái)專(zhuān)門(mén)放開(kāi)發(fā)項(xiàng)目的服務(wù)器,
"C,D,E...等 "是其它人要訪問(wèn)的服務(wù)器對(duì)外
現(xiàn)在有多個(gè)項(xiàng)目我需要部署到多臺(tái)服務(wù)器上面去,現(xiàn)在我的方法是使用"capistrano"
1: 在A新建一個(gè)部署項(xiàng)目"deploy"讓其來(lái)發(fā)送指令,使C,D,E..服務(wù)器到"B"服務(wù)器上下載項(xiàng)目
2: 以前我部署的時(shí)候是進(jìn)到deploy中然后進(jìn)到對(duì)應(yīng)的項(xiàng)目進(jìn)行 cap production deploy 來(lái)部署
3: 現(xiàn)在我要想用一個(gè)項(xiàng)目來(lái)專(zhuān)門(mén)負(fù)責(zé)部署類(lèi)似"deploy"但是我想同時(shí)部署多個(gè)項(xiàng)目到多臺(tái)服務(wù)器上去.
4: 所以我想問(wèn)請(qǐng)教一下,是否有那么一個(gè)機(jī)制"同時(shí)部署多項(xiàng)目到多臺(tái)服務(wù)器上"
5:我聽(tīng)說(shuō)過(guò)caphub 但是還沒(méi)有怎么領(lǐng)會(huì)其用法,還有其它的方法嗎?
光陰似箭催人老,日月如移越少年。
As long as you can ssh to operate the remote machine, you can change it to the command you want to execute
for i in 1.1.1.1 2.2.2.2 3.3.3.3 4.4.4.4 ; do ssh root@$i 'cd /path/to; git pull; supervisor reload' done;
@yanyaoer The method used is the simplest shell implementation. The disadvantage is that the whole process is queued and not concurrent. You can use some concurrency gadgets such as pssh onall, which can be very complete and have other great uses and result feedback. It is also very easy to operate more server command operations at the same time.