---
title: "Lesson 2: Generating a Deployment Artifact - Deploying a Drupal 9 Application"
date: "2025-02-06T01:21:59+00:00"
summary:
image:
type: "article"
url: "/acquia-cloud-platform/help/92671-lesson-2-generating-deployment-artifact-deploying-drupal-9-application"
id: "f7ed6ae2-0f5b-49e3-827c-2248edea8b2a"
---

Table of contents will be added

This is **Lesson 2** of [Tutorial: Deploying a Drupal Application](/node/94606).  
 

**In this lesson we will:**
===========================

1.  Generate a deployment artifact.
2.  Push the artifact to Acquia Cloud Platform.

 

**Lesson Goal**
===============

Generate a production-ready deployment artifact for a Drupal 9 application.

In order to complete this lesson you will need:

*   A Drupal 9 application that is ready for deployment.
*   Access to an [Acquia Cloud](/node/55808) subscription.
*   [Composer](https://getcomposer.org/)
*   [PHP](https://www.php.net/) version **8.0** or later recommended - see [Acquia's EOL schedule](/node/55892)
*   [Git](https://git-scm.com/)

 

**Lesson**
==========

**Manual approach**
-------------------

At a minimum, use Composer to remove development dependencies and optimize your application's `autoloader`:

    composer install --no-dev --optimize-autoloader

This will install only the dependencies in your `composer.json`'s "`require`" array (**not** in the "`require-dev`" array) and will [optimize Composer's `autoloader`](https://getcomposer.org/doc/articles/autoloader-optimization.md), which significantly improves application performance.

You should also consider performing the following manual steps:

*   Remove Drupal core text files, like `CHANGELOG.txt`, from your `docroot` directory. These can inadvertently reveal your exact Drupal core version to malicious site visitors.
*   Change/Restrict any reachable path for security purposes.
*   Compile front end source code (like SASS) into front end assets (like CSS).

After you've manually prepared your codebase for production, you will need to create a new Git tag.

**Creating Git Tags**
---------------------

Using a [git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) for deployment is a best practice because tags are immutable. In other words, after it has been created a tag cannot be changed. For instance, using a tag will prevent someone from accidentally pushing a new commit to a branch that is deployed to your production environment. This cannot happen with a tag.

    git tag 1.0.0 -m 'This is the first major release!'

Now that your tag is cut, you can push it to Acquia Cloud Platform:

    git push origin 1.0.0

###   
**Naming your releases**

You should use a naming convention for your tags that works well for your team. The most popular (and recommended option) is [Semantic Versioning](https://semver.org/) (**semver**). In short, **semver** provides a set of rules for naming tags. The rules help you track:

*   The order in which releases are made.
*   Releases that introduce backwards incompatible changes (major).
*   Releases that introduce new, backwards compatible functionality (minor).
*   Releases that provide backwards compatible bug fixes (patch).

Tags using **semver** take the form `MAJOR.MINOR.PATCH`. For more information, see [semver.org](https://semver.org/).

In combination with Composer version constraints, you can use **semver** to ensure that your application's dependencies are never accidentally updated to a backwards incompatible version.

Now that you have a deployment artifact, you're ready to deploy it on your Acquia Cloud Platform non-production environment! Reminder: Before moving to Production, ensure you take a database backup of your Production environment first.  
 

**Proceed to**  
[Lesson 3: Release the Kraken (code) - Deploying a Drupal 9 Application](/node/92201)
------------------------------------------------------------------------------------------------------

 

**Resources**
=============

*   [Deployment workflow](/node/56468)
*   [Semantic Versioning](https://semver.org/)