GScC’21

Documenting things, Writing example and the GIT-Week 9 & 10, the Ending of GSoC’21.

Mohit Bhat
Leopards Lab
Published in
5 min readAug 17, 2021

--

Hey welcome to week 9 and 10 which means we are at end of GSoC period. Will talk about my work done in these two weeks, will also discuss some git commands and how was my experience working in GSoC

Examples writing — An important way to explain world how to run the module

When we build modules, it’s very important to specify some example’s for end users to understand how module works.

In these two weeks I wrote the examples for all the services that I have implemented for digital ocean. For example to use Nodelcoud Digital Ocean Loadbalancer you can include and call functions like this:

const nodeCloud = require("../../lib/");const optionsProvider = {overrideProviders: false};const ncProviders = nodeCloud.getProviders(optionsProvider);const lb = ncProviders.do.loadbalancer();
// For creating load balancerfunction create() {let options = { name: "example-lb-01", region: "nyc3", forwarding_rules: [ {
entry_protocol: "http",
entry_port: 80, target_protocol: "http", target_port: 80
},
{
entry_protocol: "https",
entry_port: 443, target_protocol: "https", target_port: 443, tls_passthrough: true
}],
droplet_ids: []}; lb.create(options)
.then(result => {
console.log("Output is: ", result);
}).catch(err => {
console.log("Error is: ", err);
});
}// For getting all load balancersfunction listAllLoadBalancers() {
lb.list()
.then(result => {
console.log("Output is: ", result);
}).catch(err => {
console.log("Error is: ", err);
});
}
// for deleting load balancerfunction deleteLoadBalancer() {let lbId = "4de7ac8b-495b-4884-9a69-1050c6793cd6"; lb.delete(lbId)
.then(result => {
console.log("Output is: ", result);
})
.catch(err => {
console.log("Error is: ", err);
});
}//for updating load balancerfunction updateLoadBalancer() {let lbId = "4de7ac8b-495b-4884-9a69-1050c6793cd6";
let options = {
name: "updated-example-lb-01",
region: "nyc3",
droplet_ids: [3164444, 3164445],
algorithm: "round_robin",
forwarding_rules: [
{
entry_protocol: "http",
entry_port: 80,
target_protocol: "http",
target_port: 80,
certificate_id: "",
tls_passthrough: false
},
{
entry_protocol: "https",
entry_port: 443,
target_protocol: "https",
target_port: 443,
certificate_id: "",
tls_passthrough: true
}],
health_check: {
protocol: "http",
port: 80,
path: "/",
check_interval_seconds: 10,
response_timeout_seconds: 5,
healthy_threshold: 5,
unhealthy_threshold: 3
},
sticky_sessions: {
type: "none"
},
redirect_http_to_https: false,
enable_proxy_protocol: true,
enable_backend_keepalive: true,
vpc_uuid: "c33931f2-a26a-4e61-b85c-4e95a2ec431b"
};
lb.update(lbId, options)
.then(result => {
console.log("Output is: ", result);
}).catch(err => {
console.log("Error is: ", err);
});
}

Week 8 and 9 updates

In these two weeks I worked on:

  • Adding examples for Digital ocean services
  • Updating nodecloud documentation for Digital Ocean services
  • Updating code generation tool documentation, included some diagrams, architecture diagrams and directory structure explanation for more clarity
  • Fixing Issues in the plugin encountered while testing

The Git- The merging of my pull request

we recently worked on merging of the approved pull request that I have worked upon. I was initially bit worrried like merge conflicts might come and then you know problem starts. But I was glad nothing sort of that happend as we merged all pull request in line by line manner, with rebasing and merging new updates. Also while I was working on these pull request I had make sure that the pull requests are in an serial manner and updates are non conflicting .

Lets deep dive into some basics of Git :

  • To clone a repo:
git clone reponame
  • To commit
git commit -m”The message on commit”
  • To push

Push is basically git fetch and git merge both

git push or git push origin branch name(If you are not on master/main branch)
  • To make a local branch
git checkout -b <branch name>

Note: This branch is currently on your computer, to push this branch to your repo do: git push origin branch name

Also if your are on master branch and you made new branch using above command, then the code present on the new branch will be of master, if your run the above code say from branch 1 and made branch 2, then code will be of branch 1 initially. In short from the branch you checkout a new branch the code in that comes from that branch

  • To go to a particular branch
git checkout <branch name>

Now for example you are working on an local dev branch on your forked repo and somebody pushed changes to master branch. Now before making pull request it is very important you merge changes done by someone else on master with your local dev branch. This is because you are making changes on an oudated master branch work. To merge changes follow below steps:

First of all you have to mention the origin repo url from where you have to get the actual new code on your forked repo.

git set upstream <repo name>

using above command you are saying for this branch the upstream(you can name anything) the original repo is present on this url

Now to fetch changes

git fetch upstream

This will fetch all changes from Main/Original Repo(You can specify any Repo)

Now lets merge into the local master branch by checking out to master and then running

git merge upstream/master(you are saying merge changes from upstream master branch on to the current checked out branch)

you can also merge changes to another branch say dev

git merge dev upstream/master or you can first checkout to dev and then run git merge upstream/master

Then push changes to your forked repo by

git push origin dev 

And make the pull request with latest master updates

The week ended like this and now I have to submit my final report and videos and submit it for evaluation to google.

Its the time of Final Evaluation, GSoC End’s today!!

Yeah, it’s end of Google Summer Of Code 2021 with ScoreLab community but its not end in my open source journey. I have now fell in love with open source and will continue to use my knowledge to improve the open source projects. I would like to thank my Mentor Rajitha Warusavitarana for such a beautiful open source journey. These 10 weeks went like with speed of light because of him. I will miss the weekly meetings, the discussions that happened and yes the ending when all the Pull request merged successfully.

GSoC was really an amazing learning time for me. I have now more clarity with git and remote repository handling. Not only that I learnt how SDK’s are built, how nodejs modules are built, working in an step by step manner and the importance of testing. I would recommend everyone trying GSoC once not for name or fame but for the learning it gives.

Will truly miss these 3 moths of working and learning. Will come back soon with new series of learning and experiences.

Till then GoodBye✌️ and Have Fun!😋

Follow me here…. Linkedin, Github, Twitter

--

--

Mohit Bhat
Leopards Lab

Blockchain & Full Stack Developer | GSoC’21 @ SCoReLab | Certified Ethereum Developer | Ethereum India Fellow | SIH2020 Finalist | Postman Student Expert