upgradinate_script.rb
helper = UpgradinateFileHelper.new 'OLD NESS', 'NEW-NESS'
helper.upgradinate_files [
"/path/to/project/Gemfile"
]
for instance in `ec2-describe-instances | grep ami-80dd59e9 | grep '^INSTANCE' | cut -f2 -s`; do | |
ec2-create-tags $instance --tag "Name=Foobar" | |
done |
ORIGINAL_JENKINS_SERVER= | |
ORIGINAL_SERVER_USER= | |
NEW_JENKINS_SERVER= | |
NEW_SERVER_USER= | |
# ON THE ORIGINAL JENKINS SERVER | |
ssh $ORIGINAL_SERVER_USER@$ORIGINAL_JENKINS_SERVER | |
cd /var/lib/jenkins/ | |
for i in `ls jobs`; do echo "jobs/$i/config.xml";done > config.totar |
#cloud-config | |
output: | |
all: ">> /var/log/cloud-init.log" | |
# the chef server's alias will be "chef", add a /etc/hosts entry for it | |
bootcmd: | |
- echo 127.0.0.1 chef >> /etc/hosts | |
apt_sources: |
When the chef client fails to run the recipe successfully during bootstrapping sudo chef-client
to setup the connection with the chef-server. It will run with an empty run list. After its connected login to http://yourchefserver.com:4040/nodes/_NODE_NAME_, add the roles/recipes to the chef-client and run sudo chef-client
from the client again.
When fixing a recipe and re-running make your modifications run knife cookbook upload -a #or cookbook name
from your dev machine and run sudo chef-client
from the chef client.
When there are issues registering the client with the chef-server check that the chef-client name isn't already registered on the server under clients or nodes or that the client has not already been registered (see below)
Basic configuration
How to knife the chef
knife cookbook upload -aWill upload all cookbooks
knife cookbook site vendor cookbook_name # e.g. jenkins
### Chef Knife config example | |
# https://github.com/fnichol/chef-bootstrap-repo/blob/master/.chef/knife.rb | |
### | |
# Environment variables required: | |
# CHEF_SERVER_URL - IP or url of your chef server | |
# CHEF_USER - Initial user | |
# AWS_ACCESS_KEY - AWS Access ID found here https://portal.aws.amazon.com/gp/aws/securityCredentials | |
# AWS_SECRET_KEY - AWS Secrete key found in link above |
#!/usr/bin/env bash | |
set -e | |
set -x | |
### How To Use | |
# | |
# sudo bash -c 'bash \ | |
# <(curl -sLB https://raw.github.com/gist/1209226/bootstrap_chef_server.sh) \ | |
# --hostname foo.example.com' | |
# |
#!/bin/sh | |
# | |
# Too many crusty old git branches? Run this to find likely candidates for deletion | |
# It lists all the remote branches and sorts them by age. | |
# | |
# Folks at pivotal shared this with me | |
# | |
#$ . show-remote-branch-info.sh | |
# 2012-05-04 09:42:29 -0700 4 minutes ago Ted & Bill \torigin/hey_Bill |
## html_safe_intput.rb | |
# encoding: UTF-8 | |
class HtmlSafeInput < Formtastic::Inputs::TextInput | |
# Called dynamically, via form.input :foo, :as => :html_safe | |
def to_html | |
return super if object[method].blank? | |
input_wrapping do | |
label_html << |