2

I'd like to use gems specified from Gemfile that I uploaded. However, I keep getting

/usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- capybara (LoadError) from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' from app.rb:3:in `<main>'

Seems like the code cannot find the required gems. This is my .worker file:

runtime "ruby"
stack "ruby-2.1"

exec "app.rb"

gemfile "Gemfile"

full_remote_build true

My Gemfile:

source "https://rubygems.org"

gem "capybara"
gem "capybara-webkit"

I uploaded my work using this command:

zip -r my_work.zip . ; iron worker upload --zip my_work.zip --name my_work iron/ruby ruby app.rb ; iron worker queue --wait my_work

Thanks in advance.

RubyCat
  • 155
  • 11

1 Answers1

2

There's a couple things here:

1) you are using full_remote_build with a .worker file, but then uploading the zip. Those two things don't go together, it's one or the other.

2) Be sure you are vendoring the gems so they are included when you zip them. To vendor: docker run --rm -v "$PWD":/worker -w /worker iron/ruby:dev bundle install --standalone --clean. Then at the top of your script, add: require_relative 'bundle/bundler/setup'.

See the documentation here for more details: https://github.com/iron-io/dockerworker/tree/master/ruby

Travis Reeder
  • 38,611
  • 12
  • 87
  • 87
  • So, basically I need to use docker to do this? Coz the iron ruby docker is using alpine linux as the image and it's not that straight forward to install qt webkit. Or maybe I should use ubuntu image. What do you think? – RubyCat Jan 13 '16 at 19:38
  • I see. You could try building it using our old images: https://hub.docker.com/r/iron/images/tags/ , but you probably don't need the .worker file. Follow steps 1 and 2 at the dockerworker link but use the iron/images:ruby-2.1 instead of iron/ruby:dev, then continue at these steps to upload your zip: https://github.com/iron-io/dockerworker/tree/master/ruby#if-you-dont-want-to-package-your-code-using-docker – Travis Reeder Jan 14 '16 at 07:24