A mind that is stretched by a new experience can never go back to its old dimensions.

RVM, Rails, AWS, and ‘error was SSL_connect returned=1’ on OSX

November 20th, 2016 Posted in geek out | No Comments »

Failed to login, error was SSL_connect returned=1 errno=0 state=error: certificate verify failed

I have a rails application with the following versions:

$ rvm -v
rvm 1.27.0 (latest) by Wayne E. Seguin , Michal Papis [https://rvm.io/]

$ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]

$ gem list rails
*** LOCAL GEMS ***
..
rails (5.0.0.1)

$ gem list aws
*** LOCAL GEMS ***
aws-sdk (2.6.19)
aws-sdk-core (2.6.19)
aws-sdk-resources (2.6.19)

While running my Rails app and making my first actual service call to AWS, I get:
log_groups = cloudwatch.describe_log_groups
ERROR:
Seahorse::Client::NetworkingError (SSL_connect returned=1 errno=0 state=error: certificate verify failed):

SOLUTION:
Successful Solution:
The cert linked through OpenSSL’s distro wasn’t matching what AWS uses for it’s API endpoints. This fixes it:


require 'aws-sdk'
require 'aws-sdk-core'

Aws.use_bundled_cert! <---- THAT'S THE FUCKING MAGIC RIGHT THERE
creds = Aws::Credentials.new(@access_key, @secret_key)
cloudwatch_client = Aws::CloudWatchLogs::Client.new(region: session[:default_region], credentials: creds)

Failed Solution #1:
I tried RVM’s Suggested Solution, but it failed without a good answer:
$ rvm osx-ssl-certs update all
Updating certificates for /System/Library/OpenSSL/cert.pem: Updating certificates in '/System/Library/OpenSSL/cert.pem'.
tee: /System/Library/OpenSSL/cert.pem: Operation not permitted
Failed.
Updating certificates for /etc/openssl/cert.pem: Already up to date.
Updating certificates for /usr/local/etc/openssl/cert.pem: Already up to date.

There is nothing in /System/Library/OpenSSL/cert.pem , and I cannot even edit the file if i sudo, so I gave up on that solution.

Failed Solution #2:
Actually, this partially worked but would not work in production. The cert linked through OpenSSL’s distro wasn’t matching what AWS uses for it’s API endpoints.

I got AWS’s certificate bundle from:
https://raw.githubusercontent.com/aws/aws-sdk-ruby/master/aws-sdk-core/ca-bundle.crt

require 'aws-sdk'
require 'aws-sdk-core'
Aws.config[:ssl_ca_bundle] = "/full_path_to_my_app/vendor/assets/ca-bundle.crt"
creds = Aws::Credentials.new(@access_key, @secret_key)
cloudwatch = Aws::CloudWatchLogs::Client.new(region: session[:default_region], credentials: creds)

30 countries… need some more

March 24th, 2016 Posted in travel | No Comments »

raj’s Travel Map

raj has been to: Bahamas, Canada, Switzerland, People’s Republic of China, Colombia, Costa Rica, Czech Republic, Germany, United Kingdom, Greece, Hungary, Ireland, India, Italy, Japan, Cambodia, Saint Martin, Mexico, Netherlands, Poland, Portugal, Senegal, Sint Maarten, Thailand, Turkey, United States, Vatican, British Virgin Islands, U.S. Virgin Islands, South Africa.
Get your own travel map from Matador Network.

Installing mysql2 gem on an EC2 instance

January 24th, 2016 Posted in geek out | No Comments »

I wanted to use the mysql2 ruby gem on an EC2 instance and was having a LOT of trouble. The logs just weren’t useful.

Here is what it looked like:

[ec2-user@ip-172-31-44-229 /]$ sudo gem install mysql2
Building native extensions. This could take a while…
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.

/usr/bin/ruby2.0 extconf.rb
checking for ruby/thread.h… *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib64
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/bin/ruby2.0
/usr/share/ruby/2.0/mkmf.rb:434:in `try_do’: The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/ruby/2.0/mkmf.rb:565:in `try_cpp’
from /usr/share/ruby/2.0/mkmf.rb:1044:in `block in have_header’
from /usr/share/ruby/2.0/mkmf.rb:895:in `block in checking_for’
from /usr/share/ruby/2.0/mkmf.rb:340:in `block (2 levels) in postpone’
from /usr/share/ruby/2.0/mkmf.rb:310:in `open’
from /usr/share/ruby/2.0/mkmf.rb:340:in `block in postpone’
from /usr/share/ruby/2.0/mkmf.rb:310:in `open’
from /usr/share/ruby/2.0/mkmf.rb:336:in `postpone’
from /usr/share/ruby/2.0/mkmf.rb:894:in `checking_for’
from /usr/share/ruby/2.0/mkmf.rb:1043:in `have_header’
from extconf.rb:16:in `

Gem files will remain installed in /usr/local/share/ruby/gems/2.0/gems/mysql2-0.4.2 for inspection.
Results logged to /usr/local/share/ruby/gems/2.0/gems/mysql2-0.4.2/ext/mysql2/gem_make.out


The real error is well hidden:

The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.

Solution that works for Amazon Linux:
sudo yum install mysql-devel build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev autoconf libc6-dev ncurses-dev automake libtool
sudo gem install mysql2

Basically install every dev related gem under the sun.

Et voila:

[ec2-user@ip-172-31-44-229 /]$ sudo gem install mysql2Building native extensions. This could take a while…
Successfully installed mysql2-0.4.2
Parsing documentation for mysql2-0.4.2
Installing ri documentation for mysql2-0.4.2
Done installing documentation for mysql2 after 0 seconds
1 gem installed

Cutting the Cheese — my Giardia problems improving after probiotics

May 30th, 2015 Posted in giardia | No Comments »

This is another chapter in my Giardia diary. I picked up Giardia in July of 2014. I went tubing in the Potomac river with a bunch of friends and co-workers, drank copious amounts of beer and apparently enough river water to give me giardia.

I took Metronidazole (Flagyl) and the immediate symptoms went away by the end of August, just in time for me to start a new job at Amazon Web Services without needing to make #2 four times per day.

Intense lactose intolerance

However, any dairy products, even a slice of butter or cheese, would give me gas and diarrhea. In March, I went back to see my PCP. I gave them stool samples, which came back negative for giardia.
StoolColl
The only advice he could give me was to take probiotics regularly and hope that things got better.

What helped

Daily probiotics

I was taking “Vitacost Probiotic 15-35 — 35 billion CFU** – 120 Vegetarian Capsules” until about March 2015. They didn’t agree with me and it took forever to figure out why. Turns out they contain milk !!!

My friend Ben M. recommended Align probiotics since they helped him get over his Giardia bout, which he picked up while drinking from a stream in India (!!?!!).
india-river
Align Probiotics are expensive but I think Align is what helped my digestive system recover. They come in a foil tin, like birth control pills, that have a day of the week labeled on them. It helps you to not miss a dose.

They helped A LOT!!! I started getting gas and diarrhea a lot less often after 2 weeks into the 4 week course.

Lactaid

Lactaid milk made me sick still.
lactaid

My friend Chelsey also has lactose issues and eats one or two Lactaid pills just before eating cheese. I tried that too. You can buy Lactaid caps in boxes of 60 from Amazon for about $12. The Lactaid pills contain the enzyme Lactase, which apparently Giardia patients stop producing. The pills didn’t help much at first; I could only have about one coffee creamer in the morning. Anything more than that and I’d get sick. But it got better.

I’ve finished the Align 4-week course ad now, I can have cheese on my sandwich or hamburger. I can’t drink a full glass of milk, or eat more than a slice of pizza, but stay tuned for another episode of Cutting the Cheese!

Cinta Antigua – Boda

May 11th, 2015 Posted in general | No Comments »

Floridian Condominium recommended contractors

February 24th, 2015 Posted in home improvement | No Comments »

Leave a comment on the google doc (preferred) or here if you have an addition or want a change made.