broker


Namebroker JSON
Version 0.6.1 PyPI version JSON
download
home_pageNone
SummaryThe infrastructure middleman.
upload_time2024-10-14 20:54:59
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords broker ansibletower docker podman beaker
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PythonPackage](https://github.com/SatelliteQE/broker/actions/workflows/python-publish.yml/badge.svg)](https://github.com/SatelliteQE/broker/actions/workflows/python-publish.yml)
[![ContainerImage](https://github.com/SatelliteQE/broker/actions/workflows/update_broker_image.yml/badge.svg)](https://github.com/SatelliteQE/broker/actions/workflows/update_broker_image.yml)
[![CodeQL](https://github.com/SatelliteQE/broker/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/SatelliteQE/broker/actions/workflows/codeql-analysis.yml)
# Broker
The infrastrucure middleman

# Description
Broker is a tool designed to provide a common interface between one or many services that provision virtual machines or containers. It is an abstraction layer that allows you to ignore most of the implementation details and just get what you need.

# Docs
Broker's docs can be found at the wiki for this repo: https://github.com/SatelliteQE/broker/wiki

# Quickstart
Install cmake with `dnf install cmake`

**Note:** We recommend using [uv](https://github.com/astral-sh/uv?tab=readme-ov-file#installation) to manage your Broker installation.

Install Broker either as a tool with uv `uv tool install broker` 

or with pip `pip install broker`

**Note:** If you install with pip it is recommended that you do so in a virtual environment.

(optional) If you are using the Container provider, install the extra dependency based on your container runtime of choice with either `... install broker[podman]` or `... install broker[docker]`.

(optional) If you are using the Beaker provider, install the extra dependency with `dnf install krb5-devel` and then `... install broker[beaker]`.

The first time you run Broker, like with `broker --version`, it will check if you already have a `broker_settings.yaml` in the location it expects.
If not, then it will help you get one setup and place it in the default broker directory `~/.broker/`

If you want Broker to operate out of a different location, export a `BROKER_DIRECTORY` environment variable with the desired path.

You can check `broker --version` at any time to verify where it is looking for its config file.

# Basic CLI Usage
**Checking out a VM or container**
To checkout a single VM with arbitrary arguments:
```
broker checkout --workflow test-workflow --workflow-arg1 something --workflow-arg2 else
```

To checkout multiple VMs at once:
```
broker checkout --workflow test-workflow --count 3
```

To pass complex data structures:
```
broker checkout --container-host my-image --args-file tests/data/broker_args.json --extra tests/data/args_file.yaml
```

**Nicks**

Broker allows you to define configurable nicknames for checking out vms. Just add yours to setting.yaml and call with the `--nick` option
```
broker checkout --nick rhel7
```

**Listing your VMs and containers**

Broker maintains a local inventory of the VMs and containers you've checked out. You can see these with the ```inventory``` command.
```
broker inventory
```
To sync your inventory from a supported provider, use the `--sync` option.
```
broker inventory --sync AnsibleTower
```
To sync an inventory for a specific instance, use the following syntax with --sync.
```
broker inventory --sync Container::<instance name>
```

**Extending your VM lease time**

Providers supporting extending a VM's lease time make that functionality available through the `extend` subcommand.
```
broker extend 0
broker extend hostname
broker extend vmname
broker extend --all
```

**Checking in VMs and containers**

You can also return a VM to its provider with the `checkin` command.
Containers checked in this way will be fully deleted regardless of its status.
You may use either the local id (`broker inventory`), the hostname, or "all" to checkin everything.
```
broker checkin my.host.fqdn.com
broker checkin 0
broker checkin 1 3 my.host.fqdn.com
broker checkin --all
```

**Gaining information about Broker's providers**

Broker's `providers` command allows you to gather information about what providers are avaiable as well as each providers actions. Additionally, you can find out information about different arguments for a provider's action with this command.
```
broker providers --help
broker providers AnsibleTower --help
broker providers AnsibleTower --workflows
broker providers AnsibleTower --workflow test-workflow
```

**Run arbitrary actions**

If a provider action doesn't result in a host creation/removal, Broker allows you to execute that action as well. There are a few output options available as well.
When executing with the Container provider, a new container will be spun up with your command (if specified), ran, and cleaned up.
```
broker execute --help
broker execute --workflow my-awesome-workflow --additional-arg True
broker execute -o raw --workflow my-awesome-workflow --additional-arg True --artifacts last
```

**Machine processable output**

If running in a CI or other automated environment, Broker offers the choice to store important output information in an output file. This is json-formatted data. Please be aware that any existing file with the matching path and name will be erased.
```
broker --output-file output.json checkout --nick rhel7
broker --output-file inventory.json inventory
```

**Run Broker in the background**

Certain Broker actions can be run in the background, these currently are: checkout, checkin, and execute. When running a command in this mode, it will spin up a new Broker process and no longer log to stderr. To check progress, you can still follow broker's log file.
Note that background mode will interfere with output options for execute since it won't be able to print to stdout. Those should kept in log mode.
```
broker checkout --background --nick rhel7
broker checkin -b --all
broker execute -b --workflow my-awesome-workflow --artifacts
```

# Development Setup
Install cmake with `dnf install cmake`

Clone the Broker repository and install locally with  `uv pip install "broker[dev] @ ."`

Copy the example settings file to `broker_settings.yaml` and edit it.

To run Broker outside of its base directory, specify the directory with the `BROKER_DIRECTORY` environment variable.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "broker",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "broker, AnsibleTower, docker, podman, beaker",
    "author": null,
    "author_email": "Jacob J Callahan <jacob.callahan05@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/55/7a/b9053b20a3300493a8f2f35b684610d46aab393c6e9a602fa1d5bba1df6b/broker-0.6.1.tar.gz",
    "platform": "any",
    "description": "[![PythonPackage](https://github.com/SatelliteQE/broker/actions/workflows/python-publish.yml/badge.svg)](https://github.com/SatelliteQE/broker/actions/workflows/python-publish.yml)\n[![ContainerImage](https://github.com/SatelliteQE/broker/actions/workflows/update_broker_image.yml/badge.svg)](https://github.com/SatelliteQE/broker/actions/workflows/update_broker_image.yml)\n[![CodeQL](https://github.com/SatelliteQE/broker/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/SatelliteQE/broker/actions/workflows/codeql-analysis.yml)\n# Broker\nThe infrastrucure middleman\n\n# Description\nBroker is a tool designed to provide a common interface between one or many services that provision virtual machines or containers. It is an abstraction layer that allows you to ignore most of the implementation details and just get what you need.\n\n# Docs\nBroker's docs can be found at the wiki for this repo: https://github.com/SatelliteQE/broker/wiki\n\n# Quickstart\nInstall cmake with `dnf install cmake`\n\n**Note:** We recommend using [uv](https://github.com/astral-sh/uv?tab=readme-ov-file#installation) to manage your Broker installation.\n\nInstall Broker either as a tool with uv `uv tool install broker` \n\nor with pip `pip install broker`\n\n**Note:** If you install with pip it is recommended that you do so in a virtual environment.\n\n(optional) If you are using the Container provider, install the extra dependency based on your container runtime of choice with either `... install broker[podman]` or `... install broker[docker]`.\n\n(optional) If you are using the Beaker provider, install the extra dependency with `dnf install krb5-devel` and then `... install broker[beaker]`.\n\nThe first time you run Broker, like with `broker --version`, it will check if you already have a `broker_settings.yaml` in the location it expects.\nIf not, then it will help you get one setup and place it in the default broker directory `~/.broker/`\n\nIf you want Broker to operate out of a different location, export a `BROKER_DIRECTORY` environment variable with the desired path.\n\nYou can check `broker --version` at any time to verify where it is looking for its config file.\n\n# Basic CLI Usage\n**Checking out a VM or container**\nTo checkout a single VM with arbitrary arguments:\n```\nbroker checkout --workflow test-workflow --workflow-arg1 something --workflow-arg2 else\n```\n\nTo checkout multiple VMs at once:\n```\nbroker checkout --workflow test-workflow --count 3\n```\n\nTo pass complex data structures:\n```\nbroker checkout --container-host my-image --args-file tests/data/broker_args.json --extra tests/data/args_file.yaml\n```\n\n**Nicks**\n\nBroker allows you to define configurable nicknames for checking out vms. Just add yours to setting.yaml and call with the `--nick` option\n```\nbroker checkout --nick rhel7\n```\n\n**Listing your VMs and containers**\n\nBroker maintains a local inventory of the VMs and containers you've checked out. You can see these with the ```inventory``` command.\n```\nbroker inventory\n```\nTo sync your inventory from a supported provider, use the `--sync` option.\n```\nbroker inventory --sync AnsibleTower\n```\nTo sync an inventory for a specific instance, use the following syntax with --sync.\n```\nbroker inventory --sync Container::<instance name>\n```\n\n**Extending your VM lease time**\n\nProviders supporting extending a VM's lease time make that functionality available through the `extend` subcommand.\n```\nbroker extend 0\nbroker extend hostname\nbroker extend vmname\nbroker extend --all\n```\n\n**Checking in VMs and containers**\n\nYou can also return a VM to its provider with the `checkin` command.\nContainers checked in this way will be fully deleted regardless of its status.\nYou may use either the local id (`broker inventory`), the hostname, or \"all\" to checkin everything.\n```\nbroker checkin my.host.fqdn.com\nbroker checkin 0\nbroker checkin 1 3 my.host.fqdn.com\nbroker checkin --all\n```\n\n**Gaining information about Broker's providers**\n\nBroker's `providers` command allows you to gather information about what providers are avaiable as well as each providers actions. Additionally, you can find out information about different arguments for a provider's action with this command.\n```\nbroker providers --help\nbroker providers AnsibleTower --help\nbroker providers AnsibleTower --workflows\nbroker providers AnsibleTower --workflow test-workflow\n```\n\n**Run arbitrary actions**\n\nIf a provider action doesn't result in a host creation/removal, Broker allows you to execute that action as well. There are a few output options available as well.\nWhen executing with the Container provider, a new container will be spun up with your command (if specified), ran, and cleaned up.\n```\nbroker execute --help\nbroker execute --workflow my-awesome-workflow --additional-arg True\nbroker execute -o raw --workflow my-awesome-workflow --additional-arg True --artifacts last\n```\n\n**Machine processable output**\n\nIf running in a CI or other automated environment, Broker offers the choice to store important output information in an output file. This is json-formatted data. Please be aware that any existing file with the matching path and name will be erased.\n```\nbroker --output-file output.json checkout --nick rhel7\nbroker --output-file inventory.json inventory\n```\n\n**Run Broker in the background**\n\nCertain Broker actions can be run in the background, these currently are: checkout, checkin, and execute. When running a command in this mode, it will spin up a new Broker process and no longer log to stderr. To check progress, you can still follow broker's log file.\nNote that background mode will interfere with output options for execute since it won't be able to print to stdout. Those should kept in log mode.\n```\nbroker checkout --background --nick rhel7\nbroker checkin -b --all\nbroker execute -b --workflow my-awesome-workflow --artifacts\n```\n\n# Development Setup\nInstall cmake with `dnf install cmake`\n\nClone the Broker repository and install locally with  `uv pip install \"broker[dev] @ .\"`\n\nCopy the example settings file to `broker_settings.yaml` and edit it.\n\nTo run Broker outside of its base directory, specify the directory with the `BROKER_DIRECTORY` environment variable.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "The infrastructure middleman.",
    "version": "0.6.1",
    "project_urls": {
        "Repository": "https://github.com/SatelliteQE/broker"
    },
    "split_keywords": [
        "broker",
        " ansibletower",
        " docker",
        " podman",
        " beaker"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "815e485d6144dfe39430ae0626ddfff4c55d09e56c451167ca558866c752c2fe",
                "md5": "9c2d79681f44255864c3400c34aec0ff",
                "sha256": "b3013e80108460700d30ff12004ac092877a67042c0e51a227dedd8b4b56a2c8"
            },
            "downloads": -1,
            "filename": "broker-0.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9c2d79681f44255864c3400c34aec0ff",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 87287,
            "upload_time": "2024-10-14T20:54:57",
            "upload_time_iso_8601": "2024-10-14T20:54:57.893261Z",
            "url": "https://files.pythonhosted.org/packages/81/5e/485d6144dfe39430ae0626ddfff4c55d09e56c451167ca558866c752c2fe/broker-0.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "557ab9053b20a3300493a8f2f35b684610d46aab393c6e9a602fa1d5bba1df6b",
                "md5": "f9fc1544009256df762c4db9e4501d2b",
                "sha256": "8f1c0be68a5f885b07f5250a631e3b81cf65a234cf58df4c0a0f8a1baafa1f66"
            },
            "downloads": -1,
            "filename": "broker-0.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f9fc1544009256df762c4db9e4501d2b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 100090,
            "upload_time": "2024-10-14T20:54:59",
            "upload_time_iso_8601": "2024-10-14T20:54:59.634532Z",
            "url": "https://files.pythonhosted.org/packages/55/7a/b9053b20a3300493a8f2f35b684610d46aab393c6e9a602fa1d5bba1df6b/broker-0.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-14 20:54:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SatelliteQE",
    "github_project": "broker",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "broker"
}
        
Elapsed time: 0.78855s