A battle well fought with Ruby, Typhoeus & libcURL

Lately I am working on little too much on VMware Integrated OpenStack and trying to make every possible configuration automated. As you know VIO (VMware Integrated OpenStack) exposed the same OpenStack API, however, this is not the case with some of the internal stuff. So I wanted to explore the API and do some automation of the VIO Cluster.

Initially I thought of making this very simple and start using Windows PowerShell. Unfortunately PowerShell v2.0 does not support Invoke-RestMethod so I had to upgrade it to PS 4.0. Well you know you need to install .NET Framework 3.5.1 first and then you can upgrade it to PS 4.0. For this I should have 2.8GB free space in my Windows C:\ drive. Unfortunately I did not have that much free space and was not in a position to expand it as well. Thus I ruled out PowerShell and thought of moving to Ruby.

Ruby has a library Typhoeus, which is a high speed parallel HTTP module. Typhoeus runs HTTP requests in parallel while cleanly encapsulating handling logic. So in my Windows box, I installed Ruby first. Then installed Typhoeus.

gem install typhoeus

Typhoeus

Well, I was ready to run my ruby code then and then hit to the rock.

D:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.9.3-x86-mingw32/lib/ffi/library.rb:133:in `block in ffi_lib’:
Could not open l (LoadError)url’: The specified module could not be found.
Could not open library ‘libcurl.dll’: The specified module could not be found.
Could not open library ‘libcurl.so.4’: The specified module could not be found.

After google about this error a bit, I saw its common across all types of windows installation of Ruby and Typhoeus. I checked each article and tried all sorts of remedy but they did not work for me. At the end I found the solution and that is using cURL version 7.40.0 for Win64 – MinGW64

You need to download this module and extract it somewhere, then just add the extracted location to your Windows PATH variable and restart (You need to do this to load the System Variable) the Ruby command prompt. Once its done, you are pretty much good to go ahead and run your ruby code that uses Typhoeus.

 

About Prasenjit Sarkar

Prasenjit Sarkar is a Product Manager at Oracle for their Public Cloud with primary focus on Cloud Strategy, Oracle Openstack, PaaS, Cloud Native Applications and API Platform. His primary focus is driving Oracle’s Cloud Computing business with commercial and public sector customers; helping to shape and deliver on a strategy to build broad use of Oracle’s Infrastructure as a Service (IaaS) and Platform as a Service (PaaS) offerings such as Compute, Storage, Java as a Service, and Database as a Service. He is also responsible for developing public/private cloud integration strategies, customer’s Cloud Computing architecture vision, future state architectures, and implementable architecture roadmaps in the context of the public, private, and hybrid cloud computing solutions Oracle can offer.