Error "Could not find rake-10.5.0 in any of the sources" on Phusion Passenger Docker image

Luiz Aoqui

I am trying to deploy a Rails app using Docker and the Phusion Passenger Ruby base image, but whenever I try to access the app from the browser I get this error:

web_1 | [ 2016-02-08 04:18:44.6861 31/7ff292141700     age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application   /home/app/webapp: An error occurred while starting up the preloader.
web_1 |   Error ID: d3103e16
web_1 |   Error details saved to: /tmp/passenger-error-EwymlW.html
web_1 |   Message from application: <p>It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:</p>
web_1 |
web_1 |   <pre class="commands">bundle install</pre>
web_1 |
web_1 | <p>If that didn't work, then the problem is probably caused by your application being run under a different environment than it's supposed to. Please check the following:</p>
web_1 |
web_1 | <ol>
web_1 |   <li>Is this app supposed to be run as the <code>app</code> user?</li>
web_1 |   <li>Is this app being run on the correct Ruby interpreter? Below you will
web_1 |       see which Ruby interpreter Phusion Passenger attempted to use.</li>
web_1 | </ol>
web_1 |
web_1 | <p>-------- The exception is as follows: -------</p>
web_1 | Could not find rake-10.5.0 in any of the 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&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `map!&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `materialize&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/definition.rb:140:in `specs&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/definition.rb:185:in `specs_for&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/definition.rb:174:in `requested_specs&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/environment.rb:18:in `requested_specs&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:13:in `setup&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:127:in `setup&#39;
web_1 |   /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/setup.rb:18:in `&lt;top (required)&gt;&#39;
web_1 |   /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require&#39;
web_1 |   /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require&#39;
web_1 |   /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:430:in `activate_gem&#39;
web_1 |   /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:297:in `block in run_load_path_setup_code&#39;
web_1 |   /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:435:in `running_bundler&#39;
web_1 |   /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:296:in `run_load_path_setup_code&#39;
web_1 |   /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app&#39;
web_1 |   /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `&lt;module:App&gt;&#39;
web_1 |   /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `&lt;module:PhusionPassenger&gt;&#39;
web_1 |   /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `&lt;main&gt;&#39;</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 a spawning error occurred. The identifier of the error is d3103e16. Please see earlier logs for details about the error.

This is my 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 into 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 up APT when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

I tried running bundler as RUN bundle install --deployment but it didn't work as well. I am passing RAILS_ENV and PASSENGER_APP_ENV via the rails-env.conf file and they are both set to production (which is the default according to the Passenger image docs).

If I docker exec -it bash <ID> into the container and run gem list I see that all the gems are installed, so I don't know what's wrong.

Scott Jacobsen

This error is due to out of date software. Because the passenger images are not updated frequently it is important to bring everything up to date in your Dockerfile. This is how I generally setup a Dockerfile based off a 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

# The rest of your app setup here

ENTRYPOINT ["/sbin/my_init", "--"]

SYSTEM_UPDATE is just a cache buster variable. When I bump that up all the packages will be updated on the next docker build. It should be bumped frequently.

I also ensure gem and bundler are fully up to date before running bundle install.

Also, there is no benefit to copying your Gemfile and Gemfile.lock to the tmp directory, just copy it to your application directory.

You can remove your final Clean up APT when done. command - that's really not the right place for that. There should be a single RUN line that runs all the apt-get commands in a single layer.

Take a look at https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/ for the best practices around setting up a Dockerfile, especially the sections about using apt-get.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Phusion Passenger and Docker-Compose Issue with Permissions

From Dev

Rails Phusion Passenger error after updates

From Dev

Rails Phusion Passenger error after updates

From Dev

Phusion Passenger error with Rails 4 and ruby 2.5

From Dev

Passenger load error - cannot load such file -- phusion_passenger (LoadError)

From Dev

Passenger load error - cannot load such file -- phusion_passenger (LoadError)

From Dev

Phusion Passenger Not Working on Apache

From Dev

Phusion Passenger - ActiveRecord::PendingMigrationError

From Dev

Phusion-passenger crash

From Dev

Phusion-passenger crash

From Dev

Control the number of processes with Phusion Passenger?

From Dev

Phusion Passenger Error: http.Server.listen() was called more than once

From Dev

Deploying RoR App on Shared Host fails due to Ruby version error on Phusion Passenger

From Dev

watchman not found on phusion/baseimage Docker image with ember-cli

From Dev

What is optimal value for Phusion passenger PassengerMaxRequestQueueSize

From Dev

memory leak issue in rails and phusion passenger

From Dev

phusion passenger on apache : Could not spawn process for group

From Dev

SELinux permission denied to Phusion Passenger for redmine

From Dev

What is optimal value for Phusion passenger PassengerMaxRequestQueueSize

From Dev

Package manager issue after installing phusion passenger

From Dev

How to add a second app to Phusion Passenger?

From Dev

How to update phusion passenger + nginx on ubuntu server?

From Dev

How does Phusion Passenger respect gemfiles?

From Dev

Phusion Passenger file not found when the file exits

From Dev

Java Web App in Phusion Passenger Server

From Dev

Phusion Passenger Rails not balancing request across workers

From Dev

Phusion Passenger not reading .zshrc environment variables

From Dev

Start Phusion Passenger from Ruby code

From Dev

Is it possible to use Phusion Passenger Enterprise and Phusion Passenger Open source for same app but different server

Related Related

  1. 1

    Phusion Passenger and Docker-Compose Issue with Permissions

  2. 2

    Rails Phusion Passenger error after updates

  3. 3

    Rails Phusion Passenger error after updates

  4. 4

    Phusion Passenger error with Rails 4 and ruby 2.5

  5. 5

    Passenger load error - cannot load such file -- phusion_passenger (LoadError)

  6. 6

    Passenger load error - cannot load such file -- phusion_passenger (LoadError)

  7. 7

    Phusion Passenger Not Working on Apache

  8. 8

    Phusion Passenger - ActiveRecord::PendingMigrationError

  9. 9

    Phusion-passenger crash

  10. 10

    Phusion-passenger crash

  11. 11

    Control the number of processes with Phusion Passenger?

  12. 12

    Phusion Passenger Error: http.Server.listen() was called more than once

  13. 13

    Deploying RoR App on Shared Host fails due to Ruby version error on Phusion Passenger

  14. 14

    watchman not found on phusion/baseimage Docker image with ember-cli

  15. 15

    What is optimal value for Phusion passenger PassengerMaxRequestQueueSize

  16. 16

    memory leak issue in rails and phusion passenger

  17. 17

    phusion passenger on apache : Could not spawn process for group

  18. 18

    SELinux permission denied to Phusion Passenger for redmine

  19. 19

    What is optimal value for Phusion passenger PassengerMaxRequestQueueSize

  20. 20

    Package manager issue after installing phusion passenger

  21. 21

    How to add a second app to Phusion Passenger?

  22. 22

    How to update phusion passenger + nginx on ubuntu server?

  23. 23

    How does Phusion Passenger respect gemfiles?

  24. 24

    Phusion Passenger file not found when the file exits

  25. 25

    Java Web App in Phusion Passenger Server

  26. 26

    Phusion Passenger Rails not balancing request across workers

  27. 27

    Phusion Passenger not reading .zshrc environment variables

  28. 28

    Start Phusion Passenger from Ruby code

  29. 29

    Is it possible to use Phusion Passenger Enterprise and Phusion Passenger Open source for same app but different server

HotTag

Archive