# passenger\_apache2 with application\_ruby and RVM

**URL:** <https://discourse.chef.io/t/passenger-apache2-with-application-ruby-and-rvm/5020>\
**Category:** Chef Infra (archive)\
**Created:** [February 13, 2014, 12:39pm UTC](https://discourse.chef.io/t/passenger-apache2-with-application-ruby-and-rvm/5020 "2014-02-13T12:39:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_Betti](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/marco_betti/32/105_2.png) [@Marco\_Betti](https://discourse.chef.io/u/Marco_Betti)\
**Post date:** [February 13, 2014, 12:39pm UTC](https://discourse.chef.io/t/passenger-apache2-with-application-ruby-and-rvm/5020/1 "2014-02-13T12:39:40Z")

</div>

Hi Chefs,

I’m trying to install a custom rails application with chef, using  
application\_ruby cookbook with passenger\_apache2 sub-resource and chef-rvm  
(rvm) cookbook.

I’m using chef-zero (local\_mode true) to test it, in order to avoid any  
chef-solo impact and I’m currently using chef-11.8.2 omnibus installation  
on CentOS6.5\_x64.

By manually applying [https://github.com/poise/application\_ruby/pull/48](https://github.com/poise/application_ruby/pull/48)  
I managed to achieve the whole installation without using rvm, but in this  
way installation is done by embedded (omnibus) ruby and I would like to  
avoid it in order to be able to control ruby version my application will  
run with.

Unfortunately I cannot manage the whole installation working with rvm (even  
using bleeding edge version from master).

This is my wrapper recipe:

> <https://gist.github.com/marbe/8973868>

  
These are involved attributes:  

> <https://gist.github.com/marbe/8973899>

This is the error running with params-only hash to pass attribute to  
passenger\_apache2:

- First run still uses embedded ruby:  
[https://gist.github.com/marbe/8974157](https://gist.github.com/marbe/8974157)
- Second run (after re-login to set env variable after rvm install) uses  
rvm:  
[https://gist.github.com/marbe/8974173](https://gist.github.com/marbe/8974173)

This is the errror with explicit override of root\_path (third run on the  
same VM instance):  
override[‘passenger’][‘root\_path’] = '/usr/local/rvm/gems/ruby-2.1.0’

> <https://gist.github.com/marbe/8974200>

This is the errror with explicit override of root\_path (first run on new VM  
instance):

> <https://gist.github.com/marbe/8974359>

  
Again second run (after re-login to set env variable after rvm install)  
uses rvm:  

> <https://gist.github.com/marbe/8974388>

I only found this thread googling around:  
[http://lists.opscode.com/sympa/arc/chef/2013-03/msg00210.html](http://lists.opscode.com/sympa/arc/chef/2013-03/msg00210.html)  
and would like to know if anyboby else has been able to manage such a  
scenario.

Any help would be very appreciated 🙂

Marco

–  
Ing. Marco Betti  
RHCE RHEL4 id 804006512121056

---

<div class="post-metadata">

**Author:** ![Vladimir\_Skubriev](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/vladimir_skubriev/32/263_2.png) [@Vladimir\_Skubriev](https://discourse.chef.io/u/Vladimir_Skubriev)\
**Post date:** [February 13, 2014, 1:20pm UTC](https://discourse.chef.io/t/passenger-apache2-with-application-ruby-and-rvm/5020/2 "2014-02-13T13:20:38Z")

</div>

I too cannot install rvm with rvm cookbook, or system,

I write my own custom code to install rvm in user code.

See my own rvm recipe )

[https://gist.github.com/cvl-skubriev/8974850](https://gist.github.com/cvl-skubriev/8974850)

Hope this help. This worked in production some months.

I cannot share all cookbook now.

I hope in future do it, but i need some refactoring )

See joshua timberman cookbook to setup redmine too (google it).

2014-02-13 16:39 GMT+04:00 Marco Betti [m.betti@gmail.com](mailto:m.betti@gmail.com):

> Hi Chefs,
> 
> I'm trying to install a custom rails application with chef, using  
> application\_ruby cookbook with passenger\_apache2 sub-resource and chef-rvm  
> (rvm) cookbook.
> 
> I'm using chef-zero (local\_mode true) to test it, in order to avoid any  
> chef-solo impact and I'm currently using chef-11.8.2 omnibus installation  
> on CentOS6.5\_x64.
> 
> By manually applying [[COOK-4273] Fix "can't find bundle\_options resource" error by caleb · Pull Request #48 · poise/application\_ruby · GitHub](https://github.com/poise/application_ruby/pull/48)  
> I managed to achieve the whole installation without using rvm, but in this  
> way installation is done by embedded (omnibus) ruby and I would like to  
> avoid it in order to be able to control ruby version my application will  
> run with.
> 
> Unfortunately I cannot manage the whole installation working with rvm  
> (even using bleeding edge version from master).
> 
> This is my wrapper recipe:  
> [inst\_cd.rb · GitHub](https://gist.github.com/marbe/8973868)  
> These are involved attributes:  
> [inst\_cd.attributes.rb · GitHub](https://gist.github.com/marbe/8973899)
> 
> This is the error running with params-only hash to pass attribute to  
> passenger\_apache2:
> 
> - First run still uses embedded ruby:  
> [first\_run\_no\_override · GitHub](https://gist.github.com/marbe/8974157)
> - Second run (after re-login to set env variable after rvm install) uses  
> rvm:  
> [second\_run\_without\_override · GitHub](https://gist.github.com/marbe/8974173)
> 
> This is the errror with explicit override of root\_path (third run on the  
> same VM instance):  
> override['passenger']['root\_path'] = '/usr/local/rvm/gems/ruby-2.1.0'  
> [third\_run\_with\_override · GitHub](https://gist.github.com/marbe/8974200)
> 
> This is the errror with explicit override of root\_path (first run on new  
> VM instance):  
> [First\_run\_with\_override · GitHub](https://gist.github.com/marbe/8974359)  
> Again second run (after re-login to set env variable after rvm install)  
> uses rvm:  
> [second\_run\_with\_override · GitHub](https://gist.github.com/marbe/8974388)
> 
> I only found this thread googling around:  
> [chef - [chef] passenger\_apache2 and RVM](http://lists.opscode.com/sympa/arc/chef/2013-03/msg00210.html)  
> and would like to know if anyboby else has been able to manage such a  
> scenario.
> 
> Any help would be very appreciated 🙂
> 
> Marco
> 
> --  
> Ing. Marco Betti  
> RHCE RHEL4 id 804006512121056

--  
Faithfully yours,

CVision Lab System Administrator  
Vladmir Skubriev
