21
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Multistage な Capistrano with Rails

Last updated at Posted at 2013-02-18

複数環境にデプロイできるようにするため、capistrano-ext を使っていると思いますが、本体に取り込まれていたので、使い方のメモ。

Before(本体とは別で配布されていたころ)

Gemfile
gem 'capistrano'
gem 'capistrano-ext'
deploy.rb
require "capistrano/ext/multistage"

で、config/deploy 以下に {環境名}.rb というファイルを作ると、それぞれの環境を認識し、環境ごとの設定が記述できる

After(本体同梱)

Gemfile
gem 'capistrano'
deploy.rb
require "capistrano/ext/multistage"

set :stages, %w(staging production)
set :default_stage, "staging"

config/deploy 配下にファイルを作る部分は一緒。

環境を明示的に書く必要があるのが、変更点か。デフォルトを設定できるのは、ミスオペを考えると安全側に倒しておけるから、ありがたいかも。

参考資料

https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension

21
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?