1
1

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 3 years have passed since last update.

capistrano 踏み台サーバがある場合のconfig/deploy/production.rbの書き方

Posted at

構成

--------------------
target_server
user: deploy
key: id_rsa.pemが必要
--------------------
^
|
--------------------
bastion_server.com
user: bastion_user
--------------------
^
|
--------------------
local
--------------------

config/deploy/production.rb

server "target_server", user: "deploy", roles: %w{app db web}, my_property: :my_value

set :ssh_options, {
  keys: %w(~/.ssh/id_rsa.pem),
  forward_agent: false,
  user: 'deploy',
  proxy: Net::SSH::Proxy::Command::new('ssh bastion_user@bastion_server.com -W %h:%p')
}

参考
config/deploy/production.rbの設定について
https://gist.github.com/chansuke/737784de811f140853239daa7b6b75ef

SSHのProxyCommandについて
https://dev.classmethod.jp/articles/direct-ssh-by-proxycommand/

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?