• SSL certificate error with elasticsearch gem on ruby 2.2.2

    I don't know exactly why but with Ruby 2.2.2p95 on OSX I get the following error when I try to use the elasticsearch gem:

    Faraday::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
    OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
    

    To fix it, just try to avoid using rubys build in Net::HTTP lib and switch to another one (for example typheous). Just add it to your Gemfile, let Bundler run and the elasticsearch gem will use it by itself:

    gem 'typhoeus', require: 'typhoeus/adapters/faraday'
    
    • elasticsearch
    • net/http
    • ruby
    • ssl
    • tech
    • typheous
    2015-04-26 23:05:00 +0000
  • Set your paths right for rbenv and all the other cool stuff you're using

    Rbenv is awesome. I find it the most simple solution to handle different Ruby versions. But if you use it with tons of other stuff like brew and heroku you have to take care in what order you set your paths to use everytime the right bins for loading your applications. Here is what I use in my .bash_profile:

    export PATH="$HOME/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/heroku/bin:$PATH"
    eval "$(rbenv init -)"
    export PATH="./.bundle/bin:$PATH"
    

    First add heroku, then add everything related to brew and then add everything related to rbenv. After this, load rbenv and your currently selected Ruby version. If you find gemsets useless like I do add the last line of the example also. This will load all the binstubs in the current directory that you can create with the --binstubs option for bundler. To make it even more convenient add this also to your .bash_profile:

    alias bi='bundle --binstubs .bundle/bin'
    

    Now you can bundle with binstubs by just typing "bi" and all gems and bins will load in the following order:

    1. project specific gems in the current folder
    2. ruby specific gems from with rbenv currently selected ruby version
    3. gems/bins installed with brew
    4. gems/bin installed in the system
    • bash
    • bundler
    • configuration
    • env
    • path
    • rbenv
    • ruby
    • shell
    • tech
    • terminal
    2015-04-26 23:05:00 +0000
  • instagram

    • animals
    • berlin
    • dead
    • mammals
    • museum
    • vscocam
    2015-04-26 16:52:00 +0000 Δ via instagram
  • instagram

    • 1hzforlife
    • berlin
    • nerd
    • nerdheaven
    • quantumphysics
    • startup
    2015-04-18 11:05:00 +0000 Δ via instagram
  • instagram

    • gigmit
    • sofi
    • sofi15
    • vscocam
    2015-03-20 11:28:00 +0000 Δ via instagram
  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08
  • 09
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110

Benjamin Knofe
I love to create things with code.
Currently working at Contentful and living in Berlin and Gräfenroda.

about
github.com/benben
twitter.com/bknofe
to.be/benben
ben.hasbeen.in
Everything on this site is CC-BY
Hosted on hyrb