Skip to content

CLI Reference

milkcrate provides a unified command-line interface for all operations.

Usage

uv run milkcrate <command>

For detailed help on any command, use:

milkcrate <command> --help

Commands

The following commands are available. All commands support --help for detailed usage information.

cli

milkcrate - A unified CLI for container orchestration platform management.

Usage:

cli [OPTIONS] COMMAND [ARGS]...

Options:

  --version  Show the version and exit.
  --help     Show this message and exit.

backup

Create a backup of milkcrate data (database, uploads, extracted apps).

Creates a timestamped compressed archive containing: - Database (instance/milkcrate.sqlite) - Uploads directory (unless --no-uploads is specified) - Extracted apps directory (unless --no-extracted is specified)

Backups are stored in the backups/ directory by default.

Examples: milkcrate backup milkcrate backup --output /path/to/backups milkcrate backup --no-uploads --no-extracted # Database only

Usage:

cli backup [OPTIONS]

Options:

  -o, --output PATH  Directory to store backups (default: ./backups).
  --no-uploads       Exclude uploads directory from backup.
  --no-extracted     Exclude extracted_apps directory from backup.
  --help             Show this message and exit.

check

Check system prerequisites and project status.

Usage:

cli check [OPTIONS]

Options:

  --help  Show this message and exit.

clean

Clean cache files, uploads, extracted apps, and/or reset database.

Cache cleaning does not require confirmation. All other operations require confirmation unless --yes is provided.

Examples: milkcrate clean --cache milkcrate clean --uploads --extracted milkcrate clean --all

Usage:

cli clean [OPTIONS]

Options:

  --cache      Remove Python cache files, bytecode, and build artifacts.
  --uploads    Remove all files from uploads/ directory.
  --extracted  Remove all files from extracted_apps/ directory.
  --db         Delete and re-initialize the database.
  --all        Clean everything: cache, uploads, extracted apps, and database.
  -y, --yes    Skip confirmation prompts (use with caution).
  --help       Show this message and exit.

down

Stop docker compose stack.

Usage:

cli down [OPTIONS]

Options:

  --help  Show this message and exit.

init-db

Initialize the SQLite database.

WARNING: This drops and recreates all tables, destroying existing data.

Usage:

cli init-db [OPTIONS]

Options:

  -y, --yes  Skip confirmation prompt (data will be destroyed).
  --help     Show this message and exit.

install

Install Python dependencies via uv.

Usage:

cli install [OPTIONS]

Options:

  --help  Show this message and exit.

package

Package the current directory as a milkcrate-deployable ZIP file.

Usage:

cli package [OPTIONS]

Options:

  -o, --output TEXT   Output filename (default: app.zip)
  -e, --exclude TEXT  Additional patterns to exclude (can be used multiple
                      times)
  --include-git       Include .git directory (normally excluded)
  --help              Show this message and exit.

rebuild

Rebuild milkcrate image.

Usage:

cli rebuild [OPTIONS]

Options:

  --help  Show this message and exit.

rebuild-all

Rebuild all compose services.

Usage:

cli rebuild-all [OPTIONS]

Options:

  --help  Show this message and exit.

restore

Restore milkcrate data from a backup.

Restores the database and optionally uploads/extracted apps from a backup archive. Requires confirmation unless --yes is provided.

Examples: milkcrate restore --list milkcrate restore backup_file.tar.gz milkcrate restore --backup-dir /path/to/backups milkcrate restore backup_file.tar.gz --no-uploads # Database only

Usage:

cli restore [OPTIONS] [BACKUP_FILE]

Options:

  --list             List all available backups.
  --backup-dir PATH  Directory containing backups (default: ./backups).
  --no-uploads       Do not restore uploads directory.
  --no-extracted     Do not restore extracted_apps directory.
  -y, --yes          Skip confirmation prompt.
  --help             Show this message and exit.

run

Start the development server locally (port 5001).

Usage:

cli run [OPTIONS]

Options:

  --help  Show this message and exit.

setup

Complete setup: install dependencies and initialize database.

Usage:

cli setup [OPTIONS]

Options:

  --help  Show this message and exit.

status

Show system status.

Usage:

cli status [OPTIONS]

Options:

  --help  Show this message and exit.

up

Start docker compose stack.

Usage:

cli up [OPTIONS]

Options:

  --help  Show this message and exit.

Packaging Applications

# Package current directory (basic)
milkcrate package

# Package with custom name
milkcrate package --output my-webapp.zip

# Package excluding specific files
milkcrate package --exclude "*.log" --exclude "temp/*"

# Package docker-compose application
milkcrate package --output my-multi-service-app.zip

Maintenance

# Create a backup of all data
milkcrate backup

# List available backups
milkcrate restore --list

# Restore from a backup
milkcrate restore backups/milkcrate_backup_20250127_143022.tar.gz

# Clean Python cache and build artifacts
milkcrate clean --cache

# Clean up development artifacts
milkcrate clean --uploads --extracted

# Full reset including cache, uploads, extracted apps, and database (caution!)
milkcrate clean --all

Project Root Detection

The CLI automatically detects the milkcrate project root by looking for key files (app.py, pyproject.toml, justfile). You can run CLI commands from any subdirectory within the project.