Roll back environment without Cloud snapshot
This article shows two solutions to roll back an environment without having a snapshot of your environment on Adobe Commerce on cloud infrastructure.
Affected products and versions
- Adobe Commerce on cloud infrastructure, all supported versions
Choose the most appropriate for your case:
- If you have a stable build, but no valid snapshot - Scenario 1: No snapshot, build stable (SSH connection available).
- If the build is broken and you have no valid snapshot - Scenario 2: No snapshot; build broken (no SSH connection).
Scenario 1: No snapshot, build stable (SSH connection available) scen2
This section shows how to roll back an environment when you have not created a snapshot but can access the environment via SSH.
The steps are:
- Disable Configuration Management.
- Uninstall the Adobe Commerce software.
- Reset the git branch.
After performing these steps:
- your Adobe Commerce installation returns to its Vanilla state (database restored; deployment configuration removed; directories under
var
cleared) - your git branch is reset to the desired state in the past
Read the detailed steps below:
Step 0 (Prerequisite): Remove config.php to disable Configuration Management disable_config_management
We need to disable Configuration Management so that it does not automatically apply the previous configuration settings during deployment.
To disable Configuration Management, make sure that your /app/etc/
directory does not contain the config.php
(for Adobe Commerce 2.4.x) or config.local.php
(for Adobe Commerce 2.1.x) files.
To remove the configuration file, follow these steps:
-
Remove the configuration file:
- For Adobe Commerce 2.4:
code language-php rm app/etc/config.php
- For Adobe Commerce 2.1:
code language-php rm app/etc/config.local.php
Learn more about Configuration Management by reviewing:
- Reduce deployment downtime on Adobe Commerce on cloud infrastructure in our support knowledge base.
- Configuration management for store settings in our developer documentation.
Step 1: Uninstall the Adobe Commerce software with setup:uninstall command setup-uninstall
Uninstalling the Adobe Commerce software drops and restores the database, removes the deployment configuration, and clears directories under var
.
Review Uninstall the Adobe Commerce software in our developer documentation.
To uninstall the Adobe Commerce software, follow these steps:
-
Execute
setup:uninstall
:code language-php php bin/magento setup:uninstall
-
Confirm uninstall.
The following message displays to confirm a successful uninstallation:
[SUCCESS]: Magento uninstallation complete.
This means we have reverted our Adobe Commerce installation (including DB) to its authentic (Vanilla) state.
Step 2: Reset the git branch reset-git-branch
With git reset, we revert the code to the desired state in the past.
-
Clone the environment to your local development environment. You may copy the command in the Cloud Console:
-
Access the commits history. Use
--reverse
to display history in reverse order for more convenience:code language-git git log --reverse
-
Select the commit hash on which you’ve been good. To reset code to its authentic state (Vanilla), find the very first commit that created your branch (environment).
-
Apply hard git reset:
code language-git git reset --h <commit_hash>
-
Push changes to server:
code language-git git push --force <origin> <branch>
After performing these steps, our git branch gets reset and the entire git changelog is clear. The last git push triggers the redeploy to apply all changes and re-install Adobe Commerce.
Scenario 2: No snapshot; build broken (no SSH connection) scen3
This section shows how to roll back an environment when it is in a critical state: the deployment procedure cannot succeed in building a working application, thus making the SSH connection unavailable.
In this scenario, you must first restore the working state of your Adobe Commerce application using git reset, then uninstall the Adobe Commerce software (to drop and restore the database, remove the deployment configuration, etc.). The scenario involves the same steps as in Scenario 1, but the order of steps is different and there is an additional step – force redeploy. The steps are:
2. Disable Configuration Management.
3. Uninstall the Adobe Commerce software.
4. Force redeploy.
After performing these steps, you will have the same results as in Scenario 1.
Step 4: Force redeploy
Make a commit (this might be an empty commit, although we do not recommend it) and push it to the server to trigger redeploy:
git commit --allow-empty -m "<message>" && git push <origin> <branch>
If setup:uninstall fails, reset database manually
If executing the setup:uninstall
command fails with an error and cannot be completed, we may clear the DB manually with these steps:
-
Connect to the MySQL DB:
code language-sql mysql -h database.internal
-
Drop the
main
DB:code language-sql drop database main;
-
Create an empty
main
DB:code language-sql create database main;
-
Delete the following configuration files:
config.php
,config.php
.bak
,env.php
, andenv.php.bak
.
After resetting the DB, make a git push to the environment to trigger redeploy and install Adobe Commerce to a newly created DB. Or run the redeploy command.
Related reading
In our developer documentation: