# Rails Recommendations

**URL:** <https://discourse.chef.io/t/rails-recommendations/5693>\
**Category:** Chef Infra (archive)\
**Created:** [September 1, 2014, 6:12am UTC](https://discourse.chef.io/t/rails-recommendations/5693 "2014-09-01T06:12:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Angus\_Buchanan](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@Angus\_Buchanan](https://discourse.chef.io/u/Angus_Buchanan)\
**Post date:** [September 1, 2014, 6:12am UTC](https://discourse.chef.io/t/rails-recommendations/5693/1 "2014-09-01T06:12:04Z")

</div>

I’m a sysadmin that comes from a Windows background, although I’m fairly  
comfortable with Linux, and LAMP stuff. Now I need to deploy a simple  
rails application into a dev/test env and also into production. It’s a  
very low load site, and it only needs to be available during office hours.  
I’m imagining initially that it could run on a single machine, but  
splitting it out isn’t a big deal later I guess. I should point out that  
I’m ok at Ruby beyond Chef, but I’m not a web developer - I don’t know much  
about Rails yet, and I’ve never written an Rails app before, so I’m new to  
the ecosystem. The app in question was written by a friend, and is for a  
charity, and I’m helping them out. I’m not in any rush, but I’d like to  
know the best approach.

What I’d like to know is what the current recommended approach is to  
building a server to run and deploy Rails in production, on Linux.  
Specifically:

1. I have seen the application and application\_rails cookbooks used - this  
seems to take a capistrano-like approach and implement it in Chef. I’m ok  
with this, but I think that I might prefer to deploy it with capistrano or  
mina instead. Is the application cookbook approach recommended?

2. An alternative approach that I’m interested in is using Omnibus to build  
a package that contains everything I need for the application to run, and  
the application itself. If this were the case would I deploy the app using  
Chef’s file or package resource, as cap or mina wouldn’t be used? I think  
this might solve the following question…

3. What’s the recommended way to get Ruby on the system? I am not very  
keen on the idea of using rvm on servers, but system packages tend to lag  
too. What is recommended?

4. What’s the recommended way to actually serve the app? I’ve read about  
Apache and Passenger - this seems like a straightforward approach, and  
simpler than unicorn or puma and so on. Are there good community cookbooks  
that can help here?

5. What about database stuff? I see there’s a database cookbook with some  
powerful tools, and a mysql cookbook, but should I try to seed the database  
with Chef or do that manually?

I think that’s all my questions for now… thanks in advance for your  
guidance.

-aob

---

<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:** [September 1, 2014, 10:16am UTC](https://discourse.chef.io/t/rails-recommendations/5693/2 "2014-09-01T10:16:36Z")

</div>

2014-09-01 10:12 GMT+04:00 Angus Buchanan [angus.o.buchanan@gmail.com](mailto:angus.o.buchanan@gmail.com):

> I'm a sysadmin that comes from a Windows background, although I'm fairly  
> comfortable with Linux, and LAMP stuff. Now I need to deploy a simple  
> rails application into a dev/test env and also into production. It's a  
> very low load site, and it only needs to be available during office hours.  
> I'm imagining initially that it could run on a single machine, but  
> splitting it out isn't a big deal later I guess. I should point out that  
> I'm ok at Ruby beyond Chef, but I'm not a web developer - I don't know much  
> about Rails yet, and I've never written an Rails app before, so I'm new to  
> the ecosystem. The app in question was written by a friend, and is for a  
> charity, and I'm helping them out. I'm not in any rush, but I'd like to  
> know the best approach.
> 
> What I'd like to know is what the current recommended approach is to  
> building a server to run and deploy Rails in production, on Linux.  
> Specifically:
> 
> 1. I have seen the application and application\_rails cookbooks used - this  
> seems to take a capistrano-like approach and implement it in Chef. I'm ok  
> with this, but I think that I might prefer to deploy it with capistrano or  
> mina instead. Is the application cookbook approach recommended?
> 
> You can use them. But you need to remember that you will spend a decent  
> amount of time with testing and learning this cookbooks. Other case - use  
> chef and write you own recipe based on default HOW\_TO to setup rails  
> application and what you need. Everywhere when you use chef cookbook's -  
> add time to their study and testing. Automating needed in those places  
> where it is absolutely necessary and can save a time.

1. An alternative approach that I'm interested in is using Omnibus to build

> a package that contains everything I need for the application to run, and  
> the application itself. If this were the case would I deploy the app using  
> Chef's file or package resource, as cap or mina wouldn't be used? I think  
> this might solve the following question...

That's good approach, but you should learn packaging system policy's  
documents. This is not easy way. But it's is you right.

> 1. What's the recommended way to get Ruby on the system? I am not very  
> keen on the idea of using rvm on servers, but system packages tend to lag  
> too. What is recommended?

You don't have a another way except using rvm or rbenv. Better to use rvm  
and install them for the user. Why better - because rvm more elegant way to  
use ruby on the system. There are a good cookbook chef-rvm to do it.

> 1. What's the recommended way to actually serve the app? I've read about  
> Apache and Passenger - this seems like a straightforward approach, and  
> simpler than unicorn or puma and so on. Are there good community cookbooks  
> that can help here?
> 
> Passenger is a default app server (Should be enough).  
> See passenger cookbook if you wish to install them with chef. But in simple  
> approach I recommend to install them manually with chef bash scripts. You  
> can see a redmine cookbook for example.

1. What about database stuff? I see there's a database cookbook with some

> powerful tools, and a mysql cookbook, but should I try to seed the database  
> with Chef or do that manually?
> 
> You can use database cookbook, but you pay for that you time. In a simple  
> production case just create a db manually and connect to it from you  
> application. If you need to create a test environment then use database  
> cookbook (recipe) for complete deploy test environment in vagrant machine  
> with kitchen.ci for example. I think this is a very simple use case.

I think that's all my questions for now... thanks in advance for your

> guidance.
> 
> -aob

--  
Faithfully yours,

CVision Lab System Administrator  
Vladimir Skubriev

---

<div class="post-metadata">

**Author:** ![Greg\_Zapp](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@Greg\_Zapp](https://discourse.chef.io/u/Greg_Zapp)\
**Post date:** [September 1, 2014, 11:55am UTC](https://discourse.chef.io/t/rails-recommendations/5693/3 "2014-09-01T11:55:22Z")

</div>

Hi Angus,

I just thought I would throw this out there.. Does this need to go onto  
existing infrastructure? Are you open to a PaaS? Even something like  
Elastic Beanstalk from Amazon could turn out quite affordable and  
flexible...

-Greg

On Mon, Sep 1, 2014 at 10:16 PM, Vladimir Skubriev [skubriev@cvisionlab.com](mailto:skubriev@cvisionlab.com)  
wrote:

> 2014-09-01 10:12 GMT+04:00 Angus Buchanan [angus.o.buchanan@gmail.com](mailto:angus.o.buchanan@gmail.com):
> 
> I'm a sysadmin that comes from a Windows background, although I'm fairly
> 
> > comfortable with Linux, and LAMP stuff. Now I need to deploy a simple  
> > rails application into a dev/test env and also into production. It's a  
> > very low load site, and it only needs to be available during office hours.  
> > I'm imagining initially that it could run on a single machine, but  
> > splitting it out isn't a big deal later I guess. I should point out that  
> > I'm ok at Ruby beyond Chef, but I'm not a web developer - I don't know much  
> > about Rails yet, and I've never written an Rails app before, so I'm new to  
> > the ecosystem. The app in question was written by a friend, and is for a  
> > charity, and I'm helping them out. I'm not in any rush, but I'd like to  
> > know the best approach.
> > 
> > What I'd like to know is what the current recommended approach is to  
> > building a server to run and deploy Rails in production, on Linux.  
> > Specifically:
> > 
> > 1. I have seen the application and application\_rails cookbooks used -  
> > this seems to take a capistrano-like approach and implement it in Chef.  
> > I'm ok with this, but I think that I might prefer to deploy it with  
> > capistrano or mina instead. Is the application cookbook approach  
> > recommended?
> > 
> > You can use them. But you need to remember that you will spend a decent  
> > amount of time with testing and learning this cookbooks. Other case - use  
> > chef and write you own recipe based on default HOW\_TO to setup rails  
> > application and what you need. Everywhere when you use chef cookbook's -  
> > add time to their study and testing. Automating needed in those places  
> > where it is absolutely necessary and can save a time.
> 
> 1. An alternative approach that I'm interested in is using Omnibus to
> 
> > build a package that contains everything I need for the application to run,  
> > and the application itself. If this were the case would I deploy the app  
> > using Chef's file or package resource, as cap or mina wouldn't be used? I  
> > think this might solve the following question...
> 
> That's good approach, but you should learn packaging system policy's  
> documents. This is not easy way. But it's is you right.
> 
> > 1. What's the recommended way to get Ruby on the system? I am not very  
> > keen on the idea of using rvm on servers, but system packages tend to lag  
> > too. What is recommended?
> 
> You don't have a another way except using rvm or rbenv. Better to use rvm  
> and install them for the user. Why better - because rvm more elegant way to  
> use ruby on the system. There are a good cookbook chef-rvm to do it.
> 
> > 1. What's the recommended way to actually serve the app? I've read about  
> > Apache and Passenger - this seems like a straightforward approach, and  
> > simpler than unicorn or puma and so on. Are there good community cookbooks  
> > that can help here?
> > 
> > Passenger is a default app server (Should be enough).  
> > See passenger cookbook if you wish to install them with chef. But in  
> > simple approach I recommend to install them manually with chef bash  
> > scripts. You can see a redmine cookbook for example.
> 
> 1. What about database stuff? I see there's a database cookbook with some
> 
> > powerful tools, and a mysql cookbook, but should I try to seed the database  
> > with Chef or do that manually?
> > 
> > You can use database cookbook, but you pay for that you time. In a simple  
> > production case just create a db manually and connect to it from you  
> > application. If you need to create a test environment then use database  
> > cookbook (recipe) for complete deploy test environment in vagrant machine  
> > with kitchen.ci for example. I think this is a very simple use case.
> 
> I think that's all my questions for now... thanks in advance for your
> 
> > guidance.
> > 
> > -aob
> 
> --  
> Faithfully yours,
> 
> CVision Lab System Administrator  
> Vladimir Skubriev

---

<div class="post-metadata">

**Author:** ![Angus\_Buchanan](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@Angus\_Buchanan](https://discourse.chef.io/u/Angus_Buchanan)\
**Post date:** [September 1, 2014, 2:52pm UTC](https://discourse.chef.io/t/rails-recommendations/5693/4 "2014-09-01T14:52:54Z")

</div>

Hi Greg,

There's already hardware that has been donated... a few Dell servers.  
We're going to use that.

-aob

On Mon, Sep 1, 2014 at 12:55 PM, Greg Zapp [greg.zapp@gmail.com](mailto:greg.zapp@gmail.com) wrote:

> Hi Angus,
> 
> I just thought I would throw this out there.. Does this need to go onto  
> existing infrastructure? Are you open to a PaaS? Even something like  
> Elastic Beanstalk from Amazon could turn out quite affordable and  
> flexible...
> 
> -Greg
> 
> On Mon, Sep 1, 2014 at 10:16 PM, Vladimir Skubriev \<  
> [skubriev@cvisionlab.com](mailto:skubriev@cvisionlab.com)\> wrote:
> 
> > 2014-09-01 10:12 GMT+04:00 Angus Buchanan [angus.o.buchanan@gmail.com](mailto:angus.o.buchanan@gmail.com):
> > 
> > I'm a sysadmin that comes from a Windows background, although I'm fairly
> > 
> > > comfortable with Linux, and LAMP stuff. Now I need to deploy a simple  
> > > rails application into a dev/test env and also into production. It's a  
> > > very low load site, and it only needs to be available during office hours.  
> > > I'm imagining initially that it could run on a single machine, but  
> > > splitting it out isn't a big deal later I guess. I should point out that  
> > > I'm ok at Ruby beyond Chef, but I'm not a web developer - I don't know much  
> > > about Rails yet, and I've never written an Rails app before, so I'm new to  
> > > the ecosystem. The app in question was written by a friend, and is for a  
> > > charity, and I'm helping them out. I'm not in any rush, but I'd like to  
> > > know the best approach.
> > > 
> > > What I'd like to know is what the current recommended approach is to  
> > > building a server to run and deploy Rails in production, on Linux.  
> > > Specifically:
> > > 
> > > 1. I have seen the application and application\_rails cookbooks used -  
> > > this seems to take a capistrano-like approach and implement it in Chef.  
> > > I'm ok with this, but I think that I might prefer to deploy it with  
> > > capistrano or mina instead. Is the application cookbook approach  
> > > recommended?
> > > 
> > > You can use them. But you need to remember that you will spend a decent  
> > > amount of time with testing and learning this cookbooks. Other case - use  
> > > chef and write you own recipe based on default HOW\_TO to setup rails  
> > > application and what you need. Everywhere when you use chef cookbook's -  
> > > add time to their study and testing. Automating needed in those places  
> > > where it is absolutely necessary and can save a time.
> > 
> > 1. An alternative approach that I'm interested in is using Omnibus to
> > 
> > > build a package that contains everything I need for the application to run,  
> > > and the application itself. If this were the case would I deploy the app  
> > > using Chef's file or package resource, as cap or mina wouldn't be used? I  
> > > think this might solve the following question...
> > 
> > That's good approach, but you should learn packaging system policy's  
> > documents. This is not easy way. But it's is you right.
> > 
> > > 1. What's the recommended way to get Ruby on the system? I am not very  
> > > keen on the idea of using rvm on servers, but system packages tend to lag  
> > > too. What is recommended?
> > 
> > You don't have a another way except using rvm or rbenv. Better to use rvm  
> > and install them for the user. Why better - because rvm more elegant way to  
> > use ruby on the system. There are a good cookbook chef-rvm to do it.
> > 
> > > 1. What's the recommended way to actually serve the app? I've read  
> > > about Apache and Passenger - this seems like a straightforward approach,  
> > > and simpler than unicorn or puma and so on. Are there good community  
> > > cookbooks that can help here?
> > > 
> > > Passenger is a default app server (Should be enough).  
> > > See passenger cookbook if you wish to install them with chef. But in  
> > > simple approach I recommend to install them manually with chef bash  
> > > scripts. You can see a redmine cookbook for example.
> > 
> > 1. What about database stuff? I see there's a database cookbook with
> > 
> > > some powerful tools, and a mysql cookbook, but should I try to seed the  
> > > database with Chef or do that manually?
> > > 
> > > You can use database cookbook, but you pay for that you time. In a  
> > > simple production case just create a db manually and connect to it from  
> > > you application. If you need to create a test environment then use database  
> > > cookbook (recipe) for complete deploy test environment in vagrant machine  
> > > with kitchen.ci for example. I think this is a very simple use case.
> > 
> > I think that's all my questions for now... thanks in advance for your
> > 
> > > guidance.
> > > 
> > > -aob
> > 
> > --  
> > Faithfully yours,
> > 
> > CVision Lab System Administrator  
> > Vladimir Skubriev

---

<div class="post-metadata">

**Author:** ![Angus\_Buchanan](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@Angus\_Buchanan](https://discourse.chef.io/u/Angus_Buchanan)\
**Post date:** [September 1, 2014, 3:03pm UTC](https://discourse.chef.io/t/rails-recommendations/5693/5 "2014-09-01T15:03:44Z")

</div>

Hi Vladimir,

On Mon, Sep 1, 2014 at 11:16 AM, Vladimir Skubriev [skubriev@cvisionlab.com](mailto:skubriev@cvisionlab.com)  
wrote:

You can use them. But you need to remember that you will spend a decent

> amount of time with testing and learning this cookbooks. Other case - use  
> chef and write you own recipe based on default HOW\_TO to setup rails  
> application and what you need. Everywhere when you use chef cookbook's -  
> add time to their study and testing. Automating needed in those places  
> where it is absolutely necessary and can save a time.

Most of the how-to docs I see are very much focussed on a development  
setup, rather than something in production. But it seems pretty  
straightforward. One question would be whether to have a deploy user if  
using capistrano, or just to deploy as the user created for running the  
app. Any suggestions?

> That's good approach, but you should learn packaging system policy's  
> documents. This is not easy way. But it's is you right.

I think with Omnibus I can just shove everything in /opt, and update the  
vhost... this also solves Ruby problems. I'm quite convinced this is a  
good idea, but I couldn't find any article or example of packaging Ruby,  
and some Gems, and the app itself. I guess I could try to make Jenkins  
build the package too.... this seems quite a nice approach. What do you  
think?

1. What's the recommended way to get Ruby on the system? I am not very

> > keen on the idea of using rvm on servers, but system packages tend to lag  
> > too. What is recommended?
> 
> You don't have a another way except using rvm or rbenv. Better to use rvm  
> and install them for the user. Why better - because rvm more elegant way to  
> use ruby on the system. There are a good cookbook chef-rvm to do it.

Well... in Omnibus the Ruby is built for me... problem solved!

Passenger is a default app server (Should be enough).

> See passenger cookbook if you wish to install them with chef. But in  
> simple approach I recommend to install them manually with chef bash  
> scripts. You can see a redmine cookbook for example.

OK cool. What about unicorn and puma? Why are these so popular if  
passenger is so simple? I prefer the simple approach, I think.

> 1. What about database stuff? I see there's a database cookbook with some
> 
> > powerful tools, and a mysql cookbook, but should I try to seed the database  
> > with Chef or do that manually?
> > 
> > You can use database cookbook, but you pay for that you time. In a simple  
> > production case just create a db manually and connect to it from you  
> > application. If you need to create a test environment then use database  
> > cookbook (recipe) for complete deploy test environment in vagrant machine  
> > with kitchen.ci for example. I think this is a very simple use case.

I don't really understand this... but never mind.

-aob

---

<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:** [September 1, 2014, 5:13pm UTC](https://discourse.chef.io/t/rails-recommendations/5693/6 "2014-09-01T17:13:42Z")

</div>

2014-09-01 19:03 GMT+04:00 Angus Buchanan [angus.o.buchanan@gmail.com](mailto:angus.o.buchanan@gmail.com):

> Hi Vladimir,
> 
> On Mon, Sep 1, 2014 at 11:16 AM, Vladimir Skubriev \<  
> [skubriev@cvisionlab.com](mailto:skubriev@cvisionlab.com)\> wrote:
> 
> You can use them. But you need to remember that you will spend a decent
> 
> > amount of time with testing and learning this cookbooks. Other case - use  
> > chef and write you own recipe based on default HOW\_TO to setup rails  
> > application and what you need. Everywhere when you use chef cookbook's -  
> > add time to their study and testing. Automating needed in those places  
> > where it is absolutely necessary and can save a time.
> 
> Most of the how-to docs I see are very much focussed on a development  
> setup, rather than something in production. But it seems pretty  
> straightforward. One question would be whether to have a deploy user if  
> using capistrano, or just to deploy as the user created for running the  
> app. Any suggestions?

I would choose the second method(just deploy as the user), because I think  
capistrano is the next high level abstraction, which involves additional  
time. I think you dont't know what use case is choose, then lakely  
capistrano not necessar at this time.

> That's good approach, but you should learn packaging system policy's
> 
> > documents. This is not easy way. But it's is you right.
> 
> I think with Omnibus I can just shove everything in /opt, and update the  
> vhost... this also solves Ruby problems. I'm quite convinced this is a  
> good idea, but I couldn't find any article or example of packaging Ruby,  
> and some Gems, and the app itself. I guess I could try to make Jenkins  
> build the package too.... this seems quite a nice approach. What do you  
> think?

Jenkins for package building/updating is cool idea. I cannot advice in  
package building in you use case. But I can suggest you. I think that you  
myst start from simple application cookbook, that includes very minimal of  
community cookbooks as much as possible in the beginning. Write deploy as  
you see it for yourself. If you want to use community cookbooks you is  
always free in this. But ensure, that complexity level is will grow. Best  
of all, when it happens gradually. As required. So you can control the  
workflow and conduct normal work planning. The work should be gradual.The  
main thing to consider the process of updating a running system. It must be  
the most transparent to you as a professional who serves the application.

> 1. What's the recommended way to get Ruby on the system? I am not very
> 
> > > keen on the idea of using rvm on servers, but system packages tend to lag  
> > > too. What is recommended?
> > 
> > You don't have a another way except using rvm or rbenv. Better to use rvm  
> > and install them for the user. Why better - because rvm more elegant way to  
> > use ruby on the system. There are a good cookbook chef-rvm to do it.
> 
> Well... in Omnibus the Ruby is built for me... problem solved!
> 
> If you already used this approach - then that's right for you.

> Passenger is a default app server (Should be enough).
> 
> > See passenger cookbook if you wish to install them with chef. But in  
> > simple approach I recommend to install them manually with chef bash  
> > scripts. You can see a redmine cookbook for example.
> 
> OK cool. What about unicorn and puma? Why are these so popular if  
> passenger is so simple? I prefer the simple approach, I think.

As far as I've heard - Unicorn faster and very simple.  
Passenger (Firefox), Unicorn (Chrome) 😉

> 1. What about database stuff? I see there's a database cookbook with
> 
> > > some powerful tools, and a mysql cookbook, but should I try to seed the  
> > > database with Chef or do that manually?
> > > 
> > > You can use database cookbook, but you pay for that you time. In a  
> > > simple production case just create a db manually and connect to it from  
> > > you application. If you need to create a test environment then use database  
> > > cookbook (recipe) for complete deploy test environment in vagrant machine  
> > > with kitchen.ci for example. I think this is a very simple use case.
> 
> I don't really understand this... but never mind.
> 
> -aob

--  
Faithfully yours,

CVision Lab System Administrator  
Vladimir Skubriev

---

<div class="post-metadata">

**Author:** ![Tensibai](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tensibai/32/29_2.png) [@Tensibai](https://discourse.chef.io/u/Tensibai)\
**Post date:** [September 1, 2014, 5:27pm UTC](https://discourse.chef.io/t/rails-recommendations/5693/7 "2014-09-01T17:27:25Z")

</div>

From phone, so I'll be brief: I would start from another rails app cookbook as exemple (like gitlab IIRC). Typically they're deployed from a git repo, easing the release process, they also usually include a dB part (even if it sounds more a rake task in my memory).

I'll be happy to provide a more complete view if needed.

---- Angus Buchanan a écrit ----

> I'm a sysadmin that comes from a Windows background, although I'm fairly comfortable with Linux, and LAMP stuff. Now I need to deploy a simple rails application into a dev/test env and also into production. It's a very low load site, and it only needs to be available during office hours. I'm imagining initially that it could run on a single machine, but splitting it out isn't a big deal later I guess. I should point out that I'm ok at Ruby beyond Chef, but I'm not a web developer - I don't know much about Rails yet, and I've never written an Rails app before, so I'm new to the ecosystem. The app in question was written by a friend, and is for a charity, and I'm helping them out. I'm not in any rush, but I'd like to know the best approach.
> 
> What I'd like to know is what the current recommended approach is to building a server to run and deploy Rails in production, on Linux. Specifically:
> 
> 1. I have seen the application and application\_rails cookbooks used - this seems to take a capistrano-like approach and implement it in Chef. I'm ok with this, but I think that I might prefer to deploy it with capistrano or mina instead. Is the application cookbook approach recommended?
> 
> 2. An alternative approach that I'm interested in is using Omnibus to build a package that contains everything I need for the application to run, and the application itself. If this were the case would I deploy the app using Chef's file or package resource, as cap or mina wouldn't be used? I think this might solve the following question...
> 
> 3. What's the recommended way to get Ruby on the system? I am not very keen on the idea of using rvm on servers, but system packages tend to lag too. What is recommended?
> 
> 4. What's the recommended way to actually serve the app? I've read about Apache and Passenger - this seems like a straightforward approach, and simpler than unicorn or puma and so on. Are there good community cookbooks that can help here?
> 
> 5. What about database stuff? I see there's a database cookbook with some powerful tools, and a mysql cookbook, but should I try to seed the database with Chef or do that manually?
> 
> I think that's all my questions for now... thanks in advance for your guidance.
> 
> -aob

---

<div class="post-metadata">

**Author:** ![Nathan\_L\_Smith](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/nathan_l_smith/32/199_2.png) [@Nathan\_L\_Smith](https://discourse.chef.io/u/Nathan_L_Smith)\
**Post date:** [September 1, 2014, 5:35pm UTC](https://discourse.chef.io/t/rails-recommendations/5693/8 "2014-09-01T17:35:01Z")

</div>

On Mon, Sep 1, 2014 at 1:12 AM, Angus Buchanan [angus.o.buchanan@gmail.com](mailto:angus.o.buchanan@gmail.com)  
wrote:

> I'm a sysadmin that comes from a Windows background, although I'm fairly  
> comfortable with Linux, and LAMP stuff. Now I need to deploy a simple  
> rails application into a dev/test env and also into production. It's a  
> very low load site, and it only needs to be available during office hours.  
> I'm imagining initially that it could run on a single machine, but  
> splitting it out isn't a big deal later I guess. I should point out that  
> I'm ok at Ruby beyond Chef, but I'm not a web developer - I don't know much  
> about Rails yet, and I've never written an Rails app before, so I'm new to  
> the ecosystem. The app in question was written by a friend, and is for a  
> charity, and I'm helping them out. I'm not in any rush, but I'd like to  
> know the best approach.
> 
> What I'd like to know is what the current recommended approach is to  
> building a server to run and deploy Rails in production, on Linux.  
> Specifically:
> 
> 1. I have seen the application and application\_rails cookbooks used - this  
> seems to take a capistrano-like approach and implement it in Chef. I'm ok  
> with this, but I think that I might prefer to deploy it with capistrano or  
> mina instead. Is the application cookbook approach recommended?

Capistrano uses only a "push" model of deployment, where you type a command  
to deploy. When you deploy with Chef it's usually more of a "pull" model,  
where the chef-client runs ensure your application is running the revision  
that you tell it to. Both the application\_rails cookbook and the  
deploy\_revision built-in resource model their directory structures and  
callbacks based on how capistrano works, where the "current" directory is  
linked to a specific release.

> 1. An alternative approach that I'm interested in is using Omnibus to  
> build a package that contains everything I need for the application to run,  
> and the application itself. If this were the case would I deploy the app  
> using Chef's file or package resource, as cap or mina wouldn't be used? I  
> think this might solve the following question...

That's also a good model, though you need to build a new package every time  
you deploy. If you have automated builds and Git caching with Omnibus this  
isn't so bad, but there is some overhead compared to just pulling down the  
latest release of your app from a Git repository.

> 1. What's the recommended way to get Ruby on the system? I am not very  
> keen on the idea of using rvm on servers, but system packages tend to lag  
> too. What is recommended?

If you're running on Ubuntu, this cookbook  
[GitHub - Sutto/chef-brightbox: Brightbox Next Gen Ruby + Passenger / Nginx recipes for Chef.](https://github.com/Sutto/chef-brightbox) uses Brightbox's apt repo (  
[Brightbox Ruby NG Experimental : “Brightbox” team](https://launchpad.net/~brightbox/+archive/ubuntu/ruby-ng-experimental)) and  
has pre-built packages for the latest Ruby and includes some other nice  
packages.

There are a few places with RPM specs for building Ruby on CentOS/Red Hat.

[GitHub - danielsdeleo/omnibus-rubies: Matrix of Ruby/Rubygems Versions in Omnibus Form](https://github.com/danielsdeleo/omnibus-rubies) has omnibus definitions for  
building Rubies.

> 1. What's the recommended way to actually serve the app? I've read about  
> Apache and Passenger - this seems like a straightforward approach, and  
> simpler than unicorn or puma and so on. Are there good community cookbooks  
> that can help here?

Either one will work fine, I prefer Unicorn+Nginx.

> 1. What about database stuff? I see there's a database cookbook with some  
> powerful tools, and a mysql cookbook, but should I try to seed the database  
> with Chef or do that manually?

The deploy\_revision resource (  
[All Infra Resources](https://docs.getchef.com/chef/resources.html#deploy)) with the default  
settings will run the migrations for you. The community database cookbook  
have some good resources for creating databases and users.

> I think that's all my questions for now... thanks in advance for your  
> guidance.
> 
> -aob

--  
Nathan L Smith  
[smith@getchef.com](mailto:smith@getchef.com)
