DE
Magento Jan 07, 2022

The Process of Magento Cloud Deployment

Jane Vyshnova

Jane Vyshnova

CEO

Author

The Process of Magento Cloud Deployment

Content

  1. Magento 2 Deployment Architecture
  2. 3 Magento 2 Deployment Steps
  3. Magento Deployment Strategy
  4. Magento 2 Pipeline Deployment
  5. Magento Deployment: AWS vs Azure
  6. Conclusion
Bookmark

The performance of a website can be affected by many factors, including the deployment process, which is quite energy-intensive and can take a long time. The duration of the deployed website being in maintenance mode is affected by many factors, such as the configuration of the environment or the amount of content. However, there are ways to significantly raise the efficiency and optimize the Magento 2 deployment process. They vary depending on whether you are improving a finished website or working on testing one under development.

The best way to optimize is to upgrade to using ece-tools that provide a package of important features, such as backing up a database or checking the configuration of the environment. You can also optimize your Magento deploy by using different strategies. Having a deep expertise in both Magento development and DevOps, we are ready to share our view on the topic.

Magento 2 Deployment Architecture

A proper deployment of a website requires a full understanding not only of processes and strategies, but also of the website components, the well-established functioning of which ensures smooth performance. The Magento platform consists of core, optional or available only for Magento Commerce components.

The core components are:

The optional components are:

The optional components for Magento Commerce only are:

The diagram below shows a sample architecture for Magento Open Source deployment.

Magento 2 Deployment Architecture
Source cloud.google.com

As you can see, the architecture consists of a web server which can communicate with both session or page cache and a database server.

The diagram below shows a sample architecture for Magento Commerce deployment.

Magento 2 deployment process
Source cloud.google.com

You can see the same elements as on the previous diagram, but also a search engine and a message queue.

3 Magento 2 Deployment Steps

Magento deployment prerequisites are an existing Magento project, a composer, Yarn or NPM and a Magento PWA Studio.

Magento cloud deployment process itself consists of three stages: build, deploy, and post-deploy. Every stage includes a specific set of actions with a limited number of resources.

1. Build phase

The first phase involves assembling containers for services that are enshrined in configuration files. Links and dependencies are also established on the foundation of the composer.lock file. The build keys written in the .magento.app.yaml file are triggered. The build phase is characterized by a lack of connectivity to services or databases and is entirely dependent on resources that are limited by the environment

2. Deploy phase

At the second phase, incoming requests go into temporary retention mode, while the website itself is transferred to maintenance mode. This phase is characterized by new container usage and a file system installation, after which network connections are opened, services from the .magento.app.yaml file relationship section are activated, and deploy hooks written in the .magento.app.yaml file are triggered. Content is only available for reading, except for the directories that the .magento.app.yaml file defines. The standard mounts property consists of such directories:

Other directories are only available for reading. At the end of this phase, when the website is out of maintenance mode, it becomes active. As a result of this process, previously temporarily withheld incoming requests become available.

3. Post-deploy phase

At the third phase, there is a post-deployment of previously defined hooks. Any actions that are taken can have a significant impact on the performance of the website. The WARM_UP_PAGES environment variable should be used to fill in the cache if necessary.

Magento Deployment Strategy

Magento 2 Deployment Strategy
Source www.simicart.com

This consists of several important steps.

1. Optimize the static content deployment

Static content deployment (SCD) significantly influences the deployment process, because it depends on the amount of content you need to create (images, themes, scripts, web pages) and the time span set to create it. The standard strategy means that static content is being generated when the website is transferred into maintenance mode. Obviously, it takes a certain amount of time for the content to be written in the pub/static directory installed for that purpose. Based on our experience, we can offer you a few simple but effective steps to help you significantly optimize your deployment process.

SCD download time will be reduced if you skip filling static view files in the var/view_preprocessed directory and create minified HTML on demand.

It's also possible to save time and storage space by reducing the number of unimportant theme files. For instance, you can use the SCD_MATRIX environment variable to deploy the backend thread in English, and the custom theme in any other language.

Read our guide on Magento performance testing to make sure your store is well optimized.

The difference between deployment strategies is that their choice depends on having to create static content at any stage in the deployment process or on demand. The diagram below shows that the best solution is to choose the deploy phase for SC generation. Even if HTML is minified, it can take a long time to copy each content file into a specific ~/pub/static directory. Creating static on-demand content looks like a great option, but its downside is that if you don't have a content file in the cache, it will be created at the time of the request, which will affect the download time.

The difference between deployment strategies
Source devdocs.magento.com

2. Reduce the downtime

During the second stage of deployment, the platform transfers into maintenance mode. As a result, your website goes offline until the process is complete. The time a website spends in this mode depends on its size, the amount of changes you’ve made during the deployment process, and the configuration for the SCD. However, the project can be configured in such a way that the downtime effect will be equal to zero.

Here are some tips to reduce the time it takes for your website to deploy an update to Production:

Magento 2 Pipeline Deployment

Magento offers a special way to deploy for any large websites that want to minimize the downtime. The point of it is that the deployment processes are performed in different systems.

Deployment systems:

Synchronizing your system configuration:

Using Magento pipeline deployment requires a perfect knowledge of the platform’s features, PHP programming and a successful work experience with large Magento-based stores.

Magento Deployment: AWS vs Azure

Magento Deployment- AWS vs Azure
Source medium.com

Magento is a huge e-commerce platform, the installation of which is a complicated and impossible-looking task for many people. AWS and Azure are popular cloud providers that try to meet the needs of Magento’s growing customer base. Jean-Luc Dubouchet, a Junior Full-Stack Tech Engineer at Hidora, compared Magento installation processes on top of AWS and Azure. Here are the results of his short investigation:

Given the received numbers, we can state that Magento deployment best practices are better performed while using AWS.

Conclusion

While the process of deploying a project looks intimidating to an unprepared person, there's really nothing complicated or confusing about it. The Magento platform provides all the necessary services and tools to ensure that the deployment is as quick and painless as possible for the site to operate. However, if lines of code make you want to tear your hair out, and the view of the endless command line is already causing you a nervous tick (or if you do not want to contact the coding staff in advance), you can ask us for help. Our experienced developers will choose and in the shortest time implement an optimal deployment strategy, saving you from unnecessary work and showing an excellent result.

Let professionals meet your challenge

Our certified specialists will find the most optimal solution for your business.

Please enter valid name
Please enter valid company
Please enter a valid phone
Please enter valid E-mail
Message is too short

    Your message has been successfully sent. We will be in touch shortly! Success icon