LogoLogo
HomeAPIBlog
3.0.0-SNAPSHOT
3.0.0-SNAPSHOT
  • INTRODUCTION
    • Getting Started
      • Running Local Development Servers
      • Beginner Tutorial: Hello World
      • Beginner Tutorial: Hello Database
      • Tutorial: Wheels, AJAX, and You
    • Frameworks and Wheels
    • Requirements
    • Manual Installation
    • Upgrading
    • Screencasts
  • Command Line Tools
    • CLI Overview
    • Quick Start Guide
    • Command Reference
      • Core Commands
        • wheels init
        • wheels info
        • wheels reload
        • wheels deps
        • wheels destroy
        • wheels watch
      • Code Generation
        • wheels generate app
        • wheels generate app-wizard
        • wheels generate controller
        • wheels generate model
        • wheels generate view
        • wheels generate property
        • wheels generate route
        • wheels generate resource
        • wheels generate api-resource
        • wheels generate frontend
        • wheels generate test
        • wheels generate snippets
        • wheels scaffold
      • Database Commands
        • wheels dbmigrate info
        • wheels dbmigrate latest
        • wheels dbmigrate up
        • wheels dbmigrate down
        • wheels dbmigrate reset
        • wheels dbmigrate exec
        • wheels dbmigrate create blank
        • wheels dbmigrate create table
        • wheels dbmigrate create column
        • wheels dbmigrate remove table
        • wheels db schema
        • wheels db seed
      • Testing Commands
        • wheels test
        • wheels test run
        • wheels test coverage
        • wheels test debug
      • Configuration Commands
        • wheels config list
        • wheels config set
        • wheels config env
      • Environment Management
        • wheels env
        • wheels env setup
        • wheels env list
        • wheels env switch
      • Plugin Management
        • wheels plugins
        • wheels plugins list
        • wheels plugins install
        • wheels plugins remove
      • Code Analysis
        • wheels analyze
        • wheels analyze code
        • wheels analyze performance
        • wheels analyze security
      • Security Commands
        • wheels security
        • wheels security scan
      • Performance Commands
        • wheels optimize
        • wheels optimize performance
      • Documentation Commands
        • wheels docs
        • wheels docs generate
        • wheels docs serve
      • CI/CD Commands
        • wheels ci init
      • Docker Commands
        • wheels docker init
        • wheels docker deploy
      • Deployment Commands
        • wheels deploy
        • wheels deploy audit
        • wheels deploy exec
        • wheels deploy hooks
        • wheels deploy init
        • wheels deploy lock
        • wheels deploy logs
        • wheels deploy proxy
        • wheels deploy push
        • wheels deploy rollback
        • wheels deploy secrets
        • wheels deploy setup
        • wheels deploy status
        • wheels deploy stop
    • CLI Development Guides
      • Creating Commands
      • Service Architecture
      • Migrations Guide
      • Testing Guide
  • Working with Wheels
    • Conventions
    • Configuration and Defaults
    • Directory Structure
    • Switching Environments
    • Testing Your Application
    • Using the Test Environment
    • Contributing to Wheels
    • Submitting Pull Requests
    • Documenting your Code
  • Handling Requests with Controllers
    • Request Handling
    • Rendering Content
    • Redirecting Users
    • Sending Files
    • Sending Email
    • Responding with Multiple Formats
    • Using the Flash
    • Using Filters
    • Verification
    • Event Handlers
    • Routing
    • URL Rewriting
      • Apache
      • IIS
      • Tomcat
      • Nginx
    • Obfuscating URLs
    • Caching
    • Nesting Controllers
    • CORS Requests
  • Displaying Views to Users
    • Pages
    • Partials
    • Linking Pages
    • Layouts
    • Form Helpers and Showing Errors
    • Displaying Links for Pagination
    • Date, Media, and Text Helpers
    • Creating Custom View Helpers
    • Localization
  • Database Interaction Through Models
    • Object Relational Mapping
    • Creating Records
    • Reading Records
    • Updating Records
    • Deleting Records
    • Column Statistics
    • Dynamic Finders
    • Getting Paginated Data
    • Associations
    • Nested Properties
    • Object Validation
    • Object Callbacks
    • Calculated Properties
    • Transactions
    • Dirty Records
    • Soft Delete
    • Automatic Time Stamps
    • Database Migrations
      • Migrations in Production
    • Using Multiple Data Sources
  • Plugins
    • Installing and Using Plugins
    • Developing Plugins
    • Publishing Plugins
  • Project Documentation
    • Overview
  • External Links
    • Source Code
    • Issue Tracker
    • Sponsor Us
    • Community
Powered by GitBook
LogoLogo
On this page
  • Synopsis
  • Description
  • Actions
  • Options
  • Examples
  • Acquire deployment lock
  • Check lock status
  • Release lock
  • Wait for lock availability
  • Force release stuck lock
  • List all locks
  • Lock Information
  • Lock Types
  • Manual locks
  • Automatic locks
  • Emergency locks
  • Use Cases
  • Maintenance window
  • Coordinated deployment
  • CI/CD integration
  • Lock States
  • Available
  • Locked
  • Expired
  • Force-locked
  • Best Practices
  • Error Handling
  • Lock already exists
  • Lock expired during operation
  • Cannot release lock
  • Integration
  • See Also

Was this helpful?

Edit on GitHub
Export as PDF
  1. Command Line Tools
  2. Command Reference
  3. Deployment Commands

wheels deploy lock

Lock deployment state to prevent concurrent deployments and maintain deployment integrity.

Synopsis

wheels deploy lock <action> [options]

Description

The wheels deploy lock command manages deployment locks to prevent concurrent deployments, ensure deployment atomicity, and maintain system stability during critical operations. This is essential for coordinating deployments in team environments and automated systems.

Actions

  • acquire - Acquire a deployment lock

  • release - Release an existing lock

  • status - Check current lock status

  • force-release - Force release a stuck lock (use with caution)

  • list - List all active locks

  • wait - Wait for lock to become available

Options

  • --environment, -e - Target environment to lock (default: production)

  • --reason - Reason for acquiring lock (required for acquire)

  • --duration - Lock duration in minutes (default: 30)

  • --wait-timeout - Maximum time to wait for lock in seconds

  • --force - Force acquire lock even if already locked

  • --owner - Lock owner identifier (default: current user)

  • --metadata - Additional lock metadata as JSON

Examples

Acquire deployment lock

wheels deploy lock acquire --reason "Deploying version 2.1.0"

Check lock status

wheels deploy lock status

Release lock

wheels deploy lock release

Wait for lock availability

wheels deploy lock wait --wait-timeout 300

Force release stuck lock

wheels deploy lock force-release --reason "Previous deployment crashed"

List all locks

wheels deploy lock list

Lock Information

Locks contain the following information:

  • Lock ID

  • Environment

  • Owner (user/system)

  • Acquisition time

  • Expiration time

  • Reason

  • Associated deployment ID

  • Metadata

Lock Types

Manual locks

User-initiated locks for maintenance or manual deployments:

wheels deploy lock acquire --reason "Database maintenance" --duration 60

Automatic locks

System-acquired locks during automated deployments:

# Automatically acquired during deployment
wheels deploy exec

Emergency locks

High-priority locks for critical operations:

wheels deploy lock acquire --force --reason "Emergency hotfix"

Use Cases

Maintenance window

# Lock environment for maintenance
wheels deploy lock acquire \
  --reason "Scheduled maintenance" \
  --duration 120 \
  --metadata '{"ticket": "MAINT-123"}'

# Perform maintenance...

# Release when done
wheels deploy lock release

Coordinated deployment

# Wait for lock and deploy
wheels deploy lock wait --wait-timeout 600
wheels deploy exec --auto-lock

CI/CD integration

# In CI/CD pipeline
if wheels deploy lock acquire --reason "CI/CD Deploy #${BUILD_ID}"; then
    wheels deploy exec
    wheels deploy lock release
else
    echo "Could not acquire lock"
    exit 1
fi

Lock States

Available

No active lock, deployments can proceed

Locked

Active lock in place, deployments blocked

Expired

Lock duration exceeded, can be cleaned up

Force-locked

Emergency lock overriding normal locks

Best Practices

  1. Always provide reasons: Clear reasons help team coordination

  2. Set appropriate durations: Don't lock longer than necessary

  3. Release locks promptly: Release as soon as operation completes

  4. Handle lock failures: Plan for scenarios when locks can't be acquired

  5. Monitor stuck locks: Set up alerts for long-running locks

  6. Use force sparingly: Only force-release when absolutely necessary

  7. Document lock usage: Keep records of lock operations

Error Handling

Common lock errors and solutions:

Lock already exists

# Check who owns the lock
wheels deploy lock status

# Wait for it to be released
wheels deploy lock wait

# Or coordinate with lock owner

Lock expired during operation

# Extend lock duration if still needed
wheels deploy lock acquire --extend

Cannot release lock

# Verify you own the lock
wheels deploy lock status --verbose

# Force release if necessary
wheels deploy lock force-release --reason "Lock owner unavailable"

Integration

The lock system integrates with:

  • CI/CD pipelines for automated deployments

  • Monitoring systems for lock alerts

  • Deployment tools for automatic locking

  • Team communication tools for notifications

See Also

Previouswheels deploy initNextwheels deploy logs

Last updated 2 days ago

Was this helpful?

- Execute deployment

- Check deployment status

- Rollback deployment

deploy exec
deploy status
deploy rollback