3.2 Installing Ghost and WordPress
In this lesson, we'll configure containers to serve websites using Ghost and WordPress.
1.Introduction1 lesson, 00:43
2.Starting With Docker6 lessons, 29:40
3.Web Servers With Docker3 lessons, 14:26
4.Conclusion1 lesson, 00:44
3.2 Installing Ghost and WordPress
Hello everyone, this is Reggie Dawson. Welcome to the Docker for Deployment course for Tuts+. In this video, we will set up a Ghost and Wordpress server and configure them for development. Ghost is a blogging platform designed for writers that has become popular recently. It's not very difficult to pick up, and you can use standard HTML to develop themes for the platform. The problem is that Ghost only runs on a server. You could use some sort of cloud-based service, but Ghost is a great example of an application that is perfect for Docker. WordPress is the most popular blogging platform in the world, although it has grown to become much more than that. Various sites and plugins have allowed WordPress to be used for everything from e-commerce to web apps. The platform has a massive ecosystem of plugins and themes that are available, and there are agencies that develop exclusively for WordPress. WordPress depends on a SQL server to run, and as a result, we will need one to set up our WordPress container. First, I will use an all in one solution, and after that, I will connect two containers to demonstrate how to use the link option. First let's get started with Ghost. Ghost should be one of the images listed in Kitematic. Click Create. Again, our volumes are created for us. If we click on the volumes and choose enable, we will be able to map our folders. If we navigate to the path set up by default, we will find the themes folder where our themes are stored. Next click on our preview to go to our Ghost page. If we add Ghost to our address bar, we can navigate to the admin page where we can create our account and set up Ghost. In keeping with the simplicity of Ghost, his is all we need to do to get an installation of Ghost up and running. Similar to Nginx, we don't need to do anything else to set up Ghost and we don't need the terminal. WordPress on the other hand is a little different. Although there's a somewhat all-in-one solution, I prefer using a separate image for the SQL server and connecting it to a WordPress server as the all-in-one solution has a problem. First, I will show you the all-in-one solution so you can see the problem that it has. Search for the Bitnami WordPress image. After you find it, click Create. If we look at the ports, we can see that we have ports mapped. Unfortunately, if we go to the volumes, there are none exposed. If we are just trying out existing themes, then this will be all right, but if we are developing our own themes, we need to configure our container properly. Let's go over to the terminal. Here we are just mapping the exposed volume from the image so that we can access it through Kitematic. Then we have an environment variable for our user ID, and a non-standard port mapped. If we run this command, after a minute or two our WordPress installation should start and we should be able to access our WordPress. The problem comes when we try to map our WordPress installation to our local folder. When we try to map our folder, it breaks our container. Fortunately, I have a better solution, although we will need to use the terminal to set this up. First, we're going to run our SQL server. This will set up a container named wp-mysql. We have an environment variable for the root password, and then we start our container with the official MySQL image. If we look at this container in Kitematic, we have an exposed port and an exposed volume. But for this example, we don't need to change any of the defaults. Once we have this running, we can now set up our WordPress container. Just remember, any time you want to use WordPress, you will need to start the SQL container first. In order to install WordPress, we will use this command. Here we are starting a container called my-wordpress. Then we have the link flag I mentioned in the networking lesson. This link serves the connected container securely without needing to know IP addresses. Here we are using the wp-mysql container with the alias mysql. Then we have the host port mapped to 8080 in the official Wordpress installation. After we run the command, we should see our preview in Kitematic. If we click on it we will be taken to the start page, but first we need to map our WordPress folder. If we go to Volumes, we will see a volume is exposed. Map it to a folder you want to use for your WordPress files. Once we do that, the WordPress files will be copied to our folder. We are now ready to build our own themes in WordPress. If we click on the preview, we are taken to the WordPress start page. Go ahead and choose your language and get started. Your installation is done. As we have learned so far, Docker allows us to build some very powerful environments for testing. In the next video, we will build a IDE with Ionic built in to demonstrate how we can use our images to host an entire environment to develop in.