The first time someone suggested adding Wordpress to the Awesome Kubernetes list, I was surprised! I didn't think of Wordpress as something that needed a distributed workload tool. So many readers mentioned it that I put together this brief tutorial.
This article analyzes available paths for migrating a WordPress website to AWS, and the architecture components for AWS-hosted WordPress. This instruction to covers how Opta can be used to provide shared storage on the AWS EKS platform for a WordPress CMS.
WordPress is a simple (CMS) content management system, a process of posting articles and media to a website. WordPress was born as a blogging platform but has grown to support the creation of all kinds of websites. It is free and open-source. It was launched in 2003. It has mainly two basic elements that are the front end and the back end. WordPress provides a spontaneous user interface for this purpose for show text, images, and other media to the web. Anything users see on the website has been uploaded to the webserver. As of 2021, more than 42% of the top 10 million websites are running WordPress.
WordPress has been developed to combine CMS competence that integrates with modern elastic, scalable, and cloud-native architecture. The WordPress group has attempted to develop modules that enable the creations of WordPress sites that exploit AWS Cloud contributions.
AWS provides a large-scale cloud platform that improves performance, control, scalability, and reliability for WordPress websites. The Amazon web services Elastic Kubernetes Service grant the company to build, manage and scale Kubernetes clusters on AWS cloud or local tools.
There are the following options in AWS when going for WordPress hosting as per utilization cases changes:
a. AmazonEC2 -- The EC2 virtual machine system is the classic way to own your own virtualized server on AWS. But the smooth scaling and automated restarting of instances aren't included
Image Source: https://aws.amazon.com/blogs/
For small WordPress websites, it acts as a perfect starting point that can scale later with its growth.
c. AWS marketplace --It includes different pre-configured WordPress images that can be deployed into AWS EC2 in quick time. That single-click deployments are tailored to unique work and come in an adjustable combination of packages and plugins for efficient use of computing resources.
While most WordPress organizations utilize speedy begins to enable automated arrangements dependent on best procedures, comprehend the parts that make up a working WordPress application in AWS cloud.
WordPress app. requires components to perform four functionalities:
- Static Host Content
- Dynamic host content
- Blog/site store content/data
- On the file system store uploaded files and images.
Now there we will discuss how above each functionality can be managed for AWS.
In a stateless web tier, the server does not keep any data from one request to the next. The user needs to do its work in a series of simple transactions, and the client has to keep track of what happens between requests. While sessions are maintained by cookies on the end-user’s web browsers, so the WordPress core is stateless.
It is defined as having the capability to link resources to a system that increases its performance (decrease output times or increase throughput). The number of compute instances includes by AWS that can be used to evolve single-server applications into scalable architecture.
There are about five main components included by scalable web tier to handle scaling for dynamic content:
- Amazon Machine Images (AMIs)
- Amazon EC2 Instances
- Load Balancing
- Automatic Scaling
- Health Checkup
Mostly all WordPress Installation files, and client customizations should be handled in a shared platform as this eases the strain on web servers. Amazon web services having the Elastic File System (EFS) which gives a scalable, highly networked file system for different compute instances.
When the WordPress installation data files and setups are moved into a common Network File System (NFS), and static resources are being served on S3, stateful parts are hosted on WordPress Databases. Amazon Aurora is the top solution for running stateful workloads for AWS applications. Both MySQL and PostgreSQL are compatible with this stage. In Opta we will use PostgreSQL.
Opta is a stage for running containerized jobs in the cloud. It abstracts away the intricacy of networking, IAM, Kubernetes, and different parts - giving you a perfect cloud skeptic interface to deploy and run your containers. It's all arrangement or configuration driven so you generally get a repeatable duplicate of your foundation.
Before starting with WordPress, we need to set up Opta. For this article, we will be used Opta.
To set up Opta, install Opta by using the following command in a Linux distro like Ubuntu.
/bin/bash -c "$(curl -fsSL https://docs.opta.dev/install.sh)"
Set-up environment Creation
An organization like AWS or Azure, we will set up an environment by executing the following commands:
opta init env (AWS)
Creating a file opta.yml to describe an environment that you will create. Using the below command and hit then a description of the environment will start showing and a cluster will be created.
Using the below command, we can create yml file that is responsible for the initial configuration for your environment and architecture setup.
We have seen the first part we will mention about the AWS region and create account id through AWS console, now the second next part we will link modules through setting up Kubernetes or k8s cluster and created several nodes.
name: aws org_name: XXXX providers: aws: region: ca-central-1 account_id: XXXXXXXXX254 modules: - type: base - type: k8s-cluster - type: k8s-base
After that execute the command
When the above command gets executed, we will create an EKS cluster for you and configure VPC, networking, and different other infrastructure pieces.
Kubernetes empowers quick scaling of web applications utilizing on-request Horizontal Pod Autoscaling (HPA) approaches. An increment in workload pushes Kubernetes to plan extra reproductions utilizing extra PODs hosting comparative data content. Kubernetes also utilizes rollback arrangement systems to aid in seamless updates for content, client uploaded files. that is the reason a WordPress hosting application on the AWS Elastic Kubernetes Service improves to implementation of scalable, high accessibility websites.
Now we will learn and understand how to provide shared storage to WordPress sites running on EKS which require access to shared volumes.
Kubernetes Access Mode is a specification of a Persistent Volume that defines how it is mounted on a host. Various storage providers help various capabilities and the mode for each Persistent Volume is set to the specific combination of access modes it supports.
There are four types of access mode supported by Kubernetes:
- Read-only Memory
- Read WriteOnce
In this article you have learned what opta is and how it is involved with deployment process, and this article explained from basic to the concept behind the deployment of WordPress on AWS using opta. If you have any trouble with the process please comment down below or join the opta slack.