Author Archives: Ajitesh Kumar
Software Build & Release Versioning Strategy
The blog represents the software build and release versioning strategy which can be used to tag web or mobile releases with different version numbering schemes as illustrated later. The strategy can as well be used for software versioning. Build/Release Version Numbering Scheme – <major>.<minor>.<patch>.<buildnumber> A release version can be of type <major>.<minor>.<patch>.<buildnumber>. Following is what each of these keywords such as major, minor, patch and buildnumber represents: major: Indicates a significant change in the application which may essentially mean one of the following: The app is re-written The app has changed significantly so much so that backward compatibility with older versions gets broken. Large set of new features At times, …
Solution to Permission Denied (Public Key) for Git Clone
Following error occurs while you are trying to clone a git project. I tried cloning a Github demo project in relation with ReactJS and NodeJS using command such as git clone git@github.com:DavidWells/isomorphic-react-example.git. In this blog, we will look into the solution of this github permission denied (public key) issue related with cloning a project using git clone command. Solution to Permission Denied (Public Key) Error Generated a new SSH Key The details can be found on this page, Generating a new SSH key and additing it to the ssh-agent Add the public key to your Github account As shown in the screenshot below, you would be required to add the …
Mocha Unit Tests with Hello World
This blog helps you get started with Mocha and also present steps and sample tests which can be used to get started. Setup Mocha using NPM For installing Mocha globally such that it can be from anywhere, execute following command: For installing with npm, you may be required to install Nodejs. npm is distributed with NodeJS which implies that downloading and installing NodeJS automatically installs npm on your computer. One can get appropriate version of NodeJS from following page, Download NodeJS. Details on npm can be found on this page, NPM. Execute mocha command to make sure it is installed appropriately. Following is the screenshot of output as a result …
Application Security – Use NPM Request Package for APIs Access
This blog represents code sample and related details that can be used to hack into the system through unprotected APIs. The security vulnerability such as following can be exploited using the code sample given later in this article. Note that the security vulnerabilities mentioned below forms part of OWASP 2017 Top 10 security vulnerabilities. Insufficient attack protection Sensitive data exposure Unprotected APIs The code below has made use of NPM request package to send the request to the API hosted ast Paytm Catalog Site. The API below displays electronics items listed on PayTMMall.com. Put the code shown above in a file, say, test.js and execute the file using command such as …
Angular 2 – How to Secure Apps from CSRF/XSRF Attack
This blog represents concepts and code samples in relation with securing Angular apps from from CSRF or XSRF attack. The following points are covered: Different types of CSRF/XSRF tokens Angular’s default CookieXSRFStrategy Server-side processing of XSRF tokens Angular custom CookieXSRFStrategy implementation Different Types of CSRF/XSRF Tokens CSRF/XSRF tokens can be of following different types: Per-session token: The token is generated once per session. With each request, the token is sent. Server verifies the correctness of the token and validity in terms of whether the token is expired or not. Per-request token: The token can be generated for each request and later verified and validated. With Angular apps, any one of …
MongoDB – Commands to Check MongoDB Performance on Linux
This blog represents code samples to check the MongoDB performance settings on Linux. Following configuration settings need to be checked: Filesystem as XFS Ulimit values Transparent huge pages Read ahead limit value File access time value TCP keepalive value Check Filesystem MongoDB recommends to use filesystem of type XFS when using WiredTiger as storage engine with MongoDB running on Linux. The details can be found on this page, MongoDB on Linux. Execute following command to check the filesystem: The output would look like following: Check ulimit values Check MongoDB recommended values for ulimit for number of open files and number of processes/threads allowed for the user access. The details can …
Angular 2 – How to Configure Route Definitions – Part 1
This blog series would be used to describe different techniques which can be used to configure route definitions in Angular apps. The routing can be defined based on following three patterns: Route definitions within AppModule Routing defined as a separate module at app root level Routing module defined within feature modules (recommended for enterprise apps) In this blog, we will learn different aspects related with creating route definitions within AppModule. The most simple way of configuring route definitions is creating route definitions within AppModule file such as app.module.ts which is found at root level. This technique can be used for only learning purpose. When creating complex or enterprise apps, this …
Spring Boot App on Google App Engine Standard Environment
This blog represents tips and techniques on how to deploy a Spring Boot app on Google App Engine standard environment. Create a Google AppEngine (GAE) Project Login into Google Cloud Console and create an AppEngine project. Configure GCloud Setup In order to upload GAE project from command prompt, the GCLoud setup needs to be configured. Execute following command from the command prompt to start configuring your appengine project: Do some of the following while configuring the setup: Select a new configuration; Enter the configuration name Login into your cloud account Successful login will list down existing Google Appengine (GAE) project. Pick the one which you created from the cloud console. …
MongoDB – How to Add Arbiter to Replica Set
This blog represents the instructions on how to add arbiter to existing Mongodb replica set. Arbiters are MongoDB instances whose primary role is to participate in replica set election in order to break ties and select PRIMARY.This instance do not hold any data and have minimal resource requirements. As a matter of fact, it does not need or require a dedicated hardware to run. However, it is advised to run arbiter on different server than the replica set. It can be any other server such as application server or monitoring server. Further details can be found on this page. Configure Arbiter Data Storage An arbiter does not store data. However, …
MongoDB – Top 10 Best Practices for AWS Production Deployments
The following are some of the best practices which should be considered for your MongoDB production deployments on AWS. File system: MongoDB recommends using either of XFS or EXT4 filesystem for greater performance. With WiredTiger storage engine, it is strongly recommended to go with XFS file system. Refer this page, MongoDB production notes for finer details. AWS EBS (Elastic Block Store) Configuration EBS-optimized instances: It is advisable to use EBS optimized instances to host MongoDB database. With EBS optimized instances, there are separate network interfaces for database, and, other traffic (application traffic). In case, the replica set is configured with ephemeral storage, at least one of the secondaries in the …
MongoDB – Not Master and SlaveOk Error Message
When trying to access MongoDB database collection data using command such as show collections on one of the secondary member of the replica set, error message such as not master and slaveOk=false occurs. Following screenshot represents the same: Following command when executed on secondaries resolves the above shown error: rs.slaveOk();
MongoDB – How to Enable Replication (Replica Set)
This blog represents steps required to enable replication in MongoDB when access control is disabled. The related details can be found on the page, Deploy Replica Set. Following are some of the key aspects which need to be understood in relation with MongoDB replica set: MongoDB replicaset consists of odd number of servers. This is done to achieve quorum in order to select a master server when one of the existing master server does down. Following are some of the steps which needed to be done to enable replication with MongoDB: Check MongoDB replication status Install additional Mongodb instances Start each member of replica set Initiate the Replica set Add …
MongoDB – How to Reset Mongo Replica Set
The following instructions would help you to reset MongoDB replica set settings and start over with replication all over again. These are especially helpful for developers starting to learn MongoDB replication. Shut down the mongodb server Start the mongodb server in the standalone mode, e.g., without –replSet <replicaSetName>. Login to Mongodb; You can use admin database Make sure that user has readWrite permission to local database. In case, it is not, use following command to grant the role to the user. The following command gives readWrite permission on local database to admin user. Switch to local database Execute the command to make the cllection such as system.replset empty Make sure that …
MongoDB – How to Create Database Users
First and foremost, one would be required to enable authentication with MongoDB database. The details can be found on this page MongoDB Database – Create User Command Following steps can be used to create a database user: Switch to the desired database. This is same as creating a database. Create user using following command: Above command would create user with with role such as dbOwner. The details on creating users can be found on this page covering the description on creating users – db.createUser() The user with role such as dbOwner can perform any administrative action on the database. The role combines the privileges granted by the readWrite, dbAdmin and …
Angular – How to Create Your First Angular App
This blog represents concepts and commands which would help you setup development environment to build Angular apps. Introduction to Angular CLI Angular CLI is a command line interface for Angular. With Angular CLI commands, the following are some of the key functionality which can be achieved using Angular CLI commands: Create an application that follows best practices recommended by Angular. ng new command is used. Test the app locally as you develop. ng serve is used. Greater details can be found on this page, Angular CLI. The documentation in relation with Angular CLI can be found on this page, Angular CLI Documentation. Install the Angular CLI The following command can …
Setup Environment for Google AppEngine Java Project
This blog presents tips and techniques on how to set up environment for deploying Java web app on Google AppEngine using GCloud SDK. Same environment can as well be used for deploying Spring boot web app. Following steps are described later: Install Google Cloud SDK Install Cloud SDK Appengine Java component Create Appengine project in Google Cloud Console Authorize GCloud Configure Appengine project using GCloud Install Google Cloud SDK Download and install Google Cloud SDK. The instructions for downloading and installing Google Cloud SDK can be found on Installing Cloud SDK page. Unzip or Untar the downloaded file and go to the google-cloud-sdk folder. Execute install.sh or install.bat appropriately from …
I found it very helpful. However the differences are not too understandable for me