Running Auto-Scalable Magento Platform in Containers: Instant Cluster Deployment to the Cloud

    magento platform in cloudIf building an e-commerce project that requires a feature-rich platform, the Magento CMS is one of the most suitable and efficient systems to handle it with. Due to its flexible modular architecture and agile ecosystem, you can continually adapt, customize and extend your website, benefiting on a large variety of embedded features like data catalog management, marketing tools, analytics, SEO engine optimization, reporting etc. Another important point to consider when running an e-commerce project is ensuring its constant availability for lots of concurrent users. Thus, to enable you launching such solution with minimal effort, the Jelastic team has developed a dedicated auto-scalable clustered Magento package.

    Being deployed in an almost one click, the Magento Cluster JPS by Jelastic runs a complex container-based failover topology with a pair of interconnected Magento nodes, load balancer in front of them and two replicated database servers. In addition, it includes a number of supplementary components like user session storage for increased fault-tolerance, Redis caching service and NGINX-based administration node to distribute static content and manage cluster configurations. All together, such environment topology provides the sustainability your project needs.

    Below you’ll find some details on each cluster component functions, preconfigured auto-scaling settings and a simple step-by-step guide describing how to get your own highly-available clustered Magento platform up and running within the Cloud in several minutes.

    Containerized Magento Cluster Topology

    Generally, structure of the auto-scalable Magento Cluster solution by Jelastic can be displayed as follows:auto scalable magento platformHere, the following Docker images are utilized to unify and simplify provisioning of application components:

    • Load Balancer (LB) – Varnish 4.1.5 (jelastic/varnish)
      Two Varnish load balancers to distribute incoming traffic within a cluster and to cache all static content; are supplemented with NGINX servers that are run as a HTTPS proxy
    • Application Server (AS) –  NGINX 1.10.1 powered by PHP 7.0.10 (jelastic/nginxphp)
      Two NGINX PHP application servers to handle Magento engine itself; are automatically scaled based on the amount of incoming traffic
    • Admin Node (AN) – NGINX 1.10.1 powered by PHP 7.0.10 (jelastic/nginxphp)
      NGINX PHP admin node to provide access to Magento Admin Panel for managing orders, catalogs, content, cluster configurations, etc and to share static content between application server instances via NFS
    • Session Storage (SS) – Redis 3.2.9 (devbeta/redis)
      Redis storage node to retain user session parameters so that in case one application server node fails, the second one can retrieve the required data and continue serving the clients without any notable interruption
    • Cache (CH) – Redis 3.2.9 (devbeta/redis)
      Redis node to store Magento cache that helps to improve application response time due to faster page loading when processing similar subsequent requests
    • Database (DB) – MySQL 5.7.latest (jelastic/mysql)
      Two MySQL database servers with asynchronous master-slave replication between them to achieve high availability, improve data protection, and alleviate system failures

    Herewith, each container within a cluster receives the default vertical scaling limit up to 8 cloudlets (equals to 1 GiB of RAM and 3.2 GHz of CPU) and a set of load alerts (to notify you when the resources consumption is close to the limit).

    Also, it’s worth to admit that when you scale either Load Balancer or Application Server layer, the appropriate LB configs (at either newly created or the already existing instance(s) respectively) are automatically adjusted to include the data on all application server nodes the load should be distributed across. In addition, the AS layer is automatically scaled by the system based on the amount of incoming traffic in order to handle the changeable load – let’s consider this approach in more details.

    Magento Application Server Auto-Scaling Settings

    As it was mentioned above, the number of application server nodes in Magento Cluster is adjusted dynamically based on the received load by means of automatic horizontal scaling. Such cluster size change is defined with the following conditions:

    • +1 node if CPU usage is more than 70% for at least 1 minute
    • -1 node if CPU usage is less than 20% for at least 1 minute

    The appropriate modifications are automatically applied to add/remove application server nodes, whilst you receive the corresponding email message on each scaling operation. Each new application server instance is automatically added to the load balancer configs, whilst nodes within the LB layer are restarted to apply the updated settings.

    Herewith, the default automatic scaling conditions can be easily tuned through adjusting the appropriate trigger settings in accordance with the Automatic Horizontal Scaling guide.

    One-Click Magento Cluster Installation

    Finally, let’s get to know how to launch the above described auto-scalable and reliable Magento-based e-commerce platform. For that, log in to your Jelastic Cloud dashboard and execute the next simple steps.

    1.The package can be installed in one of the following ways:

    • through the Marketplace section – open the appropriate frame with the same-named button at the dashboard top panel and search for the Auto-Scalable Magento Cluster package within the Apps > Clusters tab
      Click Install at the shown plank to launch the deployment dialog.
    • via the Import functionality – access the corresponding frame and paste a direct link to the Magento Cluster manifest.jps file from the appropriate package repository on GitHub

    https://github.com/jelastic-jps/magento/blob/master/magento19-php7-varnish-mysql-redis-storage/manifest.jpsrunning magento Click Import to continue.

    Tip: Visit Jelastic JPS Collection to explore other useful pre-packaged solutions that can be easily installed to the Platform in one click. Just import any of them using the link to the manifest.jps file within the appropriate repository.

    2. In the installation box, type Environment name and optional Display Name (environment alias), select the preferable region (if several ones are available) and click Install.instant magento cluster deploy3. The environment installation and cluster configuration will take a few minutes till you’ll see a box displaying your Magento Admin credentials.instant cluster deploy4. Click Open in browser and log in to the Magento Admin Panel with received administration data.

    auto scalable magento in dockerHere you can find a big variety of store management tools, categorized within separate tabs according to the provisioned options – e.g. Sales, Catalog, Customers, Promotions, etc.

    5. To start with, you can build a catalog for your online store as the very base of any e-commerce service. For that, you’ll need to compose the required catalog structure and fill it in with the proposed merch items.

    Tip: Alternatively, Magento allows importing of the already existing goods collection, e.g. to transfer a catalog from the similar Magento platform at another host. However, this procedure could require a number of additional configurations – we’ll describe them in details within the next publication of the Magento Cluster series to provide the most complete guidance.

    If deciding to build catalog from the scratch, switch to the Catalog > Manage Categories tab of the Magento Admin Panel to create the appropriate product categories and set a root category for your store.

    running magento in cloud

    After that, you can proceed with adding catalog subcategories to define more precise hierarchical sections structure and filling them in with created products so that subsequently your customers could easily find and buy them.

    Use this panel to monitor sales and customer activity, manage your catalog and its content, create promotions and newsletters, etc – in a short word, to implement all the staff that constitutes a high-quality and demanded service. And now, go ahead and explore this in practice at any of Jelastic Public Cloud Platforms – we provide all the newly registered users with a 2-week trial period for making sure that Jelastic hosting services is the best choice exactly for you.

    Need some details or assistance? Feel free to give your feedback within the comments below or contact our technical experts at Stackoverflow.

    Leave a Reply

    Your email address will not be published.