wesupport

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

Need help?

Our experts have had an average response time of 11.43 minutes in March 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

WordPress VPS hosting simplified – Using Docker to deliver light, scalable WordPress containers

by | Sep 4, 2015

As we’ve seen in a previous post, WordPress multisite is a great way to deliver multi-tenant WordPress hosting. However, multisite doesn’t allow customers access to the WordPress back-end in case they want to make custom modifications.

For WordPress developers and web hosts who want to give their customers an option to manage their own WordPress installation, but free from the limitations of a shared hosting environment, WordPress VPS hosting is the best fit.

Today we’ll see how Docker can be used to setup a light weight WordPress VPS hosting service.

How to make WordPress VPS hosting better?

When you think about VPS, the names Xen, OpenVZ and KVM come to mind. So, to setup a WordPress VPS hosting, all you need to do is to get a KVM (or another like it) hypervisor and create VPSs on which WordPress will be installed in a LAMP environment.

Let’s take a look at what all needs to be done:

  1. Install a hypervisor.
  2. Create VPS templates for various resource sizes.
  3. When an order comes in, create a VPS, and install WordPress in it.

Sounds good enough. You may have to create a couple of scripts to take care of the boiler-plate WordPress setup steps like database creation, DNS addition, Apache configuration, etc., but essentially this process is the best way to go about it. Or is it?

This would be a great implementation strategy a couple of years back, but today you have better ways to do it. Let’s look at what are the opportunities for improvement:

Better resource utilization – VPS systems that use hardware virtualization spend a lot of CPU, memory and I/O to run the hypervisor. Saving on those resources means you can accommodate more customers per server.

Easy deployment of latest software – Creating a VPS template is expert territory. You need to modify the filesystem configuration, reset network interfaces, and more to get a working template. It can be a bit hard to keep the templates updated as new versions of applications are released. As we’ll see later, template maintenance can be very easy with layered file systems like UFS. This allows you to always provision the latest software, even if an update was released just minutes back.

Better scalability – What do you do when the resource usage in VPSs go up? Usual solutions include upgrading the hardware, or taking a dump of heavy usage VPSs and restoring them in a new server. If you just have one or two servers, this idea is OK, but as the number of servers increase, it can quickly become tedious. Container technologies such as LXC makes it easy to do live migration or adjust resource usage on the fly. It saves you time on account administration and reduce service downtime.

[ Are you into VPS hosting business? Looking for a stable server infrastructure setup? Our cloud management experts will help you setup the ideal solution. ]

Light weight WordPress VPS using Docker

Container technology is not new. It’s been around since 2008, and projects like LXC and OpenVZ have used resource limitation features in Linux to create OS virtualized VPSs. It cut down on resource usage overhead and enabled better scalability. The latest kid on the block, Docker, added a couple more useful features to it.

  1. Layered file system – Docker uses UFS (Union File System) in their storage implementation. This makes sure that common data (like base image) is shared by all containers, with only changed data stored for each different container. This saves disk space, and more importantly, frees up system memory to create more container instances.
  2. Easy image management – Docker brought in an easy way to manage container templates (known as images in Docker land). You can update a container image, write down the changes using “commit” command, put it in a central repository using “push” command, and spin off a new container in another server using a “pull” command. No more need for tedious template creation kung-fu.

So, now that we know Docker is an option worth exploring, let’s see what’s involved in setting up a WordPress VPS hosting environment.

[ Trying to figure out the best infrastructure for your VPS hosting servers? Our server experts will assist you to choose and implement your VPS solutions at affordable pricing. ]

Setting up Docker

Docker is well supported in all popular Linux distros. Installation is straight forward in Fedora 22 server.

# dnf install docker
# chkconfig docker on
# service docker start
# docker run hello-world

This should give you a nice output that Docker is working.

Now, we’ll need a LAMP environment with WordPress installed. Tutum’s WordPress image worked out great for me. Get it and run it so:

# docker pull tutum/wordpress
# docker run -i -t tutum/wordpress /bin/bash

Now, you’ll get an Ubuntu server with all WordPress dependencies pre-installed. Install FTP server in the container to make it a full fledged hosting environment, and set to start them at boot time.

# apt-get update
# apt-get install proftpd
# update-rc.d proftpd defaults

Exit the container using Ctrl P + Ctrl Q, and save the new image with a custom name, like so.

# docker commit db8c3ec91d23 wp-vps

You can push this into Docker registry, but that will make it public. Instead you can setup your own private repository, and push this image there.

Once you have the new image, you can spin off new containers with:

# docker run -p 127.0.0.1:8090:80 wp-vps

This will bind the web server of your new WordPress container to port 8090 of your server.

Now we need a way for the domain in the VPS to get HTTP requests directed to it. For that we’ll use an Nginx proxy. Jwilder has a nice Nginx proxy image, which gives you VIRTUAL_HOST and VIRTUAL_PORT environment variables to channel requests to one particular domain to our defined ports.

In the same way, you can assign FTP ports to a non-standard port in your host.

Now, the basic functionality of your WordPress VPS is ready.

Need help setting up a stable VPS hosting service?

GET IN TOUCH WITH THE INDUSTRY EXPERTS

 

Using Cockpit to manage WordPress containers

So, how do you go about managing these containers? Red Hat as a nice tool for you – Cockpit. In a previous article we’d covered how to manage Docker containers using Cockpit. Head over there and you’ll see how you can install and configure Cockpit. Also, Cockpit gives you a convenient interface to allocate resource quota for your VPS customers.

Here’s how the Cockpit management interface looks like in my server:

WordPress VPS hosting using Docker and Cockpit

WordPress VPS hosting using Docker and Cockpit

 

Conclusion

WordPress VPS hosting is a great way to give customers the freedom to manage their sites, while removing the restrictions imposed by a shared hosting environment.

Container server virtualization as implemented by Docker gives you a great way to easily create, provision and maintain your WordPress VPS infrastructure.

Bobcares helps VPS and cloud hosting providers design, deploy, customize and maintain virtualized infrastructure that is custom tailored to meet their business goals. Contact Us to know how we can help you.

 

MAXIMIZE YOUR BUSINESS PROFIT!

We will setup and maintain a stable server infrastructure for your hosting business at affordable pricing.

CLICK HERE FOR YOUR IDEAL HOSTING SETUP

Bobcares provides Outsourced Hosting Support and Outsourced Server Management for online businesses. Our services include Hosting Support Services, server support, help desk support, live chat support and phone support.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags