deployer
deployer copied to clipboard
Docs: add an example with bastion server
An example with bastion server
host('10.10.10.30')
->stage('prod')
->user('deploy')
->roles('app')
->set('deploy_path', '/site')
->addSshOption('ProxyCommand', '"ssh -W %h:%p -q user@bastion"');
Originally posted by @alinalexandru in https://github.com/deployphp/deployer/issues/223#issuecomment-1489168848
Upvote & Fund
- We're using Polar.sh so you can upvote and help fund this issue.
- We receive the funding once the issue is completed & confirmed by you.
- Thank you in advance for helping prioritize & fund our backlog.
Posibile workaround in V7, until the API is changed in V8
In deploy.php use the option config_file
host('web.xxxx.xxxxx')
......
->set('config_file', 'ssh/config');
Create file ssh/config
where all the ssh options are specified
Host jumphost
HostName xxx.xxx.xxx.xxx
User xxxxx
# Optional. Depending an your setup
StrictHostKeyChecking no
Host web.xxxx.xxxxx
HostName xxx.xxx.xxx.xxx
User xxx
# Optional. Depending an your setup
StrictHostKeyChecking no
ProxyJump jumphost
Did the following using ssh config provided to a Gitlab Runner, to access target-server through bastion server.
@alinalexandru should we update DeployerPHP documentation somewhere ?
~/.ssh/config :
Host *
Forwardagent yes
StrictHostKeyChecking no
AddKeysToAgent yes
Host bastion
IdentityFile ~/.ssh/key
HostName bastion.example.com
User bastion
Host target-server
HostName ip
Port port
IdentityFile ~/.ssh/key
ProxyCommand ssh -W %h:%p bastion
User exampleUser
hosts.yml :
hosts:
env-name:
hostname: target-server
stage: stageName
branch: branchName
deploy_path: /var/www/html
ssh_arguments: ['-o StrictHostKeyChecking=no' ]