Skip to content

2aronS/aci-pilot

Repository files navigation

# aci-pilot

![license](https://img.shields.io/badge/license-MIT-blue)
![status](https://img.shields.io/badge/status-active-brightgreen)
![python](https://img.shields.io/badge/python-3.8+-blue)
![azure](https://img.shields.io/badge/azure-container%20instances-0078D4)
![code style](https://img.shields.io/badge/code%20style-black-000000)

> Pilot implementation for Azure Container Instances deployment automation

## table of contents

- [install](#install)
- [usage](#usage)
- [api](#api)
- [contributing](#contributing)
- [license](#license)

## install

```bash
pip install aci-pilot

Or from source:

git clone https://github.com/yourusername/aci-pilot.git
cd aci-pilot
pip install -e .

usage

Basic deployment:

from aci_pilot import ACIDeployer

deployer = ACIDeployer(
    subscription_id="your-subscription-id",
    resource_group="my-rg",
    location="eastus"
)

# Deploy a container
container = deployer.deploy(
    name="my-app",
    image="nginx:latest",
    cpu=1.0,
    memory=1.5,
    ports=[80, 443]
)

print(f"Container deployed at {container.ip_address}")

Using configuration file:

from aci_pilot import ACIDeployer

deployer = ACIDeployer.from_config("config.yaml")
deployer.deploy_all()

Example config.yaml:

subscription_id: "your-subscription-id"
resource_group: "my-rg"
location: "eastus"

containers:
  - name: "web-app"
    image: "myregistry.azurecr.io/webapp:latest"
    cpu: 2.0
    memory: 4.0
    ports: [80, 443]
    env:
      DATABASE_URL: "postgres://..."

api

ACIDeployer

Main class for managing ACI deployments.

Parameters:

  • subscription_id (str): Azure subscription ID
  • resource_group (str): Resource group name
  • location (str): Azure region
  • credentials (optional): Azure credentials object

Methods:

deploy(name, image, cpu, memory, ports, env=None, restart_policy="Always")

Deploy a single container instance.

Returns: Container instance object with ip_address, fqdn, and state attributes.

delete(name)

Delete a container instance by name.

list()

List all container instances in the resource group.

Returns: List of container instance objects.

get_logs(name, tail=100)

Retrieve container logs.

Returns: String containing log output.

restart(name)

Restart a container instance.

ACIDeployer.from_config(path)

Class method to create deployer from YAML config file.

Parameters:

  • path (str): Path to configuration file

Returns: Configured ACIDeployer instance.

contributing

prs welcome. open an issue first for big changes.

Run tests:

pytest tests/

Format code:

black .
isort .

license

MIT

About

Pilot implementation for Azure Container Instances deployment automation

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors