Backend Deploy CLI

The dart_cloud_deploy CLI is a robust deployment tool for managing Dart Cloud Backend deployments with OpenBao secrets management and Ansible integration.

Overview

The Deploy CLI enables DevOps and developers to:

  • Deploy Locally - Deploy using Podman/Docker without Ansible
  • Deploy Remotely - Deploy to VPS/servers using Ansible playbooks
  • Manage Secrets - Fetch secrets from OpenBao and generate .env files
  • Multi-Environment - Support for local, dev, and production environments
  • CI/CD Ready - Integrate with GitHub Actions and other CI/CD pipelines

Quick Links

Key Features

Local Deployment

  • Container Runtime - Works with Podman or Docker
  • Compose Support - Uses docker-compose/podman-compose
  • Interactive Menus - User-friendly prompts for service management
  • Health Checks - Automatic service health verification
  • Selective Rebuild - Rebuild backend only, keeping database data

Remote Deployment

  • Ansible Integration - Uses Ansible for remote deployments
  • Dynamic Playbooks - Generates playbooks on-demand
  • Modern Syntax - Uses ansible.builtin.* modules
  • Auto Cleanup - Removes generated playbooks after deployment
  • SSH Key Auth - Secure SSH key-based authentication

Secrets Management

  • OpenBao/Vault - Fetch secrets from OpenBao or HashiCorp Vault
  • Auto .env Generation - Writes secrets to .env files
  • Path Override - Fetch from different secret paths
  • Health Check - Verify OpenBao connectivity

Configuration

  • YAML & TOML - Support for both configuration formats
  • Environment Templates - Generate configs for local/dev/production
  • Validation - Validate configuration before deployment
  • Flexible Paths - Custom paths for all components

Installation

Quick Install

dart
cd ContainerPub/tools/dart_packages/dart_cloud_deploy_cli
./scripts/build.sh
./scripts/install.sh

Manual Install

dart
cd tools/dart_packages/dart_cloud_deploy_cli
dart pub get
dart pub global activate --source path .

Verify Installation

bash
dart_cloud_deploy --help

Quick Start

dart
# 1. Initialize environment (Python venv + Ansible)
dart_cloud_deploy init

# 2. Create configuration
dart_cloud_deploy config init -e local

# 3. Deploy locally
dart_cloud_deploy deploy-local

Architecture

Workflow

Diagram
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    dart_cloud_deploy                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚   init   │───▢│  config  │───▢│  deploy-local/dev    β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚       β”‚               β”‚                    β”‚                 β”‚
β”‚       β–Ό               β–Ό                    β–Ό                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Python  β”‚    β”‚  YAML/   β”‚    β”‚  Podman/Docker or    β”‚   β”‚
β”‚  β”‚   venv   β”‚    β”‚  TOML    β”‚    β”‚  Ansible Playbooks   β”‚   β”‚
β”‚  β”‚ +Ansible β”‚    β”‚  Config  β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                               β”‚
β”‚                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Local Deployment Flow

  • Load configuration from deploy.yaml
  • Check container runtime (Podman/Docker)
  • Fetch secrets from OpenBao (optional)
  • Start services with docker-compose
  • Wait for health checks
  • Display service endpoints

Remote Deployment Flow

  • Load configuration from deploy.yaml
  • Check Ansible environment
  • Fetch secrets from OpenBao (optional)
  • Generate Ansible inventory
  • Generate playbooks from templates
  • Run Ansible playbooks
  • Cleanup temporary files

Configuration Example

yaml
name: dart_cloud_backend
environment: dev
project_path: .
env_file_path: .env

openbao:
  address: http://localhost:8200
  token_path: ~/.openbao/token
  secret_path: secret/data/dart_cloud/dev

container:
  runtime: podman
  compose_file: docker-compose.yml
  project_name: dart_cloud
  services:
    backend: dart_cloud_backend
    postgres: dart_cloud_postgres

host:
  host: your-server.example.com
  port: 22
  user: deploy
  ssh_key_path: ~/.ssh/id_rsa

ansible:
  extra_vars:
    app_dir: /opt/dart_cloud

Requirements

RequirementVersionPurpose
Dart SDK^3.10.4CLI runtime
Python3.8+Ansible venv
Podman/DockerLatestLocal deployment
OpenBao/VaultOptionalSecrets management

Directory Structure

Diagram
~/.dart-cloud-deploy/
β”œβ”€β”€ config.yaml       # Global configuration
β”œβ”€β”€ credentials.yaml  # Stored credentials
β”œβ”€β”€ cache/            # Cached data
β”œβ”€β”€ logs/             # Log files
β”œβ”€β”€ playbooks/        # Generated playbooks
└── inventory/        # Ansible inventory files

Next Steps

Support

For issues, questions, or contributions: