unable to upload cookbook from knife to chef-server - ruby

I am running open source chef server on ubuntu ec2 instance. I am trying to upload the cookbook from my workstation using knife to chef-server, I am getting following error
/home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:878:in `initialize': getaddrinfo: Name or service not known (SocketError)
from /home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:878:in `open'
from /home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
from /home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
from /home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:877:in `connect'
from /home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
from /home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:851:in `start'
from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/rest-client-1.6.7/lib/restclient/resource.rb:76:in `put'
from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.6.0/lib/chef/cookbook_uploader.rb:151:in `block in uploader_function_for'
from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.6.0/lib/chef/cookbook_uploader.rb:25:in `call'
from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.6.0/lib/chef/cookbook_uploader.rb:25:in `block (3 levels) in setup_worker_threads'
from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.6.0/lib/chef/cookbook_uploader.rb:24:in `loop'
from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.6.0/lib/chef/cookbook_uploader.rb:24:in `block (2 levels) in setup_worker_threads'
when I ran the same command in the verbose mode I figured out knife or workstation or chef-client installed on my laptop is trying to connect to the private ip of the ubuntu ec2 instance.
How do I prevent the knife to stop connecting to private ip of the ubuntu ec2 instance and connect to the sub-domain/domain or elastic ip of the server.
Kindly help me out

check how you configured chef_server_url in your chef configuration file.
You may want to configure the fqdn to your server instead of just the hostname.
for example if your machine is called myhserver.mycompany.com then if you configured (in your knife.rb)
chef_server_url 'myserver:8080'
then your server may be resolved to the private ip, and if you configred
chef_server_url 'myserver.mycompany.com:8080'
Then it may be resolved to your public IP. it depends how your DNS is configured.
Note: you can also consider configuring chef_server_url to point to your IP (instead of hostnames/fqdn).

Related

Vagrant SSH Agent Forwarding + Provider Config = Error?

Relative Vagrant and Ruby newb here. I'm trying to enable SSH forwarding from my Windows machine to my Vagrant created Ubuntu VM. My Vagrantfile has some Virtualbox provider specific config:
config.vm.provider "virtualbox" do |v|
v.name = guestHostname
v.memory = 8192
v.cpus = 2
v.customize ["modifyvm", :id, "--vram", "128"]
v.gui = true
end
Works fine by itself. But when I add the config for SSH forwarding:
config.ssh.forward_agent = true
Running 'vagrant up' starts failing with this error message:
Bringing machine 'development' up with 'virtualbox' provider...
==> development: Importing base box 'bento/ubuntu-16.10'...
==> development: Matching MAC address for NAT networking...
==> development: Checking if box 'bento/ubuntu-16.10' is up to date...
==> development: Setting the name of the VM: development
==> development: Clearing any previously set network interfaces...
==> development: Preparing network interfaces based on configuration...
development: Adapter 1: nat
==> development: Forwarding ports...
development: 22 (guest) => 2222 (host) (adapter 1)
==> development: Running 'pre-boot' VM customizations...
==> development: Booting VM...
==> development: Waiting for machine to boot. This may take a few minutes...
development: SSH address: 127.0.0.1:2222
development: SSH username: vagrant
development: SSH auth method: private key
==> development: Forcing shutdown of VM...
==> development: Destroying VM and associated drives...
C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:54:in `readpartial': An established connection was aborted by the software in your host machine. (Errno::ECONNABORTED)
from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:54:in `block (2 levels) in negotiate!'
from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:52:in `loop'
from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:52:in `block in negotiate!'
from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:50:in `loop'
from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:50:in `negotiate!'
from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/server_version.rb:32:in `initialize'
from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/session.rb:84:in `new'
from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh/transport/session.rb:84:in `initialize'
from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh.rb:233:in `new'
from C:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh.rb:233:in `start'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/communicators/ssh/communicator.rb:397:in `block (2 levels) in connect'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:88:in `block in timeout'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `block in catch'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `catch'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `catch'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:103:in `timeout'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/communicators/ssh/communicator.rb:371:in `block in connect'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/util/retryable.rb:17:in `retryable'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/communicators/ssh/communicator.rb:370:in `connect'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/communicators/ssh/communicator.rb:68:in `block in wait_for_ready'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:88:in `block in timeout'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `block in catch'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `catch'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:32:in `catch'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/timeout.rb:103:in `timeout'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/communicators/ssh/communicator.rb:46:in `wait_for_ready'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/action/builtin/wait_for_communicator.rb:16:in `block in call'
Commenting out the provider specific config makes the error go away, and forwarding appears to work. Any ideas on what could be causing the issue?
I can see that you are using vagrant 1.9.4 and this is a known issue with vagrant 1.9.4. I am linking here the github issue associated with this problem. This has been fixed in version 1.9.5 though. So, you could either downgrade to 1.9.3 or upgrade to 1.9.5

homestead vagrant broken after added new site

I got a strange issue with my vagrant box. I am not very familiar with vagrant. Just want to check if any one has fixed the same problem or at least can shed some light to me. Thanks in advance for your help!
The box was working fine until I have added a new laravel site into it.(I didn't change anything from the vagrantfile. Only added the sites maping for the new site) After composer install, I tried to reload vagrant box. Then I got error as:
Bins:homestead Leo$ vagrant reload
/Applications/MAMP/htdocs/homestead/vendor/laravel/homestead/scripts/homestead.rb:178:in `+': no implicit conversion of nil into String (TypeError)
from /Applications/MAMP/htdocs/homestead/vendor/laravel/homestead/scripts/homestead.rb:178:in `block (2 levels) in configure'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/kernel_v2/config/vm_provisioner.rb:72:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/kernel_v2/config/vm_provisioner.rb:72:in `add_config'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/kernel_v2/config/vm.rb:338:in `provision'
from /Applications/MAMP/htdocs/homestead/vendor/laravel/homestead/scripts/homestead.rb:177:in `block in configure'
from /Applications/MAMP/htdocs/homestead/vendor/laravel/homestead/scripts/homestead.rb:166:in `each'
from /Applications/MAMP/htdocs/homestead/vendor/laravel/homestead/scripts/homestead.rb:166:in `configure'
from /Applications/MAMP/htdocs/homestead/Vagrantfile:30:in `block in <top (required)>'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/v2/loader.rb:37:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/v2/loader.rb:37:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/loader.rb:113:in `block (2 levels) in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/loader.rb:107:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/loader.rb:107:in `block in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/loader.rb:104:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/loader.rb:104:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/vagrantfile.rb:28:in `initialize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:746:in `new'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:746:in `vagrantfile'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:492:in `host'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:214:in `block in action_runner'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/action/runner.rb:33:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/action/runner.rb:33:in `run'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:479:in `hook'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:728:in `unload'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/bin/vagrant:130:in `ensure in <main>'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/bin/vagrant:130:in `<main>'
Tried anything I could but still cannot get the box up again.
Also on vagrant global-status, I can see 2 boxes in the same folder:
id name provider state directory
-----------------------------------------------------------------------------
2727da4 default virtualbox running /Users/Leo/Homestead
6ca3944 co-dev1 virtualbox running /Users/Leo/vagrant-dev-co
ae2f475 default virtualbox running /Users/Leo/nexuse-vagrant
83fc055 default virtualbox running /Users/Leo/symfony-dev
bb7c75f homestead virtualbox running /Applications/MAMP/htdocs/homestead
6634808 homestead-7 virtualbox poweroff /Applications/MAMP/htdocs/homestead
tried to destroy 6634808, but got error again:
Bins:~ Leo$ vagrant destroy 6634808
/Applications/MAMP/htdocs/homestead/vendor/laravel/homestead/scripts/homestead.rb:4:in `configure': undefined method `[]' for nil:NilClass (NoMethodError)
from /Applications/MAMP/htdocs/homestead/Vagrantfile:30:in `block in <top (required)>'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/v2/loader.rb:37:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/v2/loader.rb:37:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/loader.rb:113:in `block (2 levels) in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/loader.rb:107:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/loader.rb:107:in `block in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/loader.rb:104:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/config/loader.rb:104:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/vagrantfile.rb:28:in `initialize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:746:in `new'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:746:in `vagrantfile'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:669:in `machine'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/plugin/v2/command.rb:147:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/plugin/v2/command.rb:201:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/plugin/v2/command.rb:201:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/plugin/v2/command.rb:183:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/plugin/v2/command.rb:183:in `with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/plugins/commands/destroy/command.rb:30:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/cli.rb:42:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:308:in `cli'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/bin/vagrant:127:in `<main>'
homestead.yaml file is here:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
hostname: homestead
name: homestead
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: "/Applications/MAMP/htdocs/homestead/code"
to: "/home/vagrant/Code"
sites:
- map:
to: "/home/vagrant/Code/co-orion/public"
- map: dev.lara.com
to: "/home/vagrant/Code/lara/public"
- map: dev.lara53.com
to: "/home/vagrant/Code/laravel53/public"
- map: dev.es.com
to: "/home/vagrant/Code/es"
- map: dev.laradminlte.com
to: "/home/vagrant/Code/laradminlte/public"
- map: dev.lavalite.com
to: "/home/vagrant/Code/lavalite/public"
databases:
- orion
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
ports:
# - send: 50000
# to: 5000
- send: 62000
to: 9200
protocol: tcp
SSH key authentication failure might be the problem
you should edit the Homestead.yaml file. In this file, you can configure the path to your public SSH key, as well as the folders you wish to be shared between your main machine and the Homestead virtual machine.
Don't have an SSH key? On Mac and Linux, you can generally create an SSH key pair using the following command:
ssh-keygen -t rsa -C "you#homestead"
On Windows, you may install Git and use the Git Bash shell included with Git to issue the command above. Alternatively, you may use PuTTY and PuTTYgen.
Once you have created a SSH key, specify the key's path in the authorize property of your Homestead.yaml file.

Laravel Homestead Up Error

I have an error every time i run homestead up from my console
can someone please give me a solution to this?
homestead.bat up
C:/Users/Evan Oscar/AppData/Roaming/Composer/vendor/laravel/homestead/Vagrantfile:17:in `read': No such file or directory - C:/cygwin64/home/Evan Oscar/.homestead/Homestead.yaml (Errno::ENOENT)
from C:/Users/Evan Oscar/AppData/Roaming/Composer/vendor/laravel/homestead/Vagrantfile:17:in `block in <top (required)>'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/v2/loader.rb:37:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/v2/loader.rb:37:in `load'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:103:in `block (2 levels) in load'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:97:in `each'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:97:in `block in load'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:94:in `each'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:94:in `load'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/vagrantfile.rb:28:in `initialize'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:691:in `new'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:691:in `vagrantfile'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:441:in `host'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:207:in `block in action_runner'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:33:in `call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:33:in `run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:428:in `hook'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:673:in `unload'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/bin/vagrant:177:in `ensure in <main>'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/bin/vagrant:177:in `<main>'
this is my homestead.yaml file:
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Code
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
I suspect that my folder name could be a problem?
since i use "Evan Oscar" or maybe there's something that i miss when i installed homestead?
Can someone help me with this please?
I have search the web for the solution but none have really worked
I will explain the steps from the beginning so you can check if you did something wrong. I suggest you delete your homestead folder and try installing it again to see what happens.
Did you installed homestead locally or globally?
( like git clone https://github.com/laravel/homestead.git Homestead or composer global require laravel/homestead )
If the answer is locally you need to go inside the folder created when you cloned homestead and then run this command to init the config files of homestead ( ~/.homestead/Homestead.yaml or c:\users\username.homestead\Homestead.yaml for windows)
bash init.sh
If you installed it globally you can use this command from anywhere. After that you just need to configure the Homestead.yaml file as explained in the doc.
Don't forget to create your
ssh-keygen -t rsa -C "you#homestead"
I noticed you are using the default style for homestead.yaml config, try changing the urls for a more windows-like format
authorize: c:\Users\username\.ssh\homestead_rsa.pub
keys:
- c:\Users\username\.ssh\homestead_rsa
folders:
- map: C:\
Only then you run
homestead up

ruby - check ssh connection to a remote through another machine

I am using aws sdk in order to create machines, and as soon as the machines are created, i want to check ssh connection to those machines.
the problem is - from my machines, i don't have access to EC2 machines, but there is another machine on my network, which i have access to through ssh, and this machine do have access to the EC2 machines.
Now, is there a simple way through ruby to check ssh to EC2 machine ?
I've tried the following:
proxy = Net::SSH::Proxy::HTTP.new('<proxy ip>', 22)
Net::SSH.start('<EC2 machine's IP>', '<USER>', :proxy => proxy) do |ssh|
end
Errno::ECONNRESET: Connection reset by peer
from /home/galt/.rvm/gems/ruby-1.9.3-p484/gems/net-ssh-2.7.0/lib/net/ssh/proxy/http.rb:76:in `gets'
from /home/galt/.rvm/gems/ruby-1.9.3-p484/gems/net-ssh-2.7.0/lib/net/ssh/proxy/http.rb:76:in `parse_response'
from /home/galt/.rvm/gems/ruby-1.9.3-p484/gems/net-ssh-2.7.0/lib/net/ssh/proxy/http.rb:62:in `open'
from /home/galt/.rvm/gems/ruby-1.9.3-p484/gems/net-ssh-2.7.0/lib/net/ssh/transport/session.rb:67:in `block in initialize'
from /home/galt/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/timeout.rb:55:in `timeout'
from /home/galt/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
from /home/galt/.rvm/gems/ruby-1.9.3-p484/gems/net-ssh-2.7.0/lib/net/ssh/transport/session.rb:67:in `initialize'
from /home/galt/.rvm/gems/ruby-1.9.3-p484/gems/net-ssh-2.7.0/lib/net/ssh.rb:200:in `new'
from /home/galt/.rvm/gems/ruby-1.9.3-p484/gems/net-ssh-2.7.0/lib/net/ssh.rb:200:in `start'
from (irb):12
from /home/galt/.rvm/rubies/ruby-1.9.3-p484/bin/irb:12:in `<main>'
thanks !
The Net::SSH::Proxy::HTTP class is meant to point to a HTTP proxy for your ssh connections. So, you will need to set up a HTTP proxy on that machine to be able to proxy your connections through it.
If you can't do that, I suggest you use SSH reverse tunnels. We will achieve this by opening the port 8080 on the local machine, forward the traffic sent there to Server using the SSH tunnel and make Server forward it to the EC2 instance on port 22. The net-ssh ruby gem already provide commands to help us with that, but we will need to run 2 sessions in parallel, using threads:
proxy_thread = Thread.new do
Net::SSH.start('<proxy ip>', '<user>') do |ssh|
ssh.forward.remote(8080, "<AWS ip>", 22)
ssh.loop { true }
end
end
proxy_thread.start
Net::SSH.start('localhost', '<localhost user>', port: 8080) do |ssh|
#done
end
proxy_thread.kill

Cassandra on EC2

I followed this http://www.datastax.com/documentation/cassandra/2.0/cassandra/install/installAMI.html and then I try to use this ruby gem (https://github.com/iconara/cql-rb) to connect to my EC2 instance but i get the following error:
irb(main):013:0> Cql::Client.connect(host: 'PUBLIC_DNS', port: 9160)
Cql::Io::ConnectionError: end of file reached from
/Users/damien/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cql-rb-2.0.0.pre0/lib/cql/client/synchronous_client.rb:32:in
connect' from
/Users/damien/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cql-rb-2.0.0.pre0/lib/cql/client.rb:118:in
connect' from (irb):13 from
/Users/damien/.rbenv/versions/1.9.3-p392/bin/irb:12:in `'
If I SSH to the box and use cqlsh to connect to localhost it works fine.
Any idea?
You should use the native_transport_port which defaults to 9042, not the rpc_port which defaults to 9160. However, both ports are configurable inside of cassandra.yaml after a Cassandra server restart.

Resources