Skip to content

Instantly share code, notes, and snippets.

View timoschilling's full-sized avatar
👻
yolo

Timo Schilling timoschilling

👻
yolo
View GitHub Profile

Zero downtime deploys with unicorn + nginx + runit + rvm + chef

Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).

Other application notes:

  • Our application uses MongoDB, so we don't have database migrations to worry about as with MySQL or postgresql. That does not mean that we won't have to worry about issues with the database with indexes being built in MongoDB or what have you.
  • We use capistrano for deployment.

Salient points for each file:

@schnittchen
schnittchen / routes.rb
Created March 3, 2013 21:06
Routing constraints tied to your app without breaking reloading in development mode
# Sometimes Constraints need to interact with controllers (fex. in order not to query the database twice), then I like
# to put them inside the controller. If you load controllers from your routes.rb (more precisely, when routes.rb is loaded),
# these won't reload in development mode.
# If your constraints live somewhere else (say, /app/constraints), it's basically all the same.
# This demonstrates an easy workaround by wrapping the fetching of constraints in a block:
class ConstraintWrapper
# Helps to load constraints from inside controllers without breaking
# development environment reloading
@bumi
bumi / git.txt
Created October 23, 2013 15:38
Some links on where you find help to get started with git
* http://www.youtube.com/user/GitHubGuides/videos - github video guides
* http://gitimmersion.com/ - a guided tour that walks through the fundamentals of git.
* http://try.github.io/ - an interactive git tutorial to try and learn the basic git commands
* http://training.github.com/ - the github training page. they offer free git webinars
* https://www.codeschool.com/courses/git-real - git course on code school. great interactive course by the codeschool peeps.
* http://opentechschool.github.io/social-coding/ - the opentechschool course
* http://rogerdudler.github.io/git-guide/ - another simple and short git guide
* http://think-like-a-git.net/ - think like a git
* http://git-scm.com/book - full book about git. if you want to learn everything
* http://git-scm.com/book/en/Getting-Started-Git-Basics - a more technical introduction
@varyonic
varyonic / gist:542c37648de91a02402a
Last active August 29, 2015 14:08
Deprecated but working version of form_buffers removed by https://github.com/activeadmin/activeadmin/pull/3486
module ActiveAdmin
module Views
class ActiveAdminForm
class DeprecatedFormBufferSubstitute
def initialize(form)
@form = form
end
def << (value)
@form.text_node value.html_safe
end
# This template is a Cloud Formation template, that has AWS Sam seamlessly mixed in
# It is extremely powerful as you will see!
# This is a template of Lambda & RDS, publically available (so no private VPC)
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31 # This is to tell cloudformation we need to transform this template, as it has SAM!
Description: Severless set up with an RDS
######## ### ######## ### ## ##
## ## ## ## ## ## ## ## ### ###