-
-
Notifications
You must be signed in to change notification settings - Fork 0
Python CLI Complete Reference
This document provides complete feature parity documentation between the original bash script devstack.sh (now deleted) and the new devstack Python CLI wrapper.
# Install prerequisites
brew install colima docker docker-compose
# Clone repository
cd ~/devstack-core
# Setup Python dependencies (one-time)
uv venv
uv pip install -r scripts/requirements.txt
# The wrapper script automatically uses the venv
./devstack --helpStarts Colima VM and Docker services with optional profile support.
Usage:
./devstack start [--profile PROFILE]Options:
-
--profile- Service profile to start (minimal, standard, full, reference) - Can specify multiple
--profileflags
Examples:
# Start with standard profile (recommended)
./devstack start --profile standard
# Start with minimal profile (lightweight)
./devstack start --profile minimal
# Combine profiles
./devstack start --profile standard --profile referenceWhat it does:
- Checks if Colima is already running
- Starts Colima VM with configured resources (if not running)
- Loads profile-specific environment variables
- Starts Docker Compose services for specified profiles
- Shows service status after startup
Stops Docker services and Colima VM.
Usage:
./devstack stop [--profile PROFILE]Options:
-
--profile- Stop specific profile services only (optional)
Examples:
# Stop everything (VM + all services)
./devstack stop
# Stop only reference profile services
./devstack stop --profile referenceWhat it does:
- Stops Docker Compose services
- Stops Colima VM (if no profile specified)
- Releases system resources
Restarts Docker services without restarting Colima VM.
Usage:
./devstack restartWhat it does:
- Restarts all running Docker containers
- VM stays running (faster than stop + start)
- Useful for applying configuration changes
Displays status of Colima VM and all running services.
Usage:
./devstack statusOutput includes:
- Colima VM status and IP address
- Running services count
- CPU and memory allocation
- Disk usage
- Table of all running containers with status
Performs health checks on all running services.
Usage:
./devstack healthWhat it checks:
- Service container status
- Health check endpoints (if configured)
- Response times
- Dependency availability
Output:
- Color-coded health status (green = healthy, red = unhealthy)
- Detailed status for each service
View logs for all services or a specific service.
Usage:
./devstack logs [SERVICE]Arguments:
-
SERVICE- Service name (optional, shows all if omitted)
Examples:
# View all service logs
./devstack logs
# View PostgreSQL logs
./devstack logs postgres
# View Vault logs
./devstack logs vaultFeatures:
- Follows logs in real-time (Ctrl+C to exit)
- Color-coded output
- Timestamped entries
Open an interactive shell in a running container.
Usage:
./devstack shell <SERVICE>Arguments:
-
SERVICE- Service name (required)
Examples:
# Shell into PostgreSQL container
./devstack shell postgres
# Shell into Vault container
./devstack shell vault
# Shell into Redis
./devstack shell redis-1Display Colima VM IP address.
Usage:
./devstack ipOutput:
- VM IP address
- Network interface information
Initialize and unseal Vault (manual/legacy command).
Usage:
./devstack vault-initWhat it does:
- Runs vault initialization script
- Generates unseal keys
- Saves keys to
~/.config/vault/keys.json - Saves root token to
~/.config/vault/root-token - Unseals Vault
Note: This is a legacy command. Normal startup uses auto-unseal.
Manually unseal Vault using stored unseal keys.
Usage:
./devstack vault-unsealWhen to use:
- Vault is sealed after a crash
- Auto-unseal mechanism failed
- Manual intervention required
What it does:
- Reads unseal keys from
~/.config/vault/keys.json - Unseals Vault using first 3 keys
- Displays seal status
Display Vault seal status and root token information.
Usage:
./devstack vault-statusOutput:
- Sealed status (true/false)
- Initialized status
- Vault version
- Root token location
- Instructions to set VAULT_TOKEN
Print Vault root token to stdout.
Usage:
./devstack vault-token
# Use in scripts
export VAULT_TOKEN=$(./devstack vault-token)Output:
- Raw token (no formatting) for use in automation
Bootstrap Vault with PKI and service credentials.
Usage:
./devstack vault-bootstrapWhat it does:
- Enables PKI secrets engine
- Generates Root CA (10-year validity)
- Generates Intermediate CA (5-year validity)
- Configures certificate roles for all services
- Enables KV v2 secrets engine
- Generates and stores all service passwords
- Exports CA certificate chain
- Creates Forgejo database
One-time setup command - Run after first start.
Export Vault CA certificate chain to stdout.
Usage:
./devstack vault-ca-cert > ca.pem
# Install on macOS
./devstack vault-ca-cert | \
sudo security add-trusted-cert -d -r trustRoot \
-k /Library/Keychains/System.keychain /dev/stdinOutput:
- PEM-encoded CA certificate chain
- Location information (stderr)
Retrieve and display service credentials from Vault.
Usage:
./devstack vault-show-password <SERVICE>Arguments:
-
SERVICE- Service name (required)
Available services:
-
postgres- PostgreSQL admin password -
mysql- MySQL root password -
redis-1,redis-2,redis-3- Redis AUTH passwords -
rabbitmq- RabbitMQ admin password -
mongodb- MongoDB root password -
forgejo- Admin username, email, and password
Examples:
# Get PostgreSQL password
./devstack vault-show-password postgres
# Get Forgejo admin credentials
./devstack vault-show-password forgejoSecurity warning: Displays passwords in plaintext.
Initialize Forgejo via automated bootstrap script.
Usage:
./devstack forgejo-initPrerequisites:
- Colima and services running
- Vault bootstrapped
- PostgreSQL database created
What it does:
- Checks Forgejo container is running
- Runs automated installation script
- Configures Forgejo with Vault credentials
- Sets up admin user
- Configures PostgreSQL database
After completion:
- Access at http://localhost:3000
- Get credentials with
vault-show-password forgejo
Initialize Redis cluster (required for standard/full profiles).
Usage:
./devstack redis-cluster-initPrerequisites:
- Started with
--profile standardor--profile full - All 3 Redis nodes running
What it does:
- Checks Redis containers are running
- Fetches Redis password from Vault
- Creates 3-node cluster with automatic slot distribution
- Verifies cluster formation
- Displays cluster nodes
One-time setup - Only needed after first start with standard/full profile.
List all available service profiles with details.
Usage:
./devstack profilesOutput:
- Table of built-in profiles (minimal, standard, full, reference)
- Service count and RAM requirements
- Description of each profile
- Custom profile list (from profiles.yaml)
Backup all service data to timestamped directory.
Usage:
./devstack backupWhat it backs up:
- PostgreSQL: Complete dump of all databases
- MySQL: Complete dump of all databases
- MongoDB: Binary archive dump
- Forgejo: Tarball of /data directory
- .env: Configuration file
Backup location:
./backups/YYYYMMDD_HHMMSS/
Output:
- Progress indicators for each service
- Final backup size
- Backup directory path
Important: Always backup before reset command!
Completely reset and delete Colima VM - DESTRUCTIVE OPERATION.
Usage:
./devstack resetConfirmation required: Yes (interactive prompt)
This command DESTROYS:
- All Docker containers and images
- All Docker volumes (databases, Git repos, files)
- Colima VM disk and configuration
This command PRESERVES:
- Vault keys/tokens in
~/.config/vault/(on host) - Backups in
./backups/(on host) -
.envconfiguration (on host)
Always run backup first!
Restore service data from a timestamped backup directory.
Usage:
# List available backups
./devstack restore
# Restore specific backup
./devstack restore 20250110_143022Arguments:
-
BACKUP_NAME- Backup directory name (optional)
This command OVERWRITES:
- All PostgreSQL databases
- All MySQL databases
- All MongoDB databases
- Forgejo data directory
-
.envconfiguration file
What it does:
- Lists available backups (if no backup specified)
- Validates backup directory exists
- Prompts for confirmation (destructive operation)
- Restores PostgreSQL dump
- Restores MySQL dump (with Vault password)
- Restores MongoDB archive
- Restores Forgejo data directory
- Restores .env configuration
- Recommends restarting services
Examples:
# List backups
./devstack restore
# Restore from specific backup
./devstack restore 20250110_143022
# After restore, restart services
./devstack restartImportant:
- Always verify backup integrity before restoring
- Services must be running (containers active)
- Restart services after restore to apply changes
- Use with caution - cannot be undone!
| Bash Script Command | Python CLI Command | Status | Notes |
|---|---|---|---|
start |
start |
✅ | Enhanced with profile support |
stop |
stop |
✅ | Enhanced with profile support |
restart |
restart |
✅ | Identical functionality |
status |
status |
✅ | Enhanced with Rich tables |
logs |
logs |
✅ | Identical functionality |
shell |
shell |
✅ | Identical functionality |
ip |
ip |
✅ | Identical functionality |
health |
health |
✅ | Enhanced with color coding |
reset |
reset |
✅ | Added confirmation prompt |
backup |
backup |
✅ | Enhanced with progress bars |
| N/A | restore |
✅ NEW | Restore from backup (Python only) |
vault-init |
vault-init |
✅ | Identical functionality |
vault-unseal |
vault-unseal |
✅ | Identical functionality |
vault-status |
vault-status |
✅ | Identical functionality |
vault-token |
vault-token |
✅ | Identical functionality |
vault-bootstrap |
vault-bootstrap |
✅ | Identical functionality |
vault-ca-cert |
vault-ca-cert |
✅ | Identical functionality |
vault-show-password |
vault-show-password |
✅ | Identical functionality |
forgejo-init |
forgejo-init |
✅ | Identical functionality |
redis-cluster-init |
redis-cluster-init |
✅ | Identical functionality |
help |
--help |
✅ | Click provides better help |
| N/A | profiles |
✅ NEW | Profile management (Python only) |
- Native
--profileflag onstartandstopcommands - Automatic environment loading from
configs/profiles/*.env - Multiple profiles can be combined
- Rich library for colored output
- Beautiful tables for status and profiles
- Progress bars for long operations
- Consistent formatting throughout
- Clear error messages
- Actionable suggestions
- Proper exit codes
- Better validation
- Confirmation prompts for destructive operations
- Better status checking before operations
- Helpful warnings
-
vault-tokenoutputs raw token for scripting -
vault-ca-certoutputs raw certificate - Proper exit codes for CI/CD
- macOS with Apple Silicon (or Linux x86_64/arm64)
- Homebrew package manager
- 4-8GB available RAM (depending on profile)
- 20-50GB free disk space
- Colima >= 0.5.0
- Docker >= 20.10
- Docker Compose >= 2.0
- Python >= 3.9 (uses system Python via venv)
- uv (for dependency management)
- click >= 8.1.0
- rich >= 13.0.0
- PyYAML >= 6.0
- python-dotenv >= 1.0.0
-
devstack- Wrapper script (automatically uses .venv) -
manage_devstack.py- Python CLI implementation -
requirements.txt- Python dependencies -
.venv/- Virtual environment (auto-created withuv venv) -
.env- Environment configuration
-
configs/- Service configurations -
configs/profiles/- Profile-specific environment overrides -
docker-compose.yml- Service definitions with profile labels
-
~/.config/vault/- Vault keys, tokens, certificates (CRITICAL) -
backups/- Database backups - Docker volumes - Service data (managed by Docker)
# 1. Install dependencies
cd ~/devstack-core
uv venv
uv pip install -r scripts/requirements.txt
# 2. Configure
cp .env.example .env
nano .env # Set passwords if desired (optional, auto-generated)
# 3. Start with standard profile
./devstack start --profile standard
# 4. Initialize Vault
./devstack vault-init
# 5. Bootstrap Vault (creates PKI + credentials)
./devstack vault-bootstrap
# 6. Initialize Redis cluster
./devstack redis-cluster-init
# 7. Initialize Forgejo
./devstack forgejo-init
# 8. Check health
./devstack health# Start environment
./devstack start --profile standard
# Check status
./devstack status
# View service logs
./devstack logs postgres
# Get credentials
./devstack vault-show-password postgres
# Stop environment
./devstack stop# Backup before making changes
./devstack backup
# List available backups
./devstack restore
# Restore from backup if needed
./devstack restore 20250110_143022
# Restart services after config changes
./devstack restart
# Check service health
./devstack health
# View specific service logs
./devstack logs vault# Check Vault status
./devstack vault-status
# Unseal Vault if needed
./devstack vault-unseal
# Shell into container for debugging
./devstack shell postgres
# Check Colima VM IP
./devstack ip
# Full reset (DESTRUCTIVE - backup first!)
./devstack backup
./devstack resetAll commands have been tested and verified:
-
start- Starts Colima and services -
start --profile minimal- Profile support works -
start --profile standard --profile reference- Multiple profiles -
stop- Stops services and VM -
restart- Restarts services -
status- Shows VM and service status -
health- Health checks work -
logs- Shows container logs -
logs postgres- Specific service logs -
shell postgres- Interactive shell -
ip- Displays VM IP -
profiles- Lists all profiles -
vault-init- Initializes Vault -
vault-unseal- Manual unseal -
vault-status- Shows Vault status -
vault-token- Outputs token -
vault-bootstrap- Bootstraps PKI -
vault-ca-cert- Exports certificate -
vault-show-password postgres- Shows password -
vault-show-password forgejo- Shows credentials -
forgejo-init- Initializes Forgejo -
redis-cluster-init- Creates cluster -
backup- Backups all data -
restore- Lists available backups -
restore 20250110_143022- Restores from backup -
reset- Resets environment (with confirmation)
If you were using devstack.sh:
-
Update your shell history/aliases:
- Old:
./devstack.sh start - New:
./devstack start
- Old:
-
Install Python dependencies:
uv venv uv pip install -r scripts/requirements.txt
-
Test basic commands:
./devstack --help ./devstack status
-
All data and configurations are preserved - The Python CLI uses the same Docker Compose files and configurations.
-
helpcommand (replaced with--helpflag, Click standard)
-
profiles- List all service profiles
For issues or questions:
- Check
docs/TROUBLESHOOTING.md - Check
docs/FAQ.md - Review
docs/PYTHON_MANAGEMENT_SCRIPT.md - Open issue at GitHub repository
-
v1.3.0 - Python CLI implementation with full feature parity
- All bash script commands implemented
- Enhanced UI with Rich library
- Profile support integrated
- Comprehensive testing completed
- Original bash script removed