Deploying multiple app together

2020-03-26 09:04发布

I have two apps configured to deploy using capistrano and they both deploy fine individually, but I would like to make releases where both apps need to be deployed together.

If there a solution out there to deploy multiple capistrano deploys together and select branches?

I've tried caphub but it's not working for me, I get this:

cap aborted!
NoMethodError: undefined method `gsub' for #<Proc:0x007f870bf5a8e0>

I could have a bash script to deploy all, but is there something better?

标签: capistrano
2条回答
地球回转人心会变
2楼-- · 2020-03-26 09:13

Well there is a better approach if You want to keep the configurațion for Capistrano inside your projects but still be able to deploy them în paralell .

This works even if the two projects use different versions of Capistrano ( 2.x and 3.x )

You just need to do four simple steps:

1) Run this command from terminal în any directory . But make sure You have ruby >= 2.2.

gem install capistrano_multiconfig_parallel -v 2.4.O

2) create a YAML file în your home directory ( /home/username) with name 'multi_cap.yml'

3) Read this readme https://github.com/bogdanRada/capistrano_multiconfig_parallel and put all configurațions in that. File.

4) Run your deploy în paralel as showned în the Readme.

This gem allows You to deploy a application to multiple stages at the same time .

And You can specify different branches at runtime.

But before You do all of this. You need to make sure that each task won't use a resource ( file) that other task might use also or you'll find yourself în a deadlock.

Enjoy :)

查看更多
Ridiculous、
3楼-- · 2020-03-26 09:30

Try looking into Git Submodules.

Basically you choose 1 main repo and have the rest as submodules, this way Capistrano only pulls from one git repo = atomic deploy.

It won't actually merge the repos, each one will have its own commit history as before.
Submodules' code will appear under main module's root folder.

So if all your apps are to be on the same server, this could be a good solution.

查看更多
登录 后发表回答