0

I am trying to use an app (redmon: https://github.com/steelThread/redmon) packaged in a ruby gem Could you please help me getting it up and running ?

I have installed redmon like this:

tasks:

      - name: "Install redmon (redis)"
        tags:
          - redis
        become: yes
        gem: name="{{ item }}" user_install=no state=latest
        with_items:
          - redmon
        environment:
          http_proxy: "{{ prx.http }}"
          https_proxy: "{{ prx.https }}"

      - name: "Update Ruby gems (redis)"
        tags:
          - redis
        become: yes
        command: gem update --system
        environment:
          http_proxy: "{{ prx.http }}"
          https_proxy: "{{ prx.https }}"

But when I try to connect to local redis instance, I am getting the following error:

$ redmon --port 16384 --lifespan 60 --redis redis://127.0.0.1:6384
/usr/local/share/ruby/site_ruby/rubygems/dependency.rb:308:in `to_specs': Could not find 'sinatra' (>= 0) among 16 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/home/app/.gem/ruby:/usr/share/gems:/usr/local/share/gems', execute `gem env` for more information
    from /usr/local/share/ruby/site_ruby/rubygems/specification.rb:1439:in `block in activate_dependencies'
    from /usr/local/share/ruby/site_ruby/rubygems/specification.rb:1428:in `each'
    from /usr/local/share/ruby/site_ruby/rubygems/specification.rb:1428:in `activate_dependencies'
    from /usr/local/share/ruby/site_ruby/rubygems/specification.rb:1410:in `activate'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_gem.rb:68:in `block in gem'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_gem.rb:67:in `synchronize'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_gem.rb:67:in `gem'
    from /usr/local/bin/redmon:22:in `<main>'
$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.11
  - RUBY VERSION: 2.0.0 (2015-12-16 patchlevel 648) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/app/.gem/ruby
  - USER INSTALLATION DIRECTORY: /home/app/.gem/ruby
  - RUBY EXECUTABLE: /usr/bin/ruby
  - EXECUTABLE DIRECTORY: /home/app/bin
  - SPEC CACHE DIRECTORY: /home/app/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/app/.gem/ruby
     - /usr/share/gems
     - /usr/local/share/gems
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/bin
     - /usr/bin
     - /usr/local/sbin
     - /usr/sbin
     - /home/app/.local/bin
     - /home/app/bin

Would you be so kind to help me and advise me please how to resolve this ?

nskalis
  • 2,232
  • 8
  • 30
  • 49
  • 3
    How did you install sinatra? Did you run a `bundle install`? – Raphael May 02 '17 at 14:29
  • with ansible: the equivalent would be: `gem install redmon --no-user-install'` how it should be installed ? – nskalis May 02 '17 at 18:44
  • You could use the default `gem install redmon` which will install gems in your GEM_PATH(usually ~/.gem ) or specify it directly with `gem install redmon --no-user-install --install-dir $GEM_PATH` then running with `GEM_PATH= redmon ...` but before any of this, check your $GEM_PATH – Raphael May 02 '17 at 19:04
  • thanks a lot @Raphael `$ echo $GEM_PATH` is empty, am sorry but I am not familiar with ruby, how i can properly set the GEM_PATH since redmon was installed with `gem install redmon --no-user-install` ? – nskalis May 02 '17 at 19:25
  • You cat set it by running `export GEM_PATH=/path`. I suspect running --no-user-install without a GEM-PATh set will install the gems in the current folder. – Raphael May 02 '17 at 20:49

0 Answers0