Skip to main content

AI-powered infrastructure management

Project description

Opsbox

AI-Powered Infrastructure Management

Welcome to Opsbox, the open-source platform that adds a dash of AI magic to your infrastructure management. With our flexible plugin system and policy-as-code approach using Rego, managing your infrastructure has never been this enjoyable!

Features

  • 🎛️ Plugin System: Customize and extend functionality with ease.
  • 📝 Policy-as-Code with Rego: Define compliance checks and policies efficiently.
  • 🤖 AI Assistance: Leverage AI models to analyze and process your infrastructure data.
  • 💻 Command-Line Interface: An interactive CLI.
  • 📚 Documentation Support: Generate and view documentation effortlessly using mkdocs.

Installation

Ready to dive in? Let's get you set up!

Prerequisites

  • Python 3.11
  • uv

Through PyPI

Simply run pip install opsbox to install the minimal set of opsbox tools.

If using UV, initilize your project using uv init.

then uv add opsbox

Note: If you want to install AWS plugins, use the aws extras group, opsbox[aws]

Through Github

  1. Clone the Repository

    git clone https://github.com/sudoersllc/Opsbox.git
    cd Opsbox
    
  2. Install with uv

    We use [uv] for managing dependencies. If you don't have it installed, you can get it via pip:

    pip install uv
    

    Now, let's install Opsbox:

    uv sync
    

    This command will install all required dependencies specified in pyproject.toml.

Using Rego Plugins

Open Policy Agent (OPA) is an open-source policy engine that enables organizations to implement policy as code across diverse environments. Its policy language, Rego, allows users to define rules that dictate system and application behavior.

We use rego code to gather details about connected systems, alongside an Open Policy Agent (OPA) server, then format it for consumption by a language model.

Create a OPA Policy docker image

To run OpsBox with rego plugins, you'll need an OPA server. This is because OpsBox uses OPA to enforce policies on all resources that are being managed.

if you don't have OPA installed on your machine, or you dont have a running OPA instance, you can create a docker image for OPA.

Start by installing docker.

Create a dockerfile and add the following code:

    # Use the official OPA image
    FROM openpolicyagent/opa:latest

    # Expose OPA's default port
    EXPOSE 8181

    # Run OPA with the specified policy file
    CMD ["run", "--server", "--addr", "0.0.0.0:8181"]

Navigate to the directory and Build the Docker image:

    docker build -t opa-server .

or you can also follow the offical OPA documentation to create the engine: OPA Documentation

Finally, run the OPA server as follows:

    docker run -d -p 8181:8181 --name opa-server opa-server

The docker image can be found here: (https://hub.docker.com/r/openpolicyagent/opa/)

    docker run -d -p 8181:8181 --name opa openpolicyagent/opa run --server --addr=0.0.0.0:8181*

Running Opsbox

Time to see the magic in action!

Simply run:

uv run opsbox ...

or, if not using UV:

python -m opsbox ...

This will launch Opsbox and display the CLI help along with available commands.

Example Usage

Want to run a specific pipeline? Here's how:

uv run opsbox --modules your_input-your_optional_assistant-your_output --opa_url http://your-opa-url 

A recommended command to start is stray_ebs make sure you have opsbox[aws] and opsbox-cli-output installed

uv run opsbox --modules stray_ebs-cli_out --opa_url http://localhost:8181/ --aws_access_key_id {YOUR_ACCESS_KEY_ID} --aws_secret_access_key {YOUR_SECRET_ACCESS_KEY} --aws_region us-east-1

or, if not using UV:

python -m opsbox --modules your_input-your_optional_assistant-your_output --opa_url http://your-opa-url 
python -m opsbox --modules stray_ebs-cli_out --opa_url http://localhost:8181/ --aws_access_key_id {YOUR_ACCESS_KEY_ID} --aws_secret_access_key {YOUR_SECRET_ACCESS_KEY} --aws_region us-east-1

Configuration

Opsbox is flexible when it comes to configuration. You can provide options via:

  • Command-Line Arguments
  • Configuration Files
  • Environment Variables

Using a Configuration File

Create a file named .opsbox_conf.json in your home directory:

{
  "aws_access_key_id": "YOUR_ACCESS_KEY_ID",
  "aws_secret_access_key": "YOUR_SECRET_ACCESS_KEY",
  "aws_region": "YOUR_AWS_REGION",
  "opa_url": "http://your-opa-url",
}

To run a command with a config it will follow this format

uv run opsbox --modules stray_ebs-cli_out --config config.json

Command-Line Arguments

You can also provide configuration options directly through the command line:

python -m opsbox --modules example_module --aws_access_key_id YOUR_ACCESS_KEY_ID --aws_secret_access_key YOUR_SECRET_ACCESS_KEY --aws_region YOUR_AWS_REGION --opa_url http://your-opa-url 

Plugins

You'll probably want some plugins to get started!

Opsbox plugins published by gsudoers normally take the format of opsbox-<name>-<plugin_type>, and are accessible and searchable through PyPI.

There's also a collection of plugins available for AWS systems, installable by using the pip extras group aws:

pip install 'opsbox[aws]'

Let's Get Started!

Now that you're all set, it's time to unleash the power of AI on your infrastructure. Happy automating!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opsbox-0.1.6.tar.gz (31.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opsbox-0.1.6-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file opsbox-0.1.6.tar.gz.

File metadata

  • Download URL: opsbox-0.1.6.tar.gz
  • Upload date:
  • Size: 31.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.25

File hashes

Hashes for opsbox-0.1.6.tar.gz
Algorithm Hash digest
SHA256 b958a2d6ef806f4f536e2a2d705d86b47d9daf5dca0a2350aad6d17463a79b12
MD5 7a8351b4d637992f254fb3740dcee83b
BLAKE2b-256 1f723409d30e8a5077119e084973afcf86c9776e53f00566466f8219d7c88018

See more details on using hashes here.

File details

Details for the file opsbox-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: opsbox-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 28.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.25

File hashes

Hashes for opsbox-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0e5af24089541a36fdd00610e78d9f0726ee599bf93c4964e1a54a1f83a96583
MD5 da0a1ba146f5c1fdb885770a6c7b3b3c
BLAKE2b-256 dac0e0f3cb4f77fa3c5975146b0353d2d7c8e9026d110cc137686d807b4e29c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page