Merge lp:~eday/burrow/bootstrap into lp:~burrow-core/burrow/cactus
- bootstrap
- Merge into cactus
Status: | Merged |
---|---|
Approved by: | Eric Day |
Approved revision: | 2 |
Merged at revision: | 2 |
Proposed branch: | lp:~eday/burrow/bootstrap |
Merge into: | lp:~burrow-core/burrow/cactus |
Diff against target: |
738 lines (+661/-0) 14 files modified
.bzrignore (+4/-0) README (+52/-0) apps/burrow/src/burrow.app.src (+30/-0) apps/burrow/src/burrow.erl (+49/-0) apps/burrow/src/burrow_app.erl (+32/-0) apps/burrow/src/burrow_sup.erl (+32/-0) rebar.config (+20/-0) rel/files/app.config (+21/-0) rel/files/burrow (+155/-0) rel/files/erl (+34/-0) rel/files/nodetool (+138/-0) rel/files/vm.args (+32/-0) rel/reltool.config (+46/-0) start (+16/-0) |
To merge this branch: | bzr merge lp:~eday/burrow/bootstrap |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Devin Carlen | Approve | ||
Vish Ishaya | Approve | ||
Review via email: mp+50848@code.launchpad.net |
Commit message
Description of the change
Created initial OTP application and supervisor skeleton. Also includes README and configuration for building releases.
Eric Day (eday) wrote : | # |
I think there is still value in it to make sure I'm not screwing anything up. I can just commit straight to trunk and ping you guys if you'd rather not use this process though. :)
OpenStack Infra (hudson-openstack) wrote : | # |
The attempt to merge lp:~eday/burrow/bootstrap into lp:burrow failed. Below is the output from the failed tests.
/usr/bin/env: escript: No such file or directory
OpenStack Infra (hudson-openstack) wrote : | # |
The attempt to merge lp:~eday/burrow/bootstrap into lp:burrow failed. Below is the output from the failed tests.
==> burrow (compile)
Compiled src/burrow_app.erl
Compiled src/burrow.erl
Compiled src/burrow_sup.erl
==> rel (compile)
==> tmpzx6Ljg (compile)
==> burrow (eunit)
src/burrow.erl:41: can't find include lib "eunit/
src/burrow.erl:44: undefined macro 'assertEqual'
Preview Diff
1 | === added file '.bzrignore' | |||
2 | --- .bzrignore 1970-01-01 00:00:00 +0000 | |||
3 | +++ .bzrignore 2011-02-23 02:09:57 +0000 | |||
4 | @@ -0,0 +1,4 @@ | |||
5 | 1 | apps/burrow/.eunit/ | ||
6 | 2 | apps/burrow/doc | ||
7 | 3 | apps/burrow/ebin | ||
8 | 4 | rel/burrow/ | ||
9 | 0 | 5 | ||
10 | === added file 'README' | |||
11 | --- README 1970-01-01 00:00:00 +0000 | |||
12 | +++ README 2011-02-23 02:09:57 +0000 | |||
13 | @@ -0,0 +1,52 @@ | |||
14 | 1 | # Copyright (C) 2011 OpenStack LLC. | ||
15 | 2 | # | ||
16 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
17 | 4 | # you may not use this file except in compliance with the License. | ||
18 | 5 | # You may obtain a copy of the License at | ||
19 | 6 | # | ||
20 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
21 | 8 | # | ||
22 | 9 | # Unless required by applicable law or agreed to in writing, software | ||
23 | 10 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
24 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
25 | 12 | # See the License for the specific language governing permissions and | ||
26 | 13 | # limitations under the License. | ||
27 | 14 | |||
28 | 15 | Welcome to Burrow, the OpenStack Queue Service! | ||
29 | 16 | |||
30 | 17 | To build the source, run: | ||
31 | 18 | |||
32 | 19 | ./rebar compile | ||
33 | 20 | |||
34 | 21 | To start Burrow directly from the source after compiling, run: | ||
35 | 22 | |||
36 | 23 | ./start | ||
37 | 24 | |||
38 | 25 | To run the unittests and produce coverage output, run: | ||
39 | 26 | |||
40 | 27 | ./rebar compile eunit | ||
41 | 28 | |||
42 | 29 | To build the code documentation (output in apps/burrow/doc), run: | ||
43 | 30 | |||
44 | 31 | ./rebar doc | ||
45 | 32 | |||
46 | 33 | To build a release, run: | ||
47 | 34 | |||
48 | 35 | ./rebar generate | ||
49 | 36 | |||
50 | 37 | To start and stop the release, run: | ||
51 | 38 | |||
52 | 39 | ./rel/burrow/bin/burrow <start|stop> | ||
53 | 40 | |||
54 | 41 | To run the release attached to a console, run: | ||
55 | 42 | |||
56 | 43 | ./rel/burrow/bin/burrow console | ||
57 | 44 | |||
58 | 45 | If you would like more information on this project, see: | ||
59 | 46 | |||
60 | 47 | https://launchpad.net/burrow | ||
61 | 48 | http://wiki.openstack.org/QueueService | ||
62 | 49 | |||
63 | 50 | For information on the mailing list, IRC, and contributing, see: | ||
64 | 51 | |||
65 | 52 | http://wiki.openstack.org/HowToContribute | ||
66 | 0 | 53 | ||
67 | === added directory 'apps' | |||
68 | === added directory 'apps/burrow' | |||
69 | === added directory 'apps/burrow/src' | |||
70 | === added file 'apps/burrow/src/burrow.app.src' | |||
71 | --- apps/burrow/src/burrow.app.src 1970-01-01 00:00:00 +0000 | |||
72 | +++ apps/burrow/src/burrow.app.src 2011-02-23 02:09:57 +0000 | |||
73 | @@ -0,0 +1,30 @@ | |||
74 | 1 | % Copyright (C) 2011 OpenStack LLC. | ||
75 | 2 | % | ||
76 | 3 | % Licensed under the Apache License, Version 2.0 (the "License"); | ||
77 | 4 | % you may not use this file except in compliance with the License. | ||
78 | 5 | % You may obtain a copy of the License at | ||
79 | 6 | % | ||
80 | 7 | % http://www.apache.org/licenses/LICENSE-2.0 | ||
81 | 8 | % | ||
82 | 9 | % Unless required by applicable law or agreed to in writing, software | ||
83 | 10 | % distributed under the License is distributed on an "AS IS" BASIS, | ||
84 | 11 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
85 | 12 | % See the License for the specific language governing permissions and | ||
86 | 13 | % limitations under the License. | ||
87 | 14 | |||
88 | 15 | {application, burrow, [ | ||
89 | 16 | {description, "Burrow - OpenStack Queue Service"}, | ||
90 | 17 | {vsn, "2011.2"}, | ||
91 | 18 | {modules, [ | ||
92 | 19 | burrow, | ||
93 | 20 | burrow_app, | ||
94 | 21 | burrow_sup | ||
95 | 22 | ]}, | ||
96 | 23 | {applications, [ | ||
97 | 24 | kernel, | ||
98 | 25 | stdlib | ||
99 | 26 | ]}, | ||
100 | 27 | {registered, []}, | ||
101 | 28 | {mod, {burrow_app, []}}, | ||
102 | 29 | {env, []} | ||
103 | 30 | ]}. | ||
104 | 0 | 31 | ||
105 | === added file 'apps/burrow/src/burrow.erl' | |||
106 | --- apps/burrow/src/burrow.erl 1970-01-01 00:00:00 +0000 | |||
107 | +++ apps/burrow/src/burrow.erl 2011-02-23 02:09:57 +0000 | |||
108 | @@ -0,0 +1,49 @@ | |||
109 | 1 | % Copyright (C) 2011 OpenStack LLC. | ||
110 | 2 | % | ||
111 | 3 | % Licensed under the Apache License, Version 2.0 (the "License"); | ||
112 | 4 | % you may not use this file except in compliance with the License. | ||
113 | 5 | % You may obtain a copy of the License at | ||
114 | 6 | % | ||
115 | 7 | % http://www.apache.org/licenses/LICENSE-2.0 | ||
116 | 8 | % | ||
117 | 9 | % Unless required by applicable law or agreed to in writing, software | ||
118 | 10 | % distributed under the License is distributed on an "AS IS" BASIS, | ||
119 | 11 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
120 | 12 | % See the License for the specific language governing permissions and | ||
121 | 13 | % limitations under the License. | ||
122 | 14 | |||
123 | 15 | % @doc Main functions for Burrow. | ||
124 | 16 | |||
125 | 17 | -module(burrow). | ||
126 | 18 | |||
127 | 19 | -export([start/0, stop/0, restart/0]). | ||
128 | 20 | |||
129 | 21 | % @doc Start Burrow. | ||
130 | 22 | start() -> | ||
131 | 23 | application:start(?MODULE). | ||
132 | 24 | |||
133 | 25 | % @doc Stop Burrow. | ||
134 | 26 | stop() -> | ||
135 | 27 | application:stop(?MODULE). | ||
136 | 28 | |||
137 | 29 | % @doc Restart Burrow. | ||
138 | 30 | restart() -> | ||
139 | 31 | case stop() of | ||
140 | 32 | ok -> start(); | ||
141 | 33 | Error -> Error | ||
142 | 34 | end. | ||
143 | 35 | |||
144 | 36 | % | ||
145 | 37 | % Test functions. | ||
146 | 38 | % | ||
147 | 39 | |||
148 | 40 | -ifdef(TEST). | ||
149 | 41 | -include_lib("eunit/include/eunit.hrl"). | ||
150 | 42 | |||
151 | 43 | application_test() -> | ||
152 | 44 | ?assertEqual(ok, start()), | ||
153 | 45 | ?assertEqual(ok, restart()), | ||
154 | 46 | ?assertEqual(ok, stop()), | ||
155 | 47 | ?assertEqual({error, {not_started, burrow}}, restart()). | ||
156 | 48 | |||
157 | 49 | -endif. | ||
158 | 0 | 50 | ||
159 | === added file 'apps/burrow/src/burrow_app.erl' | |||
160 | --- apps/burrow/src/burrow_app.erl 1970-01-01 00:00:00 +0000 | |||
161 | +++ apps/burrow/src/burrow_app.erl 2011-02-23 02:09:57 +0000 | |||
162 | @@ -0,0 +1,32 @@ | |||
163 | 1 | % Copyright (C) 2011 OpenStack LLC. | ||
164 | 2 | % | ||
165 | 3 | % Licensed under the Apache License, Version 2.0 (the "License"); | ||
166 | 4 | % you may not use this file except in compliance with the License. | ||
167 | 5 | % You may obtain a copy of the License at | ||
168 | 6 | % | ||
169 | 7 | % http://www.apache.org/licenses/LICENSE-2.0 | ||
170 | 8 | % | ||
171 | 9 | % Unless required by applicable law or agreed to in writing, software | ||
172 | 10 | % distributed under the License is distributed on an "AS IS" BASIS, | ||
173 | 11 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
174 | 12 | % See the License for the specific language governing permissions and | ||
175 | 13 | % limitations under the License. | ||
176 | 14 | |||
177 | 15 | % @doc Application module for burrow. This contains callbacks for the | ||
178 | 16 | % application behaviour. | ||
179 | 17 | |||
180 | 18 | -module(burrow_app). | ||
181 | 19 | |||
182 | 20 | -behaviour(application). | ||
183 | 21 | -export([start/2, stop/1]). | ||
184 | 22 | |||
185 | 23 | % @doc Start callback for the application behaviour. This starts the root | ||
186 | 24 | % supervisor process and all components of the server. See application(3erl) | ||
187 | 25 | % for more details. | ||
188 | 26 | start(_Type, _Args) -> | ||
189 | 27 | burrow_sup:start_link(). | ||
190 | 28 | |||
191 | 29 | % @doc Stop callback for the application behaviour. See application(3erl) | ||
192 | 30 | % for more details. | ||
193 | 31 | stop(_State) -> | ||
194 | 32 | ok. | ||
195 | 0 | 33 | ||
196 | === added file 'apps/burrow/src/burrow_sup.erl' | |||
197 | --- apps/burrow/src/burrow_sup.erl 1970-01-01 00:00:00 +0000 | |||
198 | +++ apps/burrow/src/burrow_sup.erl 2011-02-23 02:09:57 +0000 | |||
199 | @@ -0,0 +1,32 @@ | |||
200 | 1 | % Copyright (C) 2011 OpenStack LLC. | ||
201 | 2 | % | ||
202 | 3 | % Licensed under the Apache License, Version 2.0 (the "License"); | ||
203 | 4 | % you may not use this file except in compliance with the License. | ||
204 | 5 | % You may obtain a copy of the License at | ||
205 | 6 | % | ||
206 | 7 | % http://www.apache.org/licenses/LICENSE-2.0 | ||
207 | 8 | % | ||
208 | 9 | % Unless required by applicable law or agreed to in writing, software | ||
209 | 10 | % distributed under the License is distributed on an "AS IS" BASIS, | ||
210 | 11 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
211 | 12 | % See the License for the specific language governing permissions and | ||
212 | 13 | % limitations under the License. | ||
213 | 14 | |||
214 | 15 | % @doc Supervisor module for burrow. This contains callbacks for the root | ||
215 | 16 | % supervisor behaviour. | ||
216 | 17 | |||
217 | 18 | -module(burrow_sup). | ||
218 | 19 | |||
219 | 20 | -export([start_link/0]). | ||
220 | 21 | |||
221 | 22 | -behaviour(supervisor). | ||
222 | 23 | -export([init/1]). | ||
223 | 24 | |||
224 | 25 | % @doc Start and link to the supervisor process. | ||
225 | 26 | start_link() -> | ||
226 | 27 | supervisor:start_link({local, ?MODULE}, ?MODULE, []). | ||
227 | 28 | |||
228 | 29 | % @doc Callback for the supervisor behaviour. See supervisor(3erl) for | ||
229 | 30 | % more details. | ||
230 | 31 | init([]) -> | ||
231 | 32 | {ok, {{one_for_one, 5, 10}, []}}. | ||
232 | 0 | 33 | ||
233 | === added file 'rebar' | |||
234 | 1 | Binary files rebar 1970-01-01 00:00:00 +0000 and rebar 2011-02-23 02:09:57 +0000 differ | 34 | Binary files rebar 1970-01-01 00:00:00 +0000 and rebar 2011-02-23 02:09:57 +0000 differ |
235 | === added file 'rebar.config' | |||
236 | --- rebar.config 1970-01-01 00:00:00 +0000 | |||
237 | +++ rebar.config 2011-02-23 02:09:57 +0000 | |||
238 | @@ -0,0 +1,20 @@ | |||
239 | 1 | % Copyright (C) 2011 OpenStack LLC. | ||
240 | 2 | % | ||
241 | 3 | % Licensed under the Apache License, Version 2.0 (the "License"); | ||
242 | 4 | % you may not use this file except in compliance with the License. | ||
243 | 5 | % You may obtain a copy of the License at | ||
244 | 6 | % | ||
245 | 7 | % http://www.apache.org/licenses/LICENSE-2.0 | ||
246 | 8 | % | ||
247 | 9 | % Unless required by applicable law or agreed to in writing, software | ||
248 | 10 | % distributed under the License is distributed on an "AS IS" BASIS, | ||
249 | 11 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
250 | 12 | % See the License for the specific language governing permissions and | ||
251 | 13 | % limitations under the License. | ||
252 | 14 | |||
253 | 15 | {sub_dirs, [ | ||
254 | 16 | "apps/burrow", | ||
255 | 17 | "rel" | ||
256 | 18 | ]}. | ||
257 | 19 | |||
258 | 20 | {cover_enabled, true}. | ||
259 | 0 | 21 | ||
260 | === added directory 'rel' | |||
261 | === added directory 'rel/files' | |||
262 | === added file 'rel/files/app.config' | |||
263 | --- rel/files/app.config 1970-01-01 00:00:00 +0000 | |||
264 | +++ rel/files/app.config 2011-02-23 02:09:57 +0000 | |||
265 | @@ -0,0 +1,21 @@ | |||
266 | 1 | % Copyright (C) 2011 OpenStack LLC. | ||
267 | 2 | % | ||
268 | 3 | % Licensed under the Apache License, Version 2.0 (the "License"); | ||
269 | 4 | % you may not use this file except in compliance with the License. | ||
270 | 5 | % You may obtain a copy of the License at | ||
271 | 6 | % | ||
272 | 7 | % http://www.apache.org/licenses/LICENSE-2.0 | ||
273 | 8 | % | ||
274 | 9 | % Unless required by applicable law or agreed to in writing, software | ||
275 | 10 | % distributed under the License is distributed on an "AS IS" BASIS, | ||
276 | 11 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
277 | 12 | % See the License for the specific language governing permissions and | ||
278 | 13 | % limitations under the License. | ||
279 | 14 | |||
280 | 15 | [{sasl, [ | ||
281 | 16 | {sasl_error_logger, {file, "log/sasl-error.log"}}, | ||
282 | 17 | {errlog_type, error}, | ||
283 | 18 | {error_logger_mf_dir, "log/sasl"}, % Log directory | ||
284 | 19 | {error_logger_mf_maxbytes, 10485760}, % 10 MB max file size | ||
285 | 20 | {error_logger_mf_maxfiles, 5} % 5 files max | ||
286 | 21 | ]}]. | ||
287 | 0 | 22 | ||
288 | === added file 'rel/files/burrow' | |||
289 | --- rel/files/burrow 1970-01-01 00:00:00 +0000 | |||
290 | +++ rel/files/burrow 2011-02-23 02:09:57 +0000 | |||
291 | @@ -0,0 +1,155 @@ | |||
292 | 1 | #!/bin/bash | ||
293 | 2 | # -*- tab-width:4;indent-tabs-mode:nil -*- | ||
294 | 3 | # ex: ts=4 sw=4 et | ||
295 | 4 | |||
296 | 5 | RUNNER_SCRIPT_DIR=$(cd ${0%/*} && pwd) | ||
297 | 6 | |||
298 | 7 | RUNNER_BASE_DIR=${RUNNER_SCRIPT_DIR%/*} | ||
299 | 8 | RUNNER_ETC_DIR=$RUNNER_BASE_DIR/etc | ||
300 | 9 | RUNNER_LOG_DIR=$RUNNER_BASE_DIR/log | ||
301 | 10 | # Note the trailing slash on $PIPE_DIR/ | ||
302 | 11 | PIPE_DIR=/tmp/$RUNNER_BASE_DIR/ | ||
303 | 12 | RUNNER_USER= | ||
304 | 13 | |||
305 | 14 | # Make sure this script is running as the appropriate user | ||
306 | 15 | if [ ! -z "$RUNNER_USER" ] && [ `whoami` != "$RUNNER_USER" ]; then | ||
307 | 16 | exec sudo -u $RUNNER_USER -i $0 $@ | ||
308 | 17 | fi | ||
309 | 18 | |||
310 | 19 | # Make sure CWD is set to runner base dir | ||
311 | 20 | cd $RUNNER_BASE_DIR | ||
312 | 21 | |||
313 | 22 | # Make sure log directory exists | ||
314 | 23 | mkdir -p $RUNNER_LOG_DIR | ||
315 | 24 | |||
316 | 25 | # Extract the target node name from node.args | ||
317 | 26 | NAME_ARG=`grep -e '-[s]*name' $RUNNER_ETC_DIR/vm.args` | ||
318 | 27 | if [ -z "$NAME_ARG" ]; then | ||
319 | 28 | echo "vm.args needs to have either -name or -sname parameter." | ||
320 | 29 | exit 1 | ||
321 | 30 | fi | ||
322 | 31 | |||
323 | 32 | # Extract the target cookie | ||
324 | 33 | COOKIE_ARG=`grep -e '-setcookie' $RUNNER_ETC_DIR/vm.args` | ||
325 | 34 | if [ -z "$COOKIE_ARG" ]; then | ||
326 | 35 | echo "vm.args needs to have a -setcookie parameter." | ||
327 | 36 | exit 1 | ||
328 | 37 | fi | ||
329 | 38 | |||
330 | 39 | # Identify the script name | ||
331 | 40 | SCRIPT=`basename $0` | ||
332 | 41 | |||
333 | 42 | # Parse out release and erts info | ||
334 | 43 | START_ERL=`cat $RUNNER_BASE_DIR/releases/start_erl.data` | ||
335 | 44 | ERTS_VSN=${START_ERL% *} | ||
336 | 45 | APP_VSN=${START_ERL#* } | ||
337 | 46 | |||
338 | 47 | # Add ERTS bin dir to our path | ||
339 | 48 | ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin | ||
340 | 49 | |||
341 | 50 | # Setup command to control the node | ||
342 | 51 | NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG" | ||
343 | 52 | |||
344 | 53 | # Check the first argument for instructions | ||
345 | 54 | case "$1" in | ||
346 | 55 | start) | ||
347 | 56 | # Make sure there is not already a node running | ||
348 | 57 | RES=`$NODETOOL ping` | ||
349 | 58 | if [ "$RES" = "pong" ]; then | ||
350 | 59 | echo "Node is already running!" | ||
351 | 60 | exit 1 | ||
352 | 61 | fi | ||
353 | 62 | HEART_COMMAND="$RUNNER_BASE_DIR/bin/$SCRIPT start" | ||
354 | 63 | export HEART_COMMAND | ||
355 | 64 | mkdir -p $PIPE_DIR | ||
356 | 65 | $ERTS_PATH/run_erl -daemon $PIPE_DIR $RUNNER_LOG_DIR "exec $RUNNER_BASE_DIR/bin/$SCRIPT console" 2>&1 | ||
357 | 66 | ;; | ||
358 | 67 | |||
359 | 68 | stop) | ||
360 | 69 | # Wait for the node to completely stop... | ||
361 | 70 | case `uname -s` in | ||
362 | 71 | Linux|Darwin|FreeBSD|DragonFly|NetBSD|OpenBSD) | ||
363 | 72 | # PID COMMAND | ||
364 | 73 | PID=`ps ax -o pid= -o command=|\ | ||
365 | 74 | grep "$RUNNER_BASE_DIR/.*/[b]eam"|awk '{print $1}'` | ||
366 | 75 | ;; | ||
367 | 76 | SunOS) | ||
368 | 77 | # PID COMMAND | ||
369 | 78 | PID=`ps -ef -o pid= -o args=|\ | ||
370 | 79 | grep "$RUNNER_BASE_DIR/.*/[b]eam"|awk '{print $1}'` | ||
371 | 80 | ;; | ||
372 | 81 | CYGWIN*) | ||
373 | 82 | # UID PID PPID TTY STIME COMMAND | ||
374 | 83 | PID=`ps -efW|grep "$RUNNER_BASE_DIR/.*/[b]eam"|awk '{print $2}'` | ||
375 | 84 | ;; | ||
376 | 85 | esac | ||
377 | 86 | $NODETOOL stop | ||
378 | 87 | while `kill -0 $PID 2>/dev/null`; | ||
379 | 88 | do | ||
380 | 89 | sleep 1 | ||
381 | 90 | done | ||
382 | 91 | ;; | ||
383 | 92 | |||
384 | 93 | restart) | ||
385 | 94 | ## Restart the VM without exiting the process | ||
386 | 95 | $NODETOOL restart | ||
387 | 96 | ;; | ||
388 | 97 | |||
389 | 98 | reboot) | ||
390 | 99 | ## Restart the VM completely (uses heart to restart it) | ||
391 | 100 | $NODETOOL reboot | ||
392 | 101 | ;; | ||
393 | 102 | |||
394 | 103 | ping) | ||
395 | 104 | ## See if the VM is alive | ||
396 | 105 | $NODETOOL ping | ||
397 | 106 | ;; | ||
398 | 107 | |||
399 | 108 | attach) | ||
400 | 109 | # Make sure a node IS running | ||
401 | 110 | RES=`$NODETOOL ping` | ||
402 | 111 | if [ "$RES" != "pong" ]; then | ||
403 | 112 | echo "Node is not running!" | ||
404 | 113 | exit 1 | ||
405 | 114 | fi | ||
406 | 115 | |||
407 | 116 | shift | ||
408 | 117 | $ERTS_PATH/to_erl $PIPE_DIR | ||
409 | 118 | ;; | ||
410 | 119 | |||
411 | 120 | console|console_clean) | ||
412 | 121 | # .boot file typically just $SCRIPT (ie, the app name) | ||
413 | 122 | # however, for debugging, sometimes start_clean.boot is useful: | ||
414 | 123 | case "$1" in | ||
415 | 124 | console) BOOTFILE=$SCRIPT ;; | ||
416 | 125 | console_clean) BOOTFILE=start_clean ;; | ||
417 | 126 | esac | ||
418 | 127 | # Setup beam-required vars | ||
419 | 128 | ROOTDIR=$RUNNER_BASE_DIR | ||
420 | 129 | BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin | ||
421 | 130 | EMU=beam | ||
422 | 131 | PROGNAME=`echo $0 | sed 's/.*\\///'` | ||
423 | 132 | CMD="$BINDIR/erlexec -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -embedded -config $RUNNER_ETC_DIR/app.config -args_file $RUNNER_ETC_DIR/vm.args -- ${1+"$@"}" | ||
424 | 133 | export EMU | ||
425 | 134 | export ROOTDIR | ||
426 | 135 | export BINDIR | ||
427 | 136 | export PROGNAME | ||
428 | 137 | |||
429 | 138 | # Dump environment info for logging purposes | ||
430 | 139 | echo "Exec: $CMD" | ||
431 | 140 | echo "Root: $ROOTDIR" | ||
432 | 141 | |||
433 | 142 | # Log the startup | ||
434 | 143 | logger -t "$SCRIPT[$$]" "Starting up" | ||
435 | 144 | |||
436 | 145 | # Start the VM | ||
437 | 146 | exec $CMD | ||
438 | 147 | ;; | ||
439 | 148 | |||
440 | 149 | *) | ||
441 | 150 | echo "Usage: $SCRIPT {start|stop|restart|reboot|ping|console|attach}" | ||
442 | 151 | exit 1 | ||
443 | 152 | ;; | ||
444 | 153 | esac | ||
445 | 154 | |||
446 | 155 | exit 0 | ||
447 | 0 | 156 | ||
448 | === added file 'rel/files/erl' | |||
449 | --- rel/files/erl 1970-01-01 00:00:00 +0000 | |||
450 | +++ rel/files/erl 2011-02-23 02:09:57 +0000 | |||
451 | @@ -0,0 +1,34 @@ | |||
452 | 1 | #!/bin/bash | ||
453 | 2 | |||
454 | 3 | ## This script replaces the default "erl" in erts-VSN/bin. This is necessary | ||
455 | 4 | ## as escript depends on erl and in turn, erl depends on having access to a | ||
456 | 5 | ## bootscript (start.boot). Note that this script is ONLY invoked as a side-effect | ||
457 | 6 | ## of running escript -- the embedded node bypasses erl and uses erlexec directly | ||
458 | 7 | ## (as it should). | ||
459 | 8 | ## | ||
460 | 9 | ## Note that this script makes the assumption that there is a start_clean.boot | ||
461 | 10 | ## file available in $ROOTDIR/release/VSN. | ||
462 | 11 | |||
463 | 12 | # Determine the abspath of where this script is executing from. | ||
464 | 13 | ERTS_BIN_DIR=$(cd ${0%/*} && pwd) | ||
465 | 14 | |||
466 | 15 | # Now determine the root directory -- this script runs from erts-VSN/bin, | ||
467 | 16 | # so we simply need to strip off two dirs from the end of the ERTS_BIN_DIR | ||
468 | 17 | # path. | ||
469 | 18 | ROOTDIR=${ERTS_BIN_DIR%/*/*} | ||
470 | 19 | |||
471 | 20 | # Parse out release and erts info | ||
472 | 21 | START_ERL=`cat $ROOTDIR/releases/start_erl.data` | ||
473 | 22 | ERTS_VSN=${START_ERL% *} | ||
474 | 23 | APP_VSN=${START_ERL#* } | ||
475 | 24 | |||
476 | 25 | BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin | ||
477 | 26 | EMU=beam | ||
478 | 27 | PROGNAME=`echo $0 | sed 's/.*\\///'` | ||
479 | 28 | CMD="$BINDIR/erlexec" | ||
480 | 29 | export EMU | ||
481 | 30 | export ROOTDIR | ||
482 | 31 | export BINDIR | ||
483 | 32 | export PROGNAME | ||
484 | 33 | |||
485 | 34 | exec $CMD -boot $ROOTDIR/releases/$APP_VSN/start_clean ${1+"$@"} | ||
486 | 0 | \ No newline at end of file | 35 | \ No newline at end of file |
487 | 1 | 36 | ||
488 | === added file 'rel/files/nodetool' | |||
489 | --- rel/files/nodetool 1970-01-01 00:00:00 +0000 | |||
490 | +++ rel/files/nodetool 2011-02-23 02:09:57 +0000 | |||
491 | @@ -0,0 +1,138 @@ | |||
492 | 1 | %% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- | ||
493 | 2 | %% ex: ft=erlang ts=4 sw=4 et | ||
494 | 3 | %% ------------------------------------------------------------------- | ||
495 | 4 | %% | ||
496 | 5 | %% nodetool: Helper Script for interacting with live nodes | ||
497 | 6 | %% | ||
498 | 7 | %% ------------------------------------------------------------------- | ||
499 | 8 | |||
500 | 9 | main(Args) -> | ||
501 | 10 | ok = start_epmd(), | ||
502 | 11 | %% Extract the args | ||
503 | 12 | {RestArgs, TargetNode} = process_args(Args, [], undefined), | ||
504 | 13 | |||
505 | 14 | %% See if the node is currently running -- if it's not, we'll bail | ||
506 | 15 | case {net_kernel:hidden_connect_node(TargetNode), net_adm:ping(TargetNode)} of | ||
507 | 16 | {true, pong} -> | ||
508 | 17 | ok; | ||
509 | 18 | {_, pang} -> | ||
510 | 19 | io:format("Node ~p not responding to pings.\n", [TargetNode]), | ||
511 | 20 | halt(1) | ||
512 | 21 | end, | ||
513 | 22 | |||
514 | 23 | case RestArgs of | ||
515 | 24 | ["ping"] -> | ||
516 | 25 | %% If we got this far, the node already responsed to a ping, so just dump | ||
517 | 26 | %% a "pong" | ||
518 | 27 | io:format("pong\n"); | ||
519 | 28 | ["stop"] -> | ||
520 | 29 | io:format("~p\n", [rpc:call(TargetNode, init, stop, [], 60000)]); | ||
521 | 30 | ["restart"] -> | ||
522 | 31 | io:format("~p\n", [rpc:call(TargetNode, init, restart, [], 60000)]); | ||
523 | 32 | ["reboot"] -> | ||
524 | 33 | io:format("~p\n", [rpc:call(TargetNode, init, reboot, [], 60000)]); | ||
525 | 34 | ["rpc", Module, Function | RpcArgs] -> | ||
526 | 35 | case rpc:call(TargetNode, list_to_atom(Module), list_to_atom(Function), | ||
527 | 36 | [RpcArgs], 60000) of | ||
528 | 37 | ok -> | ||
529 | 38 | ok; | ||
530 | 39 | {badrpc, Reason} -> | ||
531 | 40 | io:format("RPC to ~p failed: ~p\n", [TargetNode, Reason]), | ||
532 | 41 | halt(1); | ||
533 | 42 | _ -> | ||
534 | 43 | halt(1) | ||
535 | 44 | end; | ||
536 | 45 | ["rpcterms", Module, Function, ArgsAsString] -> | ||
537 | 46 | case rpc:call(TargetNode, list_to_atom(Module), list_to_atom(Function), | ||
538 | 47 | consult(ArgsAsString), 60000) of | ||
539 | 48 | {badrpc, Reason} -> | ||
540 | 49 | io:format("RPC to ~p failed: ~p\n", [TargetNode, Reason]), | ||
541 | 50 | halt(1); | ||
542 | 51 | Other -> | ||
543 | 52 | io:format("~p\n", [Other]) | ||
544 | 53 | end; | ||
545 | 54 | Other -> | ||
546 | 55 | io:format("Other: ~p\n", [Other]), | ||
547 | 56 | io:format("Usage: nodetool {ping|stop|restart|reboot}\n") | ||
548 | 57 | end, | ||
549 | 58 | net_kernel:stop(). | ||
550 | 59 | |||
551 | 60 | process_args([], Acc, TargetNode) -> | ||
552 | 61 | {lists:reverse(Acc), TargetNode}; | ||
553 | 62 | process_args(["-setcookie", Cookie | Rest], Acc, TargetNode) -> | ||
554 | 63 | erlang:set_cookie(node(), list_to_atom(Cookie)), | ||
555 | 64 | process_args(Rest, Acc, TargetNode); | ||
556 | 65 | process_args(["-name", TargetName | Rest], Acc, _) -> | ||
557 | 66 | ThisNode = append_node_suffix(TargetName, "_maint_"), | ||
558 | 67 | {ok, _} = net_kernel:start([ThisNode, longnames]), | ||
559 | 68 | process_args(Rest, Acc, nodename(TargetName)); | ||
560 | 69 | process_args(["-sname", TargetName | Rest], Acc, _) -> | ||
561 | 70 | ThisNode = append_node_suffix(TargetName, "_maint_"), | ||
562 | 71 | {ok, _} = net_kernel:start([ThisNode, shortnames]), | ||
563 | 72 | process_args(Rest, Acc, nodename(TargetName)); | ||
564 | 73 | process_args([Arg | Rest], Acc, Opts) -> | ||
565 | 74 | process_args(Rest, [Arg | Acc], Opts). | ||
566 | 75 | |||
567 | 76 | |||
568 | 77 | start_epmd() -> | ||
569 | 78 | [] = os:cmd(epmd_path() ++ " -daemon"), | ||
570 | 79 | ok. | ||
571 | 80 | |||
572 | 81 | epmd_path() -> | ||
573 | 82 | ErtsBinDir = filename:dirname(escript:script_name()), | ||
574 | 83 | Name = "epmd", | ||
575 | 84 | case os:find_executable(Name, ErtsBinDir) of | ||
576 | 85 | false -> | ||
577 | 86 | case os:find_executable(Name) of | ||
578 | 87 | false -> | ||
579 | 88 | io:format("Could not find epmd.~n"), | ||
580 | 89 | halt(1); | ||
581 | 90 | GlobalEpmd -> | ||
582 | 91 | GlobalEpmd | ||
583 | 92 | end; | ||
584 | 93 | Epmd -> | ||
585 | 94 | Epmd | ||
586 | 95 | end. | ||
587 | 96 | |||
588 | 97 | |||
589 | 98 | nodename(Name) -> | ||
590 | 99 | case string:tokens(Name, "@") of | ||
591 | 100 | [_Node, _Host] -> | ||
592 | 101 | list_to_atom(Name); | ||
593 | 102 | [Node] -> | ||
594 | 103 | [_, Host] = string:tokens(atom_to_list(node()), "@"), | ||
595 | 104 | list_to_atom(lists:concat([Node, "@", Host])) | ||
596 | 105 | end. | ||
597 | 106 | |||
598 | 107 | append_node_suffix(Name, Suffix) -> | ||
599 | 108 | case string:tokens(Name, "@") of | ||
600 | 109 | [Node, Host] -> | ||
601 | 110 | list_to_atom(lists:concat([Node, Suffix, os:getpid(), "@", Host])); | ||
602 | 111 | [Node] -> | ||
603 | 112 | list_to_atom(lists:concat([Node, Suffix, os:getpid()])) | ||
604 | 113 | end. | ||
605 | 114 | |||
606 | 115 | |||
607 | 116 | %% | ||
608 | 117 | %% Given a string or binary, parse it into a list of terms, ala file:consult/0 | ||
609 | 118 | %% | ||
610 | 119 | consult(Str) when is_list(Str) -> | ||
611 | 120 | consult([], Str, []); | ||
612 | 121 | consult(Bin) when is_binary(Bin)-> | ||
613 | 122 | consult([], binary_to_list(Bin), []). | ||
614 | 123 | |||
615 | 124 | consult(Cont, Str, Acc) -> | ||
616 | 125 | case erl_scan:tokens(Cont, Str, 0) of | ||
617 | 126 | {done, Result, Remaining} -> | ||
618 | 127 | case Result of | ||
619 | 128 | {ok, Tokens, _} -> | ||
620 | 129 | {ok, Term} = erl_parse:parse_term(Tokens), | ||
621 | 130 | consult([], Remaining, [Term | Acc]); | ||
622 | 131 | {eof, _Other} -> | ||
623 | 132 | lists:reverse(Acc); | ||
624 | 133 | {error, Info, _} -> | ||
625 | 134 | {error, Info} | ||
626 | 135 | end; | ||
627 | 136 | {more, Cont1} -> | ||
628 | 137 | consult(Cont1, eof, Acc) | ||
629 | 138 | end. | ||
630 | 0 | 139 | ||
631 | === added file 'rel/files/vm.args' | |||
632 | --- rel/files/vm.args 1970-01-01 00:00:00 +0000 | |||
633 | +++ rel/files/vm.args 2011-02-23 02:09:57 +0000 | |||
634 | @@ -0,0 +1,32 @@ | |||
635 | 1 | # Copyright (C) 2011 OpenStack LLC. | ||
636 | 2 | # | ||
637 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
638 | 4 | # you may not use this file except in compliance with the License. | ||
639 | 5 | # You may obtain a copy of the License at | ||
640 | 6 | # | ||
641 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
642 | 8 | # | ||
643 | 9 | # Unless required by applicable law or agreed to in writing, software | ||
644 | 10 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
645 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
646 | 12 | # See the License for the specific language governing permissions and | ||
647 | 13 | # limitations under the License. | ||
648 | 14 | |||
649 | 15 | # Name of the node | ||
650 | 16 | -name burrow@127.0.0.1 | ||
651 | 17 | |||
652 | 18 | # Cookie for distributed erlang | ||
653 | 19 | -setcookie burrow | ||
654 | 20 | |||
655 | 21 | # Heartbeat management; auto-restarts VM if it dies or becomes unresponsive | ||
656 | 22 | # (Disabled by default..use with caution!) | ||
657 | 23 | #-heart | ||
658 | 24 | |||
659 | 25 | # Enable kernel polling | ||
660 | 26 | +K true | ||
661 | 27 | |||
662 | 28 | # Increase number of concurrent ports/sockets | ||
663 | 29 | -env ERL_MAX_PORTS 16384 | ||
664 | 30 | |||
665 | 31 | # Tweak GC to run more often | ||
666 | 32 | -env ERL_FULLSWEEP_AFTER 10 | ||
667 | 0 | 33 | ||
668 | === added file 'rel/reltool.config' | |||
669 | --- rel/reltool.config 1970-01-01 00:00:00 +0000 | |||
670 | +++ rel/reltool.config 2011-02-23 02:09:57 +0000 | |||
671 | @@ -0,0 +1,46 @@ | |||
672 | 1 | % Copyright (C) 2011 OpenStack LLC. | ||
673 | 2 | % | ||
674 | 3 | % Licensed under the Apache License, Version 2.0 (the "License"); | ||
675 | 4 | % you may not use this file except in compliance with the License. | ||
676 | 5 | % You may obtain a copy of the License at | ||
677 | 6 | % | ||
678 | 7 | % http://www.apache.org/licenses/LICENSE-2.0 | ||
679 | 8 | % | ||
680 | 9 | % Unless required by applicable law or agreed to in writing, software | ||
681 | 10 | % distributed under the License is distributed on an "AS IS" BASIS, | ||
682 | 11 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
683 | 12 | % See the License for the specific language governing permissions and | ||
684 | 13 | % limitations under the License. | ||
685 | 14 | |||
686 | 15 | {sys, [ | ||
687 | 16 | {lib_dirs, ["../apps"]}, | ||
688 | 17 | {rel, "burrow", "2011.2", [ | ||
689 | 18 | burrow, | ||
690 | 19 | kernel, | ||
691 | 20 | stdlib, | ||
692 | 21 | sasl | ||
693 | 22 | ]}, | ||
694 | 23 | {rel, "start_clean", "", [ | ||
695 | 24 | kernel, | ||
696 | 25 | stdlib | ||
697 | 26 | ]}, | ||
698 | 27 | {boot_rel, "burrow"}, | ||
699 | 28 | {profile, embedded}, | ||
700 | 29 | {excl_sys_filters, [ | ||
701 | 30 | "^bin/.*", | ||
702 | 31 | "^erts.*/bin/(dialyzer|typer)" | ||
703 | 32 | ]}, | ||
704 | 33 | {app, burrow, [{incl_cond, include}]}, | ||
705 | 34 | {app, sasl, [{incl_cond, include}]} | ||
706 | 35 | ]}. | ||
707 | 36 | |||
708 | 37 | {target_dir, "burrow"}. | ||
709 | 38 | |||
710 | 39 | {overlay, [ | ||
711 | 40 | {mkdir, "log/sasl"}, | ||
712 | 41 | {copy, "files/erl", "{{erts_vsn}}/bin/erl"}, | ||
713 | 42 | {copy, "files/nodetool", "{{erts_vsn}}/bin/nodetool"}, | ||
714 | 43 | {copy, "files/burrow", "bin/burrow"}, | ||
715 | 44 | {copy, "files/app.config", "etc/app.config"}, | ||
716 | 45 | {copy, "files/vm.args", "etc/vm.args"} | ||
717 | 46 | ]}. | ||
718 | 0 | 47 | ||
719 | === added file 'start' | |||
720 | --- start 1970-01-01 00:00:00 +0000 | |||
721 | +++ start 2011-02-23 02:09:57 +0000 | |||
722 | @@ -0,0 +1,16 @@ | |||
723 | 1 | #!/bin/sh | ||
724 | 2 | # Copyright (C) 2011 OpenStack LLC. | ||
725 | 3 | # | ||
726 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
727 | 5 | # you may not use this file except in compliance with the License. | ||
728 | 6 | # You may obtain a copy of the License at | ||
729 | 7 | # | ||
730 | 8 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
731 | 9 | # | ||
732 | 10 | # Unless required by applicable law or agreed to in writing, software | ||
733 | 11 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
734 | 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
735 | 13 | # See the License for the specific language governing permissions and | ||
736 | 14 | # limitations under the License. | ||
737 | 15 | |||
738 | 16 | erl -pa apps/burrow/ebin -s burrow start |
Is there any reason to go through the approval process for the first few releases? It seems like overkill if you are the only one currently committing code. That said, i branched and ran the coverage tests and managed to start the application so that is an lgtm from me.