Cloud Foundry Ubuntu 12.04 quick start instance

Here is a instance on how to setup CloudFoundry client using Ubuntu (even behind a proxy).


CF install without using proxy

(pretty simple) this should work :

 sudo apt-get install ruby rubygems
 sudo gem install cf --no-ri --no-rdoc
 cf target

CF install behind a proxy

Behind a proxy it seems like there is a problem into CF scripts.
first we need to use ruby version 2 (wich is not the default ruby version).
and then we must patch an url validation step

So first we will use rvm (ruby version managment).

(to avoid) avoid using default ruby-rvm package (sudo apt-get remove ruby-rvm)
(optionnal) clean previous install :

 sudo gem uninstall cf
 sudo apt-get remove rubygems ruby ruby-rvm
(optionnal) to avoid ruby doc task (src)

  echo 'gem: --no-rdoc --no-ri' >> ~/.gemrc

RVM installation

RVM : Ruby Version Manager (src:
 curl -L | bash -s stable --auto-dotfiles
in case of error ("curl returned status '22'.") try it one more time..
next steps:
 . .bashrc
 rvm reload
 rvm install 2.0.0
Ensure running terminal as login shell : cf.
then selecte 2.0.0 version :
 rvm use 2.0.0
 rvm --default use 2.0.0
 $ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux]

CF install using gems

 sudo apt-get install rubygems
 gem install cf

patch CF to use proxy

To launch cf behind proxy, set http_prxy env var; example :
Try to target cf :

 cf target
  # with stack trace :
  cf -t --debug target
In version 3; we are facing the following error :
 Errno::ETIMEDOUT: Connection timed out - connect(2)  
 For more information, see ~/.cf/crash  
 /home/myuser/.rvm/gems/ruby-2.0.0-p247/gems/cf-3.0.0/lib/cf/cli.rb:288:in `initialize': Connection timed out - connect(2) (Errno::ETIMEDOUT)  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/gems/cf-3.0.0/lib/cf/cli.rb:288:in `new'  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/gems/cf-3.0.0/lib/cf/cli.rb:288:in `sane_target_url'  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/gems/cf-3.0.0/lib/cf/cli.rb:309:in `client_target'  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/gems/cf-3.0.0/lib/cf/cli.rb:377:in `client'  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/gems/cf-3.0.0/lib/cf/cli.rb:163:in `save_token_if_it_changes'  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/gems/cf-3.0.0/lib/cf/cli.rb:155:in `block in execute'  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/gems/cf-3.0.0/lib/cf/cli.rb:101:in `wrap_errors'  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/gems/cf-3.0.0/lib/cf/cli.rb:151:in `execute'  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/gems/mothership-0.5.1/lib/mothership.rb:45:in `start'  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/gems/cf-3.0.0/bin/cf:13:in `<top required="">'  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/bin/cf:23:in `load'  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/bin/cf:23:in `<main>'  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'  
     from /home/myuser/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'  
We should patch cli.rb script wich doesn't use proxy to validate url

  vi /home/myuser/.rvm/gems/ruby-2.0.0-p247/gems/cf-3.0.0/lib/cf/cli.rb
comment the following line 288 :

  #, Net::HTTP.https_default_port)
then try it again :

  cf target
this should work now!

Nb: discussion is always in progress on the push command : discussion an an issue has been submitted cf issue#20

Aucun commentaire:

Enregistrer un commentaire