Skip to content

Instantly share code, notes, and snippets.

View akirill0v's full-sized avatar

Alexander Kirillov akirill0v

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:

<div class="search_video_row_bl search_video_row_bl1">
<div class="ttl">Show videos</div>
<div class="row">
<div class="control-group check_boxes optional">
<div class="controls">
<div class="control-group boolean optional video_search_form_screenshots"><label class="boolean optional control-label" for="video_search_form_screenshots">With screenshots</label><div class="controls"><input name="video_search_form[screenshots]" type="hidden" value="0"><label class="checkbox" style="background-position: 0px 9px;"><input class="boolean optional cb_test" id="video_search_form_screenshots" name="video_search_form[screenshots]" type="checkbox" value="1"></label></div></div>
<div class="control-group boolean optional video_search_form_trailers"><label class="boolean optional control-label" for="video_search_form_trailers">With trailers</label><div class="controls"><input name="video_search_form[trailers]" type="hidden" value="0"><label class="checkbox" style="backgro

Введение

Начать стоит отсюда. Не пугайтесь то, что это книга по незнакомой OS, эти термины практически везде одинаковые и здесь они изложены в понятной для начинающих форме.

http://www.qnx.com/developers/docs/6.4.1/neutrino/getting_started/s1_procs.html

Прочесть нужно треть главы до подраздела "Starting a process", если С не пугает, читайте полностью. После прочтения вы будете понимать, что такое process, thread, mutex, priorites, semaphores, scheduler, contex-switch, kernel states.

Ruby

<div class="row">
<div class="control-group boolean optional company_privacy_company label_show">
<label class="boolean optional control-label" for="company_privacy_company">Don’t show my company in the website catalog</label>
<div class="controls">
<input name="company[privacy_company]" type="hidden" value="0">
<label class="checkbox" style="background-position: 0px 9px;">
<input class="boolean optional" id="company_privacy_company" name="company[privacy_company]" type="checkbox" value="1">
</label>
</div>
</div>
<a href='#' onclick="alert('text')">Link</a>
@akirill0v
akirill0v / gist.rb
Last active December 15, 2015 23:59
processor = Processor.new(arch: :i386, cores: 2)
dsk1 = Disk.new(size: 150.GB, speed:7200)
dsk2 = Disk.new(size: 70.GB, speed:7200)
computer = Computer.new({
processor: processor,
disks: [dsk1, dsk2]
})
def siae(arg)
# ...
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@import "compass/css3/shared";
// NOTE:
// All mixins for the 2009 spec have been written assuming they'll be fed property values that
// correspond to the standard spec. Some mixins can be fed values from the 2009 spec, but don't
// rely on it. The `legacy-order` mixin will increment the value fed to it because the 2009
// `box-ordinal-group` property begins indexing at 1, while the modern `order` property begins
// indexing at 0.
// if `true`, the 2009 properties will be emitted as part of the normal mixin call
require 'v8'
require 'open-uri'
require 'pp'
require 'ap'
require 'taka'
require 'ostruct'
#
# Monkey patch all elements to include a 'style' attribute
#
scope "(:locale)" do
root_to "welcome#index"
end
rake routes
web/welcome#index root /(:locale)(.:format)
# Вроде все ок
# Но если я захочу добавить еще один скоуп
scope "(:locale)" do