Component deployment failure
This topic discusses how to recover from a failed component deployment. Typical examples are components that have dependencies that are not met by your environment; for example, incompatible PHP versions.
You can recover from a failed deployment in any of the following ways:
- Restore a snapshot if you have one
- Remove the component from your environment’s
composer.jsonand redeploy the environment
Remove the component from
composer.json and redeploy
This section discusses how to remove the component from the root
composer.json in your environment and redeploy the environment:
- Log in to your local development system, or switch to, the Magento file system owner.
- Change to a directory to which the Magento file system owner has write access.
Enter the following command in a terminal to log in to your project:
List your projects. With the project ID, you can complete additional commands.
If necessary, clone the project to your local. You should have cloned when setting up your local development workspace.
magento-cloud project:get <project ID>
- Change to a project directory. For example,
List environments in the project. Every environment includes an active Git branch of your code, database, environment variables, configurations, and services.
magento-cloud environment:listdisplays environment hierarchies whereas
git branchdisplays does not. If you have any nested environments, use
magento-cloud environment:listto see the full list.
Fetch origin branches to get the latest code:
git fetch origin
Check out, or switch to, a specific branch and environment. Git commands only checkout the Git branch. The Magento Cloud command also switches to the active environment.
magento-cloud environment:checkout <environment ID>
To create a new environment, use
magento-cloud environment:branch <environment name> <parent environment ID>
Pull any updated code to your local for the environment ID (which is the Git branch):
git pull origin <environment ID>
Create a snapshot of the environment as a backup:
magento-cloud snapshot:create -e <environment ID>
Find a component’s Composer name
This section discusses how to get a extension’s Composer name and its version from Magento Marketplace. Alternatively, you can find the name and version of any extension (whether or not you purchased it on Marketplace) in the extension’s
composer.json file. Open
composer.json in a text editor and write down the values of
To get the extension’s Composer name from Magento Marketplace:
- Log in to Magento Marketplace with the user name and password you used to purchase the component.
In the upper right corner, click <your user name> > My Account as the following figure shows.
On the My Account page, click My Purchases as the following figure shows.
On the My Purchases page, click Technical Details for the extension you purchased as the following figure shows.
- Click Copy to copy the component name to the clipboard.
- Open a text editor.
- Paste the extension name in the text editor.
- Append a colon character (
:) to the component name.
- In Technical Details on the My Purchases page, click Copy to copy the version to the clipboard.
Append the version number to the component name after the colon.
A sample follows:
To clean up from the previous deployment, you must SSH to the environment and manually clear the contents of the Magento
Enter the following command to SSH to the current environment:
rm -rf var/*
Remove the component
To remove the component:
- Change to your environment’s root directory if you haven’t already done so.
Enter the following command:
composer remove <component-name>:<version>
If the following message displays, you don’t need to do anything further:
Package "<name>:<version>" listed for update is not installed. Ignoring.
- Wait while dependencies are updated.
Enter the following commands in the order shown to commit the changes and deploy the project:
git add -A git commit -m "<message>" git push origin <environment ID>