loading...
Cover image for Creating Your Cloud Infrastructure like Google cloud and Digital Ocean from Scratch: Part -3 : FINALLY THE CODING STUFF !!!

Creating Your Cloud Infrastructure like Google cloud and Digital Ocean from Scratch: Part -3 : FINALLY THE CODING STUFF !!!

manishfoodtechs profile image manish srivastava Updated on ・6 min read

Interesting Topic !!! Yeah … Its Part 3 :) The Coding Stuff !!!

So if you haven’t read my previous posts read Part 1 here and Part 2 here. Do not skip my posts in this series else, you will think at end: what we are talking about?

A Brief Recap :

Part-1: We met cloud brothers and Understand from them who has to use Hypervisor Type -1 and Hypervisor Type -2 .Why they switched to cloud computing and cloud's various type IaaS, PaaS and SaaS. 1.

Part-2: We again met cloud brothers. Disowned their concept of Cloud computing but called it Advance Virtualization. Understood, why amazon cloud people are clever than others. RedHat Inc's difference about cloud and Virtualization. How API (no manual intervention) is creating difference between virtualization & Cloud Computing. Also created a new Selection criteria among Hypervisor Type -1 types. 2.

Lets continue...

To find out your host provider or Machine allows Virtualization Simply run the following command in your Ubuntu Terminal. Use google for your system type.
command :$ lscpu

img

I know my 80 % Readers will fail in above test. Do't Worry, I am here.

Even you don't have Virtualization ready Server or machine , I will let you know how to create a equally good cloud with another hypervisor.

So, I am going to group the readers of this series into two categories for sake of convenience :

GROUP -1 : Having CPU Virtualization : Bare M Server or having personal desktop to playwith .

GROUP -2 : Having No CPU access: Those who have Virtual Private Servers. Group 1 readers have advantage to of Group 2 tutorial section.

You can do code stuff as per your Group Category.

CODING PART-1: HYPERVISOR SELECTION

Last post we have fixed the criteria of choosing among Hypervisors of Type 1 those can create isolated Systems. They are having advantages over Hardware Virtualisers over consumption of less resources.

GROUP -1 : Hypervisors: Xen and OpenVZ. The Xen Project hypervisor is the only type-1 hypervisor that is available as open source. Its fueling major cloud Vendors today. Group -1 needs to understand the difference between Xen, XAPI & Xenserver. Its a bit confusing. Also , we have another trunkey opensource option based on XenServer, XCP-ng. This is result of massive cooperation between individuals and companies, to deliver a product without limits. No restrictions on features and every bit available on GitHub!Please Watch this video(optional).

GROUP -2 : Hypervisors: You will find that majority of all clouds developed are based on hardware virtualisers. However, the LXC project by Linux is capable of creating different isolated Linux systems. The advantage is that you only need a linux based OS. Linux Containers (LXC) allow the usage of technology by creating containers that resemble complete isolated Linux virtual machines on the physical Linux machine, all this by sharing the kernel with the virtual portion of the system.

img

Amazon, offers application based on containers deployed on virtual machines.
This means containers are powerful. But when we talk about containers, Docker is another term that comes to everyone. Once , Docker was using LXC but they have now their own library. Futher, LXC / LXD create complete image of OS whereas docker is limited to downloading minimal required ones.

watch this video ... (optional)

CODING PART-2: UNDERSTANDING THE WHOLE PROCESS OF CLOUD's ARCHITECTURE

Remember our definition of cloud from part -2:

(Hypervisors + Resource Pooling+ Data Management + bla bla…)+ NO MANUAL INTERVENTIONS = CLOUD COMPUTING.
or I can write it as :

Virtualization + CMP = Cloud
Here , CPM is Cloud Management Platform.

After mounting of hypervisor(s) , you need a piece of software to automate all your process of creation of Virtual Machines, adding networks , allotting resources and fetching more resources when required. This Piece of software is Cloud Management Platform.

Cloud services are fighting for market share and are developing the next generation of cloud management systems. Arguably the four biggest players in the market currently are OpenStack, CloudStack, Eucalyptus and OpenNebula. All these are opensource :) . i,e you can use them personally and as well as commercially.

Openstack and cloudstack are with many functionality and are also backed by large number of organisations and developers community. Even, My team also provide support for above two. If you are looking for one , Please drop me a mail: manishfoodtechs@gmailcom.

Before, we really go for some coding stuff, Its worth to watch this video to understand the CMPs ( Cloudstack Vs Openstack):

CODING PART-3: LET'S WRITE SOME CODE AND GET OUR FIRST PRODUCTION READY CLOUD

YAAA.... COOOOLLLL.... Can't wait???

I will start with the Group 2 . As this will help both Group 1 and Group 2.

Group 2 Assets:
Machine / server: without Kernel access. Like VPS .
Hypervisor is : LXC .

If you don't have VPS, then please create a cloud Account by visiting various sites. Create a Droplet with Ubuntu. While, Writing of this post, digital ocean max ubuntu version is 18.04 LTS. Open Console of digital ocean or Putty and get connected as root user.

The First Command is as usual : sudo apt-get update && sudo apt-get upgrade
Also : sudo apt-get dist-upgrade

Our Server is fresh. We need to mount a hypervisor on its OS. Opennebula will do this for you :). Opennebula has very large and detailed documents to go thorugh if we want to download it & build it from source files. you need to be expert in this. I am going to tell a small method that will save your 2-3 days of configuring openebula as new fellow to cloud architecture.

*** JUST THREE COMMANDS & YOU WILL HAVE YOUR FIRST CLOUD ***
Command:wget https://github.com/OpenNebula/minione/releases/download/v5.8.1/minione
Command:sudo chmod u+x minione
Command:./minione --lxd --force

Use Yes ... whenever prompts.

If everything goes good you will get something like this:
OpenNebula 5.8 was installed
Sunstone (the webui) is runninng on:
http://206.189.226.184/
Use following to login:
user: oneadmin
password: Tkjjj0Vb8

troubleshoot
E: Sub-process /usr/bin/dpkg returned an error code (1)
sudo dpkg --configure -a
sudo apt-get install -f

If the above do not work then try the below command.

sudo apt-get remove --purge getdeb-repository

If the above do not work then try the below command.

sudo apt-get remove --purge getdeb-repository

Command:sudo service opennebula-sunstone start then visit the ip as given in terminal.[ Note: In future if you visit raw IP and you see nothing, please use this command]

Note 206.189.226.184 is my droplet IP and here is my dash board:

Alt Text

Good!!!, Now you have your own Cloud Management Software Go and use it.
Read docs on there site. If you need any professional help, Please let me know. I will forward it to most concerned Department to help you out.

Openebula :

1.All Kinds of different images ( ubuntu , centos etc )are available in Apps Menu.
2.You need to create a VM template and then instance it + naming and a VM is created.

  1. If you do not know how to create an VM Template with all fields, don't worry. When open nebula installs by above method it creates a centos VM. Just clone the VM and change the OS next.

  2. Making VM to connect with Digital Ocean IP address, so that you can host website etc.

you should add the gateway/DNS information into the virtual network metadata
click on “Network - Virtual Networks”

click on cloud network with ID 0

add new attribute at the bottom, name GATEWAY with value 206.189.226.184 ( my Digital Ocean IP)

add new attribute, name DNS with value 8.8.8.8

login the sandbox console and run following to enable NAT

iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE

If network interface inside the VM is configured with IP assigned by the OpenNebula and default route via 206.189.226.184 , the external services should be working. I tried by pinging 8.8.8.8 and was successful :)

Group 1 Assets:
Machine / server: with Kernel access. Like Dedicated Server or computer service.
Hypervisor is : XEN .

If You want to download for KVM hypervisor then just run above command of group 1 as:

Command:wget https://github.com/OpenNebula/minione/releases/download/v5.8.1/minione
Command:sudo chmod u+x minione
Command:`./minione --force

Rest is same.

Xen hypervisor has not been removed from OpenNebula core,
but the driver was moved to the add-on catalog to ease the contributions
and support of the component from the community. Its very easy : See Github.

Incase, you need any help let me know. You are most welcome to join my team . You should contact me here form details .

I hope you people like the above series and learned something.

Contact email: Manishfoodtechs@gmail.com. Follow, like or tag me :)

Posted on by:

manishfoodtechs profile

manish srivastava

@manishfoodtechs

Director & CEO, GDP CHURN (P) Ltd. Loves coding . Supports open source by funding.

Discussion

markdown guide
 

Hi, please let me know if i got this right... open nebula works only as CMP?
Here is my case: I have some HP DL380p Servers, I just switched to PROXMOX a few months ago and I'm currently using that as my virtualization software. I have available public IPs and I wanted to start making some money renting VMs so if i install Open Nebula it will work as self registration portal and virtualization assistant for customers? I mean like digital ocean? in case I'm right, do i have to install Open Nebula in the same server where Proxmox is? or in a separate VM? Thanks!

 

so if i install Open Nebula it will work as self registration portal and virtualization assistant for customers?
Yes, you can do. Create your user interface and use xml-RPC apis of Opennebula. Refer : docs.opennebula.io/5.10/integratio...

in case I'm right, do i have to install Open Nebula in the same server where Proxmox is? or in a separate VM?

You can do both the ways. Its not necessary that opennebula only need to get install on host. You can install it inside a VM and try it.

 

Ok, but who would be handling the virtualizations? open nebula or proxmox?

In second part of this series, I defined cloud management panels as :

I don’t want to disheartened them but I said — “This is not Cloud Computing”. This is more like “Advance Virtualization.”

I was expecting from them — “Why?” and they did.

Answer: Over Past 15 Years, The technology of Virtualization with pieces of other softwares has revolved so much that its very difficult to find what cloud computing can do today and advance virtualization can’t!!! You name it . Resource Pooling to managing different data centers…IPs allocation … anything.
Then what is the difference?
Redhat Inc defines few key difference as:
Redhat Difference of Cloud and Virtualisation... Image

Pheewwwwww…… over the head… Don’t worry, I am here… I have found that even googling so much you won’t be able to differentiate them clearly. At the end, You find all are differentiating cloud and advance virtualization only based on their advantages and disadvantages. But our question is what is exact difference?????
The exact difference is you… haha.. I mean the Manual Intervention.

Your promox and nebula has little difference in capabilities.

Nebula needs a host. If you create a vm it's fine. But nebula will have resource boundaries of vm .

You can replace your promox with opennebula.

My team is into consultant and development of such project. manishfoodtechs@gmail.com is my email.

 
 

i am thinking of getting dedicated hardware for this what do you recommend

 

Thanks, I will recommend to first try with a container based Hypervisor i.e LXC by creating an account on Digital Ocean. With each droplet- you will get free dedicated IP and also you can get some extra floating IPs. Mapping of these IPs will help you to access your VMs through an url / Public IP address. Once, you install CMP (Openebula), try to play with different menus. The more you play , more you become ...expert in Managing a CMP.

After this, you can buy your hardware and use hypervisors like Xen / KVM or the competitive LXC. Happy Coding :)