Bootstrap latest version of Chef Solo on Debian/Ubuntu dists

#!/usr/bin/env bash
echo "deb `lsb_release -cs`-0.10 main" | sudo tee /etc/apt/sources.list.d/opscode.list
mkdir -p /etc/apt/trusted.gpg.d
mkdir -p /etc/apt/trusted.gpg.d
gpg --keyserver --recv-keys 83EF826A
gpg --export | sudo tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
apt-get -y update
apt-get -y install opscode-keyring
apt-get -y upgrade
apt-get -y install chef


MongoDB Quick Start - Replica Sets and Sharding

Scaling out 1 node with Replica Set

If you already have a running mongod instance you first need restart it with --replSet

$ mongod --fork --rest --replSet mySetName --port 27017 --dbpath ~/Projects/db/data/mongo/r0 --logpath ~/Library/Logs/mongod-r0.log

Initialize the node via the mongo client

$ mongo
> rs.initiate()
        "info" : "Config now saved locally.  Should come online in about a minute.",
        "ok" : 1

This node is our Primary Node where read/write is done initially.

> db.messages.insert({City: "Tokyo"})
> db.messages.find()


tmux and irssi sitting in a tree...



# command prefix to ctrl+space
set -g prefix C-Space

# bindings
unbind-key C-b
bind-key a send-prefix
bind-key C-a last-window
bind s split-window -v
bind v split-window -h
bind-key Tab select-pane -t :.+
bind m command-prompt "split-window -h 'exec man %%'"
bind R source-file ~/.tmux.conf
bind k confirm-before "kill-window"
bind-key -r    M-Up resize-pane -U
bind-key -r  M-Down resize-pane -D
bind-key -r  M-Left resize-pane -L
bind-key -r M-Right resize-pane -R
bind-key -r    C-Up resize-pane -U 5
bind-key -r  C-Down resize-pane -D 5
bind-key -r  C-Left resize-pane -L 5
bind-key -r C-Right resize-pane -R 5

# status bar


Create a EC2 Amazon Machine Image - AMI

Customize an existing AMI image

It's much easier to customize an existing AMI image to your own taste than to start from scratch so let's do that. First we need to find an image that is close to what we want. Read EC2 quickstart on how to setup the EC2 API tools.

$ ec2-describe-images -a 
IMAGE   ami-f0f61599    alestic-64/debian-5.0-lenny-base-64-20091011.manifest.xml   063491364108    available   public      x86_64  machine aki-a3d737ca    ari-7cb95a15        instance-store


Amazon EC2 Quickstart

EC2 Preparation

First you need to sign up for Amazon's EC2 service and download your X.509 certificate and private key. The certificate and private key files are named as cert-<GUID>.pem and pk-<GUID>.pem

Create a directory to hold your EC2 access credentials.

$ mkdir ~/.ec2
$ mv ~/Downloads/*.pem ~/.ec2

Next download the EC2 API command line tools, add it to your PATH and create a few environment variables.

$ cd ~/bin
$ unzip ~/Downloads/
$ ln -s /ec2-api-tools-1.3-46266 ec2
$ export $EC2_HOME=~/bin/ec2
$ export PATH=$EC2_HOME/bin:$PATH
$ export EC2_PRIVATE_KEY=~/.ec2/pk-<guid>.pem 
$ export EC2_CERT=~/.ec2/cert-<guid>.pem
$ # JAVA_HOME is needed for ec2 tools to work
$ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home

Let's list some publicly available Amazone Machine Images (AMI) to verify that the tools are working properly.

$ ec2-describe-images -o amazon
IMAGE   ami-a21affcb    ec2-public-images/fedora-core-6-x86_64-base-v1.06.manifest.xml  amazon  available   public      x86_64  machine aki-a53adfcc    ari-a23adfcb        instance-store
IMAGE   ami-2d5fba44    ec2-public-images/fedora-core-6-x86_64-base-v1.07.manifest.xml  amazon  available   public      x86_64  machine aki-a53adfcc    ari-a23adfcb        instance-store
IMAGE   ami-225fba4b    ec2-public-images/fedora-core4-apache-mysql-v1.07.manifest.xml  amazon  available   public      i386    machine             instance-store
IMAGE   ami-25b6534c    ec2-public-images/fedora-core4-apache-mysql.manifest.xml    amazon  available   public      i386    machine             instance-store

Launch an AMI instance

In order to access an AMI instance via SSH we need to create a EC2 key pair. This can easily be done using the web based AWS management console or following the steps below.



Subscribe to howto