application_ruby cookbook and rbenv

How do I tell the application_ruby cookbook to install passenger in a specific rbenv-managed Ruby?

I’m trying to deploy a Rails app in a clean Ubuntu machine. I managed to get rbenv and Ruby 1.9.3-p327 installed leveraging @fnichol’s cookbooks.

What do I have to do to ensure that things get installed to this specific Ruby, and not to the system-wide 1.8 ?

Thanks!

  • cassiano

Hi Cassiano,

I actually had to figure this out just today, but for Unicorn. I decided on creating a bundle wrapper script which sources the environment. see this gist for the wrapper: bundle_wrapper.rb · GitHub

Unicorn allows passing in a custom bundler command which I did:

unicorn do
bundler true
bundle_command "#{base_dir}/bundle_wrapper.sh"
end

I'm not sure if passenger has something similar which you can take advantage of.

--
Graham Christensen

On Friday, May 10, 2013 at 1:57 PM, Cassiano Leal wrote:

The content of the message has not been downloaded yet.

Hi Graham,

As I said on IRC, your solution doesn't seem to apply to passenger.

I'm installing rbenv and Ruby using the rbenv cookbook found in the community site. It has an Ohai plugin that correctly reports my rbenv-installed Ruby in languages[:ruby], yet the gem still gets installed to the system Ruby, and when mod_rails tries to compile it uses that as well.

I'm very curious to understand how are people configuring and deploying Rails applications with Chef. If anyone can share how they're doing it, I'd appreciate that.

Thanks,

  • cassiano

On Friday, May 10, 2013 at 15:02, Graham Christensen wrote:

Hi Cassiano,

I actually had to figure this out just today, but for Unicorn. I decided on creating a bundle wrapper script which sources the environment. see this gist for the wrapper: bundle_wrapper.rb · GitHub

Unicorn allows passing in a custom bundler command which I did:

unicorn do
bundler true
bundle_command "#{base_dir}/bundle_wrapper.sh (http://bundle_wrapper.sh)"
end

I'm not sure if passenger has something similar which you can take advantage of.

--
Graham Christensen

On Friday, May 10, 2013 at 1:57 PM, Cassiano Leal wrote:

The content of the message has not been downloaded yet.

Hey Cassiano,

Not sure if this will apply to application_ruby, but you can see effective
use of rbenv and both Unicorn and Passenger in github.com/teohm/rackbox.

Hope this helps,

Mat

On Friday, May 10, 2013, Cassiano Leal wrote:

Hi Graham,

As I said on IRC, your solution doesn't seem to apply to passenger.

I'm installing rbenv and Ruby using the rbenv cookbook found in the
community site. It has an Ohai plugin that correctly reports my
rbenv-installed Ruby in languages[:ruby], yet the gem still gets installed
to the system Ruby, and when mod_rails tries to compile it uses that as
well.

I'm very curious to understand how are people configuring and deploying
Rails applications with Chef. If anyone can share how they're doing it, I'd
appreciate that.

Thanks,

  • cassiano

On Friday, May 10, 2013 at 15:02, Graham Christensen wrote:

Hi Cassiano,

I actually had to figure this out just today, but for Unicorn. I decided
on creating a bundle wrapper script which sources the environment. see this
gist for the wrapper: bundle_wrapper.rb · GitHub

Unicorn allows passing in a custom bundler command which I did:

unicorn do
bundler true
bundle_command "#{base_dir}/bundle_wrapper.sh"
end

I'm not sure if passenger has something similar which you can take
advantage of.

--
Graham Christensen

On Friday, May 10, 2013 at 1:57 PM, Cassiano Leal wrote:

The content of the message has not been downloaded yet.

--

--

I'm the founder of Rock Solid Ops Inc, a web consultancy.

My main fields of expertise are Ruby on Rails web development, DevOps and a
bit of mobile. If you need help scaling, understanding, securing or
managing your web infrastructure (Rails or not), get in touch!

Connect with me and read testimonials on my
LinkedInhttp://ca.linkedin.com/in/mathieumartin/,
follow me on twitter @webmat http://twitter.com/webmat, or check out my
blog at programblings.comhttp://www.programblings.com?utm_source=email+signature
.

If you're a tech person, the following may make sense to you.

I'm the author of
git_remote_branchhttps://rubygems.org/gems/git_remote_branch.
A tool that's been helping common mortals like me share git branches for 5
years. Downloaded 50 000 times.

I've also contributed to some of the popular libraries in the Rails, jQuery
and PhoneGap ecosystems:

paperclip, active_admin, jquery-ujs, jquery-rails, kaminari, AssetSync,
phonegap-plugin-facebook-connect, shoulda, woulda, jeweler.

If you visit them on GitHub, you'll see my face in the "Contributors"
section :slight_smile:

Hi Mathieu,

Thanks for sharing. I don't see where passenger or unicorn get installed there, though. Is that done elsewhere in your workflow?

Does anyone have a working example of a cookbook where a specific version of Ruby gets installed, then all gems and other Ruby stuff uses that in a sane way? It seems like there's some rocket science involved to do this with Chef, whereas if I do it manually on a server it's a breeze (install rbenv and ruby, set the global ruby version and voilà!).

What am I missing? I must be missing something very obvious here, can anyone point me to it? :slight_smile:

Thanks,

  • cassiano

On Friday, May 10, 2013 at 19:14, Mathieu Martin wrote:

Hey Cassiano,

Not sure if this will apply to application_ruby, but you can see effective use of rbenv and both Unicorn and Passenger in github.com/teohm/rackbox (http://github.com/teohm/rackbox).

Hope this helps,

Mat

On Friday, May 10, 2013, Cassiano Leal wrote:

Hi Graham,

As I said on IRC, your solution doesn't seem to apply to passenger.

I'm installing rbenv and Ruby using the rbenv cookbook found in the community site. It has an Ohai plugin that correctly reports my rbenv-installed Ruby in languages[:ruby], yet the gem still gets installed to the system Ruby, and when mod_rails tries to compile it uses that as well.

I'm very curious to understand how are people configuring and deploying Rails applications with Chef. If anyone can share how they're doing it, I'd appreciate that.

Thanks,

  • cassiano

On Friday, May 10, 2013 at 15:02, Graham Christensen wrote:

Hi Cassiano,

I actually had to figure this out just today, but for Unicorn. I decided on creating a bundle wrapper script which sources the environment. see this gist for the wrapper: bundle_wrapper.rb · GitHub

Unicorn allows passing in a custom bundler command which I did:

unicorn do
bundler true
bundle_command "#{base_dir}/bundle_wrapper.sh (http://bundle_wrapper.sh)"
end

I'm not sure if passenger has something similar which you can take advantage of.

--
Graham Christensen

On Friday, May 10, 2013 at 1:57 PM, Cassiano Leal wrote:

The content of the message has not been downloaded yet.

--

--

I'm the founder of Rock Solid Ops Inc, a web consultancy.

My main fields of expertise are Ruby on Rails web development, DevOps and a bit of mobile. If you need help scaling, understanding, securing or managing your web infrastructure (Rails or not), get in touch!

Connect with me and read testimonials on my LinkedIn (Mathieu Martin - Jane Technologies, Inc. | LinkedIn), follow me on twitter @webmat (http://twitter.com/webmat), or check out my blog at programblings.com (Programblings).

If you're a tech person, the following may make sense to you.

I'm the author of git_remote_branch (git_remote_branch | RubyGems.org | your community gem host). A tool that's been helping common mortals like me share git branches for 5 years. Downloaded 50 000 times.

I've also contributed to some of the popular libraries in the Rails, jQuery and PhoneGap ecosystems:

paperclip, active_admin, jquery-ujs, jquery-rails, kaminari, AssetSync, phonegap-plugin-facebook-connect, shoulda, woulda, jeweler.

If you visit them on GitHub, you'll see my face in the "Contributors" section :slight_smile:

Btw, for any other onlooker, sorry for the broken link, it should have been
GitHub - teohm/rackbox-cookbook: Setup a Rack-based application server to run Unicorn & Passenger apps.. For more background, now that I'm on my
computer, here's the
articlehttp://teohm.github.io/blog/2013/04/17/chef-cookbooks-for-busy-ruby-developers/where
the author presents his trio of cookbooks {app,rack,data}box.

Cassiano, to answer your specific question: I also looked around a bit
before it clicked.
Thishttps://github.com/teohm/rackbox-cookbook/blob/a755b46dfc6be5996b06ed11fd255557dc9e2e3c/recipes/ruby.rb#L16is
the only gem installed by the cookbook. Then either Unicorn or
Passenger
are installed as gems from each project's Gemfiles :slight_smile:

Now the reason why the Passenger installation as a project gem works out,
is that the cookbook then starts Passenger
standalonehttps://github.com/teohm/rackbox-cookbook/blob/a755b46dfc6be5996b06ed11fd255557dc9e2e3c/templates/default/sv-passenger-run.erb#L9instead
of having it as an Apache or nginx module :slight_smile:

Now it may not work for everyone*, but I find the approach pretty nice in
that it makes things much simpler to get going.

For the record, I personally decided on Unicorn for my current project. All
my app boxes are dedicated to one single app, so I didn't need Passenger's
flexibility. So your mileage may vary with this approach.

Mat

  • Having Passenger standalone download the nginx source and compiling it
    every time you update the gem may not be everyone's cup of tea...

--

I'm the founder of Rock Solid Ops Inc, a web consultancy.

My main fields of expertise are Ruby on Rails web development, DevOps and a
bit of mobile. If you need help scaling, understanding, securing or
managing your web infrastructure (Rails or not), get in touch!

Connect with me and read testimonials on my
LinkedInhttp://ca.linkedin.com/in/mathieumartin/,
follow me on twitter @webmat http://twitter.com/webmat, or check out my
blog at programblings.comhttp://www.programblings.com?utm_source=email+signature
.

If you're a tech person, the following may make sense to you.

I'm the author of
git_remote_branchhttps://rubygems.org/gems/git_remote_branch.
A tool that's been helping common mortals like me share git branches for 5
years. Downloaded 50 000 times.

I've also contributed to some of the popular libraries in the Rails, jQuery
and PhoneGap ecosystems:

paperclip, active_admin, jquery-ujs, jquery-rails, kaminari, AssetSync,
phonegap-plugin-facebook-connect, shoulda, woulda, jeweler.

If you visit them on GitHub, you'll see my face in the "Contributors"
section :slight_smile:

On Fri, May 10, 2013 at 8:54 PM, Cassiano Leal cassianoleal@gmail.comwrote:

Hi Mathieu,

Thanks for sharing. I don't see where passenger or unicorn get installed
there, though. Is that done elsewhere in your workflow?

Does anyone have a working example of a cookbook where a specific version
of Ruby gets installed, then all gems and other Ruby stuff uses that in a
sane way? It seems like there's some rocket science involved to do this
with Chef, whereas if I do it manually on a server it's a breeze (install
rbenv and ruby, set the global ruby version and voilà!).

What am I missing? I must be missing something very obvious here, can
anyone point me to it? :slight_smile:

Thanks,

  • cassiano

On Friday, May 10, 2013 at 19:14, Mathieu Martin wrote:

Hey Cassiano,

Not sure if this will apply to application_ruby, but you can see effective
use of rbenv and both Unicorn and Passenger in github.com/teohm/rackbox.

Hope this helps,

Mat

On Friday, May 10, 2013, Cassiano Leal wrote:

Hi Graham,

As I said on IRC, your solution doesn't seem to apply to passenger.

I'm installing rbenv and Ruby using the rbenv cookbook found in the
community site. It has an Ohai plugin that correctly reports my
rbenv-installed Ruby in languages[:ruby], yet the gem still gets installed
to the system Ruby, and when mod_rails tries to compile it uses that as
well.

I'm very curious to understand how are people configuring and deploying
Rails applications with Chef. If anyone can share how they're doing it, I'd
appreciate that.

Thanks,

  • cassiano

On Friday, May 10, 2013 at 15:02, Graham Christensen wrote:

Hi Cassiano,

I actually had to figure this out just today, but for Unicorn. I decided
on creating a bundle wrapper script which sources the environment. see this
gist for the wrapper: bundle_wrapper.rb · GitHub

Unicorn allows passing in a custom bundler command which I did:

unicorn do
bundler true
bundle_command "#{base_dir}/bundle_wrapper.sh"
end

I'm not sure if passenger has something similar which you can take
advantage of.

--
Graham Christensen

On Friday, May 10, 2013 at 1:57 PM, Cassiano Leal wrote:

The content of the message has not been downloaded yet.

--

--

I'm the founder of Rock Solid Ops Inc, a web consultancy.

My main fields of expertise are Ruby on Rails web development, DevOps and
a bit of mobile. If you need help scaling, understanding, securing or
managing your web infrastructure (Rails or not), get in touch!

Connect with me and read testimonials on my LinkedInhttp://ca.linkedin.com/in/mathieumartin/,
follow me on twitter @webmat http://twitter.com/webmat, or check out my
blog at programblings.comhttp://www.programblings.com?utm_source=email+signature
.

If you're a tech person, the following may make sense to you.

I'm the author of git_remote_branchhttps://rubygems.org/gems/git_remote_branch.
A tool that's been helping common mortals like me share git branches for
5 years. Downloaded 50 000 times.

I've also contributed to some of the popular libraries in the Rails, jQuery
and PhoneGap ecosystems:

paperclip, active_admin, jquery-ujs, jquery-rails, kaminari, AssetSync,
phonegap-plugin-facebook-connect, shoulda, woulda, jeweler.

If you visit them on GitHub, you'll see my face in the "Contributors"
section :slight_smile:

Hah, I see!

That's an interesting approach, I didn't even recall the existence of Passenger standalone. :slight_smile: I'll try to adapt this to my setup (with apache instead of nginx and a heavy use of named vhosts) but I guess it'll work out ok.

It still eludes me why it's so difficult to reproduce my current setup in Chef, though.

Thanks for all the pointers, I believe I have enough to get going for now. :slight_smile:

  • cassiano

On Friday, May 10, 2013 at 22:20, Mathieu Martin wrote:

Btw, for any other onlooker, sorry for the broken link, it should have been GitHub - teohm/rackbox-cookbook: Setup a Rack-based application server to run Unicorn & Passenger apps. (GitHub - teohm/rackbox-cookbook: Setup a Rack-based application server to run Unicorn & Passenger apps.). For more background, now that I'm on my computer, here's the article (http://teohm.github.io/blog/2013/04/17/chef-cookbooks-for-busy-ruby-developers/) where the author presents his trio of cookbooks {app,rack,data}box.

Cassiano, to answer your specific question: I also looked around a bit before it clicked. This (rackbox-cookbook/recipes/ruby.rb at a755b46dfc6be5996b06ed11fd255557dc9e2e3c · teohm/rackbox-cookbook · GitHub) is the only gem installed by the cookbook. Then either Unicorn or Passenger are installed as gems from each project's Gemfiles :slight_smile:

Now the reason why the Passenger installation as a project gem works out, is that the cookbook then starts Passenger standalone (rackbox-cookbook/templates/default/sv-passenger-run.erb at a755b46dfc6be5996b06ed11fd255557dc9e2e3c · teohm/rackbox-cookbook · GitHub) instead of having it as an Apache or nginx module :slight_smile:

Now it may not work for everyone*, but I find the approach pretty nice in that it makes things much simpler to get going.

For the record, I personally decided on Unicorn for my current project. All my app boxes are dedicated to one single app, so I didn't need Passenger's flexibility. So your mileage may vary with this approach.

Mat

  • Having Passenger standalone download the nginx source and compiling it every time you update the gem may not be everyone's cup of tea...

--

I'm the founder of Rock Solid Ops Inc, a web consultancy.

My main fields of expertise are Ruby on Rails web development, DevOps and a bit of mobile. If you need help scaling, understanding, securing or managing your web infrastructure (Rails or not), get in touch!

Connect with me and read testimonials on my LinkedIn (Mathieu Martin - Jane Technologies, Inc. | LinkedIn), follow me on twitter @webmat (http://twitter.com/webmat), or check out my blog at programblings.com (Programblings).

If you're a tech person, the following may make sense to you.

I'm the author of git_remote_branch (git_remote_branch | RubyGems.org | your community gem host). A tool that's been helping common mortals like me share git branches for 5 years. Downloaded 50 000 times.

I've also contributed to some of the popular libraries in the Rails, jQuery and PhoneGap ecosystems:

paperclip, active_admin, jquery-ujs, jquery-rails, kaminari, AssetSync, phonegap-plugin-facebook-connect, shoulda, woulda, jeweler.

If you visit them on GitHub, you'll see my face in the "Contributors" section :slight_smile:

On Fri, May 10, 2013 at 8:54 PM, Cassiano Leal <cassianoleal@gmail.com (mailto:cassianoleal@gmail.com)> wrote:

Hi Mathieu,

Thanks for sharing. I don't see where passenger or unicorn get installed there, though. Is that done elsewhere in your workflow?

Does anyone have a working example of a cookbook where a specific version of Ruby gets installed, then all gems and other Ruby stuff uses that in a sane way? It seems like there's some rocket science involved to do this with Chef, whereas if I do it manually on a server it's a breeze (install rbenv and ruby, set the global ruby version and voilà!).

What am I missing? I must be missing something very obvious here, can anyone point me to it? :slight_smile:

Thanks,

  • cassiano

On Friday, May 10, 2013 at 19:14, Mathieu Martin wrote:

Hey Cassiano,

Not sure if this will apply to application_ruby, but you can see effective use of rbenv and both Unicorn and Passenger in github.com/teohm/rackbox (http://github.com/teohm/rackbox).

Hope this helps,

Mat

On Friday, May 10, 2013, Cassiano Leal wrote:

Hi Graham,

As I said on IRC, your solution doesn't seem to apply to passenger.

I'm installing rbenv and Ruby using the rbenv cookbook found in the community site. It has an Ohai plugin that correctly reports my rbenv-installed Ruby in languages[:ruby], yet the gem still gets installed to the system Ruby, and when mod_rails tries to compile it uses that as well.

I'm very curious to understand how are people configuring and deploying Rails applications with Chef. If anyone can share how they're doing it, I'd appreciate that.

Thanks,

  • cassiano

On Friday, May 10, 2013 at 15:02, Graham Christensen wrote:

Hi Cassiano,

I actually had to figure this out just today, but for Unicorn. I decided on creating a bundle wrapper script which sources the environment. see this gist for the wrapper: bundle_wrapper.rb · GitHub

Unicorn allows passing in a custom bundler command which I did:

unicorn do
bundler true
bundle_command "#{base_dir}/bundle_wrapper.sh (http://bundle_wrapper.sh)"
end

I'm not sure if passenger has something similar which you can take advantage of.

--
Graham Christensen

On Friday, May 10, 2013 at 1:57 PM, Cassiano Leal wrote:

The content of the message has not been downloaded yet.

--

--

I'm the founder of Rock Solid Ops Inc, a web consultancy.

My main fields of expertise are Ruby on Rails web development, DevOps and a bit of mobile. If you need help scaling, understanding, securing or managing your web infrastructure (Rails or not), get in touch!

Connect with me and read testimonials on my LinkedIn (Mathieu Martin - Jane Technologies, Inc. | LinkedIn), follow me on twitter @webmat (http://twitter.com/webmat), or check out my blog at programblings.com (Programblings).

If you're a tech person, the following may make sense to you.

I'm the author of git_remote_branch (git_remote_branch | RubyGems.org | your community gem host). A tool that's been helping common mortals like me share git branches for 5 years. Downloaded 50 000 times.

I've also contributed to some of the popular libraries in the Rails, jQuery and PhoneGap ecosystems:

paperclip, active_admin, jquery-ujs, jquery-rails, kaminari, AssetSync, phonegap-plugin-facebook-connect, shoulda, woulda, jeweler.

If you visit them on GitHub, you'll see my face in the "Contributors" section :slight_smile:

On Fri, May 10, 2013 at 10:19 PM, Cassiano Leal cassianoleal@gmail.comwrote:

Hah, I see!

That's an interesting approach, I didn't even recall the existence of
Passenger standalone. :slight_smile: I'll try to adapt this to my setup (with apache
instead of nginx and a heavy use of named vhosts) but I guess it'll work
out ok.

Yeah, you can keep using Apache no problem. Just treat Passenger standalone
as an upstream. The fact that it uses nginx internally is an implementation
detail :slight_smile:

It still eludes me why it's so difficult to reproduce my current setup in
Chef, though.

I do think some of those cookbooks (e.g. application_ruby, deploy, nginx w/
Passenger) don't do enough handholding to help newcomers understand how
they should be used. I don't use them.

The attributes are all laid out just fine, but I think they could be more
explicit in detailing the assumptions the cookbook makes about how your app
works or how you subsequently deploy it.

Thanks for all the pointers, I believe I have enough to get going for now.
:slight_smile:

Glad to be of help!

Mat

On Saturday, May 11, 2013 at 02:30, Mathieu Martin wrote:

On Fri, May 10, 2013 at 10:19 PM, Cassiano Leal <cassianoleal@gmail.com (mailto:cassianoleal@gmail.com)> wrote:

It still eludes me why it's so difficult to reproduce my current setup in Chef, though.

I do think some of those cookbooks (e.g. application_ruby, deploy, nginx w/ Passenger) don't do enough handholding to help newcomers understand how they should be used. I don't use them.

The attributes are all laid out just fine, but I think they could be more explicit in detailing the assumptions the cookbook makes about how your app works or how you subsequently deploy it.
Agreed. And there's the fact that there's one cookbook on top of the other (application_ruby uses application, but you first need to understand how application works before you even try to begin understanding how application_* does, which is not only a mess in itself, but is not clearly stated anywhere I could see either). There should be some sort of a cookbook manual for these cases -- a cookbook cookbook? :slight_smile:

Thanks for all the pointers, I believe I have enough to get going for now. :slight_smile:

Glad to be of help!

Mat
Yeah, thanks again. I haven't yet gotten to the state where I can say that this will definitely work, but there's nothing pointing me to the contrary atm. I still neet to get the pg gem to compile when bundler runs, but I'm going to open a separate thread for that. :slight_smile:

Cheers!

  • cassiano

Ah, look at teohm's databox cb. Handles both pg and mysql :slight_smile:

On Saturday, May 11, 2013, Cassiano Leal wrote:

On Saturday, May 11, 2013 at 02:30, Mathieu Martin wrote:

On Fri, May 10, 2013 at 10:19 PM, Cassiano Leal <cassianoleal@gmail.com<javascript:_e({}, 'cvml', 'cassianoleal@gmail.com');>

wrote:

It still eludes me why it's so difficult to reproduce my current setup in
Chef, though.

I do think some of those cookbooks (e.g. application_ruby, deploy, nginx
w/ Passenger) don't do enough handholding to help newcomers understand how
they should be used. I don't use them.

The attributes are all laid out just fine, but I think they could be more
explicit in detailing the assumptions the cookbook makes about how your app
works or how you subsequently deploy it.

Agreed. And there's the fact that there's one cookbook on top of the other
(application_ruby uses application, but you first need to understand how
application works before you even try to begin understanding how
application_* does, which is not only a mess in itself, but is not clearly
stated anywhere I could see either). There should be some sort of a
cookbook manual for these cases -- a cookbook cookbook? :slight_smile:

Thanks for all the pointers, I believe I have enough to get going for now.
:slight_smile:

Glad to be of help!

Mat

Yeah, thanks again. I haven't yet gotten to the state where I can say
that this will definitely work, but there's nothing pointing me to the
contrary atm. I still neet to get the pg gem to compile when bundler runs,
but I'm going to open a separate thread for that. :slight_smile:

Cheers!

  • cassiano

--

--

I'm the founder of Rock Solid Ops Inc, a web consultancy.

My main fields of expertise are Ruby on Rails web development, DevOps and a
bit of mobile. If you need help scaling, understanding, securing or
managing your web infrastructure (Rails or not), get in touch!

Connect with me and read testimonials on my
LinkedInhttp://ca.linkedin.com/in/mathieumartin/,
follow me on twitter @webmat http://twitter.com/webmat, or check out my
blog at programblings.comhttp://www.programblings.com?utm_source=email+signature
.

If you're a tech person, the following may make sense to you.

I'm the author of
git_remote_branchhttps://rubygems.org/gems/git_remote_branch.
A tool that's been helping common mortals like me share git branches for 5
years. Downloaded 50 000 times.

I've also contributed to some of the popular libraries in the Rails, jQuery
and PhoneGap ecosystems:

paperclip, active_admin, jquery-ujs, jquery-rails, kaminari, AssetSync,
phonegap-plugin-facebook-connect, shoulda, woulda, jeweler.

If you visit them on GitHub, you'll see my face in the "Contributors"
section :slight_smile:

I don't see how that would help, unfortunately… My problem seems to be that bundler is running on omnibus's Ruby (not even on the system Ruby as I had original thought). I uninstalled all Ruby packages from the system, leaving it with only omnibus and one rbenv-managed Ruby. If I SSH into the machine and run bundler, it works. When Chef runs bundler during the deployment, it fails.

And I just found this line:
--ruby=/opt/chef/embedded/bin/ruby

This is one of the options passed by bundler to the gem command.

It just seems like I went out of the frying pan and into the fire. I can easily avoid the mod_rails compilation problem by running passenger standalone as you suggested, but that doesn't solve the bigger problem of the whole thing running outside of the rbenv Ruby.

Cheers!

  • cassiano

On Saturday, May 11, 2013 at 11:51, Mathieu Martin wrote:

Ah, look at teohm's databox cb. Handles both pg and mysql :slight_smile:

On Saturday, May 11, 2013, Cassiano Leal wrote:

On Saturday, May 11, 2013 at 02:30, Mathieu Martin wrote:

On Fri, May 10, 2013 at 10:19 PM, Cassiano Leal <cassianoleal@gmail.com (javascript:_e({}, 'cvml', 'cassianoleal@gmail.com');)> wrote:

It still eludes me why it's so difficult to reproduce my current setup in Chef, though.

I do think some of those cookbooks (e.g. application_ruby, deploy, nginx w/ Passenger) don't do enough handholding to help newcomers understand how they should be used. I don't use them.

The attributes are all laid out just fine, but I think they could be more explicit in detailing the assumptions the cookbook makes about how your app works or how you subsequently deploy it.
Agreed. And there's the fact that there's one cookbook on top of the other (application_ruby uses application, but you first need to understand how application works before you even try to begin understanding how application_* does, which is not only a mess in itself, but is not clearly stated anywhere I could see either). There should be some sort of a cookbook manual for these cases -- a cookbook cookbook? :slight_smile:

Thanks for all the pointers, I believe I have enough to get going for now. :slight_smile:

Glad to be of help!

Mat
Yeah, thanks again. I haven't yet gotten to the state where I can say that this will definitely work, but there's nothing pointing me to the contrary atm. I still neet to get the pg gem to compile when bundler runs, but I'm going to open a separate thread for that. :slight_smile:

Cheers!

  • cassiano

--

--

I'm the founder of Rock Solid Ops Inc, a web consultancy.

My main fields of expertise are Ruby on Rails web development, DevOps and a bit of mobile. If you need help scaling, understanding, securing or managing your web infrastructure (Rails or not), get in touch!

Connect with me and read testimonials on my LinkedIn (Mathieu Martin - Jane Technologies, Inc. | LinkedIn), follow me on twitter @webmat (http://twitter.com/webmat), or check out my blog at programblings.com (Programblings).

If you're a tech person, the following may make sense to you.

I'm the author of git_remote_branch (git_remote_branch | RubyGems.org | your community gem host). A tool that's been helping common mortals like me share git branches for 5 years. Downloaded 50 000 times.

I've also contributed to some of the popular libraries in the Rails, jQuery and PhoneGap ecosystems:

paperclip, active_admin, jquery-ujs, jquery-rails, kaminari, AssetSync, phonegap-plugin-facebook-connect, shoulda, woulda, jeweler.

If you visit them on GitHub, you'll see my face in the "Contributors" section :slight_smile: