Skip to content

Instantly share code, notes, and snippets.

@mttjohnson
Created May 31, 2018 19:12
Show Gist options
  • Select an option

  • Save mttjohnson/3ba18364d6423c30ba19b37cc9ec79ee to your computer and use it in GitHub Desktop.

Select an option

Save mttjohnson/3ba18364d6423c30ba19b37cc9ec79ee to your computer and use it in GitHub Desktop.
Magento 2 Atomic Config Changes
# Make a backup of the config
cp -a app/etc/env.php app/etc/env.php.bak
# Create new config file to use for replacement
cp -a app/etc/env.php app/etc/env.php.new
# Edit new config
vi app/etc/env.php.new
# Confirm syntax on file
php -l app/etc/env.php.new
# Put site in maintenance mode
bin/magento maintenance:enable
# Atomically replace old config file
mv app/etc/env.php.new app/etc/env.php
# Process config file differences
bin/magento app:config:import
# Take site out of maintenance mode
bin/magento maintenance:disable
# Chained One line Config Deployment
bin/magento maintenance:enable && mv app/etc/env.php.new app/etc/env.php && bin/magento app:config:import && bin/magento maintenance:disable
# Recover from backup
cp -a app/etc/env.php.bak app/etc/env.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment