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.json and 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:

Get started

Click to expand/collapse content
  1. Log in to your local development machine, or switch to, the Magento file system owner.
  2. Change to a directory to which the Magento file system owner has write access, such as the web server docroot.
  3. Log in to your project:

    magento-cloud login
  4. List your projects:

    magento-cloud project:list
  5. If necessary, clone a project.

    magento-cloud project:get <project ID>

    Typically, you should clone the project in the web server’s docroot or a Virtual Host docroot.

  6. Change to a project directory.

    For example, cd /var/www/html/magento2

  7. List environments in the project:

    magento-cloud environment:list

    magento-cloud environment:list displays environment hierarchies whereas git branch displays does not. If you have any nested environments, use magento-cloud environment:list.

  8. Fetch origin branches:

    git fetch origin
  9. Check out an environment:

    magento-cloud environment:checkout <environment ID>

    To create a new environment, use magento-cloud environment:branch <environment name> <parent environment ID>

  10. Pull updated code:

    git pull origin <environment ID>
  11. Create a snapshot of the environment.

    magento-cloud snapshot:create -e <environment ID>

Find a component’s Composer name

Click to expand/collapse content

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 "name" and "version".

To get the extension’s Composer name from Magento Marketplace:

  1. Log in to Magento Marketplace with the user name and password you used to purchase the component.
  2. In the upper right corner, click <your user name> > My Account as the following figure shows.

    Access your Marketplace account

  3. On the My Account page, click My Purchases as the following figure shows.

    Marketplace purchase history

  4. On the My Purchases page, click Technical Details for the extension you purchased as the following figure shows.

    Technical details shows the extension's Composer name

  5. Click Copy to copy the component name to the clipboard.
  6. Open a text editor.
  7. Paste the extension name in the text editor.
  8. Append a colon character (:) to the component name.
  9. In Technical Details on the My Purchases page, click Copy to copy the version to the clipboard.
  10. Append the version number to the component name after the colon.

    A sample follows:


Clear var directories

To clean up from the previous deployment, you must SSH to the environment and manually clear the contents of the Magento var directory.

  1. Enter the following command to SSH to the current environment:

    magento-cloud environment:ssh
  2. Clear the var directory:

    rm -rf var/*

Remove the component

Click to expand/collapse content

To remove the component:

  1. Change to your environment’s root directory if you haven’t already done so.
  2. 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.
  3. Wait while dependencies are updated.
  4. 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>