Permalink
Browse files

add bootstraping scripts

  • Loading branch information...
1 parent e73ced0 commit 998e7bccdc34573f8d371dbcd001a88f6ec80bc0 @notnoop committed Aug 12, 2011
Showing with 61 additions and 0 deletions.
  1. +17 −0 deploy.sh
  2. +20 −0 install.sh
  3. +2 −0 set_env
  4. +17 −0 solo.json
  5. +5 −0 solo.rb
View
17 deploy.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# Usage: ./deploy.sh [host]
+
+host="${1:-ec2-50-19-148-248.compute-1.amazonaws.com}"
+
+# The host key might change when we instantiate a new VM, so
+# we remove (-R) the old host key from known_hosts
+ssh-keygen -R "${host#*@}" 2> /dev/null
+
+tar cj . | ssh -o 'StrictHostKeyChecking no' "$host" '
+sudo rm -rf ~/chef &&
+ mkdir ~/chef &&
+ cd ~/chef &&
+ tar xj &&
+ sudo bash install.sh'
+
View
20 install.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# This runs as root on the server
+
+chef_binary=/var/lib/gems/1.9.1/bin/chef-solo
+
+# Are we on a vanilla system?
+if ! test -f "$chef_binary"; then
+ export DEBIAN_FRONTEND=noninteractive
+ # Upgrade headlessly (this is only safe-ish on vanilla systems)
+ aptitude update &&
+ apt-get -o Dpkg::Options::="--force-confnew" \
+ --force-yes -fuy dist-upgrade &&
+ # Install Ruby and Chef
+ aptitude install -y ruby1.9.1 ruby1.9.1-dev make &&
+ sudo gem1.9.1 install --no-rdoc --no-ri chef --version 0.10.0
+fi &&
+
+sudo "$chef_binary" -c solo.rb -j solo.json
+
View
2 set_env
@@ -0,0 +1,2 @@
+export DJANGO_SETTINGS_MODULE=obdemo.settings
+source /srv/openblock/virtualenv/bin/activate
View
17 solo.json
@@ -0,0 +1,17 @@
+{
+ "run_list": [
+ "recipe[app::user]",
+ "recipe[python::default]",
+ "recipe[postgis::default]",
+ "recipe[openblock::default]",
+ "recipe[app::default]",
+ "recipe[app::db_setup]"
+ ],
+
+ "project_dir": "/home/ubuntu/chef",
+ "user": "ubuntu",
+ "database": {
+ "name": "sample",
+ "user": "ubuntu"
+ }
+}
View
5 solo.rb
@@ -0,0 +1,5 @@
+root = File.absolute_path(File.dirname(__FILE__))
+
+file_cache_path root
+cookbook_path root + '/cookbooks'
+

0 comments on commit 998e7bc

Please sign in to comment.