Skip to content

Instantly share code, notes, and snippets.

View dzaporozhets's full-sized avatar

Dmitriy Zaporozhets dzaporozhets

View GitHub Profile
#!/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

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:

.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 */
#!/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(".")
#! /usr/bin/env ruby
$LOAD_PATH.unshift '/Users/schacon/projects/git/rugged/lib'
require 'rugged'
require 'rubygems'
require 'pp'
dir, id = "/opt/linux.git"
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
@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
@dzaporozhets
dzaporozhets / build.sh
Created December 20, 2013 12:03
GitLab CE build scenario
ruby -v
gem install bundler
cp config/database.yml.mysql config/database.yml
cp config/gitlab.yml.example config/gitlab.yml
sed "s/username\:.*$/username\: USERNAME/" -i config/database.yml
sed "s/password\:.*$/password\: 'PASSWORD'/" -i config/database.yml
touch log/application.log
touch log/test.log
bundle --without postgres
bundle exec rake gitlab:test RAILS_ENV=test
#!/bin/sh
#
# For each ref, validate the commit.
#
# - It disallows deleting branches without a /.
# - It disallows non fast-forward on branches without a /.
# - It disallows deleting tags without a /.
# - It disallows unannotated tags to be pushed.
class Test; end