This repository was archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
KB migration: Restore an environment #6063
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1fe95bc
Added new topic and TOC entry
jeff-matthews 8000ef2
Added files
jeff-matthews 5007943
Added optimized images
jeff-matthews ceed5b8
Fixed markdown
jeff-matthews 75c1546
Rewrote content
jeff-matthews db04657
Fixed links
jeff-matthews deaba08
Fixed MD errors
jeff-matthews 291cf72
Added xref to new topic
jeff-matthews df6ade7
Fixed xref
jeff-matthews 4707cc7
Apply suggestions from code review
jeff-matthews c2b1d5d
Revised per peer review
jeff-matthews 01267ac
Missed a var
jeff-matthews 142ef9e
Apply suggestions from code review
jeff-matthews 0a798c4
Merge branch 'master' into MAGEDOC-4000-kb-migration
jeff-matthews File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
--- | ||
title: Restore an environment | ||
group: cloud-guide | ||
--- | ||
|
||
If you encounter issues in your environment and do not have a [valid snapshot]({{ page.baseurl }}/cloud/project/project-webint-snap.html), you can try restoring your environment in one of the following ways: | ||
|
||
- SSH | ||
- Git | ||
|
||
## SSH | ||
|
||
If you have not created a snapshot, but you can access the environment using SSH, follow these steps to restore your environment: | ||
|
||
1. Disable configuration management | ||
1. Uninstall Magento | ||
1. Reset the git branch | ||
|
||
Performing these steps: | ||
|
||
- Returns your Magento installation to its original state by restoring the database, removing the deployment configuration, and clearing `var/` subdirectories. | ||
- Resets your git branch to a stable state in the past. | ||
|
||
### Disable configuration management | ||
|
||
You must disable [configuration management]({{ page.baseurl }}/cloud/live/sens-data-over.html) 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` file. | ||
|
||
{:.procedure} | ||
To remove the configuration file: | ||
|
||
1. [SSH to your environment]({{ page.baseurl }}/cloud/env/environments-ssh.html#ssh). | ||
1. Remove the configuration file: | ||
- For Magento 2.2: | ||
|
||
```bash | ||
rm app/etc/config.php | ||
``` | ||
|
||
- For Magento 2.1: | ||
|
||
```bash | ||
rm app/etc/config.local.php | ||
``` | ||
|
||
### Uninstall Magento | ||
|
||
Uninstalling the Magento software drops and restores the database, removes the deployment configuration, and clears `var/` subdirectories. | ||
|
||
{:.procedure} | ||
To uninstall the Magento software: | ||
jeff-matthews marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
1. [SSH to your environment]({{ page.baseurl }}/cloud/env/environments-ssh.html#ssh). | ||
1. Uninstall the Magento application. | ||
|
||
```bash | ||
php bin/magento setup:uninstall | ||
``` | ||
|
||
1. Confirm that Magento was successfully uninstalled. | ||
|
||
The following message displays to confirm a successful uninstallation: | ||
|
||
```terminal | ||
[SUCCESS]: Magento uninstallation complete. | ||
``` | ||
|
||
### Reset the git branch | ||
|
||
Resetting your branch reverts the code to a stable state in the past. | ||
|
||
{:.procedure} | ||
To reset your branch: | ||
jeff-matthews marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
1. Clone the project to your local development environment. You can find the command in your Project Web Interface: | ||
|
||
 | ||
|
||
1. Review the git history. Use `--reverse` to display history in reverse chronological order: | ||
|
||
```bash | ||
git log --reverse | ||
``` | ||
|
||
1. Choose a commit hash that represents the last known stable state of your code. | ||
|
||
To reset your branch to its original initialized state, find the very first commit that created your branch. | ||
|
||
 | ||
|
||
1. Use the hard reset option to reset your branch. | ||
|
||
```bash | ||
git reset --h <commit_hash> | ||
``` | ||
|
||
1. Push your changes to trigger a redeploy, which reinstalls Magento. | ||
|
||
```bash | ||
git push --force <origin> <branch> | ||
``` | ||
|
||
## Git | ||
|
||
If you have not created a snapshot, cannot access your environment using SSH, and your deployment keeps failing, you must complete the steps in the [previous section](#ssh), and then force a redeployment. | ||
|
||
### Force a redeployment | ||
|
||
Make a commit (this might be an empty commit, although we do not recommend it) and push it to the server to trigger redeploy: | ||
|
||
```bash | ||
git commit --allow-empty -m "<message>" && git push <origin> <branch> | ||
``` | ||
|
||
## Uninstall failed | ||
|
||
If executing the `setup:uninstall` command fails and cannot be completed, you might need to manually reset the database: | ||
|
||
1. [SSH to your environment]({{ page.baseurl }}/cloud/env/environments-ssh.html#ssh). | ||
1. Connect to the database. | ||
|
||
```bash | ||
mysql -h database.internal | ||
``` | ||
|
||
1. Drop the `main` database. | ||
|
||
```shell | ||
drop database main; | ||
``` | ||
|
||
1. Create an empty `main` database. | ||
|
||
```shell | ||
create database main; | ||
``` | ||
|
||
1. Delete the following configuration files. | ||
|
||
- `config.php` | ||
- `config.php.bak` | ||
- `env.php` | ||
- `env.php.bak` | ||
|
||
After resetting the database, [push your changes to trigger a redeploy]({{ page.baseurl }}/cloud/reference/cli-ref-topic.html#git-commands) and install Magento using the new database Or [run the redeploy command]({{ page.baseurl }}/cloud/reference/cli-ref-topic.html#environment-commands). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../guides/v2.2/cloud/env/restore-environment.md |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.