Capistrano config/deploy/production.rb

config/deploy/production.rbのroleについて

サーバーが一台の場合

server 'hostname',
  user: 'username',
  roles: %w{app db web}

set :ssh_options, {
  port: 'ssh-port',
  keys: File.expand_path('key-path'),
}

 でよいが、

 

サーバーが複数の場合は、

role :app,    %w{ username@hostname }
role :web,    %w{ username@hostname }
role :db,     %w{ username@hostname }

set :ssh_options, {
port: 'ssh-port',
keys: File.expand_path('key-path'),
}

 として対応する。