Configuring Nginx and Unicorn with Chef

In this post I’ll explain how to configure Nginx and Unicorn with Chef and will share with you some insights and best practices you may find useful while configuring your nodes.

Nginx and Unicorn Configuration

The first step on setting up Nginx and Unicorn configuration with Chef is to download the corresponding cookbooks. You can do this with any cookbook management tool like Berkshelf or Librarian-Chef. In this example I will use Berkshelf.

# Berksfile

site :opscode

cookbook 'nginx'
cookbook 'runit'
cookbook 'unicorn'

Continue Reading →

Handling Multiple Domains Routes in your Ruby on Rails Applications

In this post I’ll share with you a technique to make your Ruby on Rails applications handle multiple domains using routes constraints.

Because your development environment will use a different domain than your production environment, you should somewhere configure which domains will be use in each environment. You can configure this in your application settings file.

# config/settings.yml



Continue Reading →

Crafting Ruby Grape APIs: Partial Response (Part I)

In this article I am going to talk about a useful API development technique called Partial Response which can be used in Ruby Grape API’s to allow clients retrieving just the amount information they need instead of the full resource representation. This techinque reduces bandwidth usage and increases client efficiency and responsiveness, specially in mobile devices.

This is the first part of a series of posts I am going to write about crafting Ruby API’s with the Grape framework.

The most common approach to Partial Response is to include a fields=field1,field2,field-n parameter in the request specifing the necessary fields.

For example:,description

Continue Reading →