lordraw/open-automator-shell

By lordraw

Updated 7 months ago

Command-line interface for executing automated workflows with YAML configuration files

Image
Languages & frameworks
API management
0

634

lordraw/open-automator-shell repository overview

Open-Automator Shell

Command-line interface for executing automated workflows with YAML configuration.

Docker Image Version Docker Pulls Image Size Platform

Overview

Open-Automator Shell is a powerful CLI tool for running automated workflows defined in YAML files. It provides a flexible, modular approach to automation with support for encrypted wallets, task orchestration, and comprehensive error handling.

Key Features
  • 🚀 YAML-Based Workflows - Define complex automation tasks in simple YAML format
  • 🔐 Secure Wallet Support - Encrypted or plain-text credential management
  • 🏗️ Modular Architecture - Extensible with custom modules (system, network, I/O, Git, PostgreSQL, etc.)
  • 🔄 Task Dependencies - Control flow with success/failure handlers
  • 📊 Detailed Logging - Comprehensive execution logs and debugging
  • 🌐 Multi-Platform - Native support for AMD64 and ARM64 architectures
  • 🐳 Lightweight - Slim container based on Python 3.12

Quick Start

Pull the Image
docker pull lordraw/open-automator-shell:latest
Run a Simple Workflow
# Run a workflow file
docker run --rm \
  -v $(pwd)/workflows:/workflows \
  -v $(pwd)/data:/data \
  lordraw/open-automator-shell:latest \
  /workflows/myworkflow.yaml
With Encrypted Wallet
docker run --rm \
  -v $(pwd)/workflows:/workflows \
  -v $(pwd)/data:/data \
  -e OA_WALLET_FILE=/data/wallet.enc \
  -e OA_WALLET_PASSWORD=mysecret \
  lordraw/open-automator-shell:latest \
  /workflows/myworkflow.yaml

Usage Examples

Example 1: Basic Workflow Execution
# Create a simple workflow
cat > workflow.yaml << 'EOF'
- tasks:
  - name: hello
    module: oa-system
    function: execute_command
    params:
      command: echo "Hello from Open-Automator!"
EOF

# Run it
docker run --rm -v $(pwd):/workflows lordraw/open-automator-shell:latest /workflows/workflow.yaml
Example 2: Multi-Step Workflow with Error Handling
# workflow-advanced.yaml
- tasks:
  - name: check_disk
    module: oa-system
    function: execute_command
    params:
      command: df -h
    on_success: backup_files
    on_failure: notify_error

  - name: backup_files
    module: oa-io
    function: copy_file
    params:
      source: /data/important.txt
      destination: /backup/important.txt

  - name: notify_error
    module: oa-notify
    function: send_notification
    params:
      message: "Disk check failed!"
docker run --rm \
  -v $(pwd):/workflows \
  -v $(pwd)/data:/data \
  -v $(pwd)/backup:/backup \
  lordraw/open-automator-shell:latest \
  /workflows/workflow-advanced.yaml
Example 3: Using Secrets from Wallet
# First, create a wallet
docker run --rm -it \
  -v $(pwd)/data:/data \
  lordraw/open-automator-wallet:latest \
  create /data/wallet.enc

# Then use it in workflow
docker run --rm \
  -v $(pwd)/workflows:/workflows \
  -v $(pwd)/data:/data \
  -e OA_WALLET_FILE=/data/wallet.enc \
  -e OA_WALLET_PASSWORD=mysecret \
  lordraw/open-automator-shell:latest \
  /workflows/workflow-with-secrets.yaml

Workflow with secrets:

# workflow-with-secrets.yaml
- tasks:
  - name: connect_db
    module: oa-pg
    function: connect
    params:
      host: "{{DB_HOST}}"
      user: "{{DB_USER}}"
      password: "{{DB_PASSWORD}}"
      database: "{{DB_NAME}}"
Example 4: Git Operations
# workflow-git.yaml
- tasks:
  - name: clone_repo
    module: oa-git
    function: clone_repository
    params:
      url: https://github.com/user/repo.git
      path: /data/repo

  - name: checkout_branch
    module: oa-git
    function: checkout
    params:
      repo_path: /data/repo
      branch: main
docker run --rm \
  -v $(pwd)/data:/data \
  lordraw/open-automator-shell:latest \
  /data/workflow-git.yaml

Environment Variables

VariableDescriptionDefaultRequired
OA_WALLET_FILEPath to wallet file (encrypted or JSON)/data/wallet.encNo
OA_WALLET_PASSWORDPassword for encrypted walletchangemeNo*
WORKFLOW_PATHDefault path for workflows/workflowsNo
LOG_LEVELLogging level (DEBUG, INFO, WARNING, ERROR)INFONo

*Required only for encrypted wallets

Docker Compose Example

version: '3.8'

services:
  # One-shot workflow execution
  workflow-runner:
    image: lordraw/open-automator-shell:latest
    volumes:
      - ./workflows:/workflows
      - ./data:/data
      - ./logs:/logs
    environment:
      - OA_WALLET_FILE=/data/wallet.enc
      - OA_WALLET_PASSWORD=${WALLET_PASSWORD}
      - LOG_LEVEL=INFO
    command: /workflows/main-workflow.yaml
    restart: "no"

  # Scheduled execution with cron
  scheduled-workflow:
    image: lordraw/open-automator-shell:latest
    volumes:
      - ./workflows:/workflows
      - ./data:/data
    environment:
      - OA_WALLET_FILE=/data/wallet.json
    entrypoint: /bin/bash
    command: |
      -c "while true; do 
        python3.12 automator.py /workflows/hourly-task.yaml
        sleep 3600
      done"
    restart: unless-stopped

Run with:

WALLET_PASSWORD=mysecret docker-compose up

Volume Mounts

Recommended volume mounts:

docker run --rm \
  -v /path/to/workflows:/workflows:ro \    # Workflow files (read-only)
  -v /path/to/data:/data \                 # Data directory
  -v /path/to/logs:/logs \                 # Log output
  -v /path/to/output:/output \             # Workflow outputs
  lordraw/open-automator-shell:latest \
  /workflows/myworkflow.yaml

Available Modules

The shell includes these built-in modules:

  • oa-system - System operations (commands, processes, files)
  • oa-network - Network operations (HTTP, TCP, DNS)
  • oa-io - File I/O operations (read, write, copy, move)
  • oa-git - Git operations (clone, commit, push, pull)
  • oa-pg - PostgreSQL database operations
  • oa-notify - Notifications (email, webhooks, Slack)
  • oa-utility - Utility functions (data processing, validation)

Workflow Structure

# Basic workflow structure
- tasks:
  - name: task_name
    module: module_name
    function: function_name
    params:
      param1: value1
      param2: value2
    on_success: next_task    # Optional
    on_failure: error_task   # Optional

  - name: next_task
    module: another_module
    function: another_function

Tips and Best Practices

1. Use Read-Only Mounts for Workflows
-v $(pwd)/workflows:/workflows:ro

This prevents accidental modification of workflow files.

2. Separate Secrets from Workflow Files

Use wallet files instead of hardcoding secrets:

# Good ✅
params:
  password: "{{DB_PASSWORD}}"

# Bad ❌
params:
  password: "hardcoded_secret"
3. Use Plain Wallet for Development

For development/testing, use plain JSON wallets:

echo '{"DB_PASSWORD": "test123"}' > data/wallet.json

docker run --rm \
  -v $(pwd)/data:/data \
  -e OA_WALLET_FILE=/data/wallet.json \
  lordraw/open-automator-shell:latest workflow.yaml
4. Check Exit Codes
docker run --rm lordraw/open-automator-shell:latest workflow.yaml
if [ $? -eq 0 ]; then
  echo "Workflow succeeded"
else
  echo "Workflow failed"
fi
5. Debug with Verbose Logging
docker run --rm \
  -e LOG_LEVEL=DEBUG \
  lordraw/open-automator-shell:latest \
  workflow.yaml 2>&1 | tee workflow.log

Architecture Support

This image supports multiple architectures:

  • linux/amd64 - Intel/AMD 64-bit
  • linux/arm64 - ARM 64-bit (Apple Silicon, ARM servers)

Docker will automatically pull the correct architecture for your system.

Health Check

The container includes a basic health check:

HEALTHCHECK CMD pgrep -f python3.12 || exit 1

Security Considerations

  1. Encrypted Wallets: Use encrypted wallets for production
  2. Secrets Management: Never commit wallet files to version control
  3. Read-Only Volumes: Mount workflow directories as read-only when possible
  4. User Permissions: The container runs as non-root user (uid 1000)
  5. Network Isolation: Use Docker networks to isolate containers

Troubleshooting

Workflow file not found
# Ensure absolute path or correct mount
docker run --rm -v $(pwd):/workflows lordraw/open-automator-shell:latest /workflows/file.yaml
Wallet password error
# Verify password is correct
docker run --rm -it -v $(pwd)/data:/data lordraw/open-automator-wallet:latest verify /data/wallet.enc
Permission denied
# Fix file permissions (container uses uid 1000)
chown -R 1000:1000 data/
Module not found
# List available modules
docker run --rm lordraw/open-automator-shell:latest --list-modules

Version Information

  • Base Image: python:3.12-slim-bookworm
  • Python Version: 3.12
  • User: automator (uid:1000)
  • Working Directory: /app

Support


Star us on GitHub!https://github.com/lordraw77/open-automator

Tag summary

Content type

Image

Digest

sha256:b66657b1b

Size

300.5 MB

Last updated

7 months ago

docker pull lordraw/open-automator-shell