Host WordPress site on GCP with Docker

Hey There. Now we are moving ahead with our set up of the WordPress site. In this Post, we will cover the part of server configurations. We will be configuring our server on GCP (Google Cloud Platform) Using Docker Compose configuration we have done in previous posts. The post will mostly focus on GCP overview and configuration of the instance and install dependencies for installing WP_Docker.

To configure an instance on GCP we need GCP access. One can use GCP’s 12 Month trial version for beginning and experiments or can check GCP plans as per the services. After getting GCP console we are ready to set up one VM instance.

To create VM instance open GCP > Compute Engine > vm instance.

To create new instance click Create Instance and you need to fill up configuration details.

Fill up the details like instance name, region etc. One can change VM boot disk by clicking Change in book disk box. There will be list of Boot disks like shown below. We will use Ubuntu 16.04 LTS.

Select Ubuntu 16.04 LTS and click Select.

Click Create to initialize the instance. The instance will be started in few minutes and one can check the instance status like below.

Now our instance is ready to configure WP_Docker and install dependencies. To access VM instance click ssh to login to ssh into the instance. It will open a popup menu and give access to the instance.

Now we are inside out instance so we need to install few dependencies because instance does not have docker and docker-compose pre-installed. To install docker check follow this steps. After installing docker install Docker-compose by following this steps.

Confirm Docker and docker-compose by running below commands.

$ docker -v
$ docker-compose -v

If everything is Ok then we can move to next step to install over WP_Docker.

Run this series of commands.

$ git clone [email protected]:vishaldodiya/WP_Docker.git

( this will need ssh setup on GitHub or you can use Http link )

$ cd WP_Docker
$ cp .env.example .env

in .env file one can change a MySQL password, database name and virtual hostname that will be required for configuration. Now we are good to run the setup file.

$ bash setup.sh

After successfully running all this commands our all docker containers will be started. Now to access our site and access from the domain name and DNS configurations will be covered in next post.

Written on June 28, 2018