# RE: rails, nginx, unicorn

**URL:** <https://discourse.chef.io/t/re-rails-nginx-unicorn/5235>\
**Category:** Chef Infra (archive)\
**Created:** [April 16, 2014, 3:09pm UTC](https://discourse.chef.io/t/re-rails-nginx-unicorn/5235 "2014-04-16T15:09:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![S\_Ahmed](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/s_ahmed/32/289_2.png) [@S\_Ahmed](https://discourse.chef.io/u/S_Ahmed)\
**Post date:** [April 16, 2014, 3:09pm UTC](https://discourse.chef.io/t/re-rails-nginx-unicorn/5235/1 "2014-04-16T15:09:11Z")

</div>

Hello,

Is there a rails,nginx, unicorn cookbook out there in chef land that is  
maintained by a web 3.0 company out there? 🙂

For some reason I see most people are still stuck with apache.

I know I can build my own (that’s the beauty of chef hehe) but just curious  
if there any any cookbooks that are rails/ruby specific that are maintained  
by a company that just so happens to open source their devops.

Thanks for your guidance.

---

<div class="post-metadata">

**Author:** ![jeffbyrnes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeffbyrnes/32/1478_2.png) [@jeffbyrnes](https://discourse.chef.io/u/jeffbyrnes)\
**Post date:** [April 16, 2014, 4:00pm UTC](https://discourse.chef.io/t/re-rails-nginx-unicorn/5235/2 "2014-04-16T16:00:50Z")

</div>

We’ve written a few cookbooks for our Rails apps, but they’re private for various reasons. However, the community nginx cookbook is pretty good: [https://github.com/opscode-cookbooks/nginx](https://github.com/opscode-cookbooks/nginx)

And you can check out our fork of it that adds some socket proxy goodness for Unicorn:

> **[evertrue/nginx-cookbook](https://github.com/evertrue/nginx-cookbook)**
>
> nginx-cookbook - Development repository for Opscode Cookbook nginx

The pattern we follow is to set up the server with nginx properly configured, then let the apps’ deployments install rbenv, Ruby, & Bundler, then use Bundler to install all the necessary gems for the app. Initial deployment is a bit slow, but after that, you’ve got the flexibility to let your apps determine the specific versions of things you need (e.g., Ruby itself, Rails, various gems).

–  
Jeff Byrnes  
@berkleebassist  
Operations Engineer  
EverTrue  
704.516.4628

On April 16, 2014 at 11:09:11 AM, S Ahmed ([sahmed1020@gmail.com](mailto:sahmed1020@gmail.com)) wrote:

Hello,

Is there a rails,nginx, unicorn cookbook out there in chef land that is maintained by a web 3.0 company out there? 🙂

For some reason I see most people are still stuck with apache.

I know I can build my own (that’s the beauty of chef hehe) but just curious if there any any cookbooks that are rails/ruby specific that are maintained by a company that just so happens to open source their devops.

Thanks for your guidance.

---

<div class="post-metadata">

**Author:** ![S\_Ahmed](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/s_ahmed/32/289_2.png) [@S\_Ahmed](https://discourse.chef.io/u/S_Ahmed)\
**Post date:** [April 23, 2014, 3:49pm UTC](https://discourse.chef.io/t/re-rails-nginx-unicorn/5235/3 "2014-04-23T15:49:27Z")

</div>

Thanks. WHere exactly is that socket proxy goodness? 🙂

If you install unicorn via 'gem install unicorn', what about the start/stop  
scripts etc?

On Wed, Apr 16, 2014 at 12:00 PM, Jeff Byrnes [jeff@evertrue.com](mailto:jeff@evertrue.com) wrote:

> We’ve written a few cookbooks for our Rails apps, but they’re private for  
> various reasons. However, the community nginx cookbook is pretty good:  
> [GitHub - sous-chefs/nginx: Development repository for the nginx cookbook](https://github.com/opscode-cookbooks/nginx)
> 
> And you can check out our fork of it that adds some socket proxy goodness  
> for Unicorn:  
> [GitHub - evertrue/nginx-cookbook: Development repository for Opscode Cookbook nginx](https://github.com/evertrue/nginx-cookbook)
> 
> The pattern we follow is to set up the server with nginx properly  
> configured, then let the apps’ deployments install rbenv, Ruby, & Bundler,  
> then use Bundler to install all the necessary gems for the app. Initial  
> deployment is a bit slow, but after that, you’ve got the flexibility to let  
> your apps determine the specific versions of things you need (e.g., Ruby  
> itself, Rails, various gems).
> 
> --  
> Jeff Byrnes  
> @berkleebassist [http://twitter.com/berkleebassist](http://twitter.com/berkleebassist)  
> Operations Engineer  
> EverTrue [http://www.evertrue.com/](http://www.evertrue.com/)  
> 704.516.4628
> 
> On April 16, 2014 at 11:09:11 AM, S Ahmed ([sahmed1020@gmail.com](mailto:sahmed1020@gmail.com)) wrote:
> 
> Hello,
> 
> Is there a rails,nginx, unicorn cookbook out there in chef land that is  
> maintained by a web 3.0 company out there? 🙂
> 
> For some reason I see most people are still stuck with apache.
> 
> I know I can build my own (that's the beauty of chef hehe) but just  
> curious if there any any cookbooks that are rails/ruby specific that are  
> maintained by a company that just so happens to open source their devops.
> 
> Thanks for your guidance.

---

<div class="post-metadata">

**Author:** ![jeffbyrnes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeffbyrnes/32/1478_2.png) [@jeffbyrnes](https://discourse.chef.io/u/jeffbyrnes)\
**Post date:** [April 23, 2014, 4:00pm UTC](https://discourse.chef.io/t/re-rails-nginx-unicorn/5235/4 "2014-04-23T16:00:14Z")

</div>

The socket proxy stuff is over on its own branch: [https://github.com/evertrue/nginx-cookbook/tree/add\_socket\_proxy\_type](https://github.com/evertrue/nginx-cookbook/tree/add_socket_proxy_type)

Here’s the diff master…add\_socket\_proxy\_type on our fork. Bear in mind our fork’s master is likely behind the upstream, community cookbook.

As for the start & stop scripts, we use Capistrano to deploy our apps, and we have a number of nice gems for Cap that handle Unicorn stuff. For Unicorn itself, check out sepastian-capistrano3-unicorn. We use these gems to handle installing rbenv and Ruby:  
capistrano-rbenv  
capistrano-rbenv-maintenance  
They’re all available on Rubygems, and hopefully the README helps you out, but feel free to open an issue on the requisite repositories if need be.

–  
Jeff Byrnes  
@berkleebassist  
Operations Engineer  
EverTrue  
704.516.4628

On April 23, 2014 at 11:49:27 AM, S Ahmed ([sahmed1020@gmail.com](mailto:sahmed1020@gmail.com)) wrote:

Thanks. WHere exactly is that socket proxy goodness? 🙂

If you install unicorn via ‘gem install unicorn’, what about the start/stop scripts etc?

On Wed, Apr 16, 2014 at 12:00 PM, Jeff Byrnes [jeff@evertrue.com](mailto:jeff@evertrue.com) wrote:  
We’ve written a few cookbooks for our Rails apps, but they’re private for various reasons. However, the community nginx cookbook is pretty good: [https://github.com/opscode-cookbooks/nginx](https://github.com/opscode-cookbooks/nginx)

And you can check out our fork of it that adds some socket proxy goodness for Unicorn:

> **[evertrue/nginx-cookbook](https://github.com/evertrue/nginx-cookbook)**
>
> nginx-cookbook - Development repository for Opscode Cookbook nginx

The pattern we follow is to set up the server with nginx properly configured, then let the apps’ deployments install rbenv, Ruby, & Bundler, then use Bundler to install all the necessary gems for the app. Initial deployment is a bit slow, but after that, you’ve got the flexibility to let your apps determine the specific versions of things you need (e.g., Ruby itself, Rails, various gems).

–  
Jeff Byrnes  
@berkleebassist  
Operations Engineer  
EverTrue  
704.516.4628

On April 16, 2014 at 11:09:11 AM, S Ahmed ([sahmed1020@gmail.com](mailto:sahmed1020@gmail.com)) wrote:

Hello,

Is there a rails,nginx, unicorn cookbook out there in chef land that is maintained by a web 3.0 company out there? 🙂

For some reason I see most people are still stuck with apache.

I know I can build my own (that’s the beauty of chef hehe) but just curious if there any any cookbooks that are rails/ruby specific that are maintained by a company that just so happens to open source their devops.

Thanks for your guidance.
