# Context module Contexto # SSH class class SSH def initialize(ipaddress, cluster, service, container) @ipaddress = ipaddress @cluster = cluster @service = service @container = container @bastion_host = 'bastion.empatico.xyz' @bastion_user = '' @user_name = 'ec2-user' @options = {} end def console exec "#{cmd} c'\"" end def rake(rake_cmd) exec "#{cmd} #{rake_cmd}'\"" end def cmd "ssh -t -A #{@bastion_host} \"ssh -t ec2-user@#{@ipaddress} 'docker exec -it \\$(docker ps | grep ecs-#{@cluster}-#{@service}-.*-#{@container} | cut -d\\ -f1) bin/rails " end end end