Skip to content

Add CLI deployment scripts for existing servers#1

Open
justin-russell wants to merge 9 commits intomainfrom
cli
Open

Add CLI deployment scripts for existing servers#1
justin-russell wants to merge 9 commits intomainfrom
cli

Conversation

@justin-russell
Copy link

@justin-russell justin-russell commented Feb 3, 2026

Summary

Implements complete CLI deployment workflow for deploying OpenClaw to existing servers with true one-command deployment. No separate setup or inventory file creation required - just provide an IP address and SSH key.

🎯 One-Command Deployment (NEW!)

The deployment script now handles everything automatically:

# Deploy and auto-onboard in one command
./run-deploy.sh <IP> -k ~/.ssh/key -n my-server

# That's it! No setup.sh, no create-inventory.sh needed

What happens automatically:

  • ✅ Detects Python 3.12+ and installs dependencies if needed
  • ✅ Creates virtual environment if missing
  • ✅ Installs Ansible and collections automatically
  • ✅ Generates temporary inventory from IP
  • ✅ Deploys OpenClaw to server
  • ✅ Launches interactive onboard wizard

Key Features

🚀 Streamlined Deployment

  • One-command deployment: ./run-deploy.sh <IP> -k <key> -n <name>
  • Auto-setup integrated into run-deploy.sh
  • Direct IP address support (no inventory file needed)
  • Instance naming via -n/--name flag
  • Full backward compatibility with inventory files

🔧 Automatic Setup

  • Detects Python 3.12+ across multiple sources (python3.12, python3, python, pyenv)
  • Creates virtual environment automatically if missing
  • Installs all dependencies automatically
  • Installs Ansible collections automatically
  • Only errors if Python 3.12+ not found (with install instructions)

📦 Instance Artifact Management

  • Automatically creates instance artifacts after deployment
  • Stores connection details (IP, SSH key path, instance name)
  • Works seamlessly with connect-instance.sh for easy reconnection

✨ Auto-Onboard by Default

  • Deploys and immediately launches interactive OpenClaw wizard
  • --skip-onboard flag available if needed
  • Streamlined user experience

New Deployment Workflows

Before (3 steps):

./setup.sh
./create-inventory.sh <IP> inventory.ini
INSTANCE_NAME_OVERRIDE=my-server ./run-deploy.sh -k <key> -i inventory.ini

After (1 step):

./run-deploy.sh <IP> -k <key> -n my-server

Legacy Support (still works):

./run-deploy.sh -k <key> -i inventory.ini

Scripts

run-deploy.sh (ENHANCED)

Deploy OpenClaw to existing servers with auto-setup:

  • Direct IP support: ./run-deploy.sh <IP> -k <key>
  • Instance naming: -n/--name <name> flag
  • Auto-setup: Installs dependencies automatically if needed
  • Auto-inventory: Generates temporary inventory files
  • Backward compatible: Still supports -i inventory.ini
  • Auto-onboard: Launches wizard by default (--skip-onboard to disable)
  • Creates instance artifacts automatically
  • Supports INSTANCE_NAME_OVERRIDE environment variable

setup.sh

Standalone environment setup (optional now):

  • Finds Python 3.12+ (checks multiple sources including pyenv)
  • Creates venv if needed
  • Installs requirements.txt
  • Installs Ansible Hetzner collection
  • Shows installation instructions if Python 3.12+ missing

connect-instance.sh

Connect to deployed instances:

  • Reads instance artifacts for connection details
  • Launch onboard/setup wizards interactively
  • Open interactive shell as roboclaw user
  • Supports custom IP/key via --ip and --key flags

create-inventory.sh

Generate Ansible inventory files (advanced use):

  • For users who need multi-server inventories
  • Simple wrapper to create inventory from IP address
  • Validates IP format

cleanup-ssh-key.yml

Manage SSH keys in Hetzner Cloud:

  • List all SSH keys
  • Delete specific keys by name

Usage Examples

Basic deployment:

./run-deploy.sh 192.168.1.100 -k ~/.ssh/id_ed25519

With custom name:

./run-deploy.sh 192.168.1.100 -k ~/.ssh/key -n production

Skip auto-onboard:

./run-deploy.sh 192.168.1.100 -k key -n prod --skip-onboard

Using --ip flag:

./run-deploy.sh --ip 192.168.1.100 -k key -n test

Backward compatible (inventory file):

./run-deploy.sh -k key -i hosts.ini

Environment variables:

INSTANCE_NAME_OVERRIDE=my-server ./run-deploy.sh 192.168.1.100 -k key

Improvements to Existing Scripts

run-hetzner.sh

  • Added prerequisite checks (Python 3.12+, Ansible, dependencies)
  • Suggests running ./setup.sh if prerequisites missing

hetzner-finland-fast.yml

  • Removed unsupported 'force' parameter from ssh_key module
  • Added debug task to show provisioning parameters

Documentation

  • Updated README with one-command Quick Start
  • Clear examples showing new simplified workflow
  • Prerequisites section emphasizing auto-setup
  • Complete workflow examples
  • Updated TLDR section

Testing

All deployment scenarios tested:

  • ✅ One-command deployment with IP
  • ✅ Custom instance naming with -n flag
  • ✅ Auto-setup runs when venv missing
  • ✅ Auto-onboard launches successfully
  • ✅ Backward compatibility with inventory files
  • ✅ Environment variables (INSTANCE_NAME_OVERRIDE)
  • ✅ --skip-onboard flag works
  • ✅ --ip flag as alternative to positional
  • ✅ Instance artifacts created correctly
  • ✅ Connection script reads artifacts

Files Changed

  • run-deploy.sh (enhanced) - One-command deployment with auto-setup
  • README.md (updated) - Simplified documentation
  • setup.sh (existing) - Kept as standalone option
  • connect-instance.sh (existing) - No changes
  • create-inventory.sh (existing) - Now for advanced use
  • cleanup-ssh-key.yml (existing) - No changes
  • run-hetzner.sh (existing) - No changes

Breaking Changes

None. All existing functionality preserved with full backward compatibility.

thebalaa and others added 9 commits February 1, 2026 21:24
Implements complete deployment workflow for deploying OpenClaw to existing servers
without provisioning new Hetzner instances. Enables integration testing of Ansible
playbooks and deployment to any server with SSH access.

New scripts:
- run-deploy.sh: Deploy OpenClaw using SSH key and inventory file
  - Auto-onboards by default (--skip-onboard to disable)
  - Creates instance artifacts automatically
  - Supports custom instance names via INSTANCE_NAME_OVERRIDE

- connect-instance.sh: Connect to instances and run OpenClaw commands
  - Reads instance artifacts to get connection details
  - Supports interactive onboard/setup/shell access
  - Can use custom IP/key via --ip and --key flags

- create-inventory.sh: Generate Ansible inventory from IP address
  - Simple wrapper to create inventory files
  - Validates IP format

- cleanup-ssh-key.yml: Manage SSH keys in Hetzner Cloud
  - List all SSH keys
  - Delete specific keys by name

Improvements:
- run-hetzner.sh: Add prerequisite checks for Python 3.12, Ansible, dependencies
- hetzner-finland-fast.yml:
  - Remove unsupported 'force' parameter from ssh_key module
  - Add debug task to show provisioning parameters

Complete workflow:
1. Create inventory: ./create-inventory.sh <IP> inventory.ini
2. Deploy + onboard: ./run-deploy.sh -k <key> -i inventory.ini
3. Or connect later: ./connect-instance.sh <instance-name> onboard

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add comprehensive documentation for the new CLI deployment workflow:

- Quick Start section for deploying to existing servers
- Detailed command documentation for run-deploy.sh, connect-instance.sh, create-inventory.sh
- Complete workflow examples showing end-to-end deployment
- Updated file structure with new scripts
- Enhanced requirements section with Python 3.12+ setup
- Updated TLDR with both deployment methods

Key improvements:
- Emphasizes CLI deployment as recommended approach for testing
- Documents auto-onboard feature (default behavior)
- Shows how to skip onboarding with --skip-onboard
- Provides clear setup instructions for Python virtualenv
- Includes prerequisite checking information

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Create setup.sh to automate environment setup:
- Automatically detects Python 3.12+ (checks python3.12, python3, python, pyenv)
- Creates virtual environment if needed
- Installs all Python dependencies from requirements.txt
- Installs Ansible Hetzner collection
- Provides helpful error messages if Python 3.12+ not found
- Shows installation instructions for pyenv, apt, and brew

Update prerequisite checks:
- run-deploy.sh: Suggest running ./setup.sh if prerequisites missing
- run-hetzner.sh: Suggest running ./setup.sh if prerequisites missing

Update README:
- Replace manual setup steps with ./setup.sh one-liner
- Document what setup.sh does and how it works
- Update Quick Start, Requirements, Complete Workflows, and TLDR
- Emphasize simplicity: just run ./setup.sh

User experience improvements:
- No need to know about venv, pip, or ansible-galaxy
- No need to find the right Python binary
- Just run ./setup.sh and everything is installed
- Clear errors if Python 3.12+ not available

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Transform run-deploy.sh into a true one-command solution that:
- Auto-installs dependencies (Python 3.12+, venv, Ansible, collections)
- Accepts IP address directly as positional argument
- Accepts instance name via -n/--name flag
- Auto-generates temporary inventory files
- Maintains full backward compatibility with inventory files

New workflow: ./run-deploy.sh <IP> -k <key> -n <name>
Old workflow still works: ./run-deploy.sh -k <key> -i <inventory>

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Merge changes from main while preserving all deployment infrastructure:
- Add LICENSE file (GNU AGPL v3)
- Update README with Discord and Twitter/X community links
- Update website Footer with correct social links
- Keep all CLI deployment scripts and infrastructure
- Keep all Ansible playbooks and requirements

No deployment functionality removed - all features intact.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Move all CLI scripts and Ansible playbooks into a dedicated cli/ directory:
- All shell scripts (.sh files)
- All Ansible playbooks (.yml files)
- ansible.cfg configuration

Changes:
- Created cli/ directory structure
- Moved 16 files: scripts, playbooks, and config
- Updated all scripts to cd to correct directory on startup
- Added path resolution for user-provided arguments (SSH keys, inventory)
- Updated README, PROVISION.md, HETZNER_SETUP.md with new paths
- Updated File Structure section in README
- All scripts reference ../instances/ and ../venv/ correctly

User workflow remains simple:
  ./cli/run-deploy.sh <IP> -k <key> -n <name>

Tested and verified:
- Deployment works correctly with new structure
- Path resolution handles relative and absolute paths
- Instance artifacts created successfully

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants