Files
docker-tools/bash/MIGRATION_NOTES.md
2026-03-22 00:54:34 -07:00

4.0 KiB
Executable File

Migration Notes: docker-stack.sh + docker-update.sh → docker-manager.sh

Overview

The docker-stack.sh and docker-update.sh scripts have been combined into a single docker-manager.sh script that provides both stack lifecycle management and update functionality.

Why Combine?

  • Logical grouping: Stack management and updates are closely related operations
  • Better UX: Single entry point for all stack operations
  • Reduced duplication: Shared functions (get_stacks, is_stack_running, etc.)
  • Consistent interface: All stack operations in one place

Migration Guide

Old Commands → New Commands

Stack Management

# Old
docker-stack.sh --list
docker-stack.sh --start myapp
docker-stack.sh --stop myapp
docker-stack.sh --restart myapp
docker-stack.sh --status myapp
docker-stack.sh --logs myapp

# New (same commands work!)
docker-manager.sh --list
docker-manager.sh --start myapp
docker-manager.sh --stop myapp
docker-manager.sh --restart myapp
docker-manager.sh --status myapp
docker-manager.sh --logs myapp

Update Operations

# Old
docker-update.sh --check
docker-update.sh --all
docker-update.sh --stack myapp
docker-update.sh --auto

# New (slightly different flags)
docker-manager.sh --check
docker-manager.sh --update-all    # was --all
docker-manager.sh --update myapp  # was --stack
docker-manager.sh --auto

Flag Changes

Old (docker-update.sh) New (docker-manager.sh) Notes
--all --update-all or -a More explicit
--stack STACK --update STACK or -u More consistent

Backward Compatibility

The old scripts (docker-stack.sh and docker-update.sh) are still available and functional. They can be:

  • Kept: For backward compatibility with existing scripts
  • Removed: If you prefer a single unified script
  • Aliased: Create symlinks or aliases pointing to docker-manager.sh

Creating Aliases (Optional)

If you want to keep using the old command names:

# Create symlinks
ln -s docker-manager.sh docker-stack.sh
ln -s docker-manager.sh docker-update.sh

# Or create aliases in your shell config
alias docker-stack='docker-manager.sh'
alias docker-update='docker-manager.sh'

Interactive Mode

The combined script provides a unified interactive menu:

Docker Stack Manager
====================
Available stacks:
  1) myapp [running]
  2) test-stack [stopped]
  
  r) Restart all
  s) Stop all
  u) Update all          # NEW: Update all stacks
  c) Check for updates   # NEW: Check for updates
  0) Exit

When selecting a stack, you get both management and update options:

Manage: myapp
=============
Status: ● Running

Stack Management:
  1) Start
  2) Stop
  3) Restart

Updates:
  4) Update images       # NEW: Update this stack
  5) Check for updates  # NEW: Check this stack

Other:
  6) View logs
  7) View compose file
  0) Back

Benefits

  1. Single Script: One script to manage instead of two
  2. Unified Interface: Consistent CLI flags and behavior
  3. Better Organization: Related operations grouped together
  4. Less Code Duplication: Shared helper functions
  5. Easier Maintenance: One script to update instead of two

Recommendations

  • New scripts: Use docker-manager.sh
  • Existing scripts: Update to use docker-manager.sh when convenient
  • Old scripts: Can be removed once migration is complete

Examples

Combined Operations

# Check for updates, then update all if available
docker-manager.sh --check
docker-manager.sh --update-all

# Start a stack and update it
docker-manager.sh --start myapp
docker-manager.sh --update myapp

# Check status and updates in one go
docker-manager.sh --list
docker-manager.sh --check

Automation Scripts

#!/bin/bash
# Combined stack management script

# List all stacks
docker-manager.sh --list --quiet

# Check for updates
if docker-manager.sh --check --quiet | grep -q "update available"; then
    # Update all stacks
    docker-manager.sh --update-all --yes --quiet
fi