Petabridge.Cmd.Common 1.3.2

Petabridge.Cmd

Petabridge.Cmd is a command-line interface (CLI) for Akka.NET, designed to help monitor and manage live ActorSystems through simple commands.

Akka.NET logo

Use

After you've installed the Petabridge.Cmd.Host into your Akka.NET application and the pbm client onto your workstation, you can connect to your server, download any commands that are defined on them, and begin executing them right away!

Some examples:

pbm actor hierarchy

Only works when Petabridge.Cmd.Cluster is installed.

pbm cluster show

Down All Unreachable Nodes in Cluster

Only works when Petabridge.Cmd.Cluster is installed.

pbm cluster down-unreachable

There are dozens of built-in Petabridge.Cmd commands and it's quite easy to build your own custom ones!

Installation

In order to use Petabridge.Cmd you must follow our installation instructions and get both a server and a client up and running.

Default Ports and Hostnames

By default, Petabridge.Cmd.Host will open the following ports for accepting TCP connections from pbm clients:

  • Port: 9110
  • Host: All addresses (0.0.0.0)

Server and Command Pallette Installation

Before we can use the Petabridge.Cmd client (pbm) we need to install the Petabridge.Cmd server inside one of our Akka.NET applications - which we can do by installing the Petabridge.Cmd.Host NuGet package:

dotnet add package Petabridge.Cmd.Host

Next, we just need to hook this up into our ActorSystem.

Akka.Hosting is a HOCON-less approach to configuring and instantiating Akka.NET applications, and it's the easiest way to configure Petabridge.Cmd inside your ActorSystem - using the AddPetabridgeCmd method found in the Petabridge.Cmd.Host package:

using var host = await (new HostBuilder().ConfigureServices((context, collection) =>
{
    collection.AddAkka("PbmSys", builder =>
    {
        builder.WithRemoting("localhost", 29909)
            .WithClustering(new ClusterOptions(){ SeedNodes = new[]{ "akka.tcp://PbmSys@localhost:29909" }})
        .AddPetabridgeCmd(
                new PetabridgeCmdOptions(){ Host = "localhost", Port = 8222}, // optional - customize pbm bindings 
                cmd =>
        {
            cmd.RegisterCommandPalette(new RemoteCommands());
            cmd.RegisterCommandPalette(ClusterCommands.Instance);
        });
    });
}).StartAsync());

You can register all of your CommandPalette instances using the builder and Petabridge.Cmd will be started up automatically. All HOCON values can still be used to configure binding addresses.

Manually Starting Petabridge.Cmd

In order to active Petabridge.Cmd.Host inside your Akka.NET application, you need to make the following call inside your application (if you're not using Akka.Hosting:)

private static void Main(string[] args)
{
    using (var a = ActorSystem.Create("Foo"))
    {
        var cmd = PetabridgeCmd.Get(a);
        cmd.Start();
        a.WhenTerminated.Wait();
    }
}

Registering Additional Command Palettes

See the full set of built-in Petabridge.Cmd palettes here.

Petabridge.Cmd ships with an additional set of commands for managing Akka.Cluster applications, which are not loaded by default. After installing the Petabridge.Cmd.Cluster NuGet package into your host application, you an register the commands with the PetabridgeCmd plugin via the following syntax:

using (var a = ActorSystem.Create("webcrawler"))
{
    var cmd = PetabridgeCmd.Get(a);
    cmd.RegisterCommandPalette(ClusterCommands.Instance); // non-default command palette
    cmd.Start();
    a.WhenTerminated.Wait();
}

Or when using Akka.Hosting:

collection.AddAkka("PbmSys", builder =>
{
    builder.WithRemoting("localhost", 29909)
        .WithClustering(new ClusterOptions(){ SeedNodes = new[]{ "akka.tcp://PbmSys@localhost:29909" }})
    .AddPetabridgeCmd(
            new PetabridgeCmdOptions(){ Host = "localhost", Port = 8222}, // optional - customize pbm bindings 
            cmd =>
    {
        cmd.RegisterCommandPalette(new RemoteCommands());
        cmd.RegisterCommandPalette(ClusterCommands.Instance); // non-default command palette
    });
});

Client Installation

The easiest way to install Petabridge.Cmd's client is to install the pbm .NET global tool:

> dotnet tool install --global pbm 

To see full details about how the Petabridge.Cmd client and server connectivity model works, please see "How Petabridge.Cmd Works."

Need Help?

To get help with Petabridge.Cmd you can file a bug on our issue tracker or contact us in Discord.

Showing the top 20 packages that depend on Petabridge.Cmd.Common.

Packages Downloads
Petabridge.Cmd.Cluster
Petabridge.Cmd module for working with Akka.Cluster.
32
Petabridge.Cmd.Host
Host engine for the Petabridge.Cmd CLI for managing Akka.NET apps and clusters. Used to load available commands into the cluster itself.
22
Petabridge.Cmd.Cluster
Commandline tools for working with Akka.NET and Akka.Cluster
19
Petabridge.Cmd.Host
Host engine for the Petabridge.Cmd CLI for managing Akka.NET apps and clusters. Used to load available commands into the cluster itself.
16
Petabridge.Cmd.Remote
Akka.Remote Petabridge.Cmd palettes for connection and monitoring.
10
Petabridge.Cmd.Cluster
Petabridge.Cmd module for working with Akka.Cluster.
9
Petabridge.Cmd.Host
Host engine for the Petabridge.Cmd CLI for managing Akka.NET apps and clusters. Used to load available commands into the cluster itself.
9
Petabridge.Cmd.Remote
Akka.Remote Petabridge.Cmd palettes for connection and monitoring.
8
Petabridge.Cmd.Host
Host SDK for Petabridge.Cmd command line management tools for Akka.NET.
8
Petabridge.Cmd.Cluster
Petabridge.Cmd module for working with Akka.Cluster.
7
Petabridge.Cmd.Host
Host engine for the Petabridge.Cmd CLI for managing Akka.NET apps and clusters. Used to load available commands into the cluster itself.
7
Petabridge.Cmd.Host
Host engine for the Petabridge.Cmd CLI for managing Akka.NET apps and clusters. Used to load available commands into the cluster itself.
6
Petabridge.Cmd.Host
Host engine for the Petabridge.Cmd CLI for managing Akka.NET apps and clusters. Used to load available commands into the cluster itself.
5
Petabridge.Cmd.Remote
Akka.Remote Petabridge.Cmd palettes for connection and monitoring.
5
Petabridge.Cmd.Host
Host SDK for Petabridge.Cmd command line management tools for Akka.NET.
5

This is a pretty significant set of feature improvements for [Petabridge.Cmd](https://cmd.petabridge.com/). New Commands** In 1.3.2 we've added two new commands to the built-in pallettes contained inside Petabridge.Cmd.Host: `net clients` - gives a printout of all local and remote clients connected to the current host. `net drop-all-clients` - a somewhat dangerous command intended to be used by ops teams that rely on lots of `PbmClient` instances internally. This command will automatically terminate all clients connected to the current host. Clients will receive a notification that the host has disconnected from them. Other Changes and Improvements** `actor hierarchy` now prints out all `/system` actors by default - to turn this behavior off please pass in the new `-e` parameter to exclude `/system` actors from your query. Fixed stability issues with `IPbmClient` not always shutting itself off cleanly on both the server and the client. `IPbmClient` now includes a specific `CloseAsync` method along with a `Task WhenClosed` that you can await on (in case the server shuts the client off first.) `IPbmClient` now implements `IAsyncDisposable`, which will just call `CloseAsync` under the covers.

Version Downloads Last updated
1.4.3 2 07/06/2024
1.4.2 1 06/24/2024
1.4.1 5 04/04/2024
1.4.0 6 01/25/2024
1.3.3 3 01/25/2024
1.3.2 24 09/25/2023
1.3.1 2 02/16/2024
1.3.0 3 06/13/2023
1.3.0-beta1 2 08/27/2023
1.2.2 4 02/16/2024
1.2.1 2 02/16/2024
1.2.0 6 06/13/2023
1.1.4 5 01/25/2024
1.1.3 5 06/14/2023
1.1.2 4 06/13/2023
1.1.1 3 06/13/2023
1.1.0 7 07/11/2022
1.0.2 27 03/30/2022
1.0.1 6 06/14/2023
1.0.0 5 06/13/2023
0.8.5 6 04/10/2022
0.8.4 5 06/13/2023
0.8.3 5 06/12/2023
0.8.2 5 06/14/2023
0.8.1 4 06/13/2023
0.8.0 5 06/13/2023
0.8.0-rc2 5 12/08/2023
0.8.0-rc1 5 12/09/2023
0.7.1 6 06/14/2023
0.7.0 5 06/13/2023
0.6.3 4 06/13/2023
0.6.2 5 06/13/2023
0.6.1 6 06/13/2023
0.6.0 5 06/13/2023
0.5.0 6 06/13/2023
0.4.1 7 12/08/2023
0.4.0 5 06/13/2023
0.3.3 4 06/14/2023
0.3.2 4 06/13/2023
0.3.1 6 06/14/2023
0.3.0 4 06/14/2023
0.2.2 4 06/13/2023
0.2.1 3 06/14/2023
0.2.0 4 06/13/2023
0.1.2 5 06/13/2023
0.1.1 4 06/14/2023
0.1.0 7 06/13/2023