ironfan 3.1.7 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/CHANGELOG.md +11 -0
  2. data/Gemfile +15 -12
  3. data/Rakefile +1 -1
  4. data/VERSION +1 -1
  5. data/config/ubuntu10.04-ironfan.erb +10 -0
  6. data/config/ubuntu11.10-ironfan.erb +10 -0
  7. data/ironfan.gemspec +29 -54
  8. data/lib/chef/knife/bootstrap/centos6.2-ironfan.erb +10 -0
  9. data/lib/chef/knife/bootstrap/ubuntu10.04-ironfan.erb +10 -0
  10. data/lib/chef/knife/bootstrap/ubuntu11.10-ironfan.erb +10 -0
  11. data/lib/chef/knife/cluster_kick.rb +7 -2
  12. data/lib/chef/knife/cluster_launch.rb +3 -0
  13. data/lib/chef/knife/cluster_ssh.rb +3 -3
  14. data/lib/chef/knife/ironfan_knife_common.rb +21 -0
  15. data/lib/chef/knife/ironfan_script.rb +2 -0
  16. data/lib/ironfan/chef_layer.rb +9 -9
  17. data/lib/ironfan/cloud.rb +232 -360
  18. data/lib/ironfan/cluster.rb +3 -3
  19. data/lib/ironfan/compute.rb +26 -40
  20. data/lib/ironfan/deprecated.rb +45 -10
  21. data/lib/ironfan/discovery.rb +1 -1
  22. data/lib/ironfan/dsl_builder.rb +99 -0
  23. data/lib/ironfan/facet.rb +2 -3
  24. data/lib/ironfan/fog_layer.rb +14 -10
  25. data/lib/ironfan/private_key.rb +1 -1
  26. data/lib/ironfan/security_group.rb +46 -44
  27. data/lib/ironfan/server.rb +26 -52
  28. data/lib/ironfan/server_slice.rb +13 -19
  29. data/lib/ironfan/volume.rb +47 -59
  30. data/lib/ironfan.rb +5 -4
  31. metadata +116 -122
  32. data/lib/ironfan/dsl_object.rb +0 -124
  33. data/notes/Backup of ec2-pricing_and_capacity.numbers +0 -0
  34. data/notes/Home.md +0 -45
  35. data/notes/INSTALL-cloud_setup.md +0 -103
  36. data/notes/INSTALL.md +0 -134
  37. data/notes/Ironfan-Roadmap.md +0 -70
  38. data/notes/advanced-superpowers.md +0 -16
  39. data/notes/aws_servers.jpg +0 -0
  40. data/notes/aws_user_key.png +0 -0
  41. data/notes/cookbook-versioning.md +0 -11
  42. data/notes/core_concepts.md +0 -200
  43. data/notes/declaring_volumes.md +0 -3
  44. data/notes/design_notes-aspect_oriented_devops.md +0 -36
  45. data/notes/design_notes-ci_testing.md +0 -169
  46. data/notes/design_notes-cookbook_event_ordering.md +0 -249
  47. data/notes/design_notes-meta_discovery.md +0 -59
  48. data/notes/ec2-pricing_and_capacity.md +0 -69
  49. data/notes/ec2-pricing_and_capacity.numbers +0 -0
  50. data/notes/homebase-layout.txt +0 -102
  51. data/notes/knife-cluster-commands.md +0 -18
  52. data/notes/named-cloud-objects.md +0 -11
  53. data/notes/opscode_org_key.png +0 -0
  54. data/notes/opscode_user_key.png +0 -0
  55. data/notes/philosophy.md +0 -13
  56. data/notes/rake_tasks.md +0 -24
  57. data/notes/renamed-recipes.txt +0 -142
  58. data/notes/silverware.md +0 -85
  59. data/notes/style_guide.md +0 -300
  60. data/notes/tips_and_troubleshooting.md +0 -92
  61. data/notes/version-3_2.md +0 -273
  62. data/notes/walkthrough-hadoop.md +0 -168
  63. data/notes/walkthrough-web.md +0 -166
@@ -1,166 +0,0 @@
1
- ## Walkthrough: Web Cluster
2
-
3
- Here's a very simple cluster:
4
-
5
- ```ruby
6
- Ironfan.cluster 'web_demo' do
7
- cloud(:ec2) do
8
- flavor 't1.micro'
9
- end
10
-
11
- role :base_role
12
- role :chef_client
13
- role :ssh
14
-
15
- # The database server
16
- facet :dbnode do
17
- instances 1
18
- role :mysql_server
19
-
20
- cloud do
21
- flavor 'm1.large'
22
- backing 'ebs'
23
- end
24
- end
25
-
26
- # A throwaway facet for development.
27
- facet :webnode do
28
- instances 2
29
- role :nginx_server
30
- role :awesome_webapp
31
- end
32
- end
33
- ```
34
-
35
- This code defines a cluster named web_demo. A cluster is a group of servers united around a common purpose, in this case to serve a scalable web application.
36
-
37
- The web_demo cluster has two 'facets' -- dbnode and webnode. A facet is a subgroup of interchangeable servers that provide a logical set of systems: in this case, the systems that store the website's data and those that render it.
38
-
39
- The dbnode facet has one server, which will be named `web_demo-dbnode-0`; the webnode facet has two servers, `web_demo-webnode-0` and `web_demo-webnode-1`.
40
-
41
- Each server inherits the appropriate behaviors from its facet and cluster. All the servers in this cluster have the `base_role`, `chef_client` and `ssh` roles. The dbnode machines additionally house a MySQL server, while the webnodes have an nginx reverse proxy for the custom `web_demo_webapp`.
42
-
43
- As you can see, the dbnode facet asks for a different flavor of machine (`m1.large`) than the cluster default (`t1.micro`). Settings in the facet override those in the server, and settings in the server override those of its facet. You economically describe only what's significant about each machine.
44
-
45
- ### Cluster-level tools
46
-
47
- ```
48
- $ knife cluster show web_demo
49
-
50
- +---------------------+-------+------------+-------------+--------------+---------------+-----------------+----------+--------------+------------+------------+
51
- | Name | Chef? | InstanceID | State | Public IP | Private IP | Created At | Flavor | Image | AZ | SSH Key |
52
- +---------------------+-------+------------+-------------+--------------+---------------+-----------------+----------+--------------+------------+------------+
53
- | web_demo-dbnode-0 | yes | i-43c60e20 | running | 107.22.6.104 | 10.88.112.201 | 20111029-204156 | t1.micro | ami-cef405a7 | us-east-1a | web_demo |
54
- | web_demo-webnode-0 | yes | i-1233aef1 | running | 102.99.3.123 | 10.88.112.123 | 20111029-204156 | t1.micro | ami-cef405a7 | us-east-1a | web_demo |
55
- | web_demo-webnode-1 | yes | i-0986423b | not running | | | | | | | |
56
- +---------------------+-------+------------+-------------+--------------+---------------+-----------------+----------+--------------+------------+------------+
57
-
58
- ```
59
-
60
- The commands available are:
61
-
62
- * list -- lists known clusters
63
- * show -- show the named servers
64
- * launch -- launch server
65
- * bootstrap
66
- * sync
67
- * ssh
68
- * start/stop
69
- * kill
70
- * kick -- trigger a chef-client run on each named machine, tailing the logs until the run completes
71
-
72
-
73
- ### Advanced clusters remain simple
74
-
75
- Let's say that app is truly awesome, and the features and demand increases. This cluster adds an [ElasticSearch server](http://elasticsearch.org) for searching, a haproxy loadbalancer, and spreads the webnodes across two availability zones.
76
-
77
- ```ruby
78
- Ironfan.cluster 'web_demo' do
79
- cloud(:ec2) do
80
- image_name "maverick"
81
- flavor "t1.micro"
82
- availability_zones ['us-east-1a']
83
- end
84
-
85
- # The database server
86
- facet :dbnode do
87
- instances 1
88
- role :mysql_server
89
- cloud do
90
- flavor 'm1.large'
91
- backing 'ebs'
92
- end
93
-
94
- volume(:data) do
95
- size 20
96
- keep true
97
- device '/dev/sdi'
98
- mount_point '/data'
99
- snapshot_id 'snap-a10234f'
100
- attachable :ebs
101
- end
102
- end
103
-
104
- facet :webnode do
105
- instances 6
106
- cloud.availability_zones ['us-east-1a', 'us-east-1b']
107
-
108
- role :nginx_server
109
- role :awesome_webapp
110
- role :elasticsearch_client
111
-
112
- volume(:server_logs) do
113
- size 5
114
- keep true
115
- device '/dev/sdi'
116
- mount_point '/server_logs'
117
- snapshot_id 'snap-d9c1edb1'
118
- end
119
- end
120
-
121
- facet :esnode do
122
- instances 1
123
- role "elasticsearch_data_esnode"
124
- role "elasticsearch_http_esnode"
125
- cloud.flavor "m1.large"
126
- end
127
-
128
- facet :loadbalancer do
129
- instances 1
130
- role "haproxy"
131
- cloud.flavor "m1.xlarge"
132
- elastic_ip "128.69.69.23"
133
- end
134
-
135
- cluster_role.override_attributes({
136
- :elasticsearch => {
137
- :version => '0.17.8',
138
- },
139
- })
140
- end
141
- ```
142
-
143
- The facets are described and scale independently. If you'd like to add more webnodes, just increase the instance count. If a machine misbehaves, just terminate it. Running `knife cluster launch web_demo webnode` will note which machines are missing, and launch and configure them appropriately.
144
-
145
- Ironfan speaks naturally to both Chef and your cloud provider. The esnode's `cluster_role.override_attributes` statement will be synchronized to the chef server, pinning the elasticsearch version across the server and clients. Your chef roles should focus on specific subsystems; the cluster file lets you see the architecture as a whole.
146
-
147
- With these simple settings, if you have already [set up chef's knife to launch cloud servers](http://wiki.opscode.com/display/chef/Launch+Cloud+Instances+with+Knife), typing `knife cluster launch web_demo --bootstrap` will (using Amazon EC2 as an example):
148
-
149
- * Synchronize to the chef server:
150
- - create chef roles on the server for the cluster and each facet.
151
- - apply role directives (eg the homebase's `default_attributes` declaration).
152
- - create a node for each machine
153
- - apply the runlist to each node
154
- * Set up security isolation:
155
- - uses a keypair (login ssh key) isolated to that cluster
156
- - Recognizes the `ssh` role, and add a security group `ssh` that by default opens port 22.
157
- - Recognize the `nfs_server` role, and adds security groups `nfs_server` and `nfs_client`
158
- - Authorizes the `nfs_server` to accept connections from all `nfs_client`s. Machines in other clusters that you mark as `nfs_client`s can connect to the NFS server, but are not automatically granted any other access to the machines in this cluster. Ironfan's opinionated behavior is about more than saving you effort -- tying this behavior to the chef role means you can't screw it up.
159
- * Launches the machines in parallel:
160
- - using the image name and the availability zone, it determines the appropriate region, image ID, and other implied behavior.
161
- - passes a JSON-encoded user_data hash specifying the machine's chef `node_name` and client key. An appropriately-configured machine image will need no further bootstrapping -- it will connect to the chef server with the appropriate identity and proceed completely unattended.
162
- * Syncronizes to the cloud provider:
163
- - Applies EC2 tags to the machine, making your console intelligible: ![AWS Console screenshot](https://github.com/infochimps-labs/ironfan/wiki/aws_servers.jpg)
164
- - Connects external (EBS) volumes, if any, to the correct mount point -- it uses (and applies) tags to the volumes, so they know which machine to adhere to. If you've manually added volumes, just make sure they're defined correctly in your cluster file and run `knife cluster sync {cluster_name}`; it will paint them with the correct tags.
165
- - Associates an elastic IP, if any, to the machine
166
- * Bootstraps the machine using knife bootstrap