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

Written by eon01 | Published 2017/09/21
Tech Story Tags: docker | cloud-computing | alibabacloud | wordpress | devops

TLDRvia the TL;DR App

The goal of this article is discovering 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.5ports:- '80'environment:WORDPRESS_AUTH_KEY: changemeWORDPRESS_SECURE_AUTH_KEY: changemeWORDPRESS_LOGGED_IN_KEY: changemeWORDPRESS_NONCE_KEY: changemeWORDPRESS_AUTH_SALT: changemeWORDPRESS_SECURE_AUTH_SALT: changemeWORDPRESS_LOGGED_IN_SALT: changemeWORDPRESS_NONCE_SALT: changemeWORDPRESS_NONCE_AA: changemerestart: alwayslinks:- 'db:mysql'labels:aliyun.logs: /var/logaliyun.probe.url: http://container/license.txtaliyun.probe.initial_delay_seconds: '10'aliyun.routing.port_80: http://wordpressaliyun.scale: '3'db:image: registry.aliyuncs.com/acs-sample/mysql:5.7environment:MYSQL_ROOT_PASSWORD: passwordrestart: alwayslabels: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 :-)


Published by HackerNoon on 2017/09/21