WordPress Cloud Hosting: Highly Available and Auto-Scalable Cluster in Containers

By | December 14, 2017

Updated WordPress cluster installation guide is available within the recent article >> Enterprise WordPress Hosting: Automatic Scaling and High Availability


Permanent availability and high performance are among the very key points the developers usually consider when choosing a hosting service. Obviously, no one wants to lose money because of occasional downtime, but at the same time - no one can be completely safe from it. Thus, to minimize the risk of such issue occurrence and to ensure an extra level of redundancy, the clustering approach can be used.  auto-scalable wordpress clusterIn this article, we intend to show how an ordinary application can be adjusted for matching the enterprise level demands with the example of WordPress Cluster solution - a highly popular open source blogging tool and content management system (CMS), powered by PHP. Through applying some special configurations to run it as an auto-scalable and highly available cluster, we’ll reveal how to easily create a reliable and cost-efficient solution for your site or blog with hundreds of users. Such solution could ensure your service operability in various complicated conditions like single server downtime or high users influx (so-called load spikes).

Thus, without further hesitation, let’s check out the proposed pre-packaged WordPress Cluster specifics, as well as ways of its deployment and further management.

Auto-Scalable WP Cluster in Containers

Our out-of-the-box automated WordPress Cluster solution is based on Jelastic dockerized templates and provides the latest WordPress CMS version. The key components of the environment with this package deployed are the following:

  • for distributing incoming traffic within a cluster, an NGINX load balancer is used; herewith, it can be manually scaled horizontally after installation, whilst the newly added node(s) discover available application servers automatically
  • the WordPress application itself is handled with two NGINX PHP servers that are automatically scaled based on the preconfigured triggers
  • two replicated MySQL DB servers to store and operate user data
  • dedicated Data Storage node to eliminate data duplication and ensure the same content presence across all application servers

All software stacks utilize the default image tag when creating the appropriate containers (usually, points to the latest software version by default, though could be customized by your hosting provider as well). Each node is provided with resource limit of 8 cloudlets by default (i.e. 1 GiB of RAM and 3.2 GHz of CPU), which could be subsequently easily increased.   dockerized templates cloud hosting During the WordPress Cluster installation, the following operations are automatically run in a chain by the system using the innovative Jelastic-developed Cloud Scripting technology (to track the currently run processes, refer to the embedded https://app.{platformDomain}/console ):

  • configuring automatic horizontal scaling to deal with load spikes on application servers (where bottlenecks usually happen) through adding one more node in case CPU usage is more than 70% of the allocated resources, and removing it if consumption falls below 20%
  • setting up asynchronous Multi-Master Replication for DB Cluster to boost data reliability, achieve high availability and prevent the whole app downtime in case of a single database server failure
  • installation of the latest WordPress version from the official website and extracting its content into the /data directory on the Storage node, which will be subsequently mounted on application server layer
  • mounting the /data folder on Data Storage container to the application server’s /var/www/webroot/ROOT directory, so that all its nodes, including the automatically connected newly added ones, will operate the same single data set (rather than keeping and constantly synchronizing changes within their own content copies) with the common cached pages storage
  • configuring an advanced HyperDB class to support replication, failover, load balancing and partitioning
  • adding SuperCache Plugin to enhance cluster productivity and response time by  returning the auto-generated static HTML pages for the most frequent requests instead of processing comparatively heavier WordPress PHP scripts each time

In such a way, you can be confident in your data safety and availability - one of the most important requirements for production-purpose sites. As all of these actions are completely automated, the creation of an auto-scalable, highly efficient and reliable WordPress cluster becomes a trivial task for everyone.

Deploying WordPress Cluster in One Click

Being usually rather complicated and time-consuming, with Jelastic operations of the WordPress cluster deployment and configuration represent the completely automated processes. Just a few elementary actions:

1. Log in to the Jelastic dashboard with your credentials and start the installation in one of the following ways:

  • Marketplace

Just type the package name into the search field within the opened frame and click on Install at the shown solution plank.  wordpress cluster from marketplace

  • Import

Within the opened frame, switch to the URL tab and import the link from below to fetch the appropriate WordPress cluster manifest file:

https://github.com/jelastic-jps/wordpress-cluster/blob/master/manifest.jps   one-click wp cluster2. In the opened confirmation window, type the preferable WP Title for your blog site.  docker container wordpressAlso, set Environment name and, optionally, customize its Display Name. Then, select the preferable region (if several are available) and click on Install.

Note: Considering the complexity of the packaged topology, you might be asked to upgrade from trial account to a full version at some Jelastic service providers in order to get the needed amount of resources. However, you have a possibility to try out the installation for free by signing up from the dedicated registration page.

3. Once environment installation and configuration is completed, you’ll see a frame displaying your administration data (simultaneously, these credentials will be sent to your account email).  enter wordpress admin panelGreat! The WordPress cluster is successfully deployed to the Cloud, so you can start using it right away - click on the Open in browser button for the created environment to access your website or use the credentials from above to enter WP admin panel.  automatically scaled wordpress cmsThat’s it! Now you can start filling your reliable and automatically scaled WordPress CMS with the required content to attract the maximum number of users without fear to overload it.

Managing Your Scalable WordPress Cluster

Despite a predefined structure, this WP Cluster solution remains fully customizable after installation. For example, the load triggers for automatic scaling can be adjusted due to the specific needs, as well as the environment can be extended with extra services or features.

Below, we provide an overview of the most common operations that can be performed through the intuitive Jelastic UI in just a few mouse clicks:

  • Adjust Environment Topology

The current structure and the main parameters of your WordPress cluster can be instantly modified by clicking on the Change environment topology button next to your environment name.  wordpress cluster one clickWithin the opened wizard, adjust the required topology settings (same as during environment creation) and simply Apply the made changes. For example, here you can enlarge the default number of containers in each layer or bound a Public IP address to a cluster entry point for enhanced availability.

  • Encrypt Connection with Custom SSL

In order to secure your environment and ensure application data safety, an SSL certificate can be activated. For this purpose, you can enable Jelastic SSL while editing environment topology.  encrypt with enable ssl certificateAlso, there is an easier way to accomplish this by applying the Let’s Encrypt add-on. It can be installed automatically from the Marketplace and provides the required protection for both internal and external environment domain(s) without the hassle of manual configurations. Note that it will require Public IP that is available in a full account only.

While installation choose the cluster environment and entry node, specify the preliminary bound domain name and confirm - the rest configurations will be implicitly done by Jelastic to save your time and keep your nerves.   let’s encrypt add-on

  • Customize Automatic Scaling Conditions

You can increase the allocated resource range for the highly-loaded node within Change environment topology window by adjusting cloudlet Scaling LimitThis will not affect the actual consumption of the resources, but will provide some capacities buffer for the case of load spikes.

The unique automatic vertical scaling principle the Jelastic PaaS follows lets you pay only for the really consumed resources but not for allocated limits, so even such complex clusters keep being cost effective.WordPress Cluster auto scalingAlso, you can re-configure the default WordPress cluster horizontal auto-scaling behavior via the environment Settings > Monitoring > Auto Horizontal Scaling section by editing available setup. For more details on the scaling triggers tuning, refer to the dedicated guidetune triggers automatic horizontal scalingKeep tracking resource usage level for each node via Statistics and tune the scaling rules when it is required.  wordpress cluster cloud hostingAs you see, it’s pretty easy to enhance your service quality even more with the dozens of features provided by Jelastic PaaS - all of them are described within Jelastic documentation, so just follow the appropriate instruction to get the best hosting experience.

Help us to become better - we are eagerly awaiting for your feedback on this solution, striving to reveal the points we could enhance. It is also worth mentioning that similar clustering approach can be applied to different types of applications and we are happy to help with your custom case. So let’s cooperate to save your valuable time for coding, instead of caring about your service stability!

Faced any issue during WordPress cluster installation or usage? Contact our technical advisors at Stackoverflow.