Skip to content

Instantly share code, notes, and snippets.

@teohm
teohm / cap3-run-flow.txt
Last active December 19, 2015 11:19
capistrano v3 task run flow
rake deploy
======
starting
started
deploy:check
deploy:git:check
deploy:check:directories
deploy:check:linked_dirs
deploy:check:linked_files
cat Rakefile
file 'traxity.tar.gz' => Dir['sensordatad/**/*'] do |t|
sh "tar -cvzf #{t.name} #{t.prerequisites.join(' ')}"
end
file 'cookbooks.tar.gz' do
  sh 'berks install --path cookbooks'
  sh 'tar -czf cookbooks.tar.gz cookbooks'
end
support multi deploy environments (staging, production)
use git repo by default
use ssh forward agent (with checks teohm/capistrano-ssh-helpers)
support bundler
support shared file upload,symlink
support release cleanup
support restart (app server, worker)
support assets precompile and assets rollback
support BUILD_VERSION file creation
support rbenv (default_run_options[:shell] = '/bin/bash --login')
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
require 'guard/guard'
require 'mixlib/shellout'
module ::Guard
class Kitchen < ::Guard::Guard
def start
::Guard::UI.info("Guard::Kitchen is starting")
@teohm
teohm / git-for-busy-dev-team.md
Last active December 16, 2015 15:39
git notes

Git for Busy Dev Team

Install Git

  • Mac OSX
  • Linux
  • Windows

Setup Git

What does a modern web app usually need:

  • support localization in frontend and backend
  • reliable background worker queue system
  • content caching system
  • client-polling / server-push system
  • full-text search system
  • user authentication system
  • user access control system
  • rich front-end framework (reliable on flanky network)
@teohm
teohm / tarball-opscode-cookbook.bash
Created April 14, 2013 11:09
Prepare chef cookbook for opscode community repo
knife cookbook metadata -o ../ appbox-cookbook
git archive --format=tar.gz --prefix=appbox/ v0.1.0 -o appbox-0.1.0.tar.gz
createuser --password USERNAME
createdb --owner=USERNAME DATABASE_NAME
@teohm
teohm / openssl-downgrade.bash
Last active December 15, 2015 19:09
Downgrade OpenSSL (1.0.1c) in Ubuntu 12.10 to Ubuntu 11.10's OpenSSL (1.0.0e)
sudo vi /etc/apt/sources.list
deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric main
deb-src http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric main
deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates main
deb-src http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates main
deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-security main
deb-src http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-security main
deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric universe
deb-src http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric universe
@teohm
teohm / unscoped.rb
Created April 1, 2013 11:59 — forked from lwe/unscoped.rb
# Provides the ability to unscope associations, this solves problems described in
# http://stackoverflow.com/questions/1540645/how-to-disable-default-scope-for-a-belongs-to/11012633#11012633
#
# Examples
#
# class Document < ActiveRecord::Base
# default_scope where(deleted: false)
# end
#
# class Comment < ActiveRecord::Base