Deployment of ownCloud over Google Cloud Platform with SQL(database) service

Hirendra kumar
6 min readSep 20, 2020

--

Problem statement of an task in GCP workshop.

Step1). Create multiple projects namely developer and production.

Step2). Create VPC network for both the projects.

Step3). Create a link between both the VPC networks using VPC Peering.

Step4). Create a Kubernetes Cluster in developer project and launch any web application with the Load balancer.

Step5). Create a SQL server in the production project and create a database.

Step6). Connect the SQL database to the web application launched in the Kubernetes cluster.

Owncloud:

ownCloud is a file server that enables secure storage, collaboration and sharing.

It is convenient to store files in the cloud, so they are available on any device and can be shared with a few clicks. There are a lot of popular providers like Google, Apple, Facebook, Twitter and Dropbox. With a lot of these vendors, files are stored and processed beyond users control. With U.S. firms, files are subject to the Cloud Act and thus to government snooping.

GCP:

Google is a cloud provider company and they provides lots of services like compute engine for compute resources , kubernetes engine for creating a multinode cluster in which master node is fully managed by them, GKE and SQL services and many others.

projects :

In GCP , projects is a way to manage the admin workload , if admin wants to give a IAM role to employee and want that only compute engine will be used by him then admin can create a project for his employee requirements and for other employee admin create other project . now both the projects is different , no relation between both the projects.

we can associate projects with the billing and all the set of APIs; and billing, authentication, and monitoring settings will be within that projects.

now let’s start:

>> first we have to create two projects named developer and production .

creating project for developer
creating project for production

now both the projects is created.

after creating both the projects we have to enable the google API to use any service like compute engine and kubernetes enigne in both projects. so that we can use these services.

>> now we have to create VPC in both the projects .

Virtual Private Cloud (VPC) provides networking functionality to Compute Engine virtual machine (VM) instances, Google Kubernetes Engine (GKE) clusters, and the App Engine flexible environment. VPC provides networking for your cloud-based resources and services that is global, scalable, and flexible.

  1. creating vpc for developer project-
creating vpc named dev-vpc
clicked on create

now vpc for developer will be create , now adding firewall in this vpc.

adding firewall in dev-vpc

I gave source ip 0.0.0.0/0 so that it is accessible form anyone and all protocols is allowed in this.

2. creating vpc for production project-

creating vpc for production
click on create

now vpc for production wiil be create , now add firewall to this vpc for better security.

creating firewall for prod-vpc

now this vpc is also accessible from anyone and all protocols is also allowed.

now the vpc for both the projects is created.

VPC Peering:

In GCP , connecting two vpc is called vpc peering , both the vpc can be anywhere . In this peering they use their own private network that is very secure and very reliable and fast also. using VPC peering VM instances that is launched in both vpc will be connected securely.

>> creating VPC peering:

in above picture creating peering connection with prod vpc that is in production project.

now creating peering connection with dev-vpc in developer project.

the vpc-peering connection is established , now the VM in those vpc can connect securely and can share data fastly with google fast private network.

>> now creating k8s cluster in developer project:

kubernetes cluster is fully managed service by GCP and we can create here multiple-node cluster very easily . and can deploy application on the top of multiple pods.

creating webcluster

launching nodes in all the data center (1a, 1b ,1c) for better security.

taking size 1 , so that in each data center one node will be created.

cluster called webcluster created.

we can see from command line also.

running gcloud command in command line and kubectl is configured.

>> now launching application called owncloud .

command to create owncloud pods-

kubectl create deployment web --image=owncloud

with deployment, owncloud web application is created . using deployment k8s has has a capability to keep on checking the pods , if any pods goes down due to any reason then they will launch automatically.

Command for verifying that pod is running-

kubectl get pods

command to expose deployment so that clients can access the site:

kubectl expose deployment web --type=LoadBalancer --port=80

exposing the deployment with the Load Balancer because LoadBalancer will helps to load the balances if crowd comes.

Load Balancer info -

This load balancer managing three nodes to load the balance.

Command to fetch the ip of Loadbalancer:

kubectl get services

after getting this ip client will connect to the site with the help of load balancer.

>> now creating SQL service:

SQL is the google cloud database service.

database called mysql creating.

setting network connection for public world. so that our application can connect it to store their login info and data etc.

>>now accessing the application of owncloud with the ip.

first page

now creating user.

creating user
login with user and password

Now we are into the owncloud and we can store here any type of data.

owncloud website

Now i am uploading one of my image data into the cloud. Image is uploaded that is sample.png data.

now our owncloud is launched and it is like your own private cloud . you can store any type of data into this.

THANK YOU !!

--

--