ruby on rails - Error "Could not find rake-10.5.0 in any of the sources" on Phusion Passenger Docker image -
i trying deploy rails app using docker , phusion passenger ruby base image, whenever try access app browser error:
web_1 | [ 2016-02-08 04:18:44.6861 31/7ff292141700 age/cor/app/implementation.cpp:304 ]: not spawn process application /home/app/webapp: error occurred while starting preloader. web_1 | error id: d3103e16 web_1 | error details saved to: /tmp/passenger-error-ewymlw.html web_1 | message application: <p>it looks bundler not find gem. maybe didn't install gems application needs. install gems, please run:</p> web_1 | web_1 | <pre class="commands">bundle install</pre> web_1 | web_1 | <p>if didn't work, problem caused application being run under different environment it's supposed to. please check following:</p> web_1 | web_1 | <ol> web_1 | <li>is app supposed run <code>app</code> user?</li> web_1 | <li>is app being run on correct ruby interpreter? below web_1 | see ruby interpreter phusion passenger attempted use.</li> web_1 | </ol> web_1 | web_1 | <p>-------- exception follows: -------</p> web_1 | not find rake-10.5.0 in of sources (bundler::gemnotfound) web_1 | <pre> /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:92:in `block in materialize' web_1 | /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `map!' web_1 | /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `materialize' web_1 | /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/definition.rb:140:in `specs' web_1 | /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/definition.rb:185:in `specs_for' web_1 | /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/definition.rb:174:in `requested_specs' web_1 | /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/environment.rb:18:in `requested_specs' web_1 | /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:13:in `setup' web_1 | /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:127:in `setup' web_1 | /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/setup.rb:18:in `<top (required)>' web_1 | /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' web_1 | /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' web_1 | /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:430:in `activate_gem' web_1 | /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:297:in `block in run_load_path_setup_code' web_1 | /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:435:in `running_bundler' web_1 | /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:296:in `run_load_path_setup_code' web_1 | /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app' web_1 | /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:app>' web_1 | /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:phusionpassenger>' web_1 | /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'</pre> web_1 | web_1 | web_1 | [ 2016-02-08 04:18:44.6935 31/7ff293143700 age/cor/con/checkoutsession.cpp:277 ]: [client 1-2] cannot checkout session because spawning error occurred. identifier of error d3103e16. please see earlier logs details error.
this dockerfile
:
from phusion/passenger-ruby22:0.9.18 # set correct environment variables. env home /root # use baseimage-docker's init process. cmd ["/sbin/my_init"] # enable nginx/passenger run rm -f /etc/service/nginx/down # enable portals virtual host run rm /etc/nginx/sites-enabled/default copy portals.conf /etc/nginx/sites-enabled/portals.conf run mkdir /home/app/webapp # load env vars nginx copy rails-env.conf /etc/nginx/main.d/rails-env.conf # install gems dependencies copy gemfile* /tmp/ workdir /tmp run bundle install # copy rails app workdir /home/app/webapp copy . ./ run chown -r app:app ./ # clean apt when done. run apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
i tried running bundler run bundle install --deployment
didn't work well. passing rails_env
, passenger_app_env
via rails-env.conf
file , both set production (which default according passenger image docs).
if docker exec -it bash <id>
container , run gem list
see gems installed, don't know what's wrong.
this error due out of date software. because passenger images not updated important bring date in dockerfile
. how setup dockerfile
based off phusion image:
from phusion/passenger-ruby22:0.9.18 env system_update=1 run apt-get update \ && apt-get upgrade -y -o dpkg::options::="--force-confold" \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* workdir /home/app copy gemfile /home/app/gemfile copy gemfile.lock /home/app/gemfile.lock run gem update --system && \ gem update bundler && \ bundle install --jobs 4 --retry 5 # rest of app setup here entrypoint ["/sbin/my_init", "--"]
system_update
cache buster variable. when bump packages updated on next docker build. should bumped frequently.
i ensure gem
, bundler
date before running bundle install
.
also, there no benefit copying gemfile
, gemfile.lock
tmp directory, copy application directory.
you can remove final clean apt when done.
command - that's not right place that. there should single run
line runs apt-get
commands in single layer.
take @ https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/ best practices around setting dockerfile, sections using apt-get.
Comments
Post a Comment