0% found this document useful (0 votes)
38 views

Final Report - 19070123125

The document describes an internship project to create an on-call application using Node.js that demonstrates high availability through a distributed data system. Key steps taken include configuring multiple servers on multipass for the frontend, backend, API, database, and load balancer. Dependencies like Express, Body Parser, EJS, and Mongoose were installed. A MongoDB replication set was configured with one primary master node and two slave nodes to provide high availability even if a node fails.

Uploaded by

Bright Avenue
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Final Report - 19070123125

The document describes an internship project to create an on-call application using Node.js that demonstrates high availability through a distributed data system. Key steps taken include configuring multiple servers on multipass for the frontend, backend, API, database, and load balancer. Dependencies like Express, Body Parser, EJS, and Mongoose were installed. A MongoDB replication set was configured with one primary master node and two slave nodes to provide high availability even if a node fails.

Uploaded by

Bright Avenue
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

INTERNSHIP PROJECT REPORT

Jan – May 2023

ON-CALL APPLICATION USING NODEJS

Submitted by

SHARMISHTHA TONGIA

PRN 19070123125

Under the Guidance

Mousumi Bhanja Hans Gogia

Name of Faculty Mentor Name of Industry Mentor


Designation Designation

Department of Electronics and Telecommunication Engineering

SYMBIOSIS INSTITUTE OF TECHNOLOGY, PUNE

Jan to May 2023


DECLARATION

I hereby declare that the project work titled “ON CALL WEB APPLICATION” is an
authentic record of my own work carried out at Phonepe Pvt. Lmt. as requirements of five
months internship semester for the award of degree of B.Tech. ENTC Engineering,
Symbiosis Institute of Technology, Pune, under the guidance of Mr. Hans Gogia and
Mousumi Bhanja, during Jan to May.

(Signature of student)
19070123125
(PRN)

Date: ___________________

Certified that the above statement made by the student is correct to the best of our
knowledge and belief.

(Name & Designation) (Name & Designation)


Faculty Mentor Industry Mentor
Introduction To Company
Phonepe is a digital platform that was launched in 2016. It was founded by Rahul Chari,
Sameer Nigam, Burzin Engineer. Phonepe is owned by Walmart. The platform is capable
of providing users with a unique way to do transactions . It allows users to transfer money,
pay bills , recharge mobiles and make purchases.

PhonePe uses the Unified Payments Interface(UPI) technology to facilitate


transactions,allowing for quick and secure money transfers between bank
accounts.Phonepe has become one of the most important digital payments platform in
India. In addition to payments it also offers services such as insurance, investments through
partnership with various financial institutions.

Phonepe has also expanded its offerings to include a variety of other services such as food
ordering ,cab bookings for movies and events.The platform has integrated with online
retailers so that users can pay directly through the app.

The phonepe app considers users in mind, it’s simple and effective to use, it has various
features for users to manage their money online and a simple way to secure payments
PhonePe's emphasis on security is another distinctive quality. To guarantee that user
transactions are safe and secure, PhonePe employs industry-standard security methods like
128-bit SSL encryption, two-factor authentication, and transaction limitations.

Overall, PhonePe is one of the most well-liked mobile payment platforms in India thanks
to its distinctive features. Millions of consumers love it because of its easy-to-use interface,
swift transactions, and variety of services. PhonePe is positioned to maintain its dominance
in India's mobile payments sector because to its emphasis on innovation and security.

TABLE OF CONTENT
INTRODUCTION TO PHONEPE 1
DETAILS OF PROJECT 2
WORK DONE 3-22
LEARNINGS 23-24
Introduction To Company

The way users interact on PhonePe has been improved by the constant addition of new
features in addition to its already robust set of capabilities. One of these features is PhonePe
Switch, which gives users instant access to a variety of services like restaurant ordering,
cab booking, among more, all within the PhonePe app. The customers can now access
different features without switching between many different applications, which has
increased convenience.

PhonePe's promotion of digital payments and reduction of the reliance on payments in cash
has significantly benefited the Indian economy. Interactions in a variety of industries,
including retail, hospitality, transportation, and more, have been made easier thanks to the
platform.

PhonePe has made a significant impact by facilitating financial inclusion. PhonePe has
made it feasible for people in India, where a substantial section of the population lacks
access to banking services, to conduct digital transactions. This has aided in closing the
gap between the populace that uses banks and that that doesn't, as well as helped the
economy as a whole expand.

The company PhonePe has made a significant impact by facilitating financial inclusion.
PhonePe has rendered it feasible for people in India, where a substantial section of the
population lacks access to banking services, to conduct digital transactions. This has aided
in closing the gap between the populace that uses banks and that that doesn't, as well as
helped the economy as a whole expand.

Additionally, PhonePe has assisted in the expansion of India's internet network. In order to
promote digital payments and advance the nation's overall digital infrastructure, it has been
closely collaborating with government officials and other parties in the equation. This has
aided in the formation of an ecosystem that is favorable for the expansion of digital
transactions and has helped the nation as a whole.

It has launched several campaigns to inform people about the benefits of digital payments
and encourage them to adopt it. These initiatives have helped increase people's awareness
of the importance of financial inclusion and contributed to the overall growth of India's
digital economy.
PROJECT UNDERTAKEN
Summary:
A web application powered by nginx using a distributed data system as backend which
demonstrate its high availability.
The web application is a user management system wherein a user can be added, updated
and deleted , it shows the users currently on rotation , it works through connecting with a
REST API which is connected to a mongodb cluster to fetch and update information to ,
the frontend and the backend are created on different instances on multipass while the
mongodb cluster is set up with ONE PRIMARY master node and 2 slave nodes to provide
high availability and scalability

Framework and Languages used in the project:


To build the frontend –
HTML
Css
JS

For the backend –


Node.js
Express
NPM
Body-parser

For API-
Express
Node.js

For the database –


MongoDb

Details:
this web application is built using nginx + javascript to showcase the high availability of
distributed data system - MongoDB

Features:
A distributed data system capable of maintaining high availability despite the failure of one
or more nodes using replica sets which maintain master and slave nodes
An nginx-hosted web application to manage Daily Oncall Roster. This web application
should support CRUD operations to add / fetch / update the name of the Oncall Person
using the Inputs from Web Page and APIs for the backend.
Even if one node of the distributed system enters a failing condition, the web application
should still function without any degradation.

STEPS TAKEN BY ME TO CONFIGURE THE


PROJECT

1. CONFIGURING SERVERS

Servers are used to provide resources to a client over a network , servers are used
for web hosting , sharing resources, database management , they operate
continuously , providing access 24/7

We were supposed to configure multiple severs on multipass – a virtual machine , for all
the servers of my project .
-1 server for frontend
-1 server for backend
-3 server for database
-1 server for api
-1 server for nginx

Figure showing a list of all servers

Servers for database


-192.168.64.3
-192.168.64.4
-192.168.64.5
Server for API
-192.168.64.10

Server for frontend and backend


-192.168.64.2

To create a server in multipass I used the command , multipass launch and multipass list

2. DEPENDENCIES FOR THE APPLICATION

Dependencies are modules that are installed through node package manager to add
functionality and development for the application , the dependencies used by me for my
project were as follows

-Express : Express is a Node.js framework , it simplifies developing web application by


providing simple functions for pathways and listening on ports , to include Express in your
web application, you have to first require the module

Body-Parser: Body-Parser is parsers the request from the client side and can be used to
figure out values inserted in a form

Ejs (Embedded Java Script): It is a templating language that allows you to embed JS code
in html files , to access EJS , you need to use app.set a view engine with EJS

Mongoose – It is required for modelling my mongodb database schema and includes type-
casting , validation ,query building and other useful features

After creating my servers , I started with frontend coding of my application , I configured


a nodejs file through
-sudo apt install nodejs
-sudo apt install npm
-node -v
-npm -v

Figure shows the dependencies installed for my project

3. CONFIGURING A REPLICATION SET IN MONGODB

To showcase high availability and distributed database system of my application , I need


to configure a mongodb replication set , so that even if one server goes down the application
is still able to retrieve contents of the database

To configure a mongodb replica set , I had to first select a primary node and 2 slave nodes
so that all write requests are made to the primary node while all slave requests are made to
the secondary nodes.

-192.168.64.3 – primary node


-192.168.64.4 – slave node
-192.168.64.5 – slave node

To configure the replica set I had to edit the etc/hosts file for all the server files so their
ip’s could become publically accessible

Then I had to configure the firewall settings so the severs could talk to each other through
sudo ufw allow from 192.168.64.3 to any port 27017

After configuring the firewalls rule I had to configure the replica set by changing the
configuration file of mongod and adding a replica set name to the replication
After making the replication changes the mongod server is restarted then with rs.initiate a
replication set is configured where each node is given a priority , higher the priority , higher
are the chances for a node to become primary

Figure shows the editing of etc/hosts file for DNS


4)
CONFIGURING THE DATABASE IN STUDIO3T

Studio3T is IDE for MongoDB , a NOSQL database , it provides a GUI for interacting with
the MongoDB database , making it easier to view and manage data and perform database
functionalities

I first made a connection to my server with my primary node at 192.168.64.3 with the
application , after the connection I added random names , contacts and date information to
my database in a JSON format ({name: value, date:value , contact:value})
As visible from the image , the database is connected to my mongodb server 192.168.64.3
on port 27017 , which is the prime node of my mongodb cluster for accepting read requests

Now we check to see if the database is visible in all the nodes of the cluster

5) CONFIGURING THE API TO CONNECT TO MY DATABASE

In the API , I first configure all the dependency modules like express, body-parser, ejs and
mongoose

Const express = require(‘express’)


Const bodyparser = require(‘bodyparser’)
Const ejs = require(‘ejs’)
Const mongoose = require(‘mongoose’)

Then I construct a try and catch block for trying to connect to the mongodb url and then a
catch for any errors that might come up , in the connection string for mongodb , I specify
try{
Mongoose.connect(“mongodb://user:password@hostname:portname,hostname:portname,
hostname:portname/dbname?authentication”)
}
Catch(err){
Console.log(err)
}

After connect to my database successfully I construct a schema of my mongodb


collection , I specify the keys and their values

Const userSchema = {
name: String,
date:String,
contact:String
};
const User = mongose.model(“User”, userSchema);

Now I specify a path for my api endpoint , as the IP of my API is http://192.168.64.10:3000


and my collection is user , I make the endpoint of my API as
http://192.168.64.10:3000/users

I configure the API to work with GET, POST , PUT and Delete requests , the GET request
will fetch all the users in my dataset , the POST request will add a user to my database ,
the PUT will update a user and DELETE will delete a user

To test the functionality of my API I use tools like postman and Curl from the command
line , while making the header set to x-www-url-encoded

6. TESTING ENDPOINT OF API WITH POSTMAN AND CURL

To testify the endpoint of my API , I use the tool postman and check if my api is
integrated with my mongodb cluster

GET REQUEST – to fetch all the users from the database


POST REQUEST – to post a new user to the database

PUT REQUEST – To update a user’s data in the database


DELETE REQUEST – there are 2 types of delete request , one which can delete the
entire database and one which deletes the entry of a particular user

7) BUILDING THE BACKEND


This is a nodejs and express application which can integrate with the REST API to perform
CRUD operations

Create EJS pages which will be served when user enters a particular path , require all the
dependencies installed in the first step and start a server at port 3000 which will listen for
any requests

Making all the path requests

when a client comes to the ‘/’ path , an index.html file is rendered , where the user can
make posts request which is then made to the api through FETCH API , after the user posts
the request , the user is then redirected to a page where all current users are listed
through res.redirect ‘/cuser’ , in the navigation bar the user can navigate to a update path
and a delete path

when a user navigates to the ‘/update’ path an updates.ejs file is rendered to the user which
will the let the user select the name , contact and date for updating the user , this is done
through sending a method:PUT through the fetch API

8) INDIVIDUAL EJS PAGES


I create individual embedded java script pages which will then get rendered when the
user navigated to a particular page like delete or update

-get_users.ejs – gets all the users listed in the database


-update_users.ejs – updates the users information through name in the database
-delete_users.ejs – delete a particular user in the database
-cusers.ejs – to showcase the current users in the database

I provide fetch methods for all the pages in the script tag as
fetch(url){
method: Delete,
headers: {
content-type : ‘application/ x-www-form-urlencoded’
}
.then(response){
if(response.ok){
message = user deleted successfully}
else{
message = user deletion was not successful
]

I provide this for all the pages while changing the method to POST PUT OR GET

9) BUILDING THE FRONT END OF THE APPLICATION


I first create the index.html page which would be rendered when a user visits the site , I
code the page in html and also create a navigation bar with paths to other pages and a
form for the posting of a user . I then create a CSS.styles page for creating a style box for
my homepage and linking it to the index.html page

Creating the all USERS page :

Updating Users Page:


Deleting Users Page

10) Deploying the Application on Nginx


Nginx is a popular web server and a reverse proxy server which supports a variety of
extensions and plugins , it can be configured as a reverse proxy which will allow it to
distribute the incoming traffic to multiple nodes.
Nginx is widely used as it can handle high amounts of incoming traffic, and it is also used
in production environment to serve large amounts of web content and other web related
tasks

to deploy my node express app on nginx , I first had to install nginx and configure a server
block for the same in the /etc/nginx/sites-available directory if nginx

server{
server_name 192.168.64.2;
location /{
proxy pass http://192.168.64.2:3000;
proxy_http_version 1.1;
}
}

after creating the server block I create a symbolic link of my app in sites-enabled , and
remove the default website that nginx showcases
My website should now start on a browser and showcase nginx as a server in the
networking tools in the browser

WORK DONE IN THE TRAINING PERIOD


During the first two months of the internship, we were trained on the responsibilities of an
SRE and subjects like LINUX , DATABSE SYSTEMS, DISTRIBUTED DATABASE
SYSTEMS and SQL/NOSQL, During this time we were asked to give an exam every week
after which our interviews were conducted

Work done during week one –

Learnt about Linux as an operating system –


The most important piece of software that is used on a computer is called the operating
system. It is responsible for managing not only the computer's memory and processes but
also the entirety of the computer's software and hardware. Additionally, it gives you the
ability to communicate with the computer even if you are not fluent in the language that
the computer uses. The process of interacting with computers, such as navigating through
files and directories, establishing settings, connecting to the network, and other similar
activities, is simplified as a result. The operating system Windows is one that is widely
utilised. A computer is rendered unusable in the absence of an operating system. Watch the
video that has been provided here to find out more about computer operating systems.

It is possible to define the file system as the method of storing the data in a specific manner
in order for it to be located easily whenever it is essential to do so. The kind of file system
that was used is determined by the operating system that was used. The primary goal of the
file system is to simplify the process of storing information in a particular manner for both
the users and the operating system. This is done to ensure that both parties are able to store
or retrieve the files without difficulty. The file system is responsible for the files and
directories that are meant to be stored on the storage device using any operating system.
As its name suggests, the file system deals with these matters. The only thing the operating
system does is act as a go-between, facilitating the transmission of data from the data source
to the storage device so that it can be saved on that device.

Pwd :You can use the pwd command to print the working directory.
To list the contents of a directory, you use the ls command (short for list).
You can change to a different directory using the cd command (short for change directory).
Arguments is an input given as part of terminal commands.There can be one or more
arguments/parameters.
Options modify the behavior of a command.
Useful shortcuts.
up arrow key → will bring up the last command that was executed. Each press will bring
up the previous command executed.
history → will print out a list of the previous commands executed.
tab key → pressing the tab key can be used to auto-complete the directory and file names
while typing paths or filenames.

WEEK 2 OF TRAINING
User accounts are used to control access to Linux systems, and users are responsible for
monitoring and controlling their own activities once they have logged in.

Each user account has a username and a UID, both of which are completely unique
identifiers. When a user account is first created, the username associated with that account
is mapped to a certain UID.
A username is used by the user, but the UID is what the system refers to. It is impossible
for two users to share the same username.

UID cannot be changed. It is fixed in its current state. When it is allocated to a user account,
it does not change after that point onward.
Users are one-of-a-kind to a particular computer but are not one-of-a-kind across all
computers. This indicates that the user identifier (UID) on LAPTOP-1 may be the same as
the user identifier (UID) on LAPTOP-2, even if they are not the same user.

Accounts for Normal or Regular Users


Whenever Linux is installed, the default configuration of the operating system includes the
creation of one standard user account.
They come complete with their very own /home directory in addition to a login shell.
This account was designed for regular use and has a modest level of rights (restricted
access). It is only able to access the files, services, and apps that it is authorised to use, and
it is restricted to only performing the activities that it is permitted to do. Linux will not
allow you to carry out the command in question if you do not possess the appropriate
permissions.
There is no limit to the number of standard user accounts that can be created. It may be
disabled or removed altogether, depending on the requirements.
Account for service
Every service is going to have its own user account.
A programme or application in Linux that runs or plans to operate in the background is
referred to as a service. This definition is rather simplified. That is to say, it operates in the
background without the user ever being aware that it is doing so.
For instance, a MySQL user will launch a MySQL service or application (because MySQL
is one of the most used databases).
These accounts are not designed to be used for day-to-day tasks, nor should they be utilised
in that manner.
It is possible for a system to accommodate many service consumers.

WEEK 3 OF TRAINING
Linux, just like other operating systems, uses permissions to guard its resources from
unauthorised access.
These permissions outline the proper procedures for a user to follow when accessing the
resources.
A person who accesses a resource, such as a user account, system process, or programme,
is considered to be a user of that resource.
A file or directory is an example of a resource, which refers to any object that users can
access.
There are three different levels of permissions for each object: user owner permissions,
group owner permissions, and other permissions. These permissions determine how a user,
group, and maybe other users can access an object.
(It is important to keep in mind that a group is simply a collection of users.)

person owner refers to the person who initially created the object in question or the user
who was designated as user owner by the user who actually owns the system or the root
(admin) user.
The major group of user owners or other groups selected by the actual owner or the root
user is referred to as the group owner.
Others refers to any users or groups that are not included in the previous two categories.

chmod 777 foldername will give read, write, and execute permissions for everyone. chmod
700 foldername will give read, write, and execute permissions for the user only.
chmod 327 foldername will give write and execute (3) permission for the user, w (2) for
the group, and read, write, and execute for the users.

The abbreviation for Advanced Package Tool is APT. It is a collection of essential


programmes that may be found in the Debian and Ubuntu distributions of Linux.
You can maintain Ubuntu or Debian server up to date with the latest security patches by
using the apt command, which also allows you to install, uninstall, or remove applications.
Apt collaborates with the dpkg programme to perform system installations and updates.
Identifies the appropriate location for each file within the Linux file system
Offers a straightforward method for upgrading any previously installed applications on the
PC.
Software packages are another name for the applications that need to be installed on our
system.
Packages of software consist of a compressed archive that contains all of the necessary
files for the software to function properly.
They typically come packaged with dependencies that must be installed simultaneously
with the main programme. The text that is listed after the scenario presented above, in
which we are installing VLC, The following extra packages will be installed: here is a list
of additional packages (dependencies) that will be necessary for VLC to operate as
intended when the installation is complete.
WEEK 4 OF TRAINING

Just for a moment, pretend that you are looking at a video on YouTube. That is exactly
what you plan to do next, which is to view the video. It is a huge relief to not have to
manually start the display services and network services and then keep an eye on them
throughout the day to make sure they are functioning correctly. We may thank daemons
for that because they take care of work of that nature on our behalf.

Daemons are useful programmes that operate invisibly in the background as daemons to
keep an eye on and maintain various subsystems in order to guarantee that the operating
system functions appropriately.

A systemd object that carries out or regulates a certain activity or operation is referred to
as a unit. Systemd makes use of units in order to start and stop services, manage those
services, organise the boot process, manage tasks and processes, generate sockets, mount
file systems, and initialise hardware.

A name, a type, and a configuration file make up what is known as a systemd unit. The
name gives the unit its own distinct identity throughout the world. The responsibility or
task that the unit is to perform is defined in the configuration file. The type allows the unit
to be grouped with other sorts of units that are comparable to it.

Consider systemd to be a bus driver and the units to be the controllers of the bus, such as
the gear, clutch, lever, brake, accelerator, and so on. This will help you grasp the connection
between systemd and the units. In the same way that the bus driver makes use of controllers
in order to drive and control the bus, the systemd makes use of units in order to drive and
control the system operations and services.

All sorts of software and operating systems use a file with the LOG file extension, which
is commonly referred to as a logfile, to keep account of anything that has occurred,
typically including an event detail, date, and time. It is possible to use it for anything that
the programme considers to be appropriate to record.

Antivirus software may, for instance, write information to a LOG file to describe the
findings of the most recent scan. This information may include the files and directories that
were scanned, those that were skipped, and the files that were identified as having harmful
code.

A programme that backs up files might generate a LOG file that can be opened at a later
time to look over a prior backup job, read through any errors that were encountered, or
view the location to which the files were backed up to.

Explaining the newest features that were added in the most recent update of a piece of
software is a far more straightforward goal for this format, which is why it was designed
the way it was. Release notes or changelogs are common names for these types of
documents.
LEARNING OUTCOMES

SRE TRAINING :

• Understanding the practicalities of being an SRE


• Knowledge of operating systems and linux terminal with networking and
monitoring tools
• Ability to design, implement, and manage resilient systems .
• Familiarity with tools and technologies used in SRE such monitoring , alerting ,
and incident responsive tools
• Understanding of how to manage change and maintain system stability
• Familiarity with cloud computing and containerization technologies
• Understanding of SLA’s and how to report on service reliability
LEARNING OUTCOMES

Web Development Training:


• Proficiency in web development languages such as HTML, CSS , JavaScript and
related frameworks and libraries
• Ability to design responsive websited and implement user interface and user
experiences
• Familiarity with server side programming languages and frameworks like Node.js
and Express
• Knowledge of database management and forming server side clusters
• Ability to use VC tools like GIT
• Understanding how to create API’s and connect it through frontend and backend
• Understand how to deploy web applications and the understanding of web servers
and fault tolerance across nodes

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy