如何通过rvm和apache部署rails-project?

时间:2015-11-10 05:57:07

标签: ruby-on-rails apache rvm passenger

请帮助解决问题。

在ubuntu14上我安装apache2(带乘客模块),rvm和几个版本的rails。我尝试在localhost或web上启动这些rails-projects。

我创建了两个gemset:

md1@md1 /var/log/apache2 $ rvm gemset list_all

gemsets for ruby-2.0.0-p643 (found in /home/md1/.rvm/gems/ruby-2.0.0-p643)
   (default)
   global
   proj_r4_0

gemsets for ruby-2.2.1 (found in /home/md1/.rvm/gems/ruby-2.2.1)
   (default)
   global
=> proj_r4

在rails 4.2.4上创建/ home / md1 / rails / proj_r4项目之后 我在rails 4.0.0上创建/ home / md1 / rails / proj_r4_0项目

为每个项目我创建文件.rvmrc包含:

rvm use 2.0.0@proj_r4

rvm use 2.2.1@proj_r4_0

我对apache的设置:

<VirtualHost *:80>
        ServerAdmin prozaik81-2@yandex.ru
        DocumentRoot /home/md1/rails/proj_r4/public
        ServerName proj_r4.ru

        RailsEnv production
        <Directory /home/md1/rails/proj_r4/public>
                Options FollowSymLinks
                Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>



<VirtualHost *:80>
        ServerAdmin prozaik81-2@yandex.ru
        DocumentRoot /home/md1/rails/proj_r4_0/public
        ServerName proj_r4_0.ru

        RailsEnv production
        <Directory /home/md1/rails/proj_r4_0/public>
                Options FollowSymLinks
                Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


127.0.0.1       localhost proj_r4.ru proj_r4_0.ru

但是在地址/ home / md1 / rails / proj_r4和/ home / md1 / rails / proj_r4_0我看到如下错误消息:

  

我们很抱歉,但出了点问题。

     

我们已收到有关此问题的通知,我们将对此进行审核   不久。本网站管理员的信息

     

Phusion Passenger应用程序服务器遇到错误   启动您的Web应用程序。因为您正在运行此Web   应用程序在分段或生产模式下,错误的详细信息   出于安全原因,此网页已被忽略。

     

请阅读Passenger日志文件以查找错误的详细信息。

     

或者,您可以打开“友好错误页面”功能(请参阅   下面),这将使Phusion Passenger显示许多有关的细节   在浏览器中出错。

     

打开友好错误页面:

Nginx integration mode
Apache integration mode
Standalone mode

我尝试在控制台中运行:

rake assets:precompile

并设置为config / application.rb

config.assets.initialize_on_precompile = false

但它没有解决问题

也是apache日志:

[ 2015-11-08 23:04:18.3074 7652/7f46ff38d700 age/Cor/Req/CheckoutSession.cpp:253 ]: [Client 1-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 747dc5c0. Please see earlier logs for details about the error.
App 7895 stdout: 
App 7895 stdout: 
[ 2015-11-08 23:06:49.4866 7652/7f47059f8700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /home/md1/rails/proj_r4: An error occured while starting up the preloader.
  Error ID: eceeb28e
  Error details saved to: /tmp/passenger-error-0tPkpl.html
  Message from application: cannot load such file -- bundler/setup (LoadError)
  /home/md1/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  /home/md1/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:430:in `activate_gem'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:297:in `block in run_load_path_setup_code'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:435:in `running_bundler'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:296:in `run_load_path_setup_code'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'


[ 2015-11-08 23:06:49.5176 7652/7f46ff38d700 age/Cor/Req/CheckoutSession.cpp:253 ]: [Client 1-2] Cannot checkout session because a spawning error occurred. The identifier of the error is eceeb28e. Please see earlier logs for details about the error.

1 个答案:

答案 0 :(得分:0)

Message from application: cannot load such file -- bundler/setup (LoadError) 看着这个我猜你会错过目标主机上的bundler gem。 尝试安装

gem install bundler

手动为您的rvm环境。