Deploy only one role / server with capistrano

I am trying to configure multiple roles, one for live and one for dev. They look like this:

role :live, "example.com"
role :dev, "dev.example.com"

However, when I start the cover deployment, it runs for both servers. I tried the following and it always runs on both.

cap deploy live
cap ROLE=live deploy

What am I missing? I know that I can write a custom task that responds to only one role, but I do not want to write a whole bunch of tasks to tell her to respond to one role. Thank!

+3
source share
4 answers
+1

Capistrano Multistage , . , Capistrano .

( ROLES ):

cap ROLES=web deploy

:

cap ROLES=app,web deploy

( HOSTS ):

cap HOSTS=web1.myserver.com deploy

:

cap HOSTS=web1.myserver.com,web2.myserver.com deploy

() (-):

cap HOSTS=web1.myserver.com ROLES=db deploy
+12

- :

task :dev do
    role :env, "dev.example.com"
end

task :prod do
    role :env, "example.com"
end

:

cap dev deploy
cap prod deploy
+3

Another hint: if you use multi-stage, do not forget to specify ROLES constant before the command cap.

ROLES=web cap production deploy

or after wednesday

cap production ROLES=web deploy

If you set the first parameter, multistage will consider it as the name of the scene and replace it by default:

cap ROLES=web production deploy

* [...] executing `dev'
* [...] executing `production'
+2
source

Source: https://habr.com/ru/post/1729152/


All Articles