DEV Community

Cover image for Deployment of WordPress using Google Cloud Platform
Piyush Bagani
Piyush Bagani

Posted on

Deployment of WordPress using Google Cloud Platform

Hello Everyone, I hope You are all doing well.

In This Great story, I want to share the great use case I learned In the Workshop of Google Cloud Platform under the guidance of Mr. Vimal Daga.

→Google Cloud Platform: Google Cloud Platform is essentially a public cloud-based machine whose services are delivered to customers on an as-you-go basis, by way of service components. Google Cloud Platform (GCP) is a collection of Google’s computing resources, made available via services to the general public as a public cloud offering.

Follow the Steps:

Task Overview:

Creating Different 2 VPCs in vivid regions:

Go to GCP Console and then click on VPC Network and You will land on this below page. Click on Create VPC Network and Create two VPCs in different regions by clicking on create button. After the creation, we have to perform VPC Peering.

VPC Peering: A VPC peering connection is a networking connection between two VPCs that enables you to route traffic between them using private IPv4 addresses or IPv6 addresses.
alt text
alt text
→Now create Kubernetes Cluster in the developer’s VPC… Here the details for the creation of Cluster. Also, Go for install of Kubernetes Installation after this.

command: curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl

alt text

Atlast click the create button to create cluster .

→Google cloud shell can be used to do command line operations.

→Connect to the Cluster using CLI Here I’m going to use Google Cloud Shell for the Command line .After creating cluster, click on connect you will see one pop-up window ,There will a command to copy and that you have run in cloud shell. Now Launch one pod in the cluster using docker image called WordPress. — Command:kubectl create deployment myweb — image =vimal13/apache-webserver-php. Here You can also use official image of wordpress. After that we must expose the pod using loadbalancer. Command for this: kubectl expose deployment myweb — type=LoadBalancer — port =80

After this browse to the ip got by running command kubectl get services,
alt text

→Now we have to Create a SQL server in the production project and create a database.For this we have to a MySQL instance and after this we have to check whether it is created or not.

Check using the ip given by them and run command mysql -h “ip” -u “username” -p and then enter password.
alt text
→If we are not able to connect then we have to check the firewall setting by clicking on “edit configuration”
alt text
→And Now try to connect to the instance instance. We should get this
alt text
→Now we have to create database on SQL instance.
alt text
→Fill the following Information
alt text
We can create our own post and publish it.
alt text
Atlast ,The task Given by Vimal daga sir is completed

Thanks for Reading😊😊

Top comments (0)