简体   繁体   中英

Capistrano deploy.rb file based on environment

I need two deployment files (staging and production); they will have separate deployment details (host, user, environment, branch, etc...). Is it possible to cap deploy using a specific file? Something like...

cap deploy:staging    # use staging_deploy.rb
cap deploy:production # use production_deploy.rb

Or is there a better way to do this?

Capistrano 3 has multi-stage support built-in. For capistrano 2, use an extension: https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension .

In both cases, the file structure looks like this:

├── Capfile
└── config
    ├── deploy
    │   ├── production.rb
    │   └── staging.rb
    └── deploy.rb

You can override settings from deploy.rb (host, user and everything else) in a corresponding environment-specific file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM