Class: Contexto::SSH
- Inherits:
-
Object
- Object
- Contexto::SSH
- Defined in:
- lib/contexto/ssh.rb
Overview
SSH class
Instance Method Summary collapse
- #cmd ⇒ Object
- #console ⇒ Object
-
#initialize(ipaddress, cluster, service, container) ⇒ SSH
constructor
A new instance of SSH.
- #rake(rake_cmd) ⇒ Object
- #ssh ⇒ Object
- #ssh_cmd ⇒ Object
Constructor Details
#initialize(ipaddress, cluster, service, container) ⇒ SSH
Returns a new instance of SSH.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/contexto/ssh.rb', line 5 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' = {} end |
Instance Method Details
#cmd ⇒ Object
32 33 34 |
# File 'lib/contexto/ssh.rb', line 32 def cmd "'docker exec -it \\$(docker ps | grep ecs-#{@cluster}-#{@service}-.*-#{@container} | cut -d\\ -f1) bin/rails " end |
#console ⇒ Object
16 17 18 |
# File 'lib/contexto/ssh.rb', line 16 def console exec "#{ssh_cmd} #{cmd} c'\"" end |
#rake(rake_cmd) ⇒ Object
24 25 26 |
# File 'lib/contexto/ssh.rb', line 24 def rake(rake_cmd) exec "#{cmd} #{rake_cmd}'\"" end |
#ssh ⇒ Object
20 21 22 |
# File 'lib/contexto/ssh.rb', line 20 def ssh exec "#{ssh_cmd}\"" end |
#ssh_cmd ⇒ Object
28 29 30 |
# File 'lib/contexto/ssh.rb', line 28 def ssh_cmd "ssh -t -A #{@bastion_host} \"ssh -t ec2-user@#{@ipaddress} " end |