The deployment process begins when you perform a merge, push, or synchronization of your environment, or when you trigger a manual redeployment. The deployment process takes time, but there are ways to optimize deployment that depend on whether you are developing and testing or working with a live site. Most notably, you can control the static content deployment.
There are three, distinct phases of the deployment process: build, deploy, and post-deploy. Each phase performs specific actions with limited resources:
The build phase assembles containers for the services defined in the configuration files, installs dependencies based on the
composer.lock file, and runs the build hooks defined in the
.magento.app.yaml file. Without the ability to connect to any services or access the database, the build phase depends on the resources limited to the environment.
The deploy phase places a temporary hold on incoming requests and transitions the site to maintenance mode. The deploy phase uses the new containers and, after mounting the file system, opens network connections, activates the services defined in the
relationships section of the
.magento.app.yaml file, and runs the deploy hooks defined in the
.magento.app.yaml file. Everything is read only, except for directories defined in the
.magento.app.yaml file. By default, the
mounts property includes the following directories:
pub/media—contains all media data, such as Magento products or categories
pub/static—contains generated static files
var—contains temporary files created during Magento runtime
All other directories have read-only permissions. The new site becomes active at the end of the deploy phase as it transitions out of maintenance mode and releases the temporary hold on incoming requests.
The post-deploy phase runs the post-deploy hooks defined in the
.magento.app.yaml file. Performing any action on this phase can affect site performance; however, you can use the WARM_UP_PAGES environment variable to populate the cache.
You can test the optimal configuration for the state of your project by running the Smart wizards.
With ece-tools 2002.1.0 and later, you can use the scenario-based deployment feature to customize the build, deploy, and post-deploy processes for your Magento Commerce Cloud project. See Scenario-based deployment.