Skip to content

Instantly share code, notes, and snippets.

@halkeye
Created January 25, 2014 00:08
Show Gist options
  • Save halkeye/8609506 to your computer and use it in GitHub Desktop.
Save halkeye/8609506 to your computer and use it in GitHub Desktop.
For production Capistrano deploys, we can't use our own internal git server because the one off amazon box doesn't have access to the internal network. Hacked in a solution to create a port forward to talk back to our network. Works in this case so sharing.
set :repo_url, "ssh://git@localhost:9000/#{fetch(:application)}.git"
module SSHKit; module Backend
class Netssh < Printer
alias_method :orig_ssh, :ssh
def ssh
ret = orig_ssh
@@created_remote ||= ret.forward.remote(22, 'gitserver', 9000)
return ret
end
end
end; end
server 'amazonserver.amazonaws.com', roles: %w{app web db}, user: 'ec2-user'
@rdccosmo
Copy link

rdccosmo commented Feb 5, 2015

I keep getting this error:

cap aborted!
undefined method 'ssh' for class 'SSHKit::Backend::Netssh'
config/deploy/production.rb:5:in 'alias_method'

Do you have any clue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment