Skip to content

Instantly share code, notes, and snippets.

View dzaporozhets's full-sized avatar

Dmitriy Zaporozhets dzaporozhets

View GitHub Profile
@dzaporozhets
dzaporozhets / database.yml
Last active December 31, 2015 19:49
postgres.db.yml
test: &test
adapter: postgresql
encoding: unicode
database: random_db_test
pool: 5
username: dzaporozhets
password:
host: localhost
port: 5432
To install redis from debian backports we need to add the backports sources.
1. Add to /etc/apt/sources.list:
deb http://backports.debian.org/debian-backports squeeze-backports main
2. Retrieve debian key
$ gpg --keyserver pgp.mit.edu --recv-keys AED4B06F473041FA
#! /usr/bin/env ruby
$LOAD_PATH.unshift '/Users/schacon/projects/git/rugged/lib'
require 'rugged'
require 'rubygems'
require 'pp'
dir, id = "/opt/linux.git"
#!/usr/bin/env ruby
# This script can be used to generate a list of authors for each source file,
# for inclusion in the copyright header.
require 'rugged'
require 'set'
repo = Rugged::Repository.new(".")
.hll { background-color: #ffffcc }
.c { color: #586E75 } /* Comment */
.err { color: #93A1A1 } /* Error */
.g { color: #93A1A1 } /* Generic */
.k { color: #859900 } /* Keyword */
.l { color: #93A1A1 } /* Literal */
.n { color: #93A1A1 } /* Name */
.o { color: #859900 } /* Operator */
.x { color: #CB4B16 } /* Other */
.p { color: #93A1A1 } /* Punctuation */

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:

#!/bin/sh
# GITLAB
# Maintainer: @randx
# App Version: 4.0
# ABOUT
# This script performs a complete installation of Gitlab for ubuntu server 12.04.1 x64:
# * packages update
# * redis, git, postfix etc
@dzaporozhets
dzaporozhets / gist:3981157
Created October 30, 2012 15:59 — forked from thijsc/gist:1391107
Select item from chosen js select with Capybara and Selenium
def select_from_chosen(item_text, options)
field = find_field(options[:from])
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()")
page.execute_script("$('##{field[:id]}').val('#{option_value}')")
end
@dzaporozhets
dzaporozhets / gitlab_gitolite.sh
Created October 24, 2012 13:58
Fix gitolite for gitlab 3
# GITOLITE 3
sudo -u git -H sed -i "s/\(GIT_CONFIG_KEYS\s*=>*\s*\).\{2\}/\1'\.\*'/g" /home/git/.gitolite.rc
# GITOLITE 2
sudo -u git -H sed -i 's/\(GL_GITCONFIG_KEYS\s*=>*\s*\).\{2\}/\1"\.\*"/g' /home/git/.gitolite.rc
@dzaporozhets
dzaporozhets / console
Created October 11, 2012 08:00 — forked from dmitriy-kiriyenko/console
Init.d to start/stop xvfb. Put it into /etc/init.d and chmod it to 755
apt-get install xvfb
apt-get install firefox