Discovering Alibaba Cloud — Deploying a Wordpress Cluster Using The Container Service

Disclaimer

Aymen El Amri
Sep 23, 2017 · 5 min read

This content is part of / inspired by one of our online courses/training. We are offering up to 80% OFF on these materials, during the Black Friday 2019.

You can receive your discount here.


The goal of this article is to discover Alibaba Cloud using a real-world example. We are going to create a Wordpress website using Docker containers and we will be using Alibaba Container Service to deploy it.

You should create an account, set your payment information but you’ll get $300 free credit.

The full tutorial and more are published in my training Painless Docker.

Visit the training website for more details.

Like AWS, start by creating a VPC which is a virtual network dedicated to your account. The goal of setting this is logically isolating your infrastructure and resources from other virtual networks in the same cloud.

Create a Vswitch, or a virtual switch in order to choose your cloud region, CIDR and the number of IP addresses in your network.

Activate the Resource Access Management: an identity and access control service which enables you to centrally manage your users (including employees, systems or applications) and securely control their access to your resources through permission levels.

Go to your console home page and choose Container Service.

Now create a cluster:

Choose the name of the cluster and select the VPC. Select a region and a zone. I kept everything else at its default values.

The cluster could take some time to be created.

Let’s start by creatng the application

I named my application “wordpress”, selected the cluster that I created and selected “Pull Docker Image” in order to pull the latest Docker image when tag is not specified.

We can use “create with image” or “create with Orchestration Template”.

You can use an orchestration template to define and deploy a multi-container application.

The Docker Compose format is supported.

When clicking on “Use existing orchestration template”, you can access to your predefined orchestration templates or some of the templates that are already set up by default.

Using the predefined Wordpress template is easier and faster for us and we will be using it for the remainder.

This is how it looks:

web:
image: registry.aliyuncs.com/acs-sample/wordpress:4.5
ports:
- '80'
environment:
WORDPRESS_AUTH_KEY: changeme
WORDPRESS_SECURE_AUTH_KEY: changeme
WORDPRESS_LOGGED_IN_KEY: changeme
WORDPRESS_NONCE_KEY: changeme
WORDPRESS_AUTH_SALT: changeme
WORDPRESS_SECURE_AUTH_SALT: changeme
WORDPRESS_LOGGED_IN_SALT: changeme
WORDPRESS_NONCE_SALT: changeme
WORDPRESS_NONCE_AA: changeme
restart: always
links:
- 'db:mysql'
labels:
aliyun.logs: /var/log
aliyun.probe.url: http://container/license.txt
aliyun.probe.initial_delay_seconds: '10'
aliyun.routing.port_80: http://wordpress
aliyun.scale: '3'
db:
image: registry.aliyuncs.com/acs-sample/mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: password
restart: always
labels:
aliyun.logs: /var/log/mysql

If you try to use the V3 Wordpress orchestration file than you will get this error message:

Our Docker cluster is not compatible with Docker Compose v3 ! This is what the error message tells us.

This is how my cluster looks like

Now go to the Server Load Balancer service to access the IP address of your external load balancer. The latter will distribute traffic automatically across our two cluster instances.

Until now we created a Wordpress using a cluster of two nodes, each node hosts Web and DB containers and an external load balancer to distribute the traffic to our nodes.

Here are some of the pros and cons that I can pick out at this point:

Cons:

When creating the cluster and the application, I experienced some slowness. I tested 3 or 4 clusters and at each time Alibaba Cloud was really really slow !!

I am not sure if this is specific to cluster and containers orchestrations or other services could experience the same slow operations.

I also noticed some other bugs in the GUI, some buttons were not responsive and I had to reload the page in order to click on a button ..

English is available to use as a main language for the console but I’ve got an error message written in chinese..

Pros:

The fact that a Container Orchestration Service exists is a good point for Alibaba Cloud users. Not every Cloud Providers has this service.

I found the possibility of using a Docker Compose file and the possibility to set the cluster to Swarm mode (beta) very helpful.

When working with Alibaba Cloud, you’ll notice that you’ll be guided in order to set up the best practices for networking and security. You should create a VPC and a network, setup, activate the Resource Management ..etc

Alibaba Cloud is implementing known standards, so if you have been using GCP or AWS before you’ll notice that Alibaba is not too much different from what you have been using.

AliCloud is pretty generous on giving special prices and free services and this is a very good point !

Connect Deeper

In this tutorial we prototyped a Wordpress blog using Alibaba Cloud Container Service.

If you liked this article or want to discover similar tutorials, you will enjoy Painless Docker course.

You can also sign up to DevOpsLinks, a DevOps professional network and our DevOps Discussion Board where you can ask and answer DevOps related questions !

We also started Shipped Newsletter: An Independent Newsletter Focused On Containers & Orchestration.

If you are more interested in learning other Cloud providers like AWS, you can register using this form and I’ll share with you some of my new projects and some welcome gifts !

Happy hacking :-)

HackerNoon.com

how hackers start their afternoons.

Aymen El Amri

Written by

Building www.faun.dev & www.eralabs.io DevOps / Kubernetes / Architecture, Maker/Entrepreneur. Author Painless Docker SaltStack For DevOps and Practical AWS

HackerNoon.com

how hackers start their afternoons.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade