Step 1: inspect the current state
Start with read-only status commands. Run Magento CLI commands as the application filesystem owner and from the Magento root.
Show deployment mode
Reports whether Magento is in default, developer, or production mode.
bin/magento deploy:mode:show
Check maintenance mode
Reports whether maintenance mode is enabled and any exempt IP addresses.
bin/magento maintenance:status
Check caches and indexers
Shows disabled cache types and indexers that require attention.
bin/magento cache:status
bin/magento indexer:status
Step 2: control maintenance mode
Maintenance mode returns a 503 response to most visitors while deployment work is in progress. Plan monitoring and a rollback path before enabling it in production.
Enable maintenance mode
Places the application in maintenance mode so storefront traffic does not reach an incomplete deployment.
bin/magento maintenance:enable
Allow a deployment IP
Allows a reviewed IP address to access the site during maintenance.
bin/magento maintenance:allow-ips <trusted-ip>
Disable maintenance mode
Restores normal application access after deployment checks pass.
bin/magento maintenance:disable
Step 3: apply schema and generated-code changes
The exact deployment order depends on your hosting model. Back up first, use the application’s release process, and do not improvise directly on production.
Apply module setup changes
Updates module registration and applies declarative schema and data changes.
bin/magento setup:upgrade
Compile dependency injection
Generates dependency-injection factories, proxies, interceptors, and related compiled code.
bin/magento setup:di:compile
Deploy static storefront files
Generates static view files for the named locales. Remove locales the store does not use.
bin/magento setup:static-content:deploy -f en_US en_GB
Step 4: choose cache clean or cache flush
Cleaning removes Magento cache entries for selected types. Flushing empties the underlying cache storage and can affect other applications if the storage is shared.
Clean Magento caches
Removes Magento-managed cache entries while leaving unrelated shared-cache data alone.
bin/magento cache:clean
Clean selected cache types
Cleans only the specified cache types for a more targeted operation.
bin/magento cache:clean config layout block_html
Flush cache storage
Purges the cache storage used by Magento, potentially including non-Magento entries.
bin/magento cache:flush
Step 5: inspect and rebuild indexers
A complete reindex can take time on a large catalogue. Check status first and prefer scheduled indexing where it fits the store’s operating model.
List indexers and modes
Lists indexer identifiers and whether each updates on save or by schedule.
bin/magento indexer:info
bin/magento indexer:show-mode
Check indexer status
Reports valid, invalid, suspended, or working states.
bin/magento indexer:status
Reindex one or all indexers
The first command rebuilds a selected indexer; the second rebuilds all indexers.
bin/magento indexer:reindex <indexer-id>
bin/magento indexer:reindex
Step 6: create a local administrator safely
Use this only in an authorized environment. Values in angle brackets are placeholders and must never be copied as real credentials.
Create an administrator
Creates a Magento Admin user with the supplied identity fields.
bin/magento admin:user:create --admin-user=<admin-user> --admin-password=<strong-password> [email protected] --admin-firstname=<first-name> --admin-lastname=<last-name>