User:Gozer/cloudfoundry setup

From MozillaWiki
Jump to: navigation, search

Initial setup for labs

Machine Roles

3 machines setup:

  • vcap-controller1 (controls and runs the whole thing)
  • vcap-router1 (public request router)
  • vcap-dea1 (execution agent)

Fronted by Zeus on *.vcap.mozillalabs.com

Machine Setup

All servers are Ubuntu 10.04.3 LTS installs

Initial setup:

# Create dedicated vcap user
$> useradd -m vcap
$> su - vcap
$> mkdir $HOME/cloudfoundry
$> cd $HOME/cloudfoundry
# Get the current development code
$> git clone git://github.com/cloudfoundry/vcap.git
$> cd vcap
$> git submodule init
$> git submodule update --recursive
# Apply patch
$>  wget -O- https://github.com/gozer-mozilla/vcap/commit/bc71cfb1491ddab40fbb39b820ae1fd2d5c8885e.diff | ( cd $HOME/cloudfoundry/vcap && patch -p1 )

Couldfoundry Install

NOTE: This needed a small patch for the ruby chef recipe to work

ruby.diff

diff --git a/dev_setup/cookbooks/ruby/recipes/default.rb b/dev_setup/cookbooks/ruby/recipes/default.rb
index 0cbcb61..ffa950e 100644
--- a/dev_setup/cookbooks/ruby/recipes/default.rb
+++ b/dev_setup/cookbooks/ruby/recipes/default.rb
@@ -23,7 +23,7 @@
   action :create
 end
 
-bash "Install Ruby" do
+bash "Install Ruby #{ruby_version} in #{ruby_path}" do
   cwd File.join("", "tmp")
   user node[:deployment][:user]
   code <<-EOH
@@ -44,7 +44,7 @@
   not_if { ::File.exists?(File.join("", "tmp", "rubygems-#{rubygems_version}.tgz")) }
 end
 
-bash "Install RubyGems" do
+bash "Install RubyGems #{rubygems_version} for #{ruby_path}" do
   cwd File.join("", "tmp")
   user node[:deployment][:user]
   code <<-EOH

vcap-controller1

$> su - vcap
$> $HOME/cloudfoundry/vcap/dev_setup/bin/vcap_dev_setup -d $HOME/cloudfoundry -c $HOME/cloudfoundry/vcap/dev_setup/deployments/sample/multihost_labs/rest.yml  2>&1 | tee deployment.log
$> $HOME/cloudfoundry/vcap/dev_setup/bin/vcap_dev -n controller start
$> cat $HOME/cloudfoundry/vcap/dev_setup/deployments/sample/multihost_labs/rest.yml
---
deployment:
  domain: "vcap.mozillalabs.com"
  name:   "controller"
jobs:
  install:
    - nats_server
    - cloud_controller:
        builtin_services:
          - redis
          - mongodb
          - mysql
    - health_manager
    - redis_node:
        index: "0"
    - redis_gateway
    - ccdb
    - mysql_node:
        index: "0"
    - mysql_gateway
    - mongodb_gateway
    - mongodb_node:
        index: "0"

vcap-router1

$> su - vcap
$> $HOME/cloudfoundry/vcap/dev_setup/bin/vcap_dev_setup -d $HOME/cloudfoundry -c $HOME/cloudfoundry/vcap/dev_setup/deployments/sample/multihost_labs/router.yml  2>&1 | tee deployment.log
$> $HOME/cloudfoundry/vcap/dev_setup/bin/vcap_dev -n router start
$> cat $HOME/cloudfoundry/vcap/dev_setup/deployments/sample/multihost_labs/router.yml
---
# Deployment
# ----------
deployment:
  name: "router"
  domain: "vcap.mozillalabs.com"

jobs:
  install:
    - router
  installed:
    - nats_server:
        host: "vcap-controller1"
        port: "4222"
        user: "nats"
        password: "nats"

vcap-dea1

$> su - vcap
$> $HOME/cloudfoundry/vcap/dev_setup/bin/vcap_dev_setup -d $HOME/cloudfoundry -c $HOME/cloudfoundry/vcap/dev_setup/deployments/sample/multihost_labs/dea.yml  2>&1 | tee deployment.log
$> $HOME/cloudfoundry/vcap/dev_setup/bin/vcap_dev -n dea start
---
# Deployment
# ----------
deployment:
  name: "dea"
  domain: "vcap.mozillalabs.com"

jobs:
  install:
    - dea
  installed:
    - nats_server:
        host: "vcap-controller1"
        port: "4222"
        user: "nats"
        password: "nats"