rdmcfee
rdmcfee

Reputation: 550

Avoiding redundancy with capistrano multistage extension

I have a deployment script for a production server I'm looking at the capistrano multistage extension to also add a staging server.

The multistage extension allows me to split my cap recipes into config/deploy/production.rb and config/deploy/staging.rb but much of the deployment script is identical and so it's redundant. Can I keep some of the definitions and tasks in a shared file? Anyone have experience with this?

UPDATE:

I found that duplicate tasks can be placed in deploy.rb. Only unique settings need to be placed in the files for the individual stages.

Upvotes: 0

Views: 127

Answers (1)

Oscar Barrett
Oscar Barrett

Reputation: 3275

Any identical variables and tasks should be defined in deploy.rb. Capistrano uses your deploy config first, and then the config for your stage. Variables defined inside stage configs will override those defined in deploy.rb.

In general, you should at least define a unique branch, hostname and roles for each stage.

Upvotes: 1

Related Questions