Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Chef cookbooks for setting up beebo.org
Ruby Other
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
certificates
config
cookbooks
data_bags
environments
roles
.gitignore
LICENSE
README.md
Rakefile
chef-client-local
chef-client-production
solo.json
solo.md
solo.rb
upload

README.md

Overview

chef recipes for building beebo.org. They're not especially generic but they might be a small amount of use to someone, sometime.

Installation

Recreating an existing node?

In this case, you will first need to remove the existing node and client from Opscode--otherwise it will fail when it attempts to register with Opscode. Remove the node via:

$ knife node list
...
$ knife node delete mel.beebo.org

(You can also use the web interface https://manage.opscode.com/nodes.)

Remove the client via:

$ knife client list
...
$ knife client delete mel.beebo.org

(You can also use the web interface https://manage.opscode.com/clients.)

Finally, you will probably also need to remove the host from ~/.ssh/known_hosts--if the same IP address gets reused for a "different" host, ssh will complain.

Provision Manually (VMware Fusion)

Prepare Machine

# Install the machine via VMware Fusion's "Easy Install" function. * For the account username and password, use "bootstrap" and "bootstrap". * Change the "Network Adapter" to "Bridged"--if you use NAT, VMware will change the IP address of the guest pretty much every time it boots. * Reduce available memory from 1GB to 512MB. * Create a "Shared Folder" called "workspace", which contains a directory beebo-site that contains the site's source code.

If creating the shared folder doesn't work (and especially if you're using a recently-released distribution), you may need to reinstall VMware Tools:

$ sudo apt-get -y install build-essential linux-headers-$(uname -r)
# Select "Reinstall VMware Tools" from the "Virtual Machine" menu
$ sudo mkdir /cdrom
$ sudo mount /dev/cdrom1 /cdrom # try different /dev/cdrom* devices
$ cd /tmp
$ tar xfz /cdrom/VM*
$ cd vmware-tools-distrib
$ sudo ./vmware-install.pl

Once the machine ready, login to the machine via the VMware console, and follow the instructions below.

# Upgrade outdated packages
$ sudo apt-get update && sudo apt-get -y upgrade

# Install ssh (if necessary--VMware machines will need this)
$ sudo apt-get -y install openssh-server

# Create unique hostname (if necessary--VMware machines will need this)
$ sudoedit /etc/hostname # e.g. "beebo"--ensure unique across chef-managed nodes!
$ sudoedit /etc/hosts    # change "ubuntu" to whatever the hostname is
$ sudo shutdown -r now

Install chef via knife bootstrap

# VMware
$ knife bootstrap beebo.local -x bootstrap -Pbootstrap -E local -r 'role[web]' --distro ubuntu12.04-gems --sudo

If you get a segmentation fault as chef starts up, just try again... (There seems to be something wrong with ruby.)

# VirtualBox + Vagrant
$ knife bootstrap 127.0.0.1 -p 2222 -i ~/.vagrant.d/insecure_private_key -x vagrant -E local -r 'role[web]' --distro ubuntu12.04-gems --sudo

Note that this command sets the node's environment and role. If you want to change the environment, replace local with the appropriate environment (probably either local or production). If you want to change the role, replace role[web] with the appropriate role. (e.g. role[db].)

Provision Automatically (Gandi)

Install the knife-gandi gem

On the host, install the knife-gandi ruby gem:

$ gem install knife-gandi

Create the server

$ knife gandi -VV server create -r 'role[web]' -E staging -C 1 -B 5 -W 4 -I 69 -D 1 -M 512 -S mel -N mel.beebo.org -x admin -P mysecret

Note that if many cases, if these options are not provided, knife will prompt for them. (Use --defaults to bypass this.)

See knife gandi server create --help for more information about each of the arguments.

Notes:

  • Regarding -x, it appears that if you change this from admin, sudo won't work. (Though you can get root via su using the same password.)
  • -N doesn't seem to work--you'll end up with random node names. (-S does work.)

Attach data disk

Via https://www.gandi.net/admin/hosting/disk/management, attach (or create and attach) the appropriate data drive to the server. You will want to symlink the following directories to the data disk:

  • /var/lib/sqlite
  • /var/lib/mongodb
  • /var/chef/deploy
  • /var/lib/rsyncd

e.g.

$ DISK=slammer
$ rm -rf /var/lib/sqlite && ln -s /srv/$DISK/sqlite /var/lib/sqlite
$ rm -rf /var/lib/mongodb && ln -s /srv/$DISK/mongodb /var/lib/mongodb
$ rm -rf /var/lib/deploy && ln -s /srv/$DISK/deploy /var/chef/deploy

$ rm -rf /var/lib/rsyncd && ln -s /srv/nevada/rsyncd /var/lib/rsyncd

Deleting/recreating a server?

$ knife gandi server delete 62752 # id comes from knife gandi server list

Author

Michael Stillwell mjs@beebo.org

Something went wrong with that request. Please try again.