Skip to main content

Infrastructure services management for Docker compose-based services

Project description

Infra CLI

Infrastructure services management CLI and TUI.

What is Infra CLI?

Infra CLI is a Python package that manages Docker Compose services. It works with service definitions stored in /opt/infra-services/.

Installation

pip install infra-cli

Or for development:

git clone https://github.com/metrotelinc/weaverbird-infra.git
cd weaverbird-infra
pip install -e .

Quick Start

# Launch the TUI
infra

# Or use CLI commands directly
infra status
infra start traefik
infra cloudflare list-tokens

Directory Structure

# Development (your machine)
weaverbird-infra/                    # Git repo (Python code)
├── infra/                           # Python package
├── pyproject.toml
└── README.md

# Production (servers)
/opt/infra-services/                 # Docker Compose files
├── services/
│   ├── traefik/
│   ├── wireguard/
│   └── mqtt/

/etc/infra/                          # Configuration & secrets
├── infra.env                        # Environment variables
└── cloudflare.json                  # API tokens

Features

  • Docker Service Management: Start, stop, restart, and view logs for services
  • Cloudflare DNS Integration: Manage DNS records across multiple accounts/tokens
  • User Management: Manage the infra-users group for multi-admin access
  • System Info: View disk, memory, CPU, uptime, and load
  • Terminal UI: Interactive TUI for easy management
  • Dynamic Service Discovery: Automatically finds all services in /opt/infra-services/services/

Configuration

Configuration is stored in /etc/infra/:

Environment Variables (/etc/infra/infra.env)

CLOUDFLARE_API_TOKEN=your_token_here
CLOUDFLARE_EMAIL=your@email.com
TRAEFIK_DOMAIN=example.com
WG_HOST=vpn.example.com
WG_PORT=51820
MOSQUITTO_USERNAME=admin
MOSQUITTO_PASSWORD=changeme

Cloudflare Tokens (/etc/infra/cloudflare.json)

infra cloudflare add-token personal

Managing Services

Adding a New Service

  1. Create service directory:

    mkdir -p /opt/infra-services/services/my-service
    
  2. Add docker-compose.yml:

    nano /opt/infra-services/services/my-service/docker-compose.yml
    
  3. Service is automatically available:

    infra status              # Shows "my-service"
    infra start my-service
    

Service Discovery

Infra automatically discovers services from /opt/infra-services/services/:

  • Flat: services/traefik/docker-compose.ymltraefik
  • Nested: services/project/dev/docker-compose.ymlproject/dev
  • Multiple: services/app/docker-compose.yml + docker-compose.prod.yml

Disabling a Service

# Stop it
infra stop my-service

# Or rename the file
mv /opt/infra-services/services/my-service/docker-compose.yml \
   /opt/infra-services/services/my-service/docker-compose.yml.disabled

Uninstall

infra uninstall

This will:

  1. Stop all managed Docker services
  2. Remove the infra-users group
  3. Remove configuration from /etc/infra/
  4. Uninstall the Python package

Note: Docker service files remain in /opt/infra-services/. To remove them:

sudo rm -rf /opt/infra-services

License

Apache License 2.0 - See LICENSE for details.

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

infra_services-0.1.0.tar.gz (67.8 kB view details)

Uploaded Source

Built Distribution

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

infra_services-0.1.0-py3-none-any.whl (79.7 kB view details)

Uploaded Python 3

File details

Details for the file infra_services-0.1.0.tar.gz.

File metadata

  • Download URL: infra_services-0.1.0.tar.gz
  • Upload date:
  • Size: 67.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for infra_services-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ac176e130f1aa675792aa51d57ecbf9cebf911282b121c27bd8cdab6df60aec4
MD5 d34acaddae450a7744dce58f8bc1d867
BLAKE2b-256 9f0d628559de553b4911c72dcf25aab64df8494f8b65e56420b10bfc4ef12e1f

See more details on using hashes here.

File details

Details for the file infra_services-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: infra_services-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 79.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for infra_services-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1bd7fab453f779a1a28071427f7d6a36fb13a60d9b4546a8ff2cecba8ee32b9
MD5 bc1770e904f7d5c832c64c73268149e8
BLAKE2b-256 a81478701199d366ef4bc3a30925ef65649dfb7dd3b059b3d48cfdd6d0d8c468

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