I got access to cloudfoundry.com late last night, but just had a chance to start playing around this morning. First off, I love the simplicity of the developer experience... at least for Hello World style applications. I'll have to dig into it further, to start exploring how the services are implemented and how application instances scale.
Coming from an IaaS development background, one of the first things I was interested in digging into was the runtime details for the platform. I decided to extend the VMware Hello World ruby app, and have it return some details about the base OS supporting the app instance.
Here's the simple code:
require 'sinatra'
get '/' do
processor = `head /proc/cpuinfo`
memory = `head /proc/meminfo`
swap = `head /proc/swap`
linuxversion = `head /proc/version`
disks = `head /proc/partitions`
appuser = `whoami`
net = `cat /etc/network/interfaces`
output = 'local OS user: <br />' + appuser + '<br /><br />processor: <br /><pre>' + processor + '</pre><br /><br />memory: <br /><pre>' + memory + '</pre><br /><br />swap:<br />' + swap + '<br /><br />ver: <br />' + linuxversion + '<br /><br />disks:<br /><pre>' + disks + '</pre><br /><br />networking:<br /><pre>' + net + '</pre>'
output
endHere's the deployment process. The mem reservation property seems to be the only configuration that will affect the selection of an appropriate VM to host the app instance.
$ vmc push Would you like to deploy from the current directory? [Yn]: Y Application Name: test1 Application Deployed URL: 'test1.cloudfoundry.com'? Detected a Sinatra Application, is this correct? [Yn]: Memory Reservation [Default:128M] (64M, 128M, 256M, 512M, 1G or 2G) 64M Creating Application: OK Would you like to bind any services to 'test1'? [yN]: Uploading Application: Checking for available resources: OK Packing application: OK Uploading (0K): OK Push Status: OK Staging Application: OK Starting Application: OK
And here's what I get out of it, after deploying. Assuming that I don't turn it off or break this over time, you can hit the application live at http://test1.cloudfoundry.com/.
local OS user:
vcap-user-11
processor:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 37
model name : Intel(R) Xeon(R) CPU X5650 @ 2.67GHz
stepping : 1
cpu MHz : 2660.000
cache size : 12288 KB
fpu : yes
fpu_exception : yes
memory:
MemTotal: 16470448 kB
MemFree: 12623164 kB
Buffers: 217692 kB
Cached: 1959284 kB
SwapCached: 0 kB
Active: 2368488 kB
Inactive: 980064 kB
Active(anon): 1171648 kB
Inactive(anon): 164 kB
Active(file): 1196840 kB
swap:
ver:
Linux version 2.6.32-30-server (buildd@crested) (gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) ) #59-Ubuntu SMP Tue Mar 1 22:46:09 UTC 2011
disks:
major minor #blocks name
7 0 131072 loop0
8 0 1049600 sda
8 1 999023 sda1
8 16 33554432 sdb
8 17 16474657 sdb1
8 18 17077095 sdb2
networking:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 172.30.49.74
network 172.30.48.0
netmask 255.255.248.0
broadcast 172.30.55.255
gateway 172.30.48.1