Advanced Usage
Operational patterns for managing deployments beyond the basics.
Deployment Locks
Prevent concurrent deployments with manual locks:
# Lock an environment (e.g., during maintenance)
dockflow lock acquire production -m "Database migration in progress"
# Check lock status
dockflow lock status production
# Release when done
dockflow lock release productionThe dockflow deploy --force flag overrides locks when needed.
Locks also apply automatically during deployments and expire after the configured threshold.
Selective Deployment
Deploy specific services without affecting others:
dockflow deploy production --services backend
dockflow deploy production --services frontend,workerSkip the build phase to redeploy with existing images:
dockflow deploy production --skip-buildPreview what a deployment would do without executing:
dockflow deploy production --dry-runDebug Workflow
When something goes wrong:
# 1. Check what's running
dockflow ps production
dockflow details production
# 2. Diagnose issues (shows why containers aren't starting)
dockflow diagnose production
# 3. Check logs
dockflow logs production app -f
dockflow logs production --since 10m
# 4. Shell into a container
dockflow bash production app
# 5. SSH to the server for manual inspection
dockflow ssh production "docker service ls"
# 6. Check deployment history
dockflow audit production
dockflow metrics production --historyEnable verbose Ansible output during deploy:
dockflow deploy production --debugHistory Replication
Deployment history (audit log and metrics) is automatically replicated to all cluster nodes (managers and workers) after each deployment. This ensures:
- No data loss if a manager goes down
- Seamless history access after worker-to-manager promotion
- No fragmented history when manager failover occurs
History is read with automatic fallback: if the primary manager is unreachable, Dockflow tries other managers, then workers.
Manual Sync
If a node was offline during a deployment or a new node was added to the cluster, manually sync the full history:
dockflow history-sync productionThis reads history from all reachable nodes, merges and deduplicates entries, then writes the complete dataset back to every node.
history-sync deduplicates by metric ID (JSONL) and exact line match (audit log), so running it multiple times is safe.