Merge lp:~eday/burrow/bootstrap into lp:~burrow-core/burrow/cactus

Proposed by Eric Day
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
Reviewer Review Type Date Requested Status
Devin Carlen Approve
Vish Ishaya Approve
Review via email: mp+50848@code.launchpad.net

Description of the change

Created initial OTP application and supervisor skeleton. Also includes README and configuration for building releases.

To post a comment you must log in.
Revision history for this message
Vish Ishaya (vishvananda) wrote :

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.

review: Approve
Revision history for this message
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. :)

Revision history for this message
Devin Carlen (devcamcar) wrote :

approve

review: Approve
Revision history for this message
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

Revision history for this message
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/include/eunit.hrl"
src/burrow.erl:44: undefined macro 'assertEqual'

Preview Diff

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

Subscribers

People subscribed via source and target branches

to all changes: