Reputation: 13587
Here's some quotes I've found on the web:
Stages:
From Beanstalk blog
"allows you to setup one recipe to deploy your code to more than one location."
From Github
"we have a production server and a staging server. So naturally, we would like two deployment stages, production and staging. We also assume you're creating an application from scratch."
Roles:
From SO (accepted answer)
Roles allow you to write capistrano tasks that only apply to certain servers. This really only applies to multi-server deployments. The default roles of "app", "web", and "db" are also used internally, so their presence is not optional (AFAIK)
In my naivety , these sound like the same thing, could someone please explain the different in a way your grandmother could understand?
P.S I'm deploying PHP if that helps.
Upvotes: 1
Views: 595
Reputation: 3265
Stages are used to deploy different branches to different groups of servers (where a group may be one or more servers).
Roles are used to deploy the same branch to different servers in the same group, and allow you to run certain capistrano commands on certain servers in that group. For example, if you run a DB update task during deploy, you could specify to run it for the :db
role only, where :db
represents a single server, instead of wasting resources running the same command on two servers for the same result.
This is only really useful when you have multiple servers in a server group (for example, staging1 and staging2, prod1 and prod2). If you have single servers for staging and production, you don't need to worry about roles.
Note that I've also simplified the definition of stages here. You can actually deploy multiple stages to a single server if you need to, by making :deploy_to
dependent on the stage.
Upvotes: 1