… | |
… | |
14 | aemp rpc <port> <arg...> # send message, append reply |
14 | aemp rpc <port> <arg...> # send message, append reply |
15 | aemp eval <node> <expr...> # evaluate expression |
15 | aemp eval <node> <expr...> # evaluate expression |
16 | aemp trace <nodeid> # trace the network topology |
16 | aemp trace <nodeid> # trace the network topology |
17 | |
17 | |
18 | # run a node |
18 | # run a node |
19 | aemp run initialise_args... # run a node |
19 | aemp run configure_args... # run a node |
20 | |
20 | |
21 | # node configuration: node ID |
21 | # node configuration: node ID |
22 | aemp setnodeid <nodeid> # configure the real node id |
22 | aemp setnodeid <nodeid> # configure the real node id |
23 | aemp delnodeid # reset node id to default (= inherit) |
23 | aemp delnodeid # reset node id to default (= inherit) |
24 | |
24 | |
… | |
… | |
50 | aemp addservice <initfunc> # add an instance of a service |
50 | aemp addservice <initfunc> # add an instance of a service |
51 | aemp delservice <initfunc> # delete one instance of a service |
51 | aemp delservice <initfunc> # delete one instance of a service |
52 | |
52 | |
53 | # profile-specific configuration |
53 | # profile-specific configuration |
54 | aemp profile <name> <command>... # apply command to profile only |
54 | aemp profile <name> <command>... # apply command to profile only |
55 | aemp parent <name> # specify a parent profile |
55 | aemp setparent <name> # specify a parent profile |
56 | aemp delparent # clear parent again |
56 | aemp delparent # clear parent again |
57 | aemp delprofile <name> # eradicate the named profile |
57 | aemp delprofile <name> # eradicate the named profile |
58 | aemp showprofile <name> # display given profile |
58 | aemp showprofile <name> # display given profile |
59 | aemp showconfig <name> ... # display effective config |
59 | aemp showconfig <name> ... # display effective config |
60 | |
60 | |
… | |
… | |
81 | |
81 | |
82 | =over 4 |
82 | =over 4 |
83 | |
83 | |
84 | =item run <profile> <...> |
84 | =item run <profile> <...> |
85 | |
85 | |
86 | Runs a node by calling C<AnyEvent::MP::initialise_node> with the given |
86 | Runs a node by calling C<AnyEvent::MP::Kernel::configure> with the given |
87 | arguments. The node runs under L<AnyEvent::Watchdog>, can be restarted |
87 | arguments. The node runs under L<AnyEvent::Watchdog>, can be restarted |
88 | (and autorestarted, see the L<AnyEvent::Watchdog> manual). |
88 | (and autorestarted, see the L<AnyEvent::Watchdog> manual). |
89 | |
89 | |
90 | Care has been taken to load (almost) no modules other than |
90 | Care has been taken to load (almost) no modules other than |
91 | L<AnyEvent::Watchdog> and the modules it loads, so everything (including |
91 | L<AnyEvent::Watchdog> and the modules it loads, so everything (including |
… | |
… | |
342 | |
342 | |
343 | =item delprofile <name> |
343 | =item delprofile <name> |
344 | |
344 | |
345 | Deletes the profile of the given name. |
345 | Deletes the profile of the given name. |
346 | |
346 | |
347 | =item parent <name> |
347 | =item setparent <name> |
348 | |
348 | |
349 | Sets the parent profile to use - values not specified in a profile will be |
349 | Sets the parent profile to use - values not specified in a profile will be |
350 | taken from the parent profile (even recursively, with the global default |
350 | taken from the parent profile (even recursively, with the global default |
351 | config being the default parent). This is useful to configure profile |
351 | config being the default parent). This is useful to configure profile |
352 | I<classes> and then to inherit from them for individual nodes. |
352 | I<classes> and then to inherit from them for individual nodes. |
… | |
… | |
355 | global configuration. Neither will do you any good, however. |
355 | global configuration. Neither will do you any good, however. |
356 | |
356 | |
357 | Example: inherit all values not specified in the C<doomed> profile from |
357 | Example: inherit all values not specified in the C<doomed> profile from |
358 | the C<server> profile. |
358 | the C<server> profile. |
359 | |
359 | |
360 | aemp profile doomed parent server |
360 | aemp profile doomed setparent server |
361 | |
361 | |
362 | =item delparent |
362 | =item delparent |
363 | |
363 | |
364 | Removes the parent again from the profile, if any was set, so the profile |
364 | Removes the parent again from the profile, if any was set, so the profile |
365 | inherits directly from the global default config again. |
365 | inherits directly from the global default config again. |
… | |
… | |
371 | |
371 | |
372 | =item showconfig <name> <key value...> |
372 | =item showconfig <name> <key value...> |
373 | |
373 | |
374 | Shows the I<effective> config, i.e. the values as used by a node started |
374 | Shows the I<effective> config, i.e. the values as used by a node started |
375 | with the given profile name. Any additional key-value pairs specified |
375 | with the given profile name. Any additional key-value pairs specified |
376 | augment the configuration, just as with C<initialise_node>. |
376 | augment the configuration, just as with C<configure>. |
377 | |
377 | |
378 | If all arguments are omitted, show the global default config. |
378 | If all arguments are omitted, show the global default config. |
379 | |
379 | |
380 | =back |
380 | =back |
381 | |
381 | |
… | |
… | |
396 | AnyEvent::Watchdog::autorestart (1); |
396 | AnyEvent::Watchdog::autorestart (1); |
397 | AnyEvent::Watchdog::heartbeat (300); |
397 | AnyEvent::Watchdog::heartbeat (300); |
398 | |
398 | |
399 | require AnyEvent; |
399 | require AnyEvent; |
400 | require AnyEvent::MP::Kernel; |
400 | require AnyEvent::MP::Kernel; |
401 | AnyEvent::MP::Kernel::initialise_node (@ARGV); |
401 | AnyEvent::MP::Kernel::configure (@ARGV); |
402 | |
402 | |
403 | AnyEvent::detect () eq "AnyEvent::Impl::EV" |
403 | AnyEvent::detect () eq "AnyEvent::Impl::EV" |
404 | ? EV::loop () |
404 | ? EV::loop () |
405 | : AE::cv ()->recv; |
405 | : AE::cv ()->recv; |
406 | } |
406 | } |
… | |
… | |
439 | |
439 | |
440 | "$cert$key" |
440 | "$cert$key" |
441 | } |
441 | } |
442 | |
442 | |
443 | sub init { |
443 | sub init { |
444 | initialise_node aemp => nodeid => "anon/", binds => ["*:*"]; |
444 | configure profile => "aemp", nodeid => "anon/"; |
445 | } |
445 | } |
446 | |
446 | |
447 | our $cfg = AnyEvent::MP::Config::config; |
447 | our $cfg = AnyEvent::MP::Config::config; |
448 | our $profile = $cfg; |
448 | our $profile = $cfg; |
449 | |
449 | |
… | |
… | |
691 | my $name = shift @ARGV; |
691 | my $name = shift @ARGV; |
692 | |
692 | |
693 | delete $cfg->{profile}{$name}; |
693 | delete $cfg->{profile}{$name}; |
694 | ++$cfg->{dirty}; |
694 | ++$cfg->{dirty}; |
695 | }, |
695 | }, |
696 | parent => sub { |
696 | setparent => sub { |
697 | @ARGV >= 1 |
697 | @ARGV >= 1 |
698 | or die "profile name is missing\n"; |
698 | or die "profile name is missing\n"; |
699 | |
699 | |
700 | $profile->{parent} = shift @ARGV; |
700 | $profile->{parent} = shift @ARGV; |
701 | ++$cfg->{dirty}; |
701 | ++$cfg->{dirty}; |