What sort of information on my cloud do I get in my Chef cookbooks?
Every time an event is fired, and a Chef command set is sent to an instance, apart from the data required for that particular task, it always receives data describing the current cluster state. Below is an example in JSON.
You'll be getting a list of all instances in your cloud sorted by their roles, and information on application, deployment (when the event is deploy), and the instance itself.
{
"deploy": {
"myapp": {
"database": {
"adapter": "mysql",
"username": "root",
"database": "myapp",
"host": null,
"password": null
},
"memcached": {
"host": "10.12.0.240",
"port": 11211
}
"rails_env": "production",
"application_type": "rails",
"deploy_to": "/srv/www/myapp",
"scm": {
"repository": "git@github.com:peritor/myapp.git",
"scm_type": "git",
"revision": null,
"ssh_key": "",
"user": "",
"password": ""
}
}
},
"recipes": [
"rails::configure",
"scalarium_cluster_state",
"scalarium_custom_cookbooks"
],
"scalarium_custom_cookbooks": {
"enabled": false,
"recipes": [
]
},
"scalarium": {
"activity": "configure",
"applications": [
{
"name": "MyApp.com",
"slug_name": "myapp",
"application_type": "rails"
}
],
"cluster": {
"name": "MyGrid"
},
"instance": {
"aws_instance_id": "i-d19760a7",
"availability_zone": "us-west-1a",
"public_dns_name": "ec2-79-125-70-118.eu-west-1.compute.amazonaws.com",
"instance_type": "c1.medium",
"id": "340d2bec55150ab085e933ba5565c422",
"private_ip": "10.226.74.161",
"ip": "79.125.70.118",
"instance_type": "m1.large",
"private_dns_name": "ip-10-226-74-161.eu-west-1.compute.internal",
"hostname": "shortbread",
"roles": [
"couchdb",
"rails-app"
],
"architecture": "amd64"
},
"roles": {
"rails-app": {
"name": "Rails Application Server",
"instances": {
"shortbread": {
"aws_instance_id": "i-d19760a7",
"availability_zone": "us-west-1a",
"public_dns_name": "ec2-79-125-70-118.eu-west-1.compute.amazonaws.com",
"private_dns_name": "ip-10-226-74-161.eu-west-1.compute.internal",
"instance_type": "m1.large",
"elastic_ip": null,
"private_ip": "10.226.74.161",
"ip": "79.125.70.118",
"status": "online",
"backends": 16
}
}
},
"couchdb": {
"name": "CouchDB",
"instances": {
"shortbread": {
"public_dns_name": "ec2-79-125-70-118.eu-west-1.compute.amazonaws.com",
"private_dns_name": "ip-10-226-74-161.eu-west-1.compute.internal",
"instance_type": "m1.large",
"elastic_ip": null,
"private_ip": "10.226.74.161",
"ip": "79.125.70.118",
"status": "online",
"backends": 16
}
}
}
},
"deployment": null
}
}
You can access the data in your custom cookbooks by accessing them like so:
node[:scalarium][:instance][:hostname] # => shortbread
The scalarium node is also available as a JSON file
on file system for your custom scripts. The path of the JSON file
is /var/lib/scalarium/cluster_state.json
-
FAQ
-
Applications
-
Basics
-
Custom Instance Setup
-
Deployment
-
Security
-
Auto Healing
-
Tutorials
- Tutorial: Customizing your Scalarium Cloud using Chef
- Customizing your Scalarium Cloud using Chef: The Scalarium Lifecycle System
- Customizing your Scalarium Cloud using Chef: Cooking with Chef
- Customizing your Scalarium Cloud using Chef: Writing a Cookbook to set up Redis
- Customizing your Scalarium Cloud using Chef: Configuring Custom Cookbooks
- View all (4 more)
-
Load Based Auto Scaling
-
Time Based Auto Scaling
-
API