Skip to content

Instantly share code, notes, and snippets.

View fnichol's full-sized avatar

Fletcher Nichol fnichol

View GitHub Profile

Turnkey Vagrant Staging Environment

Installation

Install the vagrant and chef gems:

gem install vagrant chef

Create a vagrant project directory to work out of:

Note the nginx => {:proxy => "enable"} is to expose Jenkins on port 80 while keeping the backend process privilege separated and on port 8080.

@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@fnichol
fnichol / Guardfile
Created March 17, 2011 02:20
One of my current Guardfiles
# More info at https://github.com/guard/guard#readme
guard 'ego' do
watch('Guardfile')
end
guard 'spork' do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.*\.rb$})
@fnichol
fnichol / database.yml
Created March 24, 2011 02:12
An example using ActiveRecord to connect to a WordPress database
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: rails_proj_development
pool: 5
username: rp_dev
password: wootwoot
host: localhost
@fnichol
fnichol / init_gitflow.rake
Created March 25, 2011 03:12
Register rake tasks off `rake init' to setup your initial development environment after a fresh git clone. N.B. better to make these actions idempotent so you can run it more than once without fear.
namespace :init do
task 'gitflow_init' do
preconditions = [
%{git config --get gitflow.branch.master >/dev/null 2>&1},
%{git config --get gitflow.branch.develop >/dev/null 2>&1},
%{git config --get gitflow.prefix.feature >/dev/null 2>&1},
%{git config --get gitflow.prefix.release >/dev/null 2>&1},
%{git config --get gitflow.prefix.hotfix >/dev/null 2>&1},
%{git config --get gitflow.prefix.support >/dev/null 2>&1},
%{git config --get gitflow.prefix.versiontag >/dev/null 2>&1}
@fnichol
fnichol / README.md
Created March 30, 2011 21:17
Chef Bootstrapper For SuSE/SLES

Chef Bootstrapper For SuSE/SLES

Installation

Note: Run this script as the root user (no sudo calls are used in the script).

You will need the curl package installed, though I would have no idea why it wouldn't be installed by default:

zypper --non-interactive install curl

@fnichol
fnichol / default-site.conf
Created April 18, 2011 06:12
nginx init.d script hacked for iterative_chef lab
server {
listen 80;
server_name "";
location / {
root html;
index index.html index.htm;
}
# redirect server error pages to the static page /50x.html
cache_dir="/var/cache/downloads"
tar_url="http://nginx.org/download/nginx-0.9.7.tar.gz"
tar_file="${tar_url##http*/}"
tar_dir="${tar_file%.tar.gz}"
configure_flags="
--prefix=/opt/${tar_dir}
--conf-path=/etc/nginx/nginx.conf
--with-http_ssl_module
"
pkgs=( wget build-essential binutils-doc autoconf flex bison
@fnichol
fnichol / dna.json
Created April 28, 2011 18:34
Example webapp server configured with chef-solo dna.json
{
"webapp": {
"web_server": "apache2",
"vhosts": [
{ "id": "production",
"host_name": "main.example.com",
"non_ssl_server": true,
"www_redirect": false,
"ssl_server": true,
"ssl_www_redirect": false