nanobox-io / nanobox-engine-ruby

Engine for running Ruby apps on Nanobox
https://nanobox.io
MIT License
10 stars 9 forks source link

Could not open library 'libcurl' (ruby 2.3.1) #23

Open kholdrex opened 7 years ago

kholdrex commented 7 years ago

i have such error when i do nanobox run rails s

/app/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.10/lib/ffi/library.rb:133:in `block in ffi_lib': Could not open library 'libcurl': libcurl: cannot open shared object file: No such file or directory. (LoadError)
Could not open library 'libcurl.so': libcurl.so: cannot open shared object file: No such file or directory.
Could not open library 'libcurl.so.4': libcurl.so.4: cannot open shared object file: No such file or directory

i added extra steps into my boxfile

  extra_steps:
    - sudo apt-get update && sudo apt-get -y install libcurl4-openssl-dev libgmp-dev libcurl3

but it doesn't work... when i use nanobox run and install these packages manually it works

my boxfile.yml

run.config:
  engine: ruby
  engine.config:
    runtime: ruby-2.3
  cache_dirs:
    - vendor
    - packages
    - node_modules
  extra_path_dirs:
    - node_modules/.bin
  extra_packages:
    - nginx
    - nodejs-6.2
    - newrelic-6.3

  # Build Triggers - Changes to these files automatically
  # trigger a new build the next time a build is required.
  build_triggers:
    - Gemfile
    - Gemfile.lock
    - package.json

  extra_steps:
    - sudo apt-get update && sudo apt-get -y install libcurl4-openssl-dev libgmp-dev libcurl3
    - npm install
    - redis-server --daemonize yes

deploy.config:
  extra_steps:
    - rake assets:precompile
  transform:
    - 'bundle exec rake fix-yaml'

web.site:
  start: 'bundle exec ruby config/passenger.rb'

data.db:
  image: nanobox/postgresql:9.5
  extra_packages:
    - curl

data.queue:
  image: nanobox/redis:3.0

with ruby 2.2 it works fine, but for 2.3 it doesn't... can somebody check it please?

notxarb commented 7 years ago

packages installed using apt-get will not be available in the final build. If you want a package it should be listed in the extra_packages part of the boxfile.

I'll do some more testing, there might be an issue with where it is looking to find the libs.

sanderson commented 7 years ago

@kholdrex Since curl isn't a base dependency of ruby, it's not automatically installed by the engine. To install it, you should just include it in the run.config > extra_packages node of your boxfile.yml.

run.config:
  engine: ruby
  engine.config:
    runtime: ruby-2.3
  extra_packages:
    - nginx
    - nodejs-6.2
    - newrelic-6.3
    - curl

It could be that a gem is behaving differently in 2.2 vs 2.3 (trying to use curl in 2.3 and not in 2.2).

notxarb commented 7 years ago

can we get the gemfile from your app? That might help us figure out what is going on.