 This is the last session of one WordCamp Sydney. So I'm pretty sure you might be exhausted, but I'm pretty enjoying the yesterday and today. Yeah, I'm going to talk about deploying the WordPress into Azure in six different ways. So yeah, my name is Justin from the Maxia as a senior consultant. And I am double-awarded Microsoft MVP. And these are all my MDE. Social media profile, so if you like, you can follow me on Twitter or the WordPress or LinkedIn. So before starting, I'd like to ask a few questions. So where do you deploy your WordPress website for your personal purpose or the work purpose? So anyone using the web hosting company, like the GoDaddy or HostGator or Bluehost, OK? What about the web server on-prem, which is behind the firewall for your corporate use, OK? What about the public cloud, such as AWS, OK, Google or Azure? No one, no one. I knew it. So Azure is not that popular. How interesting. Throughout this session, but I'm going to use Azure Public Cloud to host the WordPress website onto Azure and on the cloud. So there are more than 50 locations from all around the world to host the web applications, including WordPress. And these are the four regions in Australia. So one in Sydney, one in Melbourne, the other two is in Canberra. So based on or depending on your business requirements, we can deploy our WordPress website anywhere in the world, including Australia. So there are actually many different ways deploying WordPress into Azure Cloud. But these six ways are most distinctive ways. So yeah, we can cover this up. Now, before starting, I'd like to review these diagrams. First of all, the way of deployment. We can use a virtual machine. So we can use a virtual machine to deploy the WordPress applications. But in order to use virtual machines, we need to deploy a virtual machine image. We need to deploy the network. We need to deploy IP address, et cetera, et cetera. So these kind of things are all done by ourselves. And this is actually not about application itself. This is all about the infrastructure side. So this is often called as infrastructure as a service or IaaS. So if we use this approach, then we have all the control on us. But it's less convenient. So think about this container approach. So we can call it as a container, as a service, or CAS. Then we don't have to worry about the server maintenance. So the public cloud service provider offers a server environment. On top of that, we are just using containers to host our applications, including WordPress. In this case, we don't have to worry about the server maintenance, which is more convenient than before. Now, this is my favorite part, actually. And this is the path that stands for platform as a service. And in this case, we don't have to actually worry about any server maintenance. We don't have to worry about scaling. We don't have to worry about the version upgrading or security issues, whatever. Because cloud service provider has all the maintenance issue. They do all the dirty jobs. We only focus on the code itself. So we only focus on business, our business logic, business operation, and WordPress code itself. So using PAS, the downside of that, we don't have any control on that, but the more convenient. So that's the different side of the IaaS and PAS. So think about this. Also, there is another approach. I can call it a hybrid approach, but it actually takes benefits from CAS and PAS. So we will discuss it later. Now, think about the virtual machine approach, which is referred as IaaS. So in order to use the virtual machine, we need to have the virtual machine image. So Microsoft provides predefined virtual machine image, which can be Windows or Linux. Or even in Linux, we can choose the Ubuntu, or SUSE, or CentOS, whatever. Or even they have a predefined WordPress image on top of running the Linux box. So we can simply use the WordPress image to deploy a virtual machine on that. So let's have a look at this video. So I'm going to create a virtual machine. But as I said, there is the WordPress pre-installed the virtual machine image. So we can simply choose a WordPress 4.9.7 and create the virtual machine. And we give it a name of the virtual machine, like this. Now, because this is a server, so we need to provide the server username, or the main username, like this. And we can choose either SSH key or password to access to the server. So in this demo, we just simply use a password approach. But if you prefer using SSH key, then we can use that. Now, we choose the resource group and the location, like this. And yeah, this is the basic setup. Now, we need to choose the virtual machine size. So in this demo, we just use the smallest one to avoid any cost damage. Now, so all the setup is done. But we still need to set up any sort of networking issue or virtual network or IP address whatsoever. So these are all default. I just put it as a default now. So all setup is done. Then we are waiting for the validation. And see the cost evaluation. And once it is ready, then we can create the virtual machine image. So once it's done, we can actually see how the WordPress website will be looking like. So let's have a look. So in this case, we are using virtual machine image. So we have set up code, virtual machine, and networking, which is huge to me, actually. So we have the DNS name. So we copy it and open another browser and run the predefined WordPress website, like this. So because that virtual machine has already installed the WordPress image, we can use that, like this. The problem of using the virtual machine is, as I said, we have to set up everything by ourselves, including SSL and the certificate, something like that. So if we want to run our WordPress website, we need, in a secure way, we need to enable the HTTPS connection, which is not enabled by default. So we need to manually enable it. Also, we need to install the SSL certificate onto the virtual machine, which is, to me, is a huge cost. We have to spend a lot of time to figure that out. Now, let's move on to another service approach. We are using now the Azure Container Instance, which is about using the CAS approach. So in this case, as I mentioned, we don't need to manage the server, because the server is already provided by the Azure. And we don't need to worry about the maintenance that on top of that server, we only use container image, which is WordPress has official container image on Docker Hub. So we can just simply pull that container image onto that service. So let's have a look. So in this video, I'm going to create the Azure Container Instance. And within the Container Instance, I will pull out the WordPress image. So we create. And we give it a container name. And we are referring the public Docker Hub image, like the latest version of WordPress. Then we choose the resource group. Then choose the location. When I take this video, the Australian region was not enabled. Now Australia has offering this container instance. So we can simply use that. Also, we need to give the DNS name, which we can access from outside, because it is a public container. Now all the setup is done. And if we click OK, and it will create the container instance. So once it is ready, we will see how the WordPress website is running. So when you click that, it goes into the container instance. So we put the fully qualified domain name here, WCS, 2018, or something like that. Because this container itself is not a web server. We just pull the website image. So the FQTN is not about the website. But we pull the image as the web server. So we can run that container as the website. Now we use as a portal to create the container instance and the as a portal only supports a single container scenario. So if you want to use multiple container scenarios, then probably the as a portal doesn't support that scenario. In that case, we need to use ARM template, which stands for as a resource manager template. So as I said, the official WordPress image doesn't support HTTPS connection by default. So in this case, we have to enable the HTTPS connection by modifying or customizing the official WordPress image. Or you might be thinking of if we can use the container, the technology, how can we use container orchestration or scaling, something like that. As a service instance, as a container instance, doesn't support it. Instead, if we want to use clustering or orchestration or scaling, something like that, and think about the as a Kubernetes service, I'm not covering this topic in here. Also, now we are using as a app service instance, which is the platform as a service. So as I said, it's my favorite. And the reason why I like this most is I don't have to worry about any server maintenance. I don't have to worry about any scaling. I don't have to worry about anything but code. So I can choose either Windows or Linux Box as an operating system. Actually, I run several on the WordPress website running on Windows, so I have no problem at all so far. Also, this is a pass. So it provides, we can choose runtime. So PHP 5.6 or 7.2 as a default runtime provided. So if we want to run different version of PHP runtime, probably this is not going to be working, then we can choose another approach. I will talk this later. As I said, it's support auto scaling, which means if we want to scaling out using virtual machine approach, we have to install another virtual machine. We have to install another virtual machine depending on the traffic. If we want to use container approach, we need to install another node for scaling. But if we are using pass approach, actually, when the traffic goes in, the traffic is too heavy, it automatically scales out. When the traffic is down, it automatically scales in. So that kind of scaling issue is actually I'm free from those kind of scaling concerns. Also, the SLA of the app service instance is 99.95%. So which means about less than 10 minutes a year of outage. But if you still want to hire availability, then think about the Azure Kubernetes service or Azure Service Fabric. Also, the Azure Pass supports continuous deployment. So it can nicely integrated with your Git repository or mercurial repository, which can be hosted in Bitbucket or GitHub or your internal Git server. It can be a smoothly integrated with your source code repository. So let's have a look. This is a small video of how we can deploy the WordPress website into Azure app service. Now, we are giving a name onto the Azure web service. And this will be the default name of the website. And we provide a resource name. And this time, I'm going to use a Linux box. Now, we can choose either the PHP version. So I'm going to choose PHP 7.2 now and just creating it. So comparing to the previously we deployed on the virtual machine approach, we set up all the things. But in here, we just use the deployment approach is very simplified. Now, we have a web app. But in this web app, we don't have any WordPress deployed yet. Now, we are integrating the source code repository using GitHub. And WordPress has also the public repository on GitHub. So we choose WordPress and install it. So now, it's integrated with the WordPress repository now. So when you go there, and it's not deployed yet, now, if we click the Think button, then it pulls all the data from the latest code from the GitHub repository and then deploy it. So if we change this repository to our own thing, and whenever we push the commit into the GitHub, then it automatically picks that change and deploy it into Azure. So this is done. Then when you click on the website, and we can see how we quickly deploy the WordPress application onto the Azure web app. And it also has the problem, which means because it's a pass. Pass means the Cloud Service Provider has all the server maintenance, which means our application has a dependency on the vendor. So it's a vendor-specific dependency. So if we want to migrate our WordPress application into different Cloud Service Provider, like AWS, or if we want to migrate this application into our own-prem web server, we probably need to slight modification because of that vendor dependency. So in order to avoid or overcome that vendor dependency, probably we might need to change some packaging. So in this case, we can use Container. So the way of the packaging is just use the normal artifact to the container packaging. So I can call it as a hybrid approach, but it's basically on pass. And it's using single container. So it takes benefits from pass, which means we don't have to worry about server maintenance. We don't have to worry about scaling, all sorts of things. And also, we can take benefits from CAS, which is a container on the packaging. Now, let's have a look at this short video. We are creating another web app instance using the single container. So this time, let's have a look. This time, we are giving it a different name for this web application. Then there is the OS choice at the bottom. So instead of using Windows or Linux, we choose the Docker. Then we choose a single container. And that container comes from Docker Hub, which is WordPress. That WordPress column, latest, which is the official Docker container image by WordPress. So yeah, it's actually basically it. And when we set this up, an application will be deployed straight away. So once it is deployed, then go to the web application. It has, yeah, we create the container web application like this. And go into there. And there is the URL. And if we click that application, now we can see the website. The problem is that this is the single container scenario. So if we want to have multiple containers for our development purpose, and this scenario doesn't fit. In this case, we can use Docker Compose as for the multi-container approach. So this is another hybrid scenario. So yeah, so we can use multiple containers on using the vocal container. So for example, what can we do as a multiple container approach? For example, let's think about that. If we are developing the themes or plugins, so instead of directly modifying the code base itself, we can create another container for only four themes, another container for only four plugins. And then we can combine all together and host it into the web service as a web app. Or for your quickly testing purpose, we can simply add MySQL database like this. So I define the MySQL database at the top and define the WordPress container at the bottom. So we can combine this kind of scenario as well. But this is not secure, so this is only used for your testing. So yeah, so let's have a look at this video. So as I said, we are still using the pass as a web instance like this. But this time, instead of using the single container approach, we are using Docker Compose format. So choose the web application name and choose a Docker. Then instead of choosing a single container, this time we are using Docker Compose. Then I have predefined Docker Compose, the YAML file, and upload it. Now we have all the definitions uploaded like this, which I showed before, and then created. So in this case, this web app has a particularly having the basic WordPress website and MySQL database integrated. So don't do it for your production purpose. Now, so the web app is created now. So this time we might be seeing a different result because we installed two different reservoirs at one instance. So let's have a look. So when we click this website, now we can see the different one because it's already database connection stream has been provided. So this is how we can handle multiple containers in one single web app instance. Now, there are another type of multiple container scenario. Then we can use the Kubernetes port file. This is the unlike the Docker Compose, we can also use Kubernetes port. So the basic idea is the same as the Docker Compose. It uses the container support, but the file format is different. That's the only difference. This is the port format. But to make sure that we are not using the full Kubernetes features here, we only take benefit of using the port file itself. So as I mentioned before, if we want to fully use Kubernetes feature, we consider it as a Kubernetes service. Now, have a look at this video. So we create another web app to use the Kubernetes port file. So give it a name again. And this time, we are choosing Docker. And in the last tab, which is Kubernetes and provide the port file. So I have already defined, as I showed before, the port format. And it defines the WordPress image only at this stage. So we create it. So the web app is being deployed now. Once it's deployed, actually we can see not much differences from the previous deployment. But we are using a different approach, which depends on your business requirements. If you have already the Kubernetes definition file, then we can use this approach. If we have Docker Compose file, then we can use the previous approach, something like this. So we can see the WordPress has been installed using the different multi-container scenario. So this is not the Kubernetes clustering. So if we want to run the clustering scenario, as I said, then we can use it as a Kubernetes service or as a service fabric. Now, it's almost there. So throughout this session, I showed you six different ways of deploying the WordPress website as well. From the IaaS, using the virtual machine approach, then the container instances. Then the rest four is using the Azure pass. And the rest three is a different packaging, using the single container, using Docker Compose for multi-container, using the Kubernetes port for the multi-containers. So it really depends on your business scenario. If I am asked to choose one of those six approaches, I will definitely go to one of those four and pass approach, depending on. But if I just want to stick on Azure, I will choose the number three. But if I am thinking of the future migration, then probably I can choose the rest of the three hybrid approach. It depends on really scenarios. Or if you want more control, rather than giving all the control to this cloud service provider, then probably choose on the virtual machine image approach, something like this. So this is it from my session. Any questions? Hi, thank you for that. How do you manage the file storage and other kind of persistent data that has to hang around between deployments? Because if you're using a repository-based pipeline, you're going to blow away whatever's there. Obviously, you've got to separate out theme files, plug-in files, uploaded assets. How is that handled in the pass options? Your question is about how we can manage the existing content files, something like the videos or images, something like that. Like most other cloud services, the recommended way is including Azure or AWS. They recommend us to use a different storage service. For example, Azure provides the storage account, the blob storage, so we can set up to store any images or videos directly to there. So there is a plug-in called the Azure service WordPress plug-in to directly use the blob storage instead of directly using the file storage into the pass approach. So I'm pretty sure that also Amazon has an S3 bucket account, so probably we can use that. But if that file has a kind of a part of the theme or plug-in, then probably I'll go and stick with that. But other content-wise, I think I would recommend to use the blob storage.