hohner
hohner

Reputation: 11588

Streamlining deployment with Capistrano

Is there any way I can streamline my deployment process? I currently use these git and Capistrano commands:

git add .
git commit -am 'Comment...'
git push [name]

cap deploy:setup
cap deploy
cap deploy:cleanup

So if I want to make minor changes, I have to enter my password four times (once for push, once for setup, and twice for deploy). Is there any way I can reduce the amount of commands?

Upvotes: 0

Views: 107

Answers (1)

pjmorse
pjmorse

Reputation: 9294

Your git workflow is pretty standard, and you're not going to streamline it much. You don't need to push every commit, I suppose, and there's nothing wrong with a lot of small, atomic commits.

As far as cap deploy goes, though, why are you running the setup and cleanup every time? Can't you just run cap deploy? If you need to run cleanup every time, try redefining deploy's default to include it. In your deploy.rb:

namespace :deploy do
  desc <<-DESC
    Deploys your project. This calls both `update' and `restart'. Note that \
    this will generally only work for applications that have already been deployed \
    once. For a "cold" deploy, you'll want to take a look at the `deploy:cold' \
    task, which handles the cold start specifically.
  DESC
  task :default do
    update
    restart
    cleanup # <-- this is added
  end
end

If you have a good reason to run setup every time, you can add that to the redefined default task as well.

Upvotes: 1

Related Questions