ironfan 3.1.0.rc1 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +5 -0
- data/CHANGELOG.md +18 -5
- data/README.md +34 -115
- data/TODO.md +36 -8
- data/VERSION +1 -1
- data/cluster_chef-knife.gemspec +2 -3
- data/ironfan.gemspec +29 -4
- data/lib/chef/knife/cluster_bootstrap.rb +1 -1
- data/lib/chef/knife/cluster_kick.rb +3 -3
- data/lib/chef/knife/cluster_kill.rb +1 -1
- data/lib/chef/knife/cluster_launch.rb +3 -3
- data/lib/chef/knife/cluster_list.rb +1 -1
- data/lib/chef/knife/cluster_proxy.rb +5 -5
- data/lib/chef/knife/cluster_show.rb +3 -2
- data/lib/chef/knife/cluster_ssh.rb +2 -2
- data/lib/chef/knife/cluster_start.rb +1 -2
- data/lib/chef/knife/cluster_stop.rb +2 -1
- data/lib/chef/knife/cluster_sync.rb +2 -2
- data/lib/chef/knife/cluster_vagrant.rb +144 -0
- data/lib/chef/knife/{knife_common.rb → ironfan_knife_common.rb} +8 -4
- data/lib/chef/knife/{generic_command.rb → ironfan_script.rb} +1 -1
- data/lib/chef/knife/vagrant/ironfan_environment.rb +18 -0
- data/lib/chef/knife/vagrant/ironfan_provisioners.rb +27 -0
- data/lib/chef/knife/vagrant/skeleton_vagrantfile.rb +116 -0
- data/lib/ironfan/chef_layer.rb +2 -2
- data/lib/ironfan/fog_layer.rb +16 -13
- data/lib/ironfan/private_key.rb +3 -3
- data/lib/ironfan/server.rb +9 -6
- data/lib/ironfan/server_slice.rb +11 -0
- data/notes/Home.md +30 -0
- data/notes/INSTALL-cloud_setup.md +100 -0
- data/notes/INSTALL.md +135 -0
- data/notes/Knife-Cluster-Commands.md +8 -0
- data/notes/Silverware.md +5 -0
- data/notes/aws_console_screenshot.jpg +0 -0
- data/notes/cookbook-versioning.md +11 -0
- data/notes/declaring_volumes.md +3 -0
- data/notes/design_notes-ci_testing.md +169 -0
- data/notes/design_notes-cookbook_event_ordering.md +212 -0
- data/notes/design_notes-dsl_object.md +55 -0
- data/notes/design_notes-meta_discovery.md +59 -0
- data/notes/ec2-pricing_and_capacity.md +63 -0
- data/notes/ironfan_homebase_layout.md +94 -0
- data/notes/named-cloud-objects.md +11 -0
- data/notes/rake_tasks.md +25 -0
- data/notes/renamed-recipes.txt +142 -0
- data/notes/style_guide.md +251 -0
- data/notes/tips_and_troubleshooting.md +83 -0
- metadata +50 -26
@@ -0,0 +1,63 @@
|
|
1
|
+
## Compute Costs
|
2
|
+
|
3
|
+
code $/mo $/day $/hr CPU/$ Mem/$ mem cpu cores cpcore storage bits IO type name
|
4
|
+
t1.micro 14 0.48 $0.02 10.00 33.50 0.67 0.2 1 0.2 0 64 Low Micro Micro
|
5
|
+
m1.small 61 2.04 $0.085 11.76 20.00 1.7 1 1 1 160 32 Moderate Standard Small
|
6
|
+
c1.medium 123 4.08 $0.17 29.41 10.00 1.7 5 2 2.5 350 32 Moderate High-CPU Medium
|
7
|
+
m1.large 246 8.16 $0.34 11.76 22.06 7.5 4 2 2 850 64 High Standard Large
|
8
|
+
m2.xlarge 363 12.00 $0.50 13.00 35.40 17.7 6.5 2 3.25 420 64 Moderate High-Memory Extra Large
|
9
|
+
c1.xlarge 493 16.32 $0.68 29.41 10.29 7 20 8 2.5 1690 64 High High-CPU Extra Large
|
10
|
+
m1.xlarge 493 16.32 $0.68 11.76 22.06 15 8 4 2 1690 64 High Standard Extra Large
|
11
|
+
m2.2xlarge 726 24.00 $1.00 13.00 34.20 34.2 13 4 3.25 850 64 High High-Memory Double Extra Large
|
12
|
+
m2.4xlarge 1452 48.00 $2.00 13.00 34.20 68.4 26 8 3.25 1690 64 High High-Memory Quadruple Extra Large
|
13
|
+
cc1.4xlarge 1161 38.40 $1.60 20.94 14.38 23 33.5 2 16.75 1690 64 Very High 10GB Compute Quadruple Extra Large
|
14
|
+
cg1.4xlarge 1524 50.40 $2.10 15.95 10.48 22 33.5 2 16.75 1690 64 Very High 10GB Cluster GPU Quadruple Extra Large
|
15
|
+
|
16
|
+
|
17
|
+
## Storage Costs
|
18
|
+
|
19
|
+
$/GB.hr $/GB.mo $/GB.mo $/Mio
|
20
|
+
EBS Volume $0.10
|
21
|
+
EBS Snapshot S3 $0.14
|
22
|
+
EBS I/O $0.10
|
23
|
+
|
24
|
+
S3 1st tb $0.14 /gb/month
|
25
|
+
S3 next 49tb $0.125 /gb/month
|
26
|
+
S3 next 450tb $0.110 /gb/month
|
27
|
+
|
28
|
+
### Storing 1TB data
|
29
|
+
|
30
|
+
(Cost of storage, neglecting I/O costs, and assuming the ratio of EBS volume size to snapshot size is as given)
|
31
|
+
|
32
|
+
* http://aws.amazon.com/ec2/instance-types/
|
33
|
+
* http://aws.amazon.com/ec2/#pricing
|
34
|
+
|
35
|
+
### How much does EBS cost?
|
36
|
+
|
37
|
+
The costs of EBS will be similar to the pricing structure of data storage on S3. There are three types of costs associated with EBS.
|
38
|
+
|
39
|
+
Storage Cost + Transaction Cost + S3 Snapshot Cost = Total Cost of EBS
|
40
|
+
|
41
|
+
NOTE: For current pricing information, be sure to check Amazon EC2 Pricing.
|
42
|
+
|
43
|
+
#### Storage Costs
|
44
|
+
|
45
|
+
The cost of an EBS Volume is $0.10/GB per month. You are responsible for paying for the amount of disk space that you reserve, not for the amount of the disk space that you actually use. If you reserve a 1TB volume, but only use 1GB, you will be paying for 1TB.
|
46
|
+
* $0.10/GB per month of provisioned storage
|
47
|
+
* $0.10/GB per 1 million I/O requests
|
48
|
+
|
49
|
+
#### Transaction Costs
|
50
|
+
|
51
|
+
In addition to the storage cost for EBS Volumes, you will also be charged for I/O transactions. The cost is $0.10 per million I/O transactions, where one transaction is equivalent to one read or write. This number may be smaller than the actual number of transactions performed by your application because of the Linux cache for all file systems.
|
52
|
+
$0.10 per 1 million I/O requests
|
53
|
+
|
54
|
+
#### S3 Snapshot Costs
|
55
|
+
|
56
|
+
Snapshot costs are compressed and based on altered blocks from the previous snapshot backup. Files that have altered blocks on the disk and then been deleted will add cost to the Snapshots for example. Remember, snapshots are at the data block level.
|
57
|
+
$0.15 per GB-month of data stored
|
58
|
+
$0.01 per 1,000 PUT requests (when saving a snapshot)
|
59
|
+
$0.01 per 10,000 GET requests (when loading a snapshot)
|
60
|
+
|
61
|
+
NOTE: Payment charges stop the moment you delete a volume. If you delete a volume and the status appears as "deleting" for an extended period of time, you will not be charged for the time needed to complete the deletion.
|
62
|
+
|
63
|
+
|
@@ -0,0 +1,94 @@
|
|
1
|
+
Ironfan Homebase Layout
|
2
|
+
=========================
|
3
|
+
|
4
|
+
Chef Homebase contains several directories, and each contains a README.md file describing its purpose and use in greater detail.
|
5
|
+
|
6
|
+
These are the main assets you'll use:
|
7
|
+
|
8
|
+
* `cookbooks/` - Cookbooks you download or create. Cookbooks install components, for example `cassandra` or `java`.
|
9
|
+
* `roles/` - Roles organize cookbooks and attribute overrides to describe the specific composition of your system. For example, you install Cassandra attaching the `cassandra_server` role to your machine. (.rb or .json files)
|
10
|
+
* `clusters/` - Clusters fully describe your machines, from its construction ('an 8-core machine on the Amazon EC2 cloud') to its roles ('install Cassandra, Ganglia for monitoring, and silverware to manage its logs and firewall').
|
11
|
+
|
12
|
+
These folders hold supporting files. You're less likely to visit here regularly.
|
13
|
+
|
14
|
+
* `knife/` - Chef and cloud configuration and their myriad attendant credential files.
|
15
|
+
* `environments/` - Organization-wide attribute values. (.json or .rb files)
|
16
|
+
* `data_bags/` - Data bags are an occasionally-useful alternative to node metadata for distributing information to your machines. (.json files)
|
17
|
+
* `certificates/` - SSL certificates generated by `rake ssl_cert` live here.
|
18
|
+
* `tasks/` - Rake tasks for common administrative tasks.
|
19
|
+
* `vendor/` - cookbooks are checked out to `vendor`; symlinks in the `cookbooks/` directory select which ones will be deployed to chef server.
|
20
|
+
|
21
|
+
## Directory setup
|
22
|
+
|
23
|
+
We recommend you set up your
|
24
|
+
|
25
|
+
/path/to/{organization}-chefrepo
|
26
|
+
│
|
27
|
+
├── clusters
|
28
|
+
│ └── { actual clusters }
|
29
|
+
│
|
30
|
+
├── roles
|
31
|
+
│ ├── { roles }
|
32
|
+
│ └── { symlinks into vendor/ironfan/roles }
|
33
|
+
│
|
34
|
+
├── site-cookbooks - directories holding internal cookbooks
|
35
|
+
│ └── users
|
36
|
+
│
|
37
|
+
├── cookbooks - symlinks to externally maintained cookbooks
|
38
|
+
│ ├── @vendor/opscode/...
|
39
|
+
│ └── @vendor/ironfan/...
|
40
|
+
│
|
41
|
+
├── vendor
|
42
|
+
│ ├── opscode
|
43
|
+
│ │ └── cookbooks - git submodule of https://github.com/opscode/cookbooks
|
44
|
+
│ │
|
45
|
+
│ └── ironfan - git submodule of https://github.com/infochimps-labs/ironfan
|
46
|
+
│ ├── site-cookbooks - systems: hadoop, cassandra, provides_service, etc.
|
47
|
+
│ ├── integration-cookbooks - integration: connects systems together
|
48
|
+
│ ├── meta-cookbooks - utilities: provides_service, system_params, can_haz
|
49
|
+
│ │
|
50
|
+
│ ├── roles
|
51
|
+
│ │
|
52
|
+
│ └── examples
|
53
|
+
│ ├── clusters - example clusters
|
54
|
+
│ └── roles - roles that go with the example clusters
|
55
|
+
│
|
56
|
+
├── certificates
|
57
|
+
├── config
|
58
|
+
├── data_bags
|
59
|
+
└── environments
|
60
|
+
|
61
|
+
## Knife dir setup
|
62
|
+
|
63
|
+
~/.chef
|
64
|
+
│
|
65
|
+
├── knife.rb
|
66
|
+
├── knife-user-{user}.rb - your user-specific knife customizations
|
67
|
+
├── {user}.pem - your chef client key
|
68
|
+
├── {organization}-validator.pem - chef validator key, used to create client keys
|
69
|
+
├── {organization}-credentials.rb - secret credentials: aws_secret_access_key, etc. Do not version.
|
70
|
+
├── {organization}-cloud.rb . - cloud assets: elastic IPs, AMI image ids, etc
|
71
|
+
├── {organization}-keypairs
|
72
|
+
│ ├── bonobo.pem
|
73
|
+
│ ├── gibbon.pem
|
74
|
+
│ ├── client-bonobo-worker-0.pem
|
75
|
+
│ └── client-bonobo-worker-0.pem
|
76
|
+
└── .gitignore - make sure not to version the secret/user-specific stuff (*-keypairs, *-credentials.rb, knife-user-*.rb)
|
77
|
+
|
78
|
+
For example, I am user `mrflip` and my organization is `infochimps`, so my tree looks like:
|
79
|
+
|
80
|
+
knife_dir
|
81
|
+
│
|
82
|
+
├── knife.rb
|
83
|
+
├── knife-user-mrflip.rb
|
84
|
+
├── mrflip.pem
|
85
|
+
├── infochimps-validator.pem
|
86
|
+
├── infochimps-credentials.rb
|
87
|
+
├── infochimps-cloud.rb .
|
88
|
+
├── infochimps-keypairs
|
89
|
+
│ ├── bonobo.pem
|
90
|
+
│ ├── gibbon.pem
|
91
|
+
│ ├── client-bonobo-master-0.pem
|
92
|
+
│ └── client-bonobo-worker-1.pem
|
93
|
+
└── .gitignore
|
94
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Named Cloud Objects
|
2
|
+
|
3
|
+
To add a new machine image, place this snippet:
|
4
|
+
|
5
|
+
Chef::Config[:ec2_image_info] ||= {}
|
6
|
+
Chef::Config[:ec2_image_info].merge!({
|
7
|
+
# ... lines like this:
|
8
|
+
# %w[ us-west-1 64-bit ebs natty ] => { :image_id => 'ami-4d580408' },
|
9
|
+
})
|
10
|
+
|
11
|
+
in your knife.rb or whereever. ironfan will notice that it exists and add to it, rather than clobbering it.
|
data/notes/rake_tasks.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
Rake Tasks
|
4
|
+
==========
|
5
|
+
|
6
|
+
The homebase contains a `Rakefile` that includes tasks that are installed with the Chef libraries. To view the tasks available with in the homebase with a brief description, run `rake -T`.
|
7
|
+
|
8
|
+
Besides your `~/.chef/knife.rb` file, the Rakefile loads `config/rake.rb`, which sets:
|
9
|
+
|
10
|
+
* Constants used in the `ssl_cert` task for creating the certificates.
|
11
|
+
* Constants that set the directory locations used in various tasks.
|
12
|
+
|
13
|
+
If you use the `ssl_cert` task, change the values in the `config/rake.rb` file appropriately. These values were also used in the `new_cookbook` task, but that task is replaced by the `knife cookbook create` command which can be configured below.
|
14
|
+
|
15
|
+
The default task (`default`) is run when executing `rake` with no arguments. It will call the task `test_cookbooks`.
|
16
|
+
|
17
|
+
The following standard chef tasks are typically accomplished using the rake file:
|
18
|
+
|
19
|
+
* `bundle_cookbook[cookbook]` - Creates cookbook tarballs in the `pkgs/` dir.
|
20
|
+
* `install` - Calls `update`, `roles` and `upload_cookbooks` Rake tasks.
|
21
|
+
* `ssl_cert` - Create self-signed SSL certificates in `certificates/` dir.
|
22
|
+
* `update` - Update the homebase from source control server, understands git and svn.
|
23
|
+
* `roles` - iterates over the roles and uploads with `knife role from file`.
|
24
|
+
|
25
|
+
Most other tasks use knife: run a bare `knife cluster`, `knife cookbook` (etc) to find out more.
|
@@ -0,0 +1,142 @@
|
|
1
|
+
cassandra :: default |
|
2
|
+
cassandra :: add_apt_repo | new
|
3
|
+
cassandra :: install_from_git |
|
4
|
+
cassandra :: install_from_package |
|
5
|
+
cassandra :: install_from_release |
|
6
|
+
cassandra :: config_from_data_bag | autoconf
|
7
|
+
cassandra :: client |
|
8
|
+
cassandra :: server |
|
9
|
+
cassandra :: authentication | not include_recipe'd -- added to role
|
10
|
+
cassandra :: bintools |
|
11
|
+
cassandra :: ec2snitch |
|
12
|
+
cassandra :: jna_support |
|
13
|
+
cassandra :: mx4j |
|
14
|
+
cassandra :: iptables |
|
15
|
+
cassandra :: ruby_client |
|
16
|
+
cassandra :: config_files | new
|
17
|
+
|
18
|
+
elasticsearch :: default |
|
19
|
+
elasticsearch :: install_from_git |
|
20
|
+
elasticsearch :: install_from_release |
|
21
|
+
elasticsearch :: plugins | install_plugins
|
22
|
+
elasticsearch :: server |
|
23
|
+
elasticsearch :: client |
|
24
|
+
elasticsearch :: load_balancer |
|
25
|
+
elasticsearch :: config_files | config
|
26
|
+
|
27
|
+
flume :: default |
|
28
|
+
flume :: master |
|
29
|
+
flume :: agent | node
|
30
|
+
flume :: plugin-hbase_sink | hbase_sink_plugin
|
31
|
+
flume :: plugin-jruby | jruby_plugin
|
32
|
+
flume :: test_flow |
|
33
|
+
flume :: test_s3_source |
|
34
|
+
flume :: config_files | config
|
35
|
+
|
36
|
+
ganglia :: agent |
|
37
|
+
ganglia :: default |
|
38
|
+
ganglia :: server |
|
39
|
+
ganglia :: config_files | new
|
40
|
+
|
41
|
+
graphite :: default |
|
42
|
+
graphite :: carbon |
|
43
|
+
graphite :: ganglia |
|
44
|
+
graphite :: dashboard | web
|
45
|
+
graphite :: whisper |
|
46
|
+
|
47
|
+
hadoop_cluster :: default |
|
48
|
+
hadoop_cluster :: add_cloudera_repo |
|
49
|
+
hadoop_cluster :: datanode |
|
50
|
+
hadoop_cluster :: doc |
|
51
|
+
hadoop_cluster :: hdfs_fuse |
|
52
|
+
hadoop_cluster :: jobtracker |
|
53
|
+
hadoop_cluster :: namenode |
|
54
|
+
hadoop_cluster :: secondarynn |
|
55
|
+
hadoop_cluster :: tasktracker |
|
56
|
+
hadoop_cluster :: wait_on_hdfs_safemode |
|
57
|
+
hadoop_cluster :: fake_topology |
|
58
|
+
hadoop_cluster :: minidash |
|
59
|
+
hadoop_cluster :: config_files | cluster_conf
|
60
|
+
|
61
|
+
hbase :: default |
|
62
|
+
hbase :: master |
|
63
|
+
hbase :: minidash |
|
64
|
+
hbase :: regionserver |
|
65
|
+
hbase :: stargate |
|
66
|
+
hbase :: thrift |
|
67
|
+
hbase :: backup_tables |
|
68
|
+
hbase :: config_files | config
|
69
|
+
|
70
|
+
jenkins :: default |
|
71
|
+
jenkins :: server |
|
72
|
+
jenkins :: user_key |
|
73
|
+
jenkins :: node_ssh |
|
74
|
+
jenkins :: osx_worker |
|
75
|
+
jenkins :: build_from_github |
|
76
|
+
jenkins :: build_ruby_rspec |
|
77
|
+
jenkins :: auth_github_oauth |
|
78
|
+
jenkins :: plugins |
|
79
|
+
#
|
80
|
+
jenkins :: add_apt_repo |
|
81
|
+
jenkins :: iptables |
|
82
|
+
jenkins :: node_jnlp |
|
83
|
+
jenkins :: node_windows |
|
84
|
+
jenkins :: proxy_apache2 |
|
85
|
+
jenkins :: proxy_nginx |
|
86
|
+
|
87
|
+
minidash :: default |
|
88
|
+
minidash :: server |
|
89
|
+
|
90
|
+
mongodb :: default |
|
91
|
+
mongodb :: apt | add_apt_repo
|
92
|
+
mongodb :: install_from_release | source
|
93
|
+
mongodb :: backup |
|
94
|
+
mongodb :: config_server | fixme
|
95
|
+
mongodb :: mongos | fixme
|
96
|
+
mongodb :: server |
|
97
|
+
|
98
|
+
nfs :: client |
|
99
|
+
nfs :: default |
|
100
|
+
nfs :: server |
|
101
|
+
|
102
|
+
redis :: default |
|
103
|
+
redis :: install_from_package |
|
104
|
+
redis :: install_from_release |
|
105
|
+
redis :: client |
|
106
|
+
redis :: server |
|
107
|
+
|
108
|
+
resque :: default |
|
109
|
+
resque :: dedicated_redis |
|
110
|
+
resque :: dashboard |
|
111
|
+
|
112
|
+
route53 :: default |
|
113
|
+
route53 :: set_hostname | ec2
|
114
|
+
|
115
|
+
statsd :: default |
|
116
|
+
statsd :: server |
|
117
|
+
|
118
|
+
volumes :: default |
|
119
|
+
volumes :: build_raid |
|
120
|
+
volumes :: format |
|
121
|
+
volumes :: mount |
|
122
|
+
volumes :: resize |
|
123
|
+
volumes_ebs :: default |
|
124
|
+
volumes_ebs :: attach_ebs |
|
125
|
+
|
126
|
+
zabbix :: agent |
|
127
|
+
zabbix :: agent_prebuild |
|
128
|
+
zabbix :: agent_source |
|
129
|
+
zabbix :: database |
|
130
|
+
zabbix :: database_mysql |
|
131
|
+
zabbix :: default |
|
132
|
+
zabbix :: firewall |
|
133
|
+
zabbix :: server |
|
134
|
+
zabbix :: server_source |
|
135
|
+
zabbix :: web |
|
136
|
+
zabbix :: web_apache |
|
137
|
+
zabbix :: web_nginx |
|
138
|
+
|
139
|
+
zookeeper :: default |
|
140
|
+
zookeeper :: client |
|
141
|
+
zookeeper :: server |
|
142
|
+
zookeeper :: config_files |
|
@@ -0,0 +1,251 @@
|
|
1
|
+
# Ironfan + Chef Style Guide
|
2
|
+
|
3
|
+
**NOTE**: NEEDS UPDATE. will be current by time of launch but the below may differ from what you see in practice.
|
4
|
+
|
5
|
+
## Cookbooks
|
6
|
+
|
7
|
+
Ordinary cookbooks describe a single system, consisting of one or more components. For example, the `redis` cookbook has a `server` component (with a daemon and moving parts), and a `client` component (which is static).
|
8
|
+
|
9
|
+
You should crisply separate cookbook-wide concerns from component concerns. The server's attributes live in `node[:redis][:server]`, it is installed by the `redis::server` cookbook, and so forth.
|
10
|
+
|
11
|
+
You should also separate system configuration from multi-system integration. Cookbooks should provide hooks that are neighborly but not exhibitionist, and otherwise mind their own business. The `hadoop_cluster` cookbook describes hadoop, the `pig` cookbook pig, and the `zookeeper` cookbook zookeeper. The job of tying those components together (copying zookeeper jars into the pig home dir, or the port+addr of hadoop daemons) should be isolated.
|
12
|
+
|
13
|
+
### Recipes
|
14
|
+
|
15
|
+
* Naming:
|
16
|
+
- `foo/recipes/default.rb` -- information shared by anyone using foo, including support packages, directories
|
17
|
+
- `foo/recipes/client.rb` -- configure me as a foo client
|
18
|
+
- `foo/recipes/server.rb` -- configure me as a foo server
|
19
|
+
- `foo/recipes/ec2_conf` -- cloud-specific settings
|
20
|
+
* Always include a `default.rb` recipe, even if it is blank.
|
21
|
+
* *DO NOT* install daemons via the default cookbook, even if that's currently the only thing it does. Remember, a node that is a client -- or refers to any current or future component of the system -- will include the default recipe.
|
22
|
+
* Do not repeat the cookbook name in a recipe title: `hbase:master`, not `hbase:hbase_master`; `zookeeper:server`, not `zookeeper:zookeeper_server`.
|
23
|
+
* Use only `[a-z0-9_]` for cookbook and component names. Do not use capital letters or dashes. Keep names to fewer than 15 characters.
|
24
|
+
|
25
|
+
### Cookbook Dependencies
|
26
|
+
|
27
|
+
* Dependencies should be announced in metadata.rb, of course.
|
28
|
+
* *DO* remember to explicitly `include_recipe` for system resources -- `runit`, `java`, `provides_service`, `thrift` and `apt`.
|
29
|
+
* *DO NOT* use `include_recipe` unless putting it in the role would be utterly un-interesting. You *want* the run to break unless it's explicitly included the role.
|
30
|
+
- *yes*: `java`, `ruby`, `provides_service`, etc.
|
31
|
+
- *no*: `zookeeper:client`, `nfs:server`, or anything that will start a daemon
|
32
|
+
Remember: ordinary cookbooks describe systems, roles and integration cookbooks coordinate them.
|
33
|
+
* `include_recipe` statements should only appear in recipes that are entry points. Recipes that are not meant to be called directly should assume their dependencies have been met.
|
34
|
+
* If a recipe is meant to be the primary entrypoint, it *should* include default, and it should do so explicitly: `include_recipe 'foo::default'` (not just 'foo').
|
35
|
+
|
36
|
+
### Templates
|
37
|
+
|
38
|
+
* *DO NOT* use node[:foo] in your templates except in rare circumstances. Instead, say `variables :foo => node[:foo]`; this lets folks use that cookbook from elsewhere.
|
39
|
+
|
40
|
+
### Attributes
|
41
|
+
|
42
|
+
* Scope concerns by *cookbook* or *cookbook and component*. `node[:hadoop]` holds cookbook-wide concerns, `node[:hadoop][:namenode]` holds component-specific concerns.
|
43
|
+
* Attributes shared by all components sit at cookbook level, and are always named for the cookbook: `node[:hadoop][:log_dir]` (since it is shared by all its components).
|
44
|
+
* Component-specific attributes sit at component level (`node[:cookbook_name][:component_name]`): eg `node[:hadoop][:namenode][:service_state]`. Do not use a prefix (NO: `node[:hadoop][:namenode_handler_count]`)
|
45
|
+
|
46
|
+
#### Attribute Files
|
47
|
+
|
48
|
+
* The main attribute file should be named `attributes/default.rb`.
|
49
|
+
* If there are a sizeable number of tunable attributes (hadoop, cassandra), place them in `attributes/tuneables.rb`.
|
50
|
+
* ?? Place integration attribute *hooks* in `attributes/integration.rb` ??
|
51
|
+
|
52
|
+
* Be generic when you're *simple and alone*, descriptive when you're not.
|
53
|
+
- If a component has only one log file, call it 'log_file': `node[:foo][:server][:log_file]` and in general do not use a prefix.
|
54
|
+
- If a component has more than one log_file, *always* use a prefix: `node[:foo][:server][:dashboard_log_file]` and `node[:foo][:server][:gc_log_file]`.
|
55
|
+
|
56
|
+
* If you don't have exactly the semantics and datatype of the convention, don't use the convention. That is, don't use `:port` and give it a comma-separated string, or `:addr` and give it an email address.
|
57
|
+
* (*this advice will change as we figure out integration rules*: use `foo_client` when you are a client of a service: so [:rails][:mysql_client][:host] to specify the hostname of your mysql server.)
|
58
|
+
|
59
|
+
## Attribute Names
|
60
|
+
|
61
|
+
### Universal Aspects
|
62
|
+
|
63
|
+
### File and Dir Aspects
|
64
|
+
|
65
|
+
A *file* is the full directory and basename for a file. A *dir* is a directory whose contents correspond to a single concern. A *root* is a prefix not intended to be used directly -- it will be decorated with suffixes to form dirs and files. A *basename* is only the leaf part of a file reference. Don't use the terms 'path' or 'filename'.
|
66
|
+
|
67
|
+
Ignore the temptation to make a one-true-home-for-my-system, or to fight the package maintainer's choices.
|
68
|
+
|
69
|
+
#### Application
|
70
|
+
|
71
|
+
* **home_dir**: Logical location for the cookbook's system code.
|
72
|
+
- default: typically, leave it up to the package maintainer. Otherwise, `:prefix_root/share/:cookbook` should be a symlink to the `install_dir` (see below).
|
73
|
+
- instead of: `xx_home` / `dir` alone / `install_dir`
|
74
|
+
* **prefix_root**: A container with directories bin, lib, share, src, to use according to convention
|
75
|
+
- default: `/usr/local`.
|
76
|
+
* **install_dir**: The cookbook's system code, in case the home dir is a pointer to potential alternates.
|
77
|
+
- default: `:prefix_root/share/:cookbook-:version` ( you don't need the directory after the cookbook runs, use `:prefix_root/share/:cookbook-:version` instead, eg `/usr/local/src/tokyo_tyrant-xx.xx`)
|
78
|
+
- Make `home_dir` a symlink to this directory (eg home_dir `/usr/local/share/elasticsearch` links to install_dir `/usr/local/share/elasticsearch-0.17.8`).
|
79
|
+
* **src_dir**: holds the compressed tarball, its expanded contents, and the compiled files when installing from source. Use this when you will run `make install` or equivalent and use the files elsewhere.
|
80
|
+
- default: `:prefix_root/src/:system_name-:version`, eg `/usr/local/src/pig-0.9.tar.gz`
|
81
|
+
- do not: expand the tarball to `:prefix_root/src/(whatever)` if it will actually be used from there; instead, use the `install_dir` convention described above. (As a guideline, I should be able to blow away `/usr/local/src` and everything still works).
|
82
|
+
* **deploy_dir**: deployed code that follows the capistrano convention. See more about deploy variables below.
|
83
|
+
- the `:deploy_dir/shared` directory holds common files
|
84
|
+
- releases are checked out to `:deploy_dir/releases/{sha}`
|
85
|
+
- the operational release is a symlink to the right release: `:deploy_dir/current -> :deploy_dir/releases/xxx`.
|
86
|
+
- do not: use this when you mean `home_dir`.
|
87
|
+
|
88
|
+
* **scratch_roots**, **persistent_roots**: an array of directories spread across volumes, with expectations on persistence
|
89
|
+
- `scratch_root`s have no guarantee of persistence -- for example, stop/start'ing a machine on EC2 destroys the contents of its local (ephemeral) drives. `persistent_root`s have the *best available* promise of persistance: if permanent (eg EBS) volumes are available, they will exclusively populate the `persistent_root`s; but if not, the ephemeral drives are used instead.
|
90
|
+
- these attributes are provided by the `mountable_volume` meta-cookbook and its appropriate integration recipe. Ordinary cookbooks should always trust the integration cookbook's choices (or visit the integration cookbook to correct them).
|
91
|
+
- each element in `persistent_roots` is by contract on a separate volume, and similarly each of the `scratch_roots` is on a separate volume. A volume *may* be in both scratch and persistent (for example, there may be only one volume!).
|
92
|
+
- the singular forms **scratch_root** and **persistent_root** are provided for your convenience and always correspond to `scratch_roots.first` and `persistent_roots.first`. This means lots the first named volume is picked on the heaviest -- if you don't like that, choose explicitly (but not randomly, or you won't be idempotent).
|
93
|
+
|
94
|
+
|
95
|
+
* **log_file**, **log_dir**, **xx_log_file**, **xx_log_dir**:
|
96
|
+
- default:
|
97
|
+
- if the log files will always be trivial in size, put them in `/var/log/:cookbook.log` or `/var/log/:cookbook/(whatever)`.
|
98
|
+
- if it's a runit-managed service, leave them in `/etc/sv/:cookbook-:component/log/main/current`, and make a symlink from `/var/log/:cookbook-component` to `/etc/sv/:cookbook-:component/log/main/`.
|
99
|
+
- If the log files are non-trivial in size, set log dir `/:scratch_root/:cookbook/log/`, and symlink `/var/log/:cookbook/` to it.
|
100
|
+
- If the log files should be persisted, place them in `/:persistent_root/:cookbook/log`, and symlink `/var/log/:cookbook/` to it.
|
101
|
+
- in all cases, the directory is named `.../log`, not `.../logs`. Never put things in `/tmp`.
|
102
|
+
- Use the physical location for the `log_dir` attribute, not the /var/log symlink.
|
103
|
+
* **tmp_dir**:
|
104
|
+
- default: `/:scratch_root/:cookbook/tmp/`
|
105
|
+
- Do not put a symlink or directory in `/tmp` -- something else blows it away, the app recreates it as a physical directory, `/tmp` overflows, pagers go off, sadness spreads throughout the land.
|
106
|
+
* **conf_dir**:
|
107
|
+
- default: `/etc/:cookbook`
|
108
|
+
* **bin_dir**:
|
109
|
+
- default: `/:home_dir/bin`
|
110
|
+
* **pid_file**, **pid_dir**:
|
111
|
+
- default: pid_file: `/var/run/:cookbook.pid` or `/var/run/:cookbook/:component.pid`; pid_dir: `/var/run/:cookbook/`
|
112
|
+
- instead of: `job_dir`, `job_file`, `pidfile`, `run_dir`.
|
113
|
+
* **cache_dir**:
|
114
|
+
- default: `/var/cache/:cookbook`.
|
115
|
+
|
116
|
+
* **data_dir**:
|
117
|
+
- default: `:persistent_root/:cookbook/:component/data`
|
118
|
+
- instead of: `datadir, `dbfile`, `dbdir`
|
119
|
+
* **journal_dir**: high-speed local storage for commitlogs and so forth. Can be deleted, though you may rather it wasn't.
|
120
|
+
- default: `:scratch_root/:cookbook/:component/scratch`
|
121
|
+
- instead of: `commitlog_dir`
|
122
|
+
|
123
|
+
### Daemon Aspects
|
124
|
+
|
125
|
+
* **daemon_name**: daemon's actual service name, if it differs from the component. For example, the `hadoop-namenode` component's daemon is `hadoop-0.20-namenode` as installed by apt.
|
126
|
+
* **daemon_states**: an array of the verbs acceptable to the Chef `service` resource: `:enable`, `:start`, etc.
|
127
|
+
* **num_xx_processes**, **num_xx_threads** the number of separate top-level processes (distinct PIDs) or internal threads to run
|
128
|
+
- instead of `num_workers`, `num_servers`, `worker_processes`, `foo_threads`.
|
129
|
+
* **log_level**
|
130
|
+
- application-specific; often takes values info, debug, warn
|
131
|
+
- instead of `verbose`, `verbosity`, `loglevel`
|
132
|
+
* **user**, **group**, **uid**, **gid** -- `user` is the user name. The `user` and `group` should be strings, even the `uid` and `gid` should be integers.
|
133
|
+
- instead of username, group_name, using uid for user name or vice versa.
|
134
|
+
- if there are multiple users, use a prefix: `launcher_user` and `observer_user`.
|
135
|
+
|
136
|
+
### Install / Deploy Aspects
|
137
|
+
|
138
|
+
* **release_url**: URL for the release.
|
139
|
+
- instead of: install_url, package_url, being careless about partial vs whole URLs
|
140
|
+
* **release_file**: Where to put the release.
|
141
|
+
- default: `:prefix_root/src/system_name-version.ext`, eg `/usr/local/src/elasticsearch-0.17.8.tar.bz2`.
|
142
|
+
- do not use `/tmp` -- let me decide when to blow it away (and make it easy to be idempotent).
|
143
|
+
- do not use a non-versioned URL or file name.
|
144
|
+
* **release_file_sha** or **release_file_md5** fingerprint
|
145
|
+
- instead of: `whatever_checksum`, `whatever_fingerprint`
|
146
|
+
* **version**: if it's a simply-versioned resource that uses the `major.minor.patch-cruft` convention. Do not use unless this is true, and do not use the source control revision ID.
|
147
|
+
|
148
|
+
* **plugins**: array of system-specific plugins
|
149
|
+
|
150
|
+
use `deploy_{}` for anything that would be true whatever SCM you're using; use
|
151
|
+
`git_{}` (and so forth) where specific to that repo.
|
152
|
+
|
153
|
+
* **deploy_env** production / staging / etc
|
154
|
+
* **deploy_strategy**
|
155
|
+
* **deploy_user** user to run as
|
156
|
+
* **deploy_dir**: Only use `deploy_dir` if you are following the capistrano convention: see above.
|
157
|
+
|
158
|
+
* **git_repo**: url for the repo, eg `git@github.com:infochimps-labs/ironfan.git` or `http://github.com/infochimps-labs/ironfan.git`
|
159
|
+
- instead of: `deploy_repo`, `git_url`
|
160
|
+
* **git_revision**: SHA or branch
|
161
|
+
- instead of: `deploy_revision`
|
162
|
+
|
163
|
+
* **apt/{repo_name}** Options for adding a cookbook's apt repo.
|
164
|
+
- Note that this is filed under *apt*, not the cookbook.
|
165
|
+
- Use the best name for the repo, which is not necessarily the cookbook's name: eg `apt/cloudera/{...}`, which is shared by hadoop, flume, pig, and so on.
|
166
|
+
- `apt/{repo_name}/url` -- eg `http://archive.cloudera.com/debian`
|
167
|
+
- `apt/{repo_name}/key` -- GPG key
|
168
|
+
- `apt/{repo_name}/force_distro` -- forces the distro (eg, you are on natty but the apt repo only has maverick)
|
169
|
+
|
170
|
+
### Ports
|
171
|
+
|
172
|
+
* **xx_port**:
|
173
|
+
- *do not* use 'port' on its own.
|
174
|
+
- examples: `thrift_port`, `webui_port`, `zookeeper_port`, `carbon_port` and `whisper_port`.
|
175
|
+
- xx_port: `default[:foo][:server][:port] = 5000`
|
176
|
+
- xx_ports, if an array: `default[:foo][:server][:ports] = [5000, 5001, 5002]`
|
177
|
+
|
178
|
+
* **addr**, **xx_addr**
|
179
|
+
- if all ports bind to the same interface, use `addr`. Otherwise, do *not* use `addr`, and use a unique `foo_addr` for each `foo_port`.
|
180
|
+
- instead of: `hostname`, `binding`, `address`
|
181
|
+
|
182
|
+
* Want some way to announce my port is http or https.
|
183
|
+
* Need to distinguish client ports from service ports. You should be using cluster service discovery anyway though.
|
184
|
+
|
185
|
+
### Application Integration
|
186
|
+
|
187
|
+
* **jmx_port**
|
188
|
+
|
189
|
+
### Tunables
|
190
|
+
|
191
|
+
* **XX_heap_max**, **xx_heap_min**, **java_heap_eden**
|
192
|
+
* **java_home**
|
193
|
+
* AVOID **java_opts** if possible: assemble it in your recipe from intelligible attribute names.
|
194
|
+
|
195
|
+
### Nitpicks
|
196
|
+
|
197
|
+
* Always put file modes in quote marks: `mode "0664"` not `mode 0664`.
|
198
|
+
|
199
|
+
## Announcing Aspects
|
200
|
+
|
201
|
+
If your app does any of the following,
|
202
|
+
|
203
|
+
* **services** -- Any interesting long-running process.
|
204
|
+
* **ports** -- Any reserved open application port
|
205
|
+
- *http*: HTTP application port
|
206
|
+
- *https*: HTTPS application port
|
207
|
+
- *internal*: port is on private IP, should *not* be visible through public IP
|
208
|
+
- *external*: port *is* available through public IP
|
209
|
+
* metric_ports:
|
210
|
+
- **jmx_ports** -- JMX diagnostic port (announced by many Java apps)
|
211
|
+
* **dashboards** -- Web interface to look inside a system; typically internal-facing only, and probably not performance-monitored by default.
|
212
|
+
* **logs** -- um, logs. You can also announce the logs' flavor: `:apache`, `log4j`, etc.
|
213
|
+
* **scheduleds** -- regularly-occurring events that leave a trace
|
214
|
+
* **exports** -- jars or libs that other programs may wish to incorporate
|
215
|
+
* **consumes** -- placed there by any call to `discover`.
|
216
|
+
|
217
|
+
### Dummy aspects
|
218
|
+
|
219
|
+
Integration cookbooks that announce as
|
220
|
+
|
221
|
+
* Elastic Load Balancers
|
222
|
+
|
223
|
+
|
224
|
+
## Clusters
|
225
|
+
|
226
|
+
* Describe physical configuration:
|
227
|
+
- machine size, number of instances per facet, etc
|
228
|
+
- external assets (elastic IP, ebs volumes)
|
229
|
+
* Describe high-level assembly of systems via roles: `hadoop_namenode`, `nfs_client`, `flume_agent`, etc.
|
230
|
+
* Describe important modifications, such as `ironfan::system_internals`, mounts ebs volumes, etc
|
231
|
+
* Describe override attributes:
|
232
|
+
- `heap size`, rvm versions, etc.
|
233
|
+
|
234
|
+
* roles and recipes
|
235
|
+
- remove `cluster_role` and `facet_role` if empty
|
236
|
+
- are not in `run_list`, but populated by the `role` and `recipe` directives
|
237
|
+
* remove big_package unless it's a dev machine (sandbox, etc)
|
238
|
+
|
239
|
+
## Roles
|
240
|
+
|
241
|
+
Roles define the high-level assembly of recipes into systems
|
242
|
+
|
243
|
+
* override attributes go into the cluster.
|
244
|
+
currently, those files are typically empty and are badly cluttering the roles/ directory.
|
245
|
+
the cluster and facet override attributes should be together, not scattered in different files.
|
246
|
+
roles shouldn't assemble systems. The contents of the infochimps_chef/roles/plato_truth.rb file belong in a facet.
|
247
|
+
|
248
|
+
* Deprecated:
|
249
|
+
- Cluster and facet roles (`roles/gibbon_cluster.rb`, `roles/gibbon_namenode.rb`, etc) go away
|
250
|
+
- roles should be service-oriented: `hadoop_master` considered harmful, you should explicitly enumerate the services
|
251
|
+
|