---
title: "Deploy Composer-Managed Drupal App"
date: "2022-04-21T19:59:46+00:00"
summary:
image:
type: "article"
url: "/acquia-cloud-platform/help/88891-deploy-composer-managed-drupal-app"
id: "ec6c160b-2f49-4060-a934-1d0e067b0b88"
---

Table of contents will be added

Goal
----

Deploy a Composer-managed Drupal application to a hosting environment

Prerequisites
-------------

*   A Composer-managed Drupal application
    
*   [Acquia CLI](/node/56001)
    

1.  Deploying a Composer Managed Drupal application
    -----------------------------------------------
    
    [Acquia](https://docs.google.com/document/d/1K2-OoV1WeDcKFaEAGF7dpiTDFObpK7A499Qn_VbC-78/edit#) and [Composer best practices](https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md#:~:text=The%20general%20recommendation%20is%20no,Composer%20to%20install%20the%20dependencies.) dictate that you should not commit Composer dependencies (like `vendor`, `docroot/core`, `docroot/modules/contrib`, etc.) to your git repository.
    
    You may ask yourself: "If I don’t commit them, how do I deploy them to a hosting environment?" That’s a good question. To answer it, let’s talk about a common and fundamental software development concept: production as an artifact of development.
    
    Many software languages compile source code (used during development) into an artifact (used during production) using a build process. For example:
    
    *   SASS and LESS are compiled into CSS
    *   Typescript and REACT JSX are “transpiled” javascript
    
    Why do this? In short, because you want your hosted Drupal site to be slim, fast, and secure. Your production environment should not contain any development tools or configuration. The things that you need to _develop_ Drupal are not the same things that you need to _run_ Drupal.
    
    For example, you make use any one of the following tools during development and testing of a Drupal application:
    
    *   Local environment configuration, like a Dockerfile or Vagrantfile
    *   Code quality tools like PHP Code Sniffer
    *   Front end tools like SASS, LESS, Gulp, Grunt,etc.
    *   Testing tools like Behat, PHPUnit, etc.
    
    You shouldn’t ship these tools or their configuration to your production environment!
    
    Let’s visualize the difference between your "source code repository" and the "artifact" that you will actually deploy to your production environment.
    
    Note two things:
    
    1.  The development "source code" contains config files for development tools that are not present in the artifact.
    2.  The artifact contains upstream dependencies (like modules, Drupal core, etc.) that are not committed to the “source code” repository.
    
2.  How to create an artifact
    -------------------------
    
    Acquia offers two methods for generating Drupal artifacts: [Acquia CLI](/node/55920)’s `push:artifact` command and [Acquia BLT](/node/55931)’s deploy command. Using Acquia CLI is simpler and is therefore Acquia’s preferred method.
    
    [Acquia CLI](/node/55920)’s `push:artifact` command generates an artifact and pushes it to a git remote. What exactly is the difference between the source code and the produced artifact? Here are a few of the more important differences. The push:artifact command will:
    
    *   Install only the `require` Composer dependencies (not any of the `require-dev` dependencies)
    *   [Optimize Composer’s autoloader](https://getcomposer.org/doc/articles/autoloader-optimization.md), making PHP execution [up to 37% faster](http://mouf-php.com/optimizing-composer-autoloader-performance)
    *   Remove `.txt` and `.md` files that are superfluous and may allow bad actors to identify your exact Drupal version
    *   Remove nested `.git` directories that may cause issues with committing dependencies
    
    If you use [Acquia Code Studio](https://www.acquia.com/products/drupal-cloud/code-studio), the `deploy` stage of the AutoDevOps pipeline will execute this Acquia CLI command for you.
    
    ### Try it yourself
    
         cd [path/to/your/repository] acli push:artifact 
    

Additional Resources
--------------------

*   [Tutorial: Creating a new Drupal application with Composer](/tutorial/install-drupal-composer-your-project)
*   [Tutorial: Deploying a Composer Managed Drupal application](/tutorial/deploying-composer-managed-drupal-application)
*   [Should I commit the dependencies in my vendor directory?](https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md#:~:text=The%20general%20recommendation%20is%20no,Composer%20to%20install%20the%20dependencies.)
*   [Using Composer to Install Drupal and Manage Dependencies](https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies)
*   [Recommended Drupal project for use on Acquia Cloud](https://github.com/acquia/drupal-recommended-project)
*   [Minimal Drupal project for use on Acquia Cloud](https://github.com/acquia/drupal-minimal-project)