Skip to content

Instantly share code, notes, and snippets.

View realmyst's full-sized avatar

Alexander Shcherbinin realmyst

  • Russia, Ulyanovsk
View GitHub Profile
require 'zmq'
context = ZMQ::Context.new
pub = context.socket ZMQ::PUB
pub.setsockopt ZMQ::IDENTITY, 'ping-pinger'
pub.bind 'tcp://*:5555'
i=0
loop do
pub.send "ping pinger #{i+=1}" ; sleep 1
end

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:

@realmyst
realmyst / gist:3340984
Created August 13, 2012 13:53 — forked from kosmatov/image-preview-html5.js
File preview on HTML5/JS/jQuery
$('form').on('change', 'input[type="file"]', function(e) {
var files = e.target.files,
f = files[0],
reader = new FileReader(),
t = this
;
reader.onload = (function(file) {