noah 0.0.5-jruby → 0.1-jruby
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.gitignore +10 -0
- data/LICENSE +201 -0
- data/README.md +68 -212
- data/Rakefile +65 -41
- data/TODO.md +65 -0
- data/bin/noah +2 -1
- data/bin/noah-watcher.rb +103 -0
- data/config.ru +6 -3
- data/config/warble.rb +18 -0
- data/examples/README.md +116 -0
- data/examples/cluster.ru +2 -0
- data/examples/custom-watcher.rb +10 -0
- data/examples/httpclient-server.rb +7 -0
- data/examples/httpclient.rb +12 -0
- data/examples/httpclient2.rb +28 -0
- data/examples/js/FABridge.js +1452 -0
- data/examples/js/WebSocketMain.swf +830 -0
- data/examples/js/swfobject.js +851 -0
- data/examples/js/web_socket.js +312 -0
- data/examples/logger.rb +11 -0
- data/examples/reconfiguring-sinatra-watcher.rb +11 -0
- data/examples/reconfiguring-sinatra.rb +33 -0
- data/examples/simple-post.rb +17 -0
- data/examples/websocket.html +24 -0
- data/examples/websocket.rb +41 -0
- data/lib/noah.rb +6 -8
- data/lib/noah/app.rb +20 -268
- data/lib/noah/application_routes.rb +70 -0
- data/lib/noah/ark.rb +0 -0
- data/lib/noah/configuration_routes.rb +81 -0
- data/lib/noah/custom_watcher.rb +79 -0
- data/lib/noah/ephemeral_routes.rb +47 -0
- data/lib/noah/helpers.rb +37 -14
- data/lib/noah/host_routes.rb +69 -0
- data/lib/noah/models.rb +86 -5
- data/lib/noah/models/applications.rb +41 -0
- data/lib/noah/models/configurations.rb +49 -0
- data/lib/noah/models/ephemerals.rb +54 -0
- data/lib/noah/models/hosts.rb +56 -0
- data/lib/noah/models/services.rb +54 -0
- data/lib/noah/models/watchers.rb +62 -0
- data/lib/noah/passthrough.rb +11 -0
- data/lib/noah/service_routes.rb +71 -0
- data/lib/noah/validations.rb +1 -0
- data/lib/noah/validations/watcher_validations.rb +48 -0
- data/lib/noah/version.rb +1 -1
- data/lib/noah/watcher_routes.rb +45 -0
- data/noah.gemspec +25 -17
- data/spec/application_spec.rb +30 -30
- data/spec/configuration_spec.rb +78 -14
- data/spec/ephemeral_spec.rb +59 -0
- data/spec/host_spec.rb +21 -21
- data/spec/noahapp_application_spec.rb +6 -6
- data/spec/noahapp_configuration_spec.rb +5 -5
- data/spec/noahapp_ephemeral_spec.rb +115 -0
- data/spec/noahapp_host_spec.rb +3 -3
- data/spec/noahapp_service_spec.rb +10 -10
- data/spec/noahapp_watcher_spec.rb +123 -0
- data/spec/service_spec.rb +27 -27
- data/spec/spec_helper.rb +13 -22
- data/spec/support/db/.keep +0 -0
- data/spec/support/test-redis.conf +8 -0
- data/spec/watcher_spec.rb +62 -0
- data/views/index.haml +21 -15
- metadata +189 -146
- data/Gemfile.lock +0 -83
- data/doc/coverage/index.html +0 -138
- data/doc/coverage/jquery-1.3.2.min.js +0 -19
- data/doc/coverage/jquery.tablesorter.min.js +0 -15
- data/doc/coverage/lib-helpers_rb.html +0 -393
- data/doc/coverage/lib-models_rb.html +0 -1449
- data/doc/coverage/noah_rb.html +0 -2019
- data/doc/coverage/print.css +0 -12
- data/doc/coverage/rcov.js +0 -42
- data/doc/coverage/screen.css +0 -270
- data/lib/noah/applications.rb +0 -46
- data/lib/noah/configurations.rb +0 -49
- data/lib/noah/hosts.rb +0 -54
- data/lib/noah/services.rb +0 -57
- data/lib/noah/watchers.rb +0 -18
data/.gemtest
ADDED
File without changes
|
data/.gitignore
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -1,213 +1,69 @@
|
|
1
|
-
# Noah
|
2
|
-
|
3
|
-
|
4
|
-
## Setup
|
5
|
-
There is no specific configuration file in use anymore. Everything is configured via command-line options to the noah binary or stored in config.ru.
|
6
|
-
|
7
|
-
* The instance of Redis is configured via the `REDIS_URL` env setting. This is honored by Ohm.
|
8
|
-
* Redis DSN strings are in the format of "redis://hostname:port/db"
|
9
|
-
* `RACK_ENV` is honored.
|
10
|
-
* `rake sample["redis://localhost:6379/2"]` populates the locally running redis instance - db 2
|
11
|
-
* `rake spec` runs the test suite (using 'redis://localhost:6379/3' for storing test data)
|
12
|
-
|
13
|
-
_rake sample_
|
14
|
-
|
15
|
-
Creating Host entry for 'localhost'
|
16
|
-
Create Service entry for redis
|
17
|
-
Create Service entry for noah
|
18
|
-
Creating Application entry for 'noah'
|
19
|
-
Creating Configuration entry for 'noah'
|
20
|
-
Creating sample entries - Host and Service
|
21
|
-
Creating sample entries - Application and Configuration
|
22
|
-
Setup successful!
|
23
|
-
|
24
|
-
## Run it
|
25
|
-
There are two way to run Noah
|
26
|
-
|
27
|
-
### config.ru
|
28
|
-
Edit config.ru to change the redis instance or rack environment.
|
29
|
-
|
30
|
-
### bin/noah
|
31
|
-
The binary script in bin was created using [Vegas](https://github.com/quirkey/vegas). It accepts the familiar rack options as well as an option for specifying the redis url.
|
32
|
-
|
33
|
-
bin/noah -p 9292 -s thin -d -F -e production -r redis://localhost:6379/2
|
34
|
-
[2011-02-07 16:48:15 -0500] Starting 'noah'...
|
35
|
-
[2011-02-07 16:48:15 -0500] trying port 9292...
|
36
|
-
Couldn't get a file descriptor referring to the console
|
37
|
-
[2011-02-07 16:48:15 -0500] Running with Rack handler: Rack::Handler::Thin
|
38
|
-
>> Thin web server (v1.2.7 codename No Hup)
|
39
|
-
>> Maximum connections set to 1024
|
40
|
-
>> Listening on 0.0.0.0:9292, CTRL+C to stop
|
41
|
-
|
42
|
-
If you leave off `-F`, all information will be logged to `$HOME/.vegas/noah`. Run `bin/noah -h` for more options.
|
43
|
-
|
44
|
-
Please note on JRuby that the port setting does not work for some f'cking reason. Bug claims to have been fixed. Until then, when on Jruby run like so:
|
45
|
-
|
46
|
-
noah -F -d -r redis://localhost:6379/0
|
47
|
-
|
48
|
-
## Example links
|
49
|
-
[Noah Start Page](http://localhost:9292/)
|
50
|
-
|
51
|
-
If you have Noah running, you can hit the above link for some links created by the setup samples.
|
52
|
-
|
53
|
-
## All configs
|
54
|
-
_curl http://localhost:9292/c/_
|
55
|
-
|
56
|
-
[
|
57
|
-
{"id":"1",
|
58
|
-
"name":"db",
|
59
|
-
"format":"string",
|
60
|
-
"body":"redis://127.0.0.1:6379/0",
|
61
|
-
"update_at":"2011-01-17 14:12:43 UTC",
|
62
|
-
"application":"noah"
|
63
|
-
}
|
64
|
-
]
|
65
|
-
|
66
|
-
## All services
|
67
|
-
_curl http://localhost:9292/s/_
|
68
|
-
|
69
|
-
[
|
70
|
-
{
|
71
|
-
"id":"1",
|
72
|
-
"name":"redis",
|
73
|
-
"status":"up",
|
74
|
-
"updated_at":"2011-01-17 14:12:43 UTC",
|
75
|
-
"host":"localhost"
|
76
|
-
},
|
77
|
-
{
|
78
|
-
"id":"2",
|
79
|
-
"name":"noah",
|
80
|
-
"status":"up",
|
81
|
-
"updated_at":"2011-01-17 14:12:43 UTC",
|
82
|
-
"host":"localhost"
|
83
|
-
}
|
84
|
-
]
|
85
|
-
|
86
|
-
## All hosts
|
87
|
-
_curl http://localhost:9292/h/_
|
88
|
-
|
89
|
-
[
|
90
|
-
{
|
91
|
-
"id":"1",
|
92
|
-
"name":"localhost",
|
93
|
-
"status":"up",
|
94
|
-
"updated_at":"2011-01-17 14:12:43 UTC",
|
95
|
-
"services":[
|
96
|
-
{
|
97
|
-
"id":"1",
|
98
|
-
"name":"redis",
|
99
|
-
"status":"up",
|
100
|
-
"updated_at":"2011-01-17 14:12:43 UTC",
|
101
|
-
"host":"localhost"
|
102
|
-
},
|
103
|
-
{
|
104
|
-
"id":"2",
|
105
|
-
"name":"noah",
|
106
|
-
"status":"up",
|
107
|
-
"updated_at":"2011-01-17 14:12:43 UTC",
|
108
|
-
"host":"localhost"
|
109
|
-
}
|
110
|
-
]
|
111
|
-
}
|
112
|
-
]
|
113
|
-
|
114
|
-
## All applications
|
115
|
-
_curl http://localhost:9292/a/_
|
116
|
-
|
117
|
-
[
|
118
|
-
{
|
119
|
-
"id":"1",
|
120
|
-
"name":"noah",
|
121
|
-
"updated_at":"2011-01-17 14:12:43 UTC"
|
122
|
-
}
|
123
|
-
]
|
124
|
-
|
125
|
-
Most other combinations of endpoints work as well:
|
126
|
-
|
127
|
-
* `http://localhost:9292/h/<hostname>/<servicename>` - `<servicename>` on `<hostname>`
|
128
|
-
* `http://localhost:9292/a/<appname>/<configname>` - Configuration for `<appname>`
|
129
|
-
* `http://localhost:9292/c/<appname>/<element>` - Specific configuration element for `<appname>`
|
130
|
-
|
131
|
-
{
|
132
|
-
"id":"1",
|
133
|
-
"name":"db",
|
134
|
-
"format":"string",
|
135
|
-
"body":"redis://127.0.0.1:6379/0",
|
136
|
-
"update_at":"2011-01-17 14:12:43 UTC",
|
137
|
-
"application":"noah"
|
138
|
-
}
|
139
|
-
|
140
|
-
# Adding new entries
|
141
|
-
There are two ways to add new objects: via irb and via the [API](https://github.com/lusis/Noah/wiki/Stabilize-API) on a running instance. The API is still in a state of flux.
|
142
|
-
|
143
|
-
## Adding a new application and configuration item
|
144
|
-
|
145
|
-
irb -rohm -rohm/contrib -r./lib/noah/models.rb
|
146
|
-
|
147
|
-
a1 = Application.create(:name => 'myapplication')
|
148
|
-
if a1.save
|
149
|
-
a1.configurations << Configuration.create(:name => 'jsonconfigobj', :format => 'json', :body => '{"configvar1":"foo","configvar2":"bar"}', :application => a1)
|
150
|
-
end
|
151
|
-
JSON.parse(Configuration[2].body)
|
152
|
-
|
153
|
-
{"configvar1"=>"foo", "configvar2"=>"bar"}
|
154
|
-
|
155
|
-
## database.yml inside Noah? Sure!
|
156
|
-
|
157
|
-
dbyaml = <<EOY
|
158
|
-
development:
|
159
|
-
adapter: mysql
|
160
|
-
database: rails_development
|
161
|
-
username: root
|
162
|
-
password: my super secret password
|
163
|
-
EOY
|
164
|
-
a2 = Application.create(:name => 'myrailsapp')
|
165
|
-
if a2.save
|
166
|
-
a2.configurations << Configuration.create(:name => 'database.yml', :format => 'yaml', :body => dbyaml, :application => a2)
|
167
|
-
end
|
168
|
-
puts YAML.dump(Configuration[3].body)
|
169
|
-
|
170
|
-
development:
|
171
|
-
adapter: mysql
|
172
|
-
database: rails_development
|
173
|
-
username: root
|
174
|
-
password: my super secret password
|
175
|
-
|
176
|
-
# Hosts and Services/Applications and Configurations
|
177
|
-
Host/Services and Applications/Configurations are almost the same thing with a few exceptions. Here are some basic facts:
|
178
|
-
|
179
|
-
* Hosts have many Services
|
180
|
-
* Applications have many Configurations
|
181
|
-
* Hosts and Services have a status - `up`,`down` or `pending`
|
182
|
-
|
183
|
-
The intention of the `status` field for Hosts and Services is that a service might, when starting up, set the appropriate status. Same goes for said service shutting down. This also applies to hosts (i.e. a curl PUT is sent to Noah during the boot process).
|
184
|
-
|
185
|
-
While an application might have different "configurations" based on environment (production, qa, dev), the Configuration object in Noah is intended to be more holistic i.e. these are the Configuration atoms (a yaml file, property X, property Y) that form the running configuration of an Application.
|
186
|
-
|
187
|
-
Here's a holistic example using a tomcat application:
|
188
|
-
|
189
|
-
* Host running tomcat comes up. It sets its status as "pending"
|
190
|
-
* Each service on the box starts up and sets its status to "pending" and finally "up" (think steps in the init script for the service)
|
191
|
-
* Tomcat (now in the role of `Application`) given a single property in a properties file called "bootstrap.url", grabs a list of `Configuration`atoms it needs to run. Let's say, by default, Tomcat starts up with all webapps disabled. Using the `Configuration` item `webapps`, it knows which ones to start up.
|
192
|
-
* Each webapp (an application under a different context root) now has the role of `Application` and the role of `Service`. As an application, the webapp would grab things that would normally be stored in a .properties file. Maybe even the log4j.xml file. In the role of `Service`, a given webapp might be an API endpoint and so it would have a hostname (a virtual host maybe?) and services associated with it. Each of those, has a `status`.
|
193
|
-
|
194
|
-
That might be confusing and it's a fairly overly-contrived example. A more comon use case would be the above where, instead of storing the database.yml on the server, the Rails application actually reads the file from Noah. Now that might not be too exciting but try this example:
|
195
|
-
|
196
|
-
* Rails application with memcached as part of the stack.
|
197
|
-
* Instead of a local configuration file, the list of memcached servers is a `Configuration` object belonging to the rails application's `Application` object.
|
198
|
-
* As new memcached servers are brought online, your CM tool (puppet or chef) updates Noah
|
199
|
-
* Your Rails application either via restarting (and thus rebootstrapping the list of memcached servers from Noah) or using the Watcher subsystem is instantly aware of those servers. You could fairly easily implement a custom Watcher that, when the list of memcached server changes, the Passenger restart file is written.
|
200
|
-
|
201
|
-
Make sense?
|
202
|
-
|
203
|
-
# Constraints
|
204
|
-
You can view all the constraints inside `models.rb` but here they are for now:
|
205
|
-
|
206
|
-
* A new host must have at least `name` and `status` set.
|
207
|
-
* A new service must have at least `name` and `status` set.
|
208
|
-
* Each Host `name` must be unique
|
209
|
-
* Each Service `name` per Host must be unique
|
210
|
-
* Each Application `name` must exist and be unique
|
211
|
-
* Each Configuration name per Application must be unique.
|
212
|
-
* Each Configuration must have `name`,`format` and `body`
|
1
|
+
# Noah
|
2
|
+
Noah is an application registry loosely based on [Apache ZooKeeper](http://zookeeper.apache.org)
|
213
3
|
|
4
|
+
What does that mean? From the ZooKeeper Home Page:
|
5
|
+
|
6
|
+
> ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. All of these kinds of services are used in some form or another by distributed applications.
|
7
|
+
|
8
|
+
Essentially Noah, is a port of those concepts into a stateless RESTful application.
|
9
|
+
|
10
|
+
## Quick Start
|
11
|
+
The quickstart guide has been moved to the wiki:
|
12
|
+
|
13
|
+
[Quick Start Guide](https://github.com/lusis/Noah/wiki/Quick-Start)
|
14
|
+
|
15
|
+
## Design Goals
|
16
|
+
Noah has a few basic design goals:
|
17
|
+
|
18
|
+
* The system **MUST** support RESTful interaction for operations where REST maps properly
|
19
|
+
* The system **MUST** support basic concepts of hosts, services, applications and configurations
|
20
|
+
* The system **MUST** support horizontal scaling.
|
21
|
+
|
22
|
+
Additionally:
|
23
|
+
|
24
|
+
* The system **SHOULD** be flexible in deployment options.
|
25
|
+
* The system **SHOULD** support watches similar to ZooKeeper
|
26
|
+
* The system **SHOULD** support pluggable callbacks for watches.
|
27
|
+
* The system **SHOULD** support being a client of itself.
|
28
|
+
|
29
|
+
## Opinionated Stack
|
30
|
+
Noah is somewhat opinionated in its stack. Noah attempts to minimize the external requirements wherever possible to allow for the widest possible installation options.
|
31
|
+
However, excellent work has been done to create performant and well-tested libraries that would be foolish to ignore. To this end, the current requirements are:
|
32
|
+
|
33
|
+
* [Redis 2.0](http://redis.io)
|
34
|
+
* [Sinatra](http://www.sinatrarb.com)
|
35
|
+
* [Ohm/Ohm-Contrib](http://ohm.keyvalue.org)
|
36
|
+
* [EventMachine](http://rubyeventmachine.com)
|
37
|
+
|
38
|
+
The above stack provides much of the functionality needed to port over ZooKeeper concepts.
|
39
|
+
|
40
|
+
### Redis
|
41
|
+
Redis is the backbone of the system. Through the native [datatypes](http://redis.io/commands) and [pubsub](http://redis.io/commands#pubsub) capabilities, much of the heavy lifting has already been done.
|
42
|
+
|
43
|
+
### Sinatra
|
44
|
+
Sinatra is the perfect library for creating API-only style applications. It allows you do focus on the meat of what an endpoint should do instead of the hassle of creating the endpoint.
|
45
|
+
|
46
|
+
### Ohm
|
47
|
+
Ohm is quite simply the most unobtrusive and flexible orm for Redis. It gets out of the way and allows you to very easily interact directly with Redis if the need arises
|
48
|
+
|
49
|
+
### EventMachine
|
50
|
+
EventMachine combined with Redis pubsub forms the basis of the Watcher and callback system.
|
51
|
+
|
52
|
+
## Motivation
|
53
|
+
It's something I've wanted to do for a while. Everytime I've needed something like Zookeeper, Zookeeper has always been too bulky and had too many moving parts. I've also always needed to interact with it from more than just Java or C. Sometimes it's been Ruby and sometimes it's been Python.
|
54
|
+
|
55
|
+
In the end, we reinvent the wheel ANYWAY. Maybe we do something like have our CM tool write our application config files with a list of memcached hosts. Maybe we write our own logic around (shudder) RMI to do some chatty broadcasting around the network for finding local nodes of type X. We always reinvent the wheel in some way.
|
56
|
+
|
57
|
+
## More information
|
58
|
+
Here are a list of some key [wiki](https://github.com/lusis/Noah/wiki) pages:
|
59
|
+
|
60
|
+
* [Concepts](https://github.com/lusis/Noah/wiki/Concepts)
|
61
|
+
How Noah views various object types in the system
|
62
|
+
* [API](https://github.com/lusis/Noah/wiki/Stablize-API)
|
63
|
+
The API is currently in draft state. It will be finalized before the 1.0 release.
|
64
|
+
* [Example Use Cases](https://github.com/lusis/Noah/wiki/Example-Use-Cases)
|
65
|
+
Some use cases for Noah and how it would fit into an existing application or infrastructure
|
66
|
+
* [Watchers and Callbacks](https://github.com/lusis/Noah/wiki/Watchers-and-Callbacks)
|
67
|
+
The general idea behind how Noah would implement watches
|
68
|
+
* [Watcher/Callback Examples](https://github.com/lusis/Noah/blob/master/examples/README.md)
|
69
|
+
Some example callbacks.
|