Managing your infrastructure with configuration management tools like Chef melds the practices of development and operations together. This workshop will focus on a development practice - Test Driven Development - and how that method can be applied to managing your Rails infrastructure and deployments. You will learn how to: Analyze your application and define your infrastructure needs (databases, load balancers, etc.), define unique infrastructure requirements for Rails applications (i.e. asset pipeline), capture your requirements in tests using Test Kitchen, ServerSpec, and other frameworks.
This workshop is being offered at Iowa Code Camp.
During the workshop we will provide an introduction to Infrastructure as Code and to Chef.
Participants of the workshop will complete hands-on labs that will practice test-driven infrastructure code development.
Our goal is to build the infrastructure required to run a basic Rails application.
NOTE: While we will be following a test-driven approach and the end result should work, we won't necessarily be following all of the best-practices for everything we build.
The master branch is where we start. There are many other branches here that build on one another working toward a working example.
- master
- labs/widget_world_ruby - a cookbook to install Ruby 2.2.2
- labs/widget_world_apache - a cookbook to install Apache
- labs/widget_world_passenger - a cookbook for managing Passenger
- labs/widget_world_postgres - a cookbook for PostgreSQL
- labs/widget_world_application - the fully deployed application
- labs/foodcritic - Fix a foodcritic violation or two
The various requirements for our infrastructure include:
- A linux-based operating system - Ubuntu 12.04
- Ruby
- An application server - Phusion Passenger for Apache
- A relational database management system (RDBMS) - PostgreSQL Database
- A Rails application - Widget World
Our application will use Ruby 2.2.2. We have created a debian package that targets our operating system (Ubuntu 12.04). The package was built with FPM using the build_ruby.sh script in this repository.
The following steps were taken to build the package:
- Provision an Ubuntu 12.04 instance on Amazon's EC2 using ami-00615068
- Run the
build_ruby.sh
script on that instance - Publish the resulting debian package to s3 at - https://s3.amazonaws.com/chef-railsconf-2015/ruby-2.2.2_amd64.deb
Build a Widget World Ruby Cookbook.
Our application will use Phusion Passenger for Apache. There may be other applications within our company that require Apache, but not Passenger. We will manage both components in individual cookbooks.
Build the following cookbooks:
Our application will use PostgreSQL version 9.1.
Build a Widget World PostgreSQL Cookbook.
Our Rails Application is available on GitHub. Deploy the initial release (v 0.0.1) of this application. This is the most advanced cookbook we'll create.