Skip to main content

Professional CLI tool for managing Odoo instances with declarative configuration, automated backups, snapshots, and GitHub integration.

Project description

DooService CLI

DooService CLI is a professional command-line tool for managing complex Odoo instances using a declarative approach. Define your entire infrastructure in a single dooservice.yml file and manage instances, repositories, and backups from the command line.

โœจ Features

  • ๐Ÿ”ง Declarative Configuration: Define all Odoo instances and repositories in a single YAML file
  • ๐Ÿš€ Full Instance Lifecycle: Create, start, stop, sync, and delete instances with simple commands
  • ๐Ÿ“ Repository Management: Automatically clone and update Odoo addon repositories from Git
  • ๐Ÿณ Docker Integration: Native Docker support for deploying Odoo and PostgreSQL containers
  • ๐Ÿ’พ Backup System: Create, test, and manage instance backups with database support
  • โšก Clean Architecture: Built with Clean Architecture principles for maintainability and extensibility
  • ๐ŸŽฏ Configuration-First: No hardcoded values - all operations require explicit configuration
  • ๐Ÿ“ Type Safety: Strong typing throughout the application with comprehensive error handling

๐Ÿ“ฆ Installation

Production Installation

# Using pipx (recommended)
pipx install dooservice-cli

# Using pip
pip install dooservice-cli

# Using uv (modern Python package manager)
uv tool install dooservice-cli

# Verify installation
dooservice --help

Development Installation

# Clone the repository
git clone https://github.com/apiservicesac/dooservice-cli-py.git
cd dooservice-cli-py

# Install uv (modern Python package manager)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Option 1: Install globally for development
uv tool install --editable .

# Option 2: Install dependencies only (requires uv run prefix)
uv sync --all-extras

# Verify installation
# For global install:
dooservice --help

# For local development:
uv run dooservice --help

๐Ÿš€ Quick Start

  1. Initialize Configuration

    # Copy example configuration
    cp dooservice.yml.example dooservice.yml
    
    # Edit the configuration to match your needs
    nano dooservice.yml
    
  2. Validate Configuration

    dooservice config validate dooservice.yml
    
  3. Create Your First Instance

    # Create instance
    dooservice instance create my-instance
    
    # Start instance
    dooservice instance start my-instance
    
  4. Access Your Instance Your Odoo instance will be running at http://localhost:8069 (or your configured port)

  5. Manage Your Instance

    # Check status
    dooservice instance status my-instance
    
    # View logs
    dooservice instance logs my-instance --follow
    
    # Create backup
    dooservice backup create my-instance
    

๐Ÿ“– Command Reference

Configuration Management

# Load and validate configuration files
dooservice config load <file_path> [--no-validate]
dooservice config validate <file_path>
dooservice config create <file_path> [--no-validate]
dooservice config convert <input_file> [--output <file>]

Instance Management

# Create and manage instances
dooservice instance create <name> [--config <file>]
dooservice instance delete <name> [--config <file>]
dooservice instance start <name> [--config <file>]
dooservice instance stop <name> [--config <file>]
dooservice instance status <name> [--config <file>]
dooservice instance logs <name> [--service <service>] [--follow] [--tail <lines>]
dooservice instance exec <name> <command> [--user <user>] [--workdir <dir>]
dooservice instance sync <name> [--no-restart] [--config <file>]

Repository Management

# Manage instance repositories
dooservice repository list <instance_name> [--repo <name>] [--config <file>]
dooservice repository status <instance_name> <repo_name> [--config <file>]
dooservice repository sync <instance_name> [--repo <name>] [--quiet] [--test]

Backup Operations

# Create and manage backups
dooservice backup create <instance_name> [--database <name>] [--format <zip|dump>] [--output <dir>]
dooservice backup test <instance_name> [--database <name>]
dooservice backup databases <instance_name>

๐Ÿ“š Configuration

The dooservice.yml file is the heart of DooService CLI. It defines your entire Odoo infrastructure in a declarative way.

Basic Structure

# Configuration version
version: "1.0"

# Global repositories that can be used by instances
repositories:
  my-addons:
    url: "https://github.com/your-org/odoo-addons.git"
    branch: "main"

# Instance definitions
instances:
  production:
    # Odoo configuration
    odoo_version: "17.0"
    data_dir: "/opt/odoo-data/production"

    # Port configuration
    ports:
      web: 8069
      db: 5432

    # Environment variables
    env_vars:
      ADMIN_PASSWORD: "admin123"
      DB_HOST: "db_production"
      DB_USER: "odoo"
      DB_PASSWORD: "odoo123"

    # Repository configuration
    repositories:
      - name: "my-addons"
        path: "/mnt/extra-addons"

    # Backup configuration (required for backup operations)
    backup:
      database: "production_db"
      output_path: "/opt/backups/production"
      format: "zip"
      container_name_pattern: "web_{instance_name}"
      xmlrpc_url: "http://localhost:8069"

  development:
    odoo_version: "17.0"
    data_dir: "/opt/odoo-data/dev"

    ports:
      web: 8070
      db: 5433

    env_vars:
      ADMIN_PASSWORD: "dev123"
      DB_HOST: "db_development"
      DB_USER: "odoo"
      DB_PASSWORD: "odoo123"

    repositories:
      - name: "my-addons"
        path: "/mnt/extra-addons"

    backup:
      database: "dev_db"
      output_path: "/opt/backups/dev"
      format: "zip"

Repository Configuration

repositories:
  # Public repository
  odoo-community:
    url: "https://github.com/OCA/server-tools.git"
    branch: "17.0"

  # Private repository (requires SSH key)
  custom-addons:
    url: "git@github.com:your-org/private-addons.git"
    branch: "main"

  # Specific commit/tag
  stable-addons:
    url: "https://github.com/your-org/addons.git"
    commit: "abc123def456"

Backup Configuration

Backup operations require explicit configuration. No default values are assumed:

instances:
  my-instance:
    # ... other configuration ...

    backup:
      # Required: Database name to backup
      database: "my_instance_db"

      # Required: Output path for backup files
      output_path: "/opt/backups/my-instance"

      # Optional: Backup format (default: zip)
      format: "zip"  # or "dump"

      # Optional: Container name pattern (default: web_{instance_name})
      container_name_pattern: "web_{instance_name}"

      # Optional: XML-RPC URL (default: http://localhost:8069)
      xmlrpc_url: "http://localhost:8069"

๐Ÿ—๏ธ Architecture

DooService CLI v0.5.0 implements Clean Architecture principles:

Module Structure

dooservice/
โ”œโ”€โ”€ core/                 # Configuration management
โ”‚   โ”œโ”€โ”€ application/      # Configuration use cases
โ”‚   โ”œโ”€โ”€ domain/          # Configuration entities and services
โ”‚   โ””โ”€โ”€ infrastructure/  # YAML parsing, CLI adapters
โ”œโ”€โ”€ instance/            # Instance management
โ”‚   โ”œโ”€โ”€ application/     # Instance use cases
โ”‚   โ”œโ”€โ”€ domain/         # Instance entities and services
โ”‚   โ””โ”€โ”€ infrastructure/ # Docker adapters, CLI
โ”œโ”€โ”€ backup/             # Backup operations
โ”‚   โ”œโ”€โ”€ application/    # Backup use cases
โ”‚   โ”œโ”€โ”€ domain/        # Backup entities and services
โ”‚   โ””โ”€โ”€ infrastructure/ # XML-RPC adapters, CLI
โ”œโ”€โ”€ repository/         # Repository management
โ”‚   โ”œโ”€โ”€ application/    # Repository use cases
โ”‚   โ”œโ”€โ”€ domain/        # Repository entities and services
โ”‚   โ””โ”€โ”€ infrastructure/ # Git adapters, CLI
โ””โ”€โ”€ shared/            # Cross-cutting concerns
    โ””โ”€โ”€ messaging/     # Unified messaging system

Key Principles

  • Domain-Driven Design: Each module represents a bounded context
  • Dependency Inversion: All dependencies point inward to domain
  • Configuration-First: No hardcoded values, explicit configuration required
  • Type Safety: Comprehensive type hints and validation
  • Clean Separation: Clear boundaries between layers

๐Ÿ› ๏ธ Development

Architecture Guidelines

  • Application Layer: Use cases orchestrating business logic
  • Domain Layer: Pure business logic with no external dependencies
  • Infrastructure Layer: External adapters (CLI, Docker, Git, etc.)

Adding New Features

  1. Follow Clean Architecture patterns
  2. Add domain entities and services first
  3. Create use cases for business logic
  4. Implement infrastructure adapters
  5. Add CLI commands last

Running Tests

# Run all tests
uv run pytest

# Run with coverage
uv run pytest --cov=dooservice

# Run specific module tests
uv run pytest tests/backup/

Code Quality

# Format code
uv run ruff format

# Lint code
uv run ruff check

# Type checking
uv run mypy dooservice/

๐Ÿค Contributing

We welcome contributions! Please see our contributing guidelines:

  1. Fork the repository
  2. Create a feature branch following Clean Architecture
  3. Add tests for new functionality
  4. Ensure all tests pass and code is properly formatted
  5. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support


Made with โค๏ธ by API SERVICE SAC

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

dooservice_cli-0.5.2-py3-none-any.whl (94.8 kB view details)

Uploaded Python 3

File details

Details for the file dooservice_cli-0.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for dooservice_cli-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 29c39637590a9bcd45bb90af1ee23d2123b4dd7a724faefa59b9761a75d7b103
MD5 1b8f92c111bc3c172c8ab1bfdb4a4af3
BLAKE2b-256 982551761355d95741a44ddf998c0c7a7e8e052d02236a394bb32ec20e629c39

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