
In the digital era, where having an online presence is almost synonymous with having a tangible identity, the platform you choose to host and build your online space holds paramount importance. Initially conceived as a blogging platform, WordPress transcended those early bounds, morphing into a comprehensive website-building powerhouse. In this tutorial, we'll look at how to easily host a WordPress environment using Acorn, discuss getting started with WordpPress, and look at how it compares with other open source options on the market.
WordPress, an immensely popular CMS (Content Management System), is known for its flexibility and ease of use. In this tutorial, we'll explore how to deploy WordPress using the Acorn MariaDB service, utilizing Docker containers for a smooth and scalable setup. We’ll also delve into managing secrets securely within our deployment.
If you want to follow along with this tutorial, you can follow this link to deploy the Acorn Image I have written for WordPress in the Acorn sandbox. Acorn's sandbox is free to everyone, and allows you to run images for two hours before they are stopped. For WordPress it is especially nice because it includes a database service, a load balancer, and a public IP, all of which we will need. If you decide you want to run WordPress on an ongoing basis, you can upgrade your Acorn account to a paid Pro account, where you can pay as you go for the cloud resources to run WordPress.
Let’s start our tutorial by looking at the architecture and steps involved in deploying WordPress.
To run WordPress we need to deploy it onto a server, and expose it to the internet. We'll start by setting up a MariaDB Database and connect it to a Docker container running the WordPress software. We'll need to use a secret to ensure only WordPress can access the database.
Docker encapsulates the WordPress application and its dependencies into a portable container, making it easy to deploy, scale, and manage. I have written several docker images since the start of my career, and WordPress is my favorite as it’s the easiest and simplest to customize according to user needs.
● I've created a pre-built WordPress images with MariaDB as a Database; You can use it to deploy your WordPress with a single click.
Or you can use the Acorn CLI and the following commands
acorn login acorn run ghcr.io/rohitg00/wordpress:v1.0 acorn container run --name [container_name] [acorn_image]
If you want to explore more about creating Aocrnfiles and Acorn images or are interested in customizing our WordPress Acorn I have created a step-by-step guide to deploying WordPress.
I recommend creating a new directory for this demo because Acorn requires you to run the following commands inside the directory where the acornfile is present. An Acornfile is a file that describes how to launch containers and services on Acorn. It is very similar to JSON and YAML, and if you're already familiar with Docker or Docker Compose, you'll find it quite easy to understand.
Every Acornfile can be built into an artifact called an Acorn Image, which is a complete package of your application. It includes all the container images, secrets, data, nested Acorns, etc. in a single OCI image that can be distributed through a registry.
$ mkdir wordpress $ cd wordpress
Now, let's build our Acornfile for WordPress, starting with the database.
Setting up Acorn MariaDB service:
services: db: { image: "ghcr.io/acorn-io/mariadb:v0.1.0" serviceArgs: dbName: "wordpress" }
Specifying the WordPress container and customizing environment variables:
containers: wp: { image: "wordpress:latest" ports: publish: "80/http" env: { WORDPRESS_DB_CLIENT: "mysql" WORDPRESS_DB_HOST: "@{service.db.address}" WORDPRESS_DB_USER: "@{service.db.secrets.admin.username}" WORDPRESS_DB_PASSWORD: "@{service.db.secrets.admin.password}" WORDPRESS_DB_NAME: "@{service.db.data.dbName}" } }
secrets: { "WORDPRESS_DB_ROOT_PASSWORD": { type: "token" } }
containers: wp: { image: "wordpress:latest" ports: publish: "80/http" env: { WORDPRESS_DB_CLIENT: "mysql" WORDPRESS_DB_HOST: "@{service.db.address}" WORDPRESS_DB_USER: "@{service.db.secrets.admin.username}" WORDPRESS_DB_PASSWORD: "@{service.db.secrets.admin.password}" WORDPRESS_DB_NAME: "@{service.db.data.dbName}" } } services: db: { image: "ghcr.io/acorn-io/mariadb:v0.1.0" serviceArgs: dbName: "wordpress" }
acorn login acorn run -n wordpress .
Expected Output:
To Access the WordPress environment you've created, visit the Acorn dashboard and find the Wordpress deployment, where you'll find an endpoint that you can follow to access the WordPress server you've deployed.
Congratulations! We have successfully installed WordPress with MariaDB on Acorn. Now you can select your language, create your account as the WordPress administrator, and begin setting up your own WordPress server.
Try selecting a theme from the free WordPress options and posting your first blog post. Once you get started with WordPress you'll find it is a rich and powerful platform for publishing web pages and blog posts, collaborating with others, and even selling goods and services through popular e-commerce plugins.
Let's compare two other popular CMS platforms, Joomla and Drupal, and see how they stack up to WordPress
##Ghost, a simple alternative to WordPress
If you're looking for something less complicated than WordPress, consider Ghost, another open-source CMS that has become very popular in the last decade. I've created an Acorn Image to deploy Ghost in your sandbox, which you can use to compare the two popular website hosting platforms.
The journey from conception as a mere blogging platform to evolving into a robust website-building powerhouse encapsulates the essence of WordPress's transformative trajectory. Its adaptability, ease of use, and rich repository of themes and plugins make it a compelling choice for individuals and businesses alike.
This tutorial not only demonstrated a seamless WordPress deployment using Acorn MariaDB service and Docker containers but also highlighted its superiority when pitted against other notable platforms like Joomla and Drupal. The extensive community support, superior SEO capabilities, and a balanced approach towards catering to both beginners and seasoned developers further accentuate WordPress's appeal.
We explored Acorn and successfully wrote an Acornfile to demonstrate the WordPress setup, but this is just scratching the surface of what you can do with Acorn. You can explore the Acorn docs or find other interesting software to deploy in your Acorn Sandbox, sucha as a Minecraft server, or a meal planning app in the Acorn Library.
Header Photo by Justin Morgan on Unsplash
Rohit Ghumare is a developer advocate living in Mumbai, India. You can find him on X, LinkedIn or Github.