Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Now using a (forked) version of the official CLoudfoundry cookbook

  • Loading branch information...
commit ced3c6848bb2550f01865a770bf27e866c5b8618 1 parent c33273a
@oldpatricka oldpatricka authored
View
75 docs/plans/cloudfoundry-multinode/01/controller.json
@@ -1,12 +1,67 @@
{
- "username":"${base_username}",
- "groupname":"ubuntu",
- "controller_host":"${controller_host}",
- "vcap_domain":"${vcap_domain}",
- "api_host":"api.${vcap_domain}",
- "vcap_services":"${vcap_services}",
- "recipes":["user", "cf", "cf::dnsmasq", "cf::multi"],
- "name" : "cloud foundry controller",
- "mysql" : { "password" : "${mysql_pw}" },
- "postgres" : { "password" : "${postgres_pw}" }
+ "username": "${base_username}",
+ "vcap_profile": "${vcap_profile}",
+ "vcap_home": "${vcap_home}",
+ "vcap_config": "${vcap_config}",
+ "deployment":{
+ "name": "${deployment_name}",
+ "home": "${deployment_home}",
+ "config_path": "${vcap_config}",
+ "user": "${base_username}",
+ "group": "ubuntu",
+ "profile": "${vcap_profile}"
+ },
+ "cloudfoundry": {
+ "revision": "HEAD",
+ "path": "${vcap_home}"
+ },
+ "ruby": {
+ "version": "${ruby_version}",
+ "path": "${deployment_home}/deploy/rubies/ruby-${ruby_version}"
+ },
+ "ruby18": {
+ "version": "${ruby18_version}",
+ "path": "${deployment_home}/deploy/rubies/ruby-${ruby18_version}"
+ },
+ "rubygems": {
+ "version": "${rubygems_version}",
+ "bundler": {"version": "${bundler_version}"},
+ "rake": {"version": "${rake_version}"}
+ },
+ "mongodb": {
+ "version": "${mongodb_version}",
+ "path": "${deployment_home}/deploy/mongodb"
+ },
+ "redis": {
+ "version": "${redis_version}",
+ "path": "${deployment_home}/deploy/redis"
+ },
+ "nodejs": {
+ "version": "${nodejs_version}",
+ "path": "${deployment_home}/deploy/nodejs"
+ },
+ "mysql": {
+ "server_root_password": "${mysql_pw}",
+ "server_repl_password": "${mysql_pw}",
+ "bind_address": "${mysql_address}"
+ },
+ "postgresql": {
+ "server_root_password": "${postgres_pw}"
+ },
+ "erlang": {
+ "version": "${erlang_version}",
+ "path": "${deployment_home}/deploy/erlang"
+ },
+ "nats": {
+ "user": "nats",
+ "password": "${nats_pw}",
+ "host": "0.0.0.0",
+ "port": "4222"
+ },
+ "cloud_controller": {
+ "local_route": "${controller_hostname}"
+ },
+ "vcap_start": "${vcap_start}",
+ "services": ["redis", "mysql", "mongodb", "postgresql"],
+ "recipes":["role[nats]","role[router]","role[ruby]","role[cloudfoundry]","role[cloud_controller]","role[health_manager]","role[dea]","role[ccdb]","role[redis]","role[mysql]","role[mongodb]","role[postgresql]"]
}
View
26 docs/plans/cloudfoundry-multinode/01/deps.conf
@@ -1,7 +1,23 @@
[deps]
-mysql_pw: monkey
-postgres_pw: monkey
-base_username: cf
-controller_host: ${controller.hostname}
+base_username: ubuntu
+controller_hostname: ${.hostname}
+deployment_name: controller
+deployment_home: /home/${.base_username}/.cloudfoundry/${.deployment_name}
+vcap_config: ${.deployment_home}/config
+vcap_profile: /etc/profile.d/vcap.sh
+vcap_home: /var/vcap
vcap_domain: vcap.me
-vcap_services: cloud_controller health_manager router services
+vcap_start: router cloud_controller health_manager services
+postgres_pw: ham
+mysql_pw: ham
+nats_pw: ham
+mysql_address: 127.0.0.1
+ruby18_version: 1.8.7-p334
+ruby_version: 1.9.2-p180
+rubygems_version: 1.5.2
+bundler_version: 1.0.10
+rake_version: 0.8.7
+mongodb_version: 1.8.1
+redis_version: 2.2.4
+nodejs_version: 0.4.8
+erlang_version: R14B02
View
7 docs/plans/cloudfoundry-multinode/01/level1.conf
@@ -1,8 +1,11 @@
[svc-controller]
bootconf: controller.json
-bootpgm: ../../common/cookbooks.tar.gz
+bootpgm: ../common/chef-solo.sh
deps: deps.conf
+#burned
+image: ami-237bba4a
# unix account name:
+ssh_username: ubuntu
bootpgm_args: controller
-readypgm: cf_ready.sh
+readypgm: ../common/cf_ready.sh
View
21 docs/plans/cloudfoundry-multinode/02/cf_ready.sh
@@ -1,21 +0,0 @@
-#!/bin/bash
-#
-# cloudfoundry_ready.sh - script to test the readyness of Cloud Foundry Services
-
-source bootenv.sh
-
-# List of services to test
-SERVICES="router cloud_controller dea health_manager"
-VCAP="/home/$username/cloudfoundry/vcap/bin/vcap"
-
-if [ -n "$vcap_services" ]; then
- SERVICES="$vcap_services"
-fi
-
-for service in $SERVICES ; do
- sudo -H -i -u $username $VCAP status $service | grep RUNNING || exit 1
-done
-
-sudo -H -i -u $username $VCAP status
-exit $?
-
View
74 docs/plans/cloudfoundry-multinode/02/dea.json
@@ -1,12 +1,66 @@
{
- "username":"${base_username}",
- "groupname":"ubuntu",
- "controller_host":"${controller_host}",
- "api_host":"api.${vcap_domain}",
- "vcap_domain":"${vcap_domain}",
- "vcap_services":"${vcap_services}",
- "recipes":["user", "cf", "cf::multi"],
- "name" : "cloud foundry dea",
- "mysql" : { "password" : "${mysql_pw}" },
- "postgres" : { "password" : "${postgres_pw}" }
+ "username": "${base_username}",
+ "vcap_profile": "${vcap_profile}",
+ "vcap_home": "${vcap_home}",
+ "vcap_config": "${deployment_config}",
+ "deployment":{
+ "name": "${deployment_name}",
+ "home": "${deployment_home}",
+ "config_path": "${deployment_config}",
+ "user": "${base_username}",
+ "group": "ubuntu",
+ "profile": "${vcap_profile}"
+ },
+ "cloudfoundry": {
+ "revision": "HEAD",
+ "path": "${vcap_home}"
+ },
+ "ruby": {
+ "version": "${ruby_version}",
+ "path": "${deployment_home}/deploy/rubies/ruby-${ruby_version}"
+ },
+ "ruby18": {
+ "version": "${ruby18_version}",
+ "path": "${deployment_home}/deploy/rubies/ruby-${ruby18_version}"
+ },
+ "rubygems": {
+ "version": "${rubygems_version}",
+ "bundler": {"version": "${bundler_version}"},
+ "rake": {"version": "${rake_version}"}
+ },
+ "mongodb": {
+ "version": "${mongodb_version}",
+ "path": "${deployment_home}/deploy/mongodb"
+ },
+ "redis": {
+ "version": "${redis_version}",
+ "path": "${deployment_home}/deploy/redis"
+ },
+ "nodejs": {
+ "version": "${nodejs_version}",
+ "path": "${deployment_home}/deploy/nodejs"
+ },
+ "mysql": {
+ "server_root_password": "${mysql_pw}",
+ "server_repl_password": "${mysql_pw}",
+ "bind_address": "${mysql_address}"
+ },
+ "postgresql": {
+ "server_root_password": "${postgres_pw}"
+ },
+ "erlang": {
+ "version": "${erlang_version}",
+ "path": "${deployment_home}/deploy/erlang"
+ },
+ "nats": {
+ "user": "nats",
+ "password": "${nats_pw}",
+ "host": "${controller_host}",
+ "port": "4222"
+ },
+ "dea": {
+ "local_route": ""
+ },
+ "vcap_start": "dea",
+ "recipes":["role[dea]"]
}
View
24 docs/plans/cloudfoundry-multinode/02/deps.conf
@@ -1,7 +1,21 @@
[deps]
-mysql_pw: monkey
-postgres_pw: monkey
-base_username: cf
controller_host: ${controller.hostname}
-vcap_domain: ${controller.vcap_domain}
-vcap_services: dea
+base_username: ubuntu
+deployment_name: dea
+deployment_home: /home/${.base_username}/.cloudfoundry/${.deployment_name}
+deployment_config: ${.deployment_home}/config
+vcap_profile: /etc/profile.d/vcap.sh
+vcap_home: /var/vcap
+postgres_pw: monkey
+mysql_pw: monkey
+nats_pw: monkey
+mysql_address: 127.0.0.1
+ruby18_version: 1.8.7-p334
+ruby_version: 1.9.2-p180
+rubygems_version: 1.5.2
+bundler_version: 1.0.10
+rake_version: 0.8.7
+mongodb_version: 1.8.1
+redis_version: 2.2.4
+nodejs_version: 0.4.8
+erlang_version: R14B02
View
6 docs/plans/cloudfoundry-multinode/02/level2.conf
@@ -1,8 +1,10 @@
[svc-dea]
bootconf: dea.json
-bootpgm: ../../common/cookbooks.tar.gz
+bootpgm: ../common/chef-solo.sh
deps: deps.conf
replica_count: 4
-
+# burned image
+image: ami-818949e8
# unix account name:
bootpgm_args: dea
+readypgm: ../common/cf_ready.sh
View
4 docs/plans/cloudfoundry-multinode/03/controllerTester.json
@@ -2,6 +2,8 @@
"username":"${base_username}",
"controller_host":"${controller_host}",
"vcap_domain":"${vcap_domain}",
- "vcap_services":"${vcap_services}",
+ "vcap_home":"${vcap_home}",
+ "vcap_start":"${vcap_start}",
+ "vcap_config":"${vcap_config}",
"api_host":"api.${vcap_domain}"
}
View
4 docs/plans/cloudfoundry-multinode/03/deps.conf
@@ -1,5 +1,7 @@
[deps]
controller_host: ${controller.hostname}
vcap_domain: ${controller.vcap_domain}
-vcap_services: ${controller.vcap_services}
+vcap_home: ${controller.vcap_home}
+vcap_start: ${controller.vcap_start}
+vcap_config: ${controller.vcap_config}
base_username: ${controller.base_username}
View
6 docs/plans/cloudfoundry-multinode/01/cf_ready.sh → docs/plans/cloudfoundry-multinode/common/cf_ready.sh
@@ -6,10 +6,10 @@ source bootenv.sh
# List of services to test
SERVICES="router cloud_controller dea health_manager"
-VCAP="/home/$username/cloudfoundry/vcap/bin/vcap"
+VCAP="$vcap_home/bin/vcap"
-if [ -n "$vcap_services" ]; then
- SERVICES="$vcap_services"
+if [ -n "$vcap_start" ]; then
+ SERVICES="$vcap_start"
fi
for service in $SERVICES ; do
View
200 docs/plans/cloudfoundry-multinode/common/chef-solo.sh
@@ -0,0 +1,200 @@
+#!/bin/bash
+
+#set -e
+
+. bootenv.sh
+
+APP_NAME="Cloud Foundry"
+
+COOKBOOK_GIT_URL="https://github.com/oldpatricka/vcap"
+COOKBOOK_GIT_BRANCH="cloudinit"
+COOKBOOK_REPO_DIR="/opt/vcap"
+COOKBOOK_DIR="$COOKBOOK_REPO_DIR/dev_setup/cookbooks"
+ROLES_DIR="$COOKBOOK_REPO_DIR/dev_setup/roles"
+CHEF_LOGLEVEL="info"
+MAKE_DIRS="/var/vcap.local"
+IP_ADDRESS=`host $HOSTNAME`
+
+function exit_on_error_with_error {
+ is_error="$1"
+ error_message="$2"
+
+ if [ $is_error -ne 0 ]; then
+ echo "$error_message"
+ exit $is_error
+ fi
+}
+
+
+CMDPREFIX=""
+if [ `id -u` -ne 0 ]; then
+ CMDPREFIX="sudo "
+fi
+
+# ========================================================================
+# The run name can differentiate multiple chef runs on same base node
+# ========================================================================
+
+if [ "X" == "X$1" ]; then
+ echo "argument required, the run name"
+ exit 1
+fi
+
+RUN_NAME=$1
+
+# ========================================================================
+# Make needed shim directories
+# ========================================================================
+
+for directory in $MAKE_DIRS; do
+ $CMDPREFIX mkdir -p $directory
+ $CMDPREFIX chown -R $username $directory
+done
+
+# ========================================================================
+# Install git and chef-solo if necessary
+# ========================================================================
+
+which git
+if [ $? -ne 0 ]; then
+ which apt-get
+ exit_on_error_with_error $? "git is missing. If this were a Debian system we would install it."
+
+ export DEBIAN_FRONTEND=noninteractive
+ export TERM=dumb
+
+ $CMDPREFIX apt-get update -f -y --force-yes --quiet --yes
+ $CMDPREFIX apt-get install -f -y --force-yes --quiet --yes git-core
+fi
+
+which chef-solo
+if [ $? -ne 0 ]; then
+
+ which apt-get
+ if [ $? -ne 0 ]; then
+ echo "chef-solo is missing. If this were a Debian system we would install it."
+ exit 1
+ fi
+
+ export DEBIAN_FRONTEND=noninteractive
+ export TERM=dumb
+
+ $CMDPREFIX apt-get update -f -y --force-yes --quiet --yes
+ $CMDPREFIX apt-get install -f -y --force-yes --quiet --yes ruby ruby-dev libopenssl-ruby rdoc ri irb build-essential wget ssl-cert
+
+ cd /tmp
+ wget http://production.cf.rubygems.org/rubygems/rubygems-1.7.2.tgz
+ tar zxf rubygems-1.7.2.tgz
+ cd rubygems-1.7.2
+ $CMDPREFIX ruby setup.rb --no-format-executable
+ $CMDPREFIX gem install chef --no-rdoc --no-ri
+ $CMDPREFIX gem install ohai --no-rdoc --no-ri
+fi
+
+
+
+# ========================================================================
+# Copy in, or update cookbook from git
+# ========================================================================
+
+TOPDIR_ABS_REL="`dirname $0`/.."
+TOPDIR_ABS=`cd $TOPDIR_ABS_REL; pwd`
+
+if [ -d "$COOKBOOK_REPO_DIR/.git" ]; then
+
+ (cd $COOKBOOK_REPO_DIR && $CMDPREFIX git fetch)
+ exit_on_error_with_error $? "Couldn't fetch from git repo '$COOKBOOK_GIT_URL'"
+else
+
+ $CMDPREFIX mkdir -p $COOKBOOK_REPO_DIR
+ exit_on_error_with_error $? "Couldn't make repo dir '$COOKBOOK_REPO_DIR'"
+
+ $CMDPREFIX git clone $COOKBOOK_GIT_URL $COOKBOOK_REPO_DIR
+ exit_on_error_with_error $? "Couldn't clone git repo '$COOKBOOK_GIT_URL'"
+fi
+
+(cd $COOKBOOK_REPO_DIR && $CMDPREFIX git checkout $COOKBOOK_GIT_BRANCH)
+exit_on_error_with_error $? "Couldn't checkout '$COOKBOOK_GIT_BRANCH' branch"
+
+(cd $COOKBOOK_REPO_DIR && $CMDPREFIX git pull)
+exit_on_error_with_error $? "Couldn't pull '$COOKBOOK_GIT_URL'"
+
+echo "Retrieved Chef Cookbook from '$COOKBOOK_GIT_URL'"
+
+# Check for replicated run name
+REPLICA_RUN=`(cd /tmp/nimbusready/ && ls -d $RUN_NAME*)`
+if [ -n $REPLICA_RUN ]; then
+ RUN_NAME=$REPLICA_RUN
+fi
+
+if [ ! -f $TOPDIR_ABS/$RUN_NAME/bootconf.json ]; then
+ echo "Cannot find chefroles.json ($TOPDIR_ABS/$RUN_NAME/bootconf.json)"
+ exit 1
+fi
+
+
+
+
+
+# ========================================================================
+# Prepare chef-solo configuration files
+# ========================================================================
+
+$CMDPREFIX mkdir -p $COOKBOOK_DIR/run/$RUN_NAME
+
+$CMDPREFIX mv $TOPDIR_ABS/$RUN_NAME/bootconf.json $COOKBOOK_DIR/run/$RUN_NAME/chefroles.json
+
+cat >> chefconf.rb << EOF
+log_level :info
+Chef::Log::Formatter.show_time = false
+
+cookbook_path '$COOKBOOK_DIR'
+role_path '$ROLES_DIR'
+file_store_path '$COOKBOOK_DIR/tmp'
+file_cache_path '$COOKBOOK_DIR/tmp'
+
+EOF
+
+# Will figure out variables + here-doc later:
+#echo "cookbook_path '$COOKBOOK_DIR'" >> chefconf.rb
+#echo "file_store_path '$COOKBOOK_DIR/tmp'" >> chefconf.rb
+#echo "file_cache_path '$COOKBOOK_DIR/tmp'" >> chefconf.rb
+
+$CMDPREFIX mv chefconf.rb $COOKBOOK_DIR/run/$RUN_NAME/chefconf.rb
+
+
+# ========================================================================
+# Prepare chef-solo launch script
+# ========================================================================
+
+cat >> rerun-chef-$RUN_NAME.sh << "EOF"
+#!/bin/bash
+
+set -e
+
+EOF
+
+# Will figure out variables + here-doc later:
+echo "chef-solo -l $CHEF_LOGLEVEL -c $COOKBOOK_DIR/run/$RUN_NAME/chefconf.rb -j $COOKBOOK_DIR/run/$RUN_NAME/chefroles.json" >> rerun-chef-$RUN_NAME.sh
+
+chmod +x rerun-chef-$RUN_NAME.sh
+
+$CMDPREFIX mv rerun-chef-$RUN_NAME.sh /opt/rerun-chef-$RUN_NAME.sh
+
+
+# ========================================================================
+# Run chef-solo launch script
+# ========================================================================
+
+echo "Running chef-solo"
+$CMDPREFIX /opt/rerun-chef-$RUN_NAME.sh
+
+#workaround to ensure new password is picked up
+echo "Kill nats"
+ps aux | awk '/nats-server/ && !/awk/ {print $2}' | xargs $CMDPREFIX kill
+
+echo "Start vcap"
+echo . $vcap_profile
+echo $vcap_home/bin/vcap -c $vcap_config start $vcap_start
+. $vcap_profile
+$vcap_home/bin/vcap -c $vcap_config start $vcap_start
View
4 docs/plans/cloudfoundry-multinode/main.conf
@@ -5,8 +5,8 @@ iaas_secret: env.CLOUDINITD_IAAS_SECRET_KEY
localsshkeypath: env.CLOUDINITD_IAAS_SSHKEY
sshkeyname: env.CLOUDINITD_IAAS_SSHKEYNAME
-image: ami-dfc80eb6
-#image: ami-3202f25b
+# ubuntu stock
+image: ami-3202f25b
iaas: us-east-1
allocation: m1.large
ssh_username: ubuntu
View
4 docs/plans/cloudfoundry/01/chef-solo.sh
@@ -184,7 +184,7 @@ echo "Running chef-solo"
$CMDPREFIX /opt/rerun-chef-$RUN_NAME.sh
echo "Start vcap"
-echo . $vcap_profile
-echo $vcap_home/bin/vcap -c $vcap_config start
. $vcap_profile
+# Kill nats server in case there's a config change we want to take effect
+$CMDPREFIX kill `ps aux | grep nats-server | grep -v grep |awk '{print $2}'`
$vcap_home/bin/vcap -c $vcap_config start
View
8 docs/plans/cloudfoundry/01/deps.conf
@@ -2,12 +2,12 @@
base_username: ubuntu
deployment_name: singlenode
deployment_home: /home/${.base_username}/.cloudfoundry/${.deployment_name}
-deployment_config: ${.deployment_home}/config
+vcap_config: ${.deployment_home}/config
vcap_profile: /etc/profile.d/vcap.sh
vcap_home: /var/vcap
-postgres_pw: monkey
-mysql_pw: monkey
-nats_pw: monkey
+postgres_pw: ham
+mysql_pw: ham
+nats_pw: ham
mysql_address: 127.0.0.1
ruby18_version: 1.8.7-p334
ruby_version: 1.9.2-p180
View
4 docs/plans/cloudfoundry/01/readytests/cf_ready.sh
@@ -6,8 +6,8 @@
SERVICES="router cloud_controller dea health_manager"
VCAP="/var/vcap/bin/vcap"
-if [ -n "$vcap_services" ]; then
- SERVICES="$vcap_services"
+if [ -n "$vcap_start" ]; then
+ SERVICES="$vcap_start"
fi
for service in $SERVICES ; do
View
6 docs/plans/cloudfoundry/01/readytests/run.sh
@@ -1,9 +1,13 @@
#!/bin/bash
-source bootenv.sh
start_dir=`pwd`
cd `dirname $0`
set -e
+source ../bootenv.sh
+
+
+$vcap_home/bin/vcap -c $vcap_config restart $vcap_start
+
if [ "X$vcaptests" != "X" ]; then
sudo -H -i -u $username `pwd`/vcap_tests.sh
fi
View
1  docs/plans/cloudfoundry/01/readytests/run_app.sh
@@ -14,6 +14,7 @@ cd $1
vmc target $api_host
vmc register --email foo@bar.com --passwd password
vmc login --email foo@bar.com --passwd password
+vmc delete env # Delete just in case left from a failed run
# the above may already be there and i cannot seem to clean them up
set -e
View
4 docs/plans/cloudfoundry/01/singlenode.json
@@ -2,11 +2,11 @@
"username": "${base_username}",
"vcap_profile": "${vcap_profile}",
"vcap_home": "${vcap_home}",
- "vcap_config": "${deployment_config}",
+ "vcap_config": "${vcap_config}",
"deployment":{
"name": "${deployment_name}",
"home": "${deployment_home}",
- "config_path": "${deployment_config}",
+ "config_path": "${vcap_config}",
"user": "${base_username}",
"group": "ubuntu",
"profile": "${vcap_profile}"
View
6 docs/plans/cloudfoundry/main.conf
@@ -5,8 +5,10 @@ iaas_secret: env.CLOUDINITD_IAAS_SECRET_KEY
localsshkeypath: env.CLOUDINITD_IAAS_SSHKEY
sshkeyname: env.CLOUDINITD_IAAS_SSHKEYNAME
-#image: ami-dfc80eb6
-image: ami-3202f25b
+# burned:
+image: ami-9f72b3f6
+# ubuntu stock
+#image: ami-3202f25b
iaas: us-east-1
allocation: m1.large
ssh_username: ubuntu
Please sign in to comment.
Something went wrong with that request. Please try again.