Last active
November 1, 2018 16:23
-
-
Save bjjb/7926219 to your computer and use it in GitHub Desktop.
A Capistrano 3.x Vagrant stage. Place into config/deploy/vagrant.rb, and deploy to the Vagrant box as if it were a production VM.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Capistrano 3.x Vagrant stage | |
# config/deploy/vagrant.rb | |
set :stage, :vagrant | |
set :rails_env, "production" | |
vagrant_ssh_config = `vagrant ssh-config`.split("\n")[1..-1].map(&:strip).inject({}) do |m, s| | |
k, v = s.split(/\s/, 2).map(&:strip); m[k] = v; m | |
end | |
server vagrant_ssh_config['HostName'], | |
roles: %w{web app db}, | |
primary: true, | |
user: vagrant_ssh_config['User'], | |
port: vagrant_ssh_config['Port'], | |
ssh_options: { | |
keys: [vagrant_ssh_config['IdentityFile']], | |
forward_agent: vagrant_ssh_config['ForwardAgent'] == 'yes' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment