GithubHelp home page GithubHelp logo

ludekstepan / chef-hello-cloud Goto Github PK

View Code? Open in Web Editor NEW

This project forked from karmi/chef-hello-cloud

0.0 2.0 0.0 160 KB

A demo of a full stack Rails application deployment (1x load balancer, 3x appserver, 1x database, 3x elasticsearch) with Chef Server

Home Page: http://www.slideshare.net/karmi/shells-kitchen-infrastructure-as-code-webexpo-2012

chef-hello-cloud's Introduction

Chef Server Hello Cloud

This repository contains a tutorial for Chef Server.

It deploys a full-stack Ruby On Rails application on the following infrastructure:

  • 1 load balancer running HAproxy
  • 3 application servers
  • 1 database server with PostgreSQL and Redis
  • 2 elasticsearch servers in cluster

Exactly as prescribed:

Hello World in Cloud

The application cookbook installs Ruby 1.9.3 via RVM, tweaks the PostgreSQL settings, searches Chef Server for database and elasticsearch nodes and stores their IPs in the configuration files, restores data from SQL dump and imports it into the search index.

The monitoring cookbook ensures all parts of the stack are monitored via Monit.

There are two options how to install the stack: locally, with Vagrant, and on Amazon EC2.

The application being deployed is Rubygems.org, in a specific version which adds full-text search using elasticsearch. See the rubygems/rubygems.org#455 issue for more information

Prerequisites

First, you need to have a valid Chef Server account, your user validation key, and your organization validation key.

Arguably the easiest way is to create a free account in Hosted Chef, provided by Opscode.

You need to export the following environment variables for the provisioning scripts:

export CHEF_ORGANIZATION='<your organization name>'
export CHEF_ORGANIZATION_KEY='/path/to/your/your-organization-validator.pem'

Building the Stack in Vagrant

Once you have your Chef Server credentials at hand, clone the repo:

git clone git://github.com/karmi/chef-hello-cloud.git
cd chef-hello-cloud

... install the required rubygems:

bundle install

... install the site cookbooks with Berkshelf:

berks install --shims ./site-cookbooks/

... upload the cookbooks to Chef Server:

knife cookbook upload --all

... and finally, upload all roles to Chef Server:

knife role from file roles/*.rb

If everything goes fine, build the simplified infrastructure in Vagrant:

time vagrant up

The process should take between 30 and 50 minutes on a reasonable workstation with at least 4GB of RAM. It has been successfuly tested on Mac Book Air Mid 2011, Mac Book Pro Mid 2010 and iMac Mid 2009.

Building the Stack in Amazon EC2

To build the stack in Amazon EC2, in addition to Chef Server credentials, you need to export the path to your private SSH key, downloaded from the AWS console:

export SSH_IDENTITY_FILE='/path/to/your/name-ec2.pem'

After that, just create the servers with Rake commands.

First, create the database and elasticsearch servers:

time rake server:create NAME=ec2-database ROLE=database
time rake server:create NAME=ec2-elasticsearch-1 ROLE=elasticsearch
time rake server:create NAME=ec2-elasticsearch-2 ROLE=elasticsearch

Once ready, create application servers:

time rake server:create NAME=ec2-application-1 ROLE=application
time rake server:create NAME=ec2-application-2 ROLE=application
time rake server:create NAME=ec2-application-3 ROLE=application

Finally, create the load balancer server:

time rake server:create NAME=ec2-load_balancer ROLE=load_balancer

After the stack is built, open the Public DNS Name URL in your web browser. You should see Rubygems.org with some nice fulltext search features running (hint: click "Tips" on the search page).


(c) 2012 Karel Minarik & Vojtech Hyza. MIT License.

chef-hello-cloud's People

Contributors

karmi avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.