开发者

Can a specify a particular server on the capistrano command line?

开发者 https://www.devze.com 2022-12-17 01:50 出处:网络
I just tried to run ca开发者_Go百科p deploy:setup on the command line, but it wanted it to run on just one particular server instead of them all. Is there a way to run a task on just one server fro

I just tried to run

ca开发者_Go百科p deploy:setup

on the command line, but it wanted it to run on just one particular server instead of them all. Is there a way to run a task on just one server from the command line, or do I have to define it that way in the deploy.rb file?


Are you using capistrano-multistage? If not I recommend you do, I believe you can achieve the same with just the deploy.rb but personally I just find it easier this way and it makes this process much neater, especially if you start doing different things in production, staging or other stages.

Basically once you've installed the gem locally you can simply run commands like this:

cap staging deploy:setup 

Where the 'staging' part matches one of you stage files (See below).

To get up and running change deploy.rb to something like this:

set :stages, %w(staging production)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
after "deploy", "deploy:cleanup"

Then add a folder named deploy into the config directory of your rails app. In there you can place your separate deployment files, e.g staging.rb and production.rb.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号