WordPress is the world’s most popular website management and blogging system, supporting more than 60 million websites. At its core, WordPress is built on one of the most common web programming languages, PHP, and uses MySQL as its back-end database. Kubernetes, the open source container management system, is one of the top 10 GitHub projects based on the number of unique developers contributing code. The challenge for developers is how to bring these two giant open source projects together to provide maximum benefits.
As a developer, you are looking to create best-of-class applications and to do that you need to use the leading tools and platforms. This pattern shows you how to harness the full power of Kubernetes clusters and demonstrates how easy it is to deploy the world’s most popular website framework on top of world’s most popular container orchestration platform.
You will find step-by-step instructions, including a full roadmap for hosting WordPress on a Kubernetes Cluster from the IBM Cloud Kubernetes Service. Each component runs in a separate container or group of containers.
WordPress represents a typical multi-tier app and each component has its own containers. The WordPress containers are the front-end tier and the MySQL container is the database/back-end tier for WordPress. The WordPress front-end tier can use MySQL as a service from IBM Cloud.
- The user interacts with WordPress via the web interface. Each WordPress container responds to its users via HTTP/HTTPS.
- When a user posts to any WordPress container, WordPress typically posts the changes to the MySQL database. The MySQL database stores the post data into persistent disks to maintain security. In addition to a MySQL container, you can also use the Compose MySQL service from IBM Cloud. After authentication and authorization are complete, WordPress user information such as a password (encrypted with MD5) and email address is created and stored in MySQL. The website, blogs, tags, categories, and other data are also stored in MySQL.
- The user can also upload themes, plugins, images, and documents. Non-textual data, such as PDFs, videos, and MP3s, can also be uploaded.
- Themes, plugins, PDFs, videos, MP3s, and more are stored in a persistent volume attached to the WordPress pods.
- The user accesses the WordPress website or blog. The WordPress core (that is, the WordPress “brain”) calls the required PHP scripts, starting with index.php.
- WordPress reaches out to the MySQL database to retrieve the website, blogs, tags, categories, and so on.
- The WordPress core then retrieves the themes, documents, images, etc. from the persistent volume, combines it with data retrieved from the database, and presents the page to the user.
Ready to put this code pattern to use? Complete details on how to get started running and using this application are in the README.