Recover from component failure
This topic discusses how to recover if a component fails to deploy properly. Typical examples include components that have dependencies that are not met by your remote environment, such as incompatible PHP versions.
You can recover from a failed deployment in any of the following ways:
- Restore a backup
- Clean project and code from previous changes and redeploy
Clean, remove, and redeploy
To clean up from the previous deployment, identify the component that was added or updated and then remove it. First, log in to the remote environment and manually clear the contents of the var
directory. Then remove the component from the composer.json
file and redeploy the environment.
To clean the var
directories:
-
On your local workstation, change to your project directory.
-
Use SSH to log in to the remote environment.
code language-bash magento-cloud ssh
-
Clear the
var
directories.code language-shell rm -rf var/*
-
Log out.
To remove the component:
-
On your local workstation, change to your project directory.
-
Clear the cache.
code language-bash composer clear-cache
-
Remove the component from the
composer.json
file.code language-bash composer remove <component-name>:<version>
If the following message displays, you do not need to do anything further:
code language-terminal Package "<name>:<version>" listed for update is not installed. Ignoring.
-
Wait while the dependencies are updated.
-
Add, commit, and push code changes.
code language-bash git add -A
code language-bash git commit -m "<message>"
code language-bash git push origin <environment-ID>
See more about restoring an environment without a backup in Restore an environment.