<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rahul Kumar</title>
    <description>The latest articles on DEV Community by Rahul Kumar (@machine_coder).</description>
    <link>https://dev.to/machine_coder</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F501672%2F57adcb55-2b3f-48d1-91b6-a056eb5616fe.png</url>
      <title>DEV Community: Rahul Kumar</title>
      <link>https://dev.to/machine_coder</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/machine_coder"/>
    <language>en</language>
    <item>
      <title>nest.js + TypeORM + PostgreSQL</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Tue, 08 Jun 2021 04:30:53 +0000</pubDate>
      <link>https://dev.to/machine_coder/nest-js-typeorm-postgresql-310k</link>
      <guid>https://dev.to/machine_coder/nest-js-typeorm-postgresql-310k</guid>
      <description>&lt;h3&gt;
  
  
  &lt;strong&gt;Agenda :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Building a rest api using Nest.JS .&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Backend Architecture :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fttobvwwzubdvz8kx8xdh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fttobvwwzubdvz8kx8xdh.png" alt="Alt Text" width="800" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Technologies used:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Node.js&lt;/strong&gt;    --- &lt;strong&gt;Platform&lt;/strong&gt; .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NestJS&lt;/strong&gt;     --- &lt;strong&gt;server&lt;/strong&gt; .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TypeORM&lt;/strong&gt;    --- &lt;strong&gt;orm&lt;/strong&gt; .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PostgreSQL&lt;/strong&gt; --- &lt;strong&gt;database&lt;/strong&gt; .&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What is Node.js :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxqmcjh8b48rgdbnottw3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxqmcjh8b48rgdbnottw3.jpg" alt="Node js" width="800" height="346"&gt;&lt;/a&gt;&lt;br&gt;
NodeJS is a Javascript runtime(contains everything to run javascript) for building server side applications .&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;What is NestJs :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhv84ldoenop46bx7e3v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhv84ldoenop46bx7e3v.png" alt="Nest" width="800" height="444"&gt;&lt;/a&gt;&lt;br&gt;
Nest is a framework for building efficient and scalable NodeJs server side applications .&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;What is TypeORM :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;TypeORM is an object relational mapper which task is to basically generates objects using object oriented programming which maps to the database virtually .&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;What is PostgreSQL :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;PostgreSQL&lt;/strong&gt; is an object relational database management system for building scalable and high availability applications .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install @nestjs/cli package .and create a new project
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm i -g @nestjs/cli
$ nest new project-name 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;In a common nestJS project :&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;main.ts contains the &lt;strong&gt;bootstraping&lt;/strong&gt; code .&lt;/li&gt;
&lt;li&gt;.spec file contains the testing files .&lt;/li&gt;
&lt;li&gt;nestjs usages module to organize the application structure .&lt;/li&gt;
&lt;li&gt;controller contains the routing rules for the application .&lt;/li&gt;
&lt;li&gt;service contains the business logic for the application .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ npm run start&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl localhost:3000  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Set up Database :&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;sudo&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;U&lt;/span&gt; &lt;span class="n"&gt;postgres&lt;/span&gt;
&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;psql&lt;/span&gt;
&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="k"&gt;database&lt;/span&gt; &lt;span class="n"&gt;conduit&lt;/span&gt;
&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="k"&gt;user&lt;/span&gt; &lt;span class="n"&gt;conduit&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="k"&gt;encrypted&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="n"&gt;conduit&lt;/span&gt;
&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="k"&gt;grant&lt;/span&gt; &lt;span class="k"&gt;all&lt;/span&gt; &lt;span class="k"&gt;privileges&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="k"&gt;database&lt;/span&gt; &lt;span class="n"&gt;conduit&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="n"&gt;conduit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;File structure :
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src
|- app.controller.ts
|- app.controller.spec.ts
|- app.module.ts
|- app.service.ts
|- main.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Create a &lt;code&gt;connection&lt;/code&gt; to the database&lt;/strong&gt; .
&lt;/h3&gt;



&lt;p&gt;&lt;code&gt;$ touch app.dbconfig.ts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;TypeOrmModuleOptions&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;typeorm&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;createTypeOrmProdConfig&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nx"&gt;TypeOrmModuleOptions&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;postgres&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;conduit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;conduit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;database&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;conduit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="na"&gt;entities&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;**&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;*.entity.{ts, js}&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)],&lt;/span&gt;
    &lt;span class="na"&gt;synchronize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;advanced-console&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Next we have to create the &lt;code&gt;entities&lt;/code&gt; for our Database . And the individual entity to the entities array in the &lt;code&gt;createConnection&lt;/code&gt; function .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ mkdir src/entities&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$cd entities&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$nano Article.ts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Entity&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Article&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;PrimaryColumn&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="nx"&gt;slug&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;

    &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Column&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;

    &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Column&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;nullable&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;

    &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Column&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Generate module, service, controller for the article route :&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nest g mo article module
nest g co article module
nest g s article module
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;p&gt;&lt;code&gt;$ cd module/article&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ nano module.article.ts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;imports : [Typeormmodue.forFeature([Article])]&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;navigate to the article service file .
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@InjectRepository(Article) private readonly articleRepo: Repository&amp;lt;Article&amp;gt;,

async getAllArticles(): Promise&amp;lt;Article[]&amp;gt; {
        return await this.articleRepo.find();
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;navigate to the article controller file .
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;constructor(private readonly articlesService: ArticlesService) {}
@Get()
    async getAllArticles(): Promise&amp;lt;Article[]&amp;gt; {
        return await this.articlesService.getAllArticles();
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then finally in the application root module .&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;imports :[TypeOrmModule.forroot([Article])]&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$npm start&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Thank You For Reading 🔥&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>node</category>
      <category>typescript</category>
      <category>postgres</category>
    </item>
    <item>
      <title>How to build and run Kubernetes locally .</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Mon, 07 Jun 2021 17:00:07 +0000</pubDate>
      <link>https://dev.to/machine_coder/how-to-build-and-run-k8s-locally-5e3m</link>
      <guid>https://dev.to/machine_coder/how-to-build-and-run-k8s-locally-5e3m</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Install GOLang (latest version):&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo wget https://golang.org/dl/go1.16.5.linux-amd64.tar.gz
rm -rf /usr/local/go &amp;amp;&amp;amp; tar -C /usr/local -xzf go1.16.5.linux-amd64.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Setup the environment via Bash :&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo 'export PATH=${PATH}:/usr/local/go/bin' &amp;gt;&amp;gt; ~/.profile
echo 'export GOPATH_K8S=${HOME}/go/src/k8s.io/kubernetes' &amp;gt;&amp;gt; ~/.profile
echo 'export PATH=${GOPATH_K8S}/third_party/etcd:${PATH}' &amp;gt;&amp;gt; ~/.profile
source ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;MAKE SURE YOU HAVE SET THE PATH FOR BOTH GO AND ETCD IN THE SECURE_PATH IN THE /etc/sudoers FILE&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;MAKE SURE TO EDIT IT AS VISUDO&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  clone kubernetes
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir -p {GOPATH_K8S}
git clone https://github.com/kubernetes/kubernetes ${GOPATH_K8S}
git remote rename origin upstream 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  install etcd
&lt;/h2&gt;



&lt;p&gt;&lt;code&gt;$ hack/install-etcd.sh&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  start docker demon
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl enable docker
systemctl start  docker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Build k8s
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;This step takes 15 minitues
cd ${GOPATH_K8S}
git checkout v1.12.3 (checkout the stable release version)
time make quick-release
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Run a Local k8s cluster
&lt;/h2&gt;



&lt;p&gt;&lt;code&gt;$ {GOPATH_K8S}/hack/local-up-cluster.sh&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  verify the cluster is running in another window
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export KUBERNETES_PROVIDER=local
export KUBECONFIG=/var/run/kubernetes/admin.kubeconfig
${GOPATH_K8S}/cluster/kubectl.sh get nodes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Fork the k8s repo on github
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;navigate to 
click fork button
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  setup gihub user name
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export GITHUB_USER=[Insert your github user name]
echo 'export GITHUB_USER=${GITHUB_USER}' &amp;gt;&amp;gt; ~/.bash_profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Change the k8s source code
&lt;/h2&gt;

&lt;p&gt;Navigate to the directory your clone&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ${GOPATH_K8S}
git remote add origin https://github.com/${GITHUB_USER}/kubernetes
git fetch origin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  These instructions make the folllowing assumptions:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-Your upstream remote going to
http://
-Your origin remote
http://
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  you can double check by runnig
&lt;/h2&gt;



&lt;p&gt;&lt;code&gt;$ git remote -v&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a new branch before making a change
&lt;/h2&gt;

&lt;p&gt;branch should have some meaning means what you have added to the code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout upstream/master
git checkout -b my-brnach-of-k8s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  If you would like to make change we recommend finding some untested code and adding a few unit tests. If you don't know how to write unit tests in go read this
&lt;/h2&gt;

&lt;p&gt;&lt;a href="http://golang.org/doc/code.html#Testing" rel="noopener noreferrer"&gt;GOLang_Testing&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Example new test
&lt;/h2&gt;



&lt;p&gt;&lt;code&gt;File: pkg/util/normalizer/normalizer_test.go&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Run Kubernetes Locally
&lt;/h2&gt;



&lt;p&gt;&lt;code&gt;$ make test WHAT-k8s.io/kubernetes/pkg/util/normalizer&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Contribute a pull request
&lt;/h2&gt;

&lt;p&gt;Commit your changes and push to your fork&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gofmt -v [insert path to changed file]
gofmt -v pkg/util/normalizer/normalier_test.go
git add .
git config --global user.name ""
git config --global user.email ""
git commit -m "commit msg"
git push -u origin/my-branch-of-k8s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  create a pull request via GiHub UI
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Navigate to https://github.com/kubernetes/kubernetes page
click on the new pull request
click on compare across forks link
select your fork and branch from the two dropdowns on the right
click on create pull request
Note that an existing maintainer must comment with the /ok-to-test comment the automated test for new contributer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have any doubt please ASK .&lt;br&gt;
Thank you for reading 🔥&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>kubernetes</category>
      <category>devops</category>
    </item>
    <item>
      <title>Building and compiling Linux Kernel :</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Sat, 23 Jan 2021 10:57:38 +0000</pubDate>
      <link>https://dev.to/machine_coder/building-and-compiling-linux-kernel-2elc</link>
      <guid>https://dev.to/machine_coder/building-and-compiling-linux-kernel-2elc</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;What is Linux Kernel ?&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;As we know &lt;code&gt;Kernel&lt;/code&gt; is the core of any operating system which is the interface between computer's hardware and it's processes .&lt;/li&gt;
&lt;li&gt;And the main task of the kernel is :
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Memory management
2. Process management
3. System calls
4. Device drivers
5. Security
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Linux Kernel&lt;/code&gt; is a free &lt;code&gt;opensource&lt;/code&gt; &lt;code&gt;monolithic&lt;/code&gt;, &lt;code&gt;modular&lt;/code&gt; and &lt;code&gt;multitasking&lt;/code&gt; Kernel for Unix like operating systems .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Though it is &lt;code&gt;opensource&lt;/code&gt; we can install and manipulate as per our need .&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Dependencies :&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Make sure to install these dependencies :
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install libncurses-dev flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;How to installation :&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to &lt;a href="https://kernel.org" rel="noopener noreferrer"&gt;kernel.org&lt;/a&gt; and download the latest version .&lt;/li&gt;
&lt;li&gt;Here I am using Ubuntu as the operating system . &lt;/li&gt;
&lt;li&gt;Install it with &lt;code&gt;wget&lt;/code&gt; .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$sudo wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.9.tar.xz&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unzip the downloaded file .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ sudo tar -xvf linux-5.10.9.tar.xz&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make a directory in your home folder .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ mkdir kernel&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy the file after extraction .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ cp -r linux-5.10.9/ /kernel&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to :
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$cd kernel/linux-5.10.9/&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start the Linux source configuration tool
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;make menuconfig&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Edit&lt;/code&gt; the configuration of kernel and save-and-exit.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flwcijonfkrngif07xjge.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flwcijonfkrngif07xjge.jpg" alt="Alt Text" width="775" height="560"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Compile&lt;/code&gt; the kernel .&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$make -j 5 KDEB_PKGVERSION=1.0 deb-pkg&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install the Kernel .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;sudo dpkg -i ../linux*.deb&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reboot your system and check for the kernel version .&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Thank You&lt;/strong&gt; 🤖🤖🤖
&lt;/h2&gt;

</description>
      <category>linux</category>
      <category>kernel</category>
      <category>opensource</category>
      <category>compilation</category>
    </item>
    <item>
      <title>Set up MySQL with Sequelize in NodeJS :</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Tue, 15 Dec 2020 11:13:08 +0000</pubDate>
      <link>https://dev.to/machine_coder/set-up-mysql-with-sequelize-in-nodejs-3a59</link>
      <guid>https://dev.to/machine_coder/set-up-mysql-with-sequelize-in-nodejs-3a59</guid>
      <description>&lt;ul&gt;
&lt;li&gt;First of all we have to create a User of the MySQL database .
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="k"&gt;database&lt;/span&gt; &lt;span class="n"&gt;devdb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="k"&gt;user&lt;/span&gt; &lt;span class="n"&gt;dev&lt;/span&gt; &lt;span class="n"&gt;identified&lt;/span&gt; &lt;span class="k"&gt;by&lt;/span&gt; &lt;span class="s1"&gt;'devpass'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;use&lt;/span&gt; &lt;span class="n"&gt;devdb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;grant&lt;/span&gt; &lt;span class="k"&gt;all&lt;/span&gt; &lt;span class="k"&gt;privileges&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="n"&gt;devdb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="n"&gt;dev&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Then we have to install sequelize as an orm(object relational mapper ) and mysql2 as the database into our project .
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;$&lt;/span&gt; &lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="nx"&gt;mysql2&lt;/span&gt; &lt;span class="nx"&gt;sequelize&lt;/span&gt; 

&lt;span class="nx"&gt;$&lt;/span&gt; &lt;span class="nx"&gt;touch&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;js&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;connecting to a database :
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sequilize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sequilize&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Sequilize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;database&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;password&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="nl"&gt;host&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;localhost&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;dilect&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;mysql&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;min&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;max&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create our Model :
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Post&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;define&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Post&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Sequilize&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;INTEGER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;autoIncrement&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;primaryKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Sequilize&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;STRING&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;allowNull&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sync&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Database has been created&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error creating database &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nx"&gt;User&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;node&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;js&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;Thank You For Reading&lt;/strong&gt;
&lt;/h1&gt;

</description>
      <category>database</category>
      <category>node</category>
      <category>mysql</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Set up MongoDB with node.js :</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Tue, 15 Dec 2020 02:36:19 +0000</pubDate>
      <link>https://dev.to/machine_coder/set-up-mongodb-with-node-js-503a</link>
      <guid>https://dev.to/machine_coder/set-up-mongodb-with-node-js-503a</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;What is MongoDB :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;It is a general purpose document based NoSQL database . Build for scalable application .&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What is Mongoose :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;mongoose is a &lt;strong&gt;object document mapper (ODM)&lt;/strong&gt; used for storing and managing data in form of objects .&lt;/li&gt;
&lt;li&gt;Which makes our code more simpler to write than the MongoDB native driver .
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What is mongod:&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Mongod&lt;/strong&gt; is the demon for MongoDB which performs background management operations and actively listening for the incoming request on port &lt;strong&gt;2701&lt;/strong&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What is mongo shell :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;This is the command line utility for performing &lt;strong&gt;CRUD&lt;/strong&gt; operations on command line . &lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What is NodeJS :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Node.js is a backend framework for building backend web application .&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm i mongoose&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;add this URL for the database connection&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mongoose.connect("mongodb://localhost:27017/(name of your db)", {useNewUrlParser:true, useUnifiedTopology: true});&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Create the &lt;strong&gt;schema&lt;/strong&gt; of our db
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;mongoose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Schema&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
   &lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="na"&gt;rating&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Int&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Create a new mongoose model the singular version of our db .
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Post&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;mongoose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Post&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;newSchema&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Create a new &lt;strong&gt;Document :&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Post_a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Dev post&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;rating&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  save the new value into the database
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;If you want to upload data into the cloud then you could upload to &lt;strong&gt;MongoDB&lt;/strong&gt; atlas which is a &lt;strong&gt;database as a service&lt;/strong&gt; . &lt;/li&gt;
&lt;/ul&gt;


&lt;div class="crayons-card my-2 p-4"&gt;
  &lt;p class="color-base-60"&gt;Post not found or has been removed.&lt;/p&gt;
&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;Thank You For Reading&lt;/strong&gt; 🤖🤖🤖
&lt;/h1&gt;

</description>
      <category>mongodb</category>
      <category>database</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Connect MongoDB Atlas and upload data :</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Mon, 14 Dec 2020 18:56:49 +0000</pubDate>
      <link>https://dev.to/machine_coder/connect-mongodb-atlas-and-upload-data-4kd9</link>
      <guid>https://dev.to/machine_coder/connect-mongodb-atlas-and-upload-data-4kd9</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;What is MongoDB atlas :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;It is a database as a service where we could upload our data to the popular cloud providers such as AWS , azure, GCP .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3fb1yk4pm6hno9tx6ybt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3fb1yk4pm6hno9tx6ybt.jpg" alt="Alt Text" width="750" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;setup :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Crate a new project .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe3bvzkpoixgvrix1x76w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe3bvzkpoixgvrix1x76w.png" alt="Alt Text" width="800" height="328"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the free tire and then choose the cloud provider .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft78gpw1dpk74o9ix895p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft78gpw1dpk74o9ix895p.png" alt="Alt Text" width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to the create a new user under the security section and then add a new user with password .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;and finally we can click on the connect button and then click on connect to our application .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then integrate that URI in your application with your username and password .&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here i am using node.js with mongoose as an odm(object document mapper)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;mongoose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mongodb+srv://admin:&amp;lt;password&amp;gt;@cluster0.jaomd.mongodb.net/&amp;lt;dbname&amp;gt;?retryWrites=true&amp;amp;w=majority&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;useNewUrlParser&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;replace with your username , password and dbname .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now we can execute &lt;strong&gt;CRUD&lt;/strong&gt; operations on our database .&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>cloud</category>
      <category>mongodb</category>
      <category>webdev</category>
      <category>database</category>
    </item>
    <item>
      <title>Cloud computing :</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Mon, 14 Dec 2020 11:36:48 +0000</pubDate>
      <link>https://dev.to/machine_coder/cloud-computing-42l4</link>
      <guid>https://dev.to/machine_coder/cloud-computing-42l4</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;Before cloud computing :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;What happened in the deployment phase .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Buy a stack of servers or we could do it on our computer .&lt;/li&gt;
&lt;li&gt;Keeping the peak traffic in mind, buy more servers .&lt;/li&gt;
&lt;li&gt;Monitoring our infrastructure 24/7 .&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Disadvantages of on-site architecture :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;This setup is expensive .&lt;/li&gt;
&lt;li&gt;Troubleshooting problems can be tedious and may conflict with your business goals .&lt;/li&gt;
&lt;li&gt;The main disadvantage is suppose we have to keep a peak traffic and bases upon that we need to configure our hardware and our system should be up and running 24/7 . But when we monitor our application we get to know that our resources are not optimized in the night which is loss of money  .&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What is cloud computing :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;It is the set of remote servers on the internet to store , manage, and process data rather than a local server .&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4vte7i7e64rhnfn0kq9w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4vte7i7e64rhnfn0kq9w.png" alt="Gcp" width="788" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Cloud Model :&lt;/strong&gt;
&lt;/h1&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Service Model :&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Iass&lt;/strong&gt; (infrastructure as a service) :&lt;/li&gt;
&lt;li&gt;You have the complete access of the infrastructure .&lt;/li&gt;
&lt;li&gt;Provides virtualized computing resources over the internet .&lt;/li&gt;
&lt;li&gt;No worries about the underling physical machine .&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Abstract the user from the physical machine .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F80uhuqxywi06cyswtz3r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F80uhuqxywi06cyswtz3r.png" alt="Alt Text" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pass :&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You have a platform where you can deploy your applications and you don't have the access .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9gzxbdrlabgakzwje02a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9gzxbdrlabgakzwje02a.png" alt="Heroku" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sass :&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;we have a access only in a form of a software .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.ytimg.com%2Fvi%2FbE31y5HbukA%2Fmaxresdefault.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.ytimg.com%2Fvi%2FbE31y5HbukA%2Fmaxresdefault.jpg" alt="sass" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Deployment Model :&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;There are three different ways to deploy cloud services: on a public cloud, private cloud or hybrid cloud. Which deployment method depends on your business needs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  There are mainly three types deployment model :
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Public  cloud &lt;/li&gt;
&lt;li&gt;Private cloud &lt;/li&gt;
&lt;li&gt;Hybrid  cloud &lt;/li&gt;
&lt;li&gt;Multi   cloud&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Public cloud :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This is the most common type of deployment model where the cloud resources like servers and the storage are completely stores on a third party cloud provider and delivers over the network . &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features :&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lower costs : 
Because they run on a pay as you go model .&lt;/li&gt;
&lt;li&gt;No maintenance : 
The cloud provider manages and checks the status of the server . &lt;/li&gt;
&lt;li&gt;Highly available : 
Access any time and anywhere with zero downtime .&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Private cloud :&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;This type of model is used by business or organizations which do some confidential work and they want their data to be compromised.&lt;/li&gt;
&lt;li&gt;Resources (like servers and storage) are stored on a on-site datacenter .&lt;/li&gt;
&lt;li&gt;If it is stored on a third party cloud provider then it is stored on a private network .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Features :&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;More flexible :&lt;/strong&gt; organization can customise according to their need .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More secure :&lt;/strong&gt; Because it is inside a private network .&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Hybrid cloud :&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It is the combination of public and private cloud which allow our application to move between public and private cloud .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The hybrid cloud is evolving to include edge workloads as well. Edge computing brings the computing power of the cloud to IoT devices closer to where the data resides. By moving workloads to the edge, devices spend less time communicating with the cloud, reducing latency and they are even able to operate reliably in extended offline periods.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A hybrid cloud platform gives organizations many advantages—such as greater flexibility, more deployment options, security, compliance and getting more value from their existing infrastructure. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Features :&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Control :&lt;/strong&gt;
Organization can maintain a private cloud to store it's sensitive data .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexibility :&lt;/strong&gt;
You can take additional resources from the public cloud when you needed .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost effective :&lt;/strong&gt;
With the ability you get to scale to public cloud you can maintain a pay as you go model .&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Multi Cloud :&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;As like we have replicas running of the software same way we can configure multiple cloud providers to run the application .&lt;/li&gt;
&lt;li&gt;As the name suggest you can configure multiple cloud providers to run the application .&lt;/li&gt;
&lt;li&gt;You can check the availability zones and the regions provided by cloud providers .&lt;/li&gt;
&lt;li&gt;If you want to setup a edge server in multiple counties then go ahead with which cloud has the maximum reach in that country . &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Features :&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Avoid Single point of failure :&lt;/strong&gt;&lt;br&gt;
Running multiple replicas in multiple instances in multiple regions in multiple cloud providers of your application can save you from single point of failure .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;High performance :&lt;/strong&gt;&lt;br&gt;
Planning to set up edge servers then go ahead with multi cloud .&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Thanks for Reading&lt;/strong&gt; 🤖🤖🤖
&lt;/h1&gt;

</description>
      <category>cloud</category>
      <category>aws</category>
      <category>azure</category>
      <category>googlecloud</category>
    </item>
    <item>
      <title>Decoding the beauty of cryptography :</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Mon, 14 Dec 2020 08:56:40 +0000</pubDate>
      <link>https://dev.to/machine_coder/decoding-the-beauty-of-cryptography-39ef</link>
      <guid>https://dev.to/machine_coder/decoding-the-beauty-of-cryptography-39ef</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;What is cryptography :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Cryptography is a practice and study of techniques for securing communication between two hosts . Which ensures that no middle person can understand the communication going on between two hosts .&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Process of cryptography :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcp2quqw5i2rmwvvnyqi1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcp2quqw5i2rmwvvnyqi1.png" alt="cryptography process" width="720" height="283"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;History of encryption :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;Caesar cipher&lt;/strong&gt; is one of the earliest known and simplest ciphers . It is a type of substitution cipher in which each letter in the plaintext is 'shifted' a certain number of places down the alphabet . &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcc0a9mses5cg1nh6qo49.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcc0a9mses5cg1nh6qo49.png" alt="caesar cipher" width="509" height="112"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enigma cipher :&lt;/strong&gt;&lt;br&gt;
The enigma cipher is a field cipher used by Germans during the world war 2.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---------------------------------------
Encryption : key values a = 17 , b = 20
---------------------------------------

original text : t  w  e n  t  y     f i f t  e  e  n
            X : 19 22 4 13 19 24    5 6 5 19 4  4  13
ax + b % 26   : 5  4  10 7 5  12    1 0 1 5  10 10 7
Encrypted text: f  e  k  h f  m     b a b f  k  k  h

------------------------- 
Decryption : a^n - 1 = 23
-------------------------

Encrypted Text      : f  e  k  h f  m     b a b f  k  k  h
Encrypted Value     : 5  4  10 7 5  12    1 0 1 5  10 10 7
23 * (X - b) mod 26 : 19 22 4 13 19 24    5 6 5 19 4  4  13
Decrypted Text      : t  w  e n  t  y     f i f t  e  e  n 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Digital encryption standards :&lt;/strong&gt;
The digital encryption standard (DES) is a symmetric key block cipher published by NIST . DES is an implementation of &lt;strong&gt;Feistel cipher .&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Classification of cryptography :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;Symmetric key cryptography (secret key encryption)&lt;/li&gt;
&lt;li&gt;Asymmetric key cryptography (public key encryption)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Symmetric key cryptography is further divided into two parts&lt;/p&gt;

&lt;p&gt;A. &lt;strong&gt;classical Cryptography :&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Transposition cipher &lt;/li&gt;
&lt;li&gt;substitution cipher &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;B. &lt;strong&gt;Modern Cryptography :&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stream cipher&lt;/li&gt;
&lt;li&gt;Block cipher&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Symmetric key cryptography :&lt;/strong&gt;&lt;br&gt;
An encryption system in which the sender and receiver of a message share a &lt;strong&gt;single common key&lt;/strong&gt; that is used to encrypt and decrypt the message . The most popular symmetric key system is the data encryption standards(DES) . &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fu96jvvfgwcd5qxdhs72p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fu96jvvfgwcd5qxdhs72p.png" alt="Symmetric key" width="800" height="313"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Classical cryptography :&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Transposition cipher :&lt;/strong&gt;
In this kind of encryption the positions held by units of plaintext (which are commonly characters or group of characters) are shifted according to the regular system so that the ciphertext constitutes a permutation of the plain text .
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 2 3 4 5 6    4 2 1 6 3 5
m e e t m e    t e m e e m
a f t e r p    e f a p t r
a r t y        y r a t

plain text  : meet me after party 
key used    : 421635
cipher text : temeemefaptryrat

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;substitution cipher :&lt;/strong&gt;
Methods of encryption by which units of plain text area replaced with cipher text , according to a fixed system the "units" may be single letters, mixtures of the above , and so forth .
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A B C D E F G H I J K L M     RTO13 is a caesar cipher , a type of 
| | | | | | | | | | | | |     substitution cipher in RTO13 
N O P Q R S T U V W X Y Z     alphabet is rotated 13 times .

plain text : ABCDEFGHIJKLMONPQRSTUVWXYZ
keyword    : ZEBRAS
cipher text: ZEBRASCDFGHUKLMNOPQTUVWXY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Modern Cryptography :&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stream cipher :&lt;/strong&gt; &lt;br&gt;
A symmetric or secret-key encryption algorithm that encrypt a single bit at a time . with a stream cipher , the same plaintext bit or byte will encrypt to a different bit or byte every time it is encrypted .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsh548m0u8rtlc1pr3iys.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsh548m0u8rtlc1pr3iys.png" alt="stream cipher" width="800" height="294"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Block cipher :&lt;/strong&gt; &lt;br&gt;
The alternative method is block cipher in which a key and algorithm are applied to block of data rather than individual bits in a stream .&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Asymmetric key encryption :&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;It usages a pair of keys &lt;strong&gt;public key&lt;/strong&gt; which can be disseminated widely over the network and &lt;strong&gt;private key&lt;/strong&gt; is only know to the host .&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Some examples of Asymmetric key :&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Diffie-Hellman&lt;/strong&gt; key exchange &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DSS&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RSA&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Diffie-Hellman&lt;/strong&gt; key exchange &lt;br&gt;
It is also known as exponential key exchange is a method of digital encryption that uses numbers raised to specific powers to produce decryption keys on the basis of components that are never directly transmitted , making the task of a would-be code breaker mathematically  overwhelming .&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Working of Diffie-Hellman :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;step-1 :&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Assume a prime number and selecting its primitive root .&lt;/li&gt;
&lt;li&gt;Assume a prime number q .&lt;/li&gt;
&lt;li&gt;select alpha primitive root of q (alpha &amp;lt; q)&lt;/li&gt;
&lt;li&gt;alpha is a primitive root of q if :
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alpha mod q , aplpha ^ 2 mod q .......... alpha ^ q-1 mod q
is implies 1, 2, 3, ..... q-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;step-2 :&lt;/strong&gt;&lt;br&gt;
Finding private key and public key of sender and receiver .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Assume xa (private key of user a)   |
----------                          |
| xa &amp;lt; q |                          |
----------                          |    (Sender)
Now , calculate public key ya       |
------------------------            |
|ya = alpha ^ xa mod q |            |
------------------------
Assume xb (private key of user a)   |
----------                          |
| xb &amp;lt; q |
----------
                                    |    (receiver)
Now , calculate public key , yb
----------------------
| yb = alpha^xb mod q |             |
-----------------------
                                    |
__Step-3 :__
Generate secret key at senders and receiver's side so sender has his private key         = xa
    receiver public key = yb
    prime number        = q

key is being generated with the following formula :
------------------
| K = yb ^ mod q |
------------------
similarly receiver has his private key = xb
                           receiver public key = ya
                           prime number = q 
* key is being generated :
-------------------
| K = ya ^ xb mod q |
--------------------
* After calculating the key on both the sides 
K = yb ^ xb mod q   ==  K = yb ^ xa mod q
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;There are lot more to know :&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;prefer old friend &lt;strong&gt;wikipedia&lt;/strong&gt; for in-depth knowledge .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And &lt;strong&gt;cryptii&lt;/strong&gt; for practice . &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://cryptii.com/" rel="noopener noreferrer"&gt;prefer site for practice&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Thanks for reading&lt;/strong&gt; 👨‍💻👨‍💻👨‍💻
&lt;/h1&gt;

</description>
      <category>cryptography</category>
      <category>security</category>
      <category>keyexchange</category>
    </item>
    <item>
      <title>Let's build a DevOps project :</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Mon, 14 Dec 2020 08:29:15 +0000</pubDate>
      <link>https://dev.to/machine_coder/let-s-build-a-devops-project-4b65</link>
      <guid>https://dev.to/machine_coder/let-s-build-a-devops-project-4b65</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;The Agenda :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;This is a project in which we have to take an application through DevOps lifecycle . &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Integrating the source code in a &lt;strong&gt;version control&lt;/strong&gt; environment for mutual development.&lt;/li&gt;
&lt;li&gt;The application must pass through a &lt;strong&gt;ci/cd pipeline&lt;/strong&gt; .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;continuous monitoring&lt;/strong&gt; is enabled for fault tolerance .
&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Phases in DevOps :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Planning &lt;/li&gt;
&lt;li&gt;Coding &lt;/li&gt;
&lt;li&gt;Testing &lt;/li&gt;
&lt;li&gt;Building &lt;/li&gt;
&lt;li&gt;Release&lt;/li&gt;
&lt;li&gt;Deploy&lt;/li&gt;
&lt;li&gt;Operate &lt;/li&gt;
&lt;li&gt;Monitor&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Planning :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A better planning of an application can lead to a better growth of our application where we have to design our system where &lt;strong&gt;high level system design&lt;/strong&gt; is involved like flow charts, features , intended users , security , Relationship in the database .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fifqy37q6idzt0ljcz55d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fifqy37q6idzt0ljcz55d.png" alt="Planning" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Coding :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Then we have to do the coding according to the features . where low level design is involved .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fux4ftt0fktpgeuvtk9qj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fux4ftt0fktpgeuvtk9qj.jpg" alt="Alt Text" width="744" height="372"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Testing :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A simple &lt;strong&gt;unit testing&lt;/strong&gt; is good enough for our application if we are not building a high scale application . Since we are using DevOps so we using Selenium to automate application testing . we use the selenium web driver and TestNG for report writing and Maven for managing  our dependency .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8zgucb4oed73sudggkee.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8zgucb4oed73sudggkee.jpg" alt="Testing" width="800" height="487"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Building :&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the building stage we are going to implement packaging , error testing, basically integrate our application with Jenkins which is a ci/cd pipeline tool which can trigger our code by configuring with webhook and then automating the testing using selenium . &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So there are mainly two types of servers one is for testing and another is production .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So our application first should go to the testing servers and then to the production servers .&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4k8i8y16k556qvfa5lir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4k8i8y16k556qvfa5lir.png" alt="Alt Text" width="800" height="276"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Release :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In the release state we are releasing a &lt;strong&gt;MVP&lt;/strong&gt; of our application to our intendent uses .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F81caxitwk38s9vumrmgx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F81caxitwk38s9vumrmgx.jpg" alt="Alt Text" width="600" height="416"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Configuration management :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This is a phase of infrastructure as a service where we have to write code for our infrastructure . and to automate it because we are using DevOps and this can be achieved by &lt;strong&gt;Configuration management tools&lt;/strong&gt; such as ansible, puppet, Ceph , SaltStack . Let's suppose our application needed more resources so that we have to allocation new servers and manually we could do that but if we think in a large scale so it is a repeatative task so by using configuration management tools we could make sure that automated servers added to our infrastructure when ever needed .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm9jujfgq9t4za7naoj7r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm9jujfgq9t4za7naoj7r.png" alt="Configuration management" width="600" height="399"&gt;&lt;/a&gt;  &lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Monitor :&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Monitoring our application is really a essence like monitoring our infrastructure . Monitoring based upon different  metrices &lt;br&gt;
like resource utilization (Mainly CPU and Memory) .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When it find potential failure symptoms an &lt;strong&gt;Alert&lt;/strong&gt; has been triggered with the log about which part of our application crashes . &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzs8ky6rljxyowgsvzdeb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzs8ky6rljxyowgsvzdeb.png" alt="Monitoring" width="800" height="468"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Steps :&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We are use two machines one is the worker and another one is the slave machine .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;create two ec2 instances in &lt;strong&gt;AWS&lt;/strong&gt; and connect using SSH .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs85iouqo51n4873xst92.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs85iouqo51n4873xst92.jpg" alt="Alt Text" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install Git and Jenkins(Java as a prerequisite) on the master Node .   &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fire up Jenkins web dashboard in the usual steps .&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxyrhth4ky99vjultecun.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxyrhth4ky99vjultecun.png" alt="Jenkins" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;configure setting where we have to create a new node and 
then configure our node machine by downloading two files and if we are downloading them we have to use the SCP command to copy them to the master node .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$scp -i /downloads/.pem (name of the files) ubuntu@ip:/home/jenkins&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Configure webhooks for a triggering point whenever we are pushing our code into GitHub .  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Coming to the node machine&lt;/strong&gt; we need to install Java and git .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;clone the git repos modify some change .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;add it to the staging area (place where git can track all the files ) .&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$git add .&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$sudo git commit -m "Initial commit"&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Then copy the ip address of Jenkins go to the settings of your repository add a webhook . &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvayk4qb40bw98793zrwu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvayk4qb40bw98793zrwu.png" alt="webhook" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;recognized as a &lt;strong&gt;payload URL&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;http://testingserverip:8080/github-webhook/&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Implement a Job inside Jenkins&lt;br&gt;
create a new item test-job&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a docker file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi1.wp.com%2Fitsfoss.com%2Fwp-content%2Fuploads%2F2019%2F11%2Fdocker_wallpaper.png%3Ffit%3D800%252C450%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi1.wp.com%2Fitsfoss.com%2Fwp-content%2Fuploads%2F2019%2F11%2Fdocker_wallpaper.png%3Ffit%3D800%252C450%26ssl%3D1" alt="docker" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The container is consists of the operating system  and the required software .&lt;br&gt;
It our case in this container &lt;strong&gt;Ubuntu&lt;/strong&gt; is the &lt;strong&gt;OS&lt;/strong&gt; and apache is configured as a &lt;strong&gt;webserver&lt;/strong&gt; .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM hshar/webapp
ADD . /var/www/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the Jenkins build environment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo docker rm -f $(sudo docker ps -a -q)
sudo docker build /home/ubuntu/website/. -t test
sudo docker run -it -p 82:80 -d test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;Now we have to test our application :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxz2c03tqqsj2l6wr3ci3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxz2c03tqqsj2l6wr3ci3.jpg" alt="selenium" width="534" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install &lt;strong&gt;selenium webdriver&lt;/strong&gt; , the singleton server and the chromedriver as per your operating system . &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Install in on test-server
&lt;/h3&gt;



&lt;p&gt;&lt;code&gt;$sudo apt install chromium-browser&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://chromedriver.chromium.org/downloads" rel="noopener noreferrer"&gt;Go to this link !&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$wget https://chromedriver.storage.googleapis.com/87.0.4280.20/chromedriver_linux64.zip&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$unzip chromedriver_linux64.zip&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Lets write a simple &lt;br&gt;
/home/ubuntu/chromedriver as a path &lt;br&gt;
execute it on &lt;strong&gt;headless mode&lt;/strong&gt; because our ubuntu server does not have a dashboard .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Test&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

   &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="o"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

       &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;setProperty&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"webdriver.chrome.driver"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"C:\\Selinium\\chromedriver.exe"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

       &lt;span class="nc"&gt;ChromeOptions&lt;/span&gt; &lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ChromeOptions&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

       &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;addArguments&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"--headless"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
       &lt;span class="nc"&gt;WebDriver&lt;/span&gt; &lt;span class="n"&gt;driver&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ChromeDriver&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

       &lt;span class="n"&gt;driver&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"http://(ip address)/"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

       &lt;span class="n"&gt;driver&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;findElement&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;By&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"id_name"&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
   &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;p&gt;&lt;code&gt;java -jar hello.jar&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Then transfer it to the node machine &lt;strong&gt;scp&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Lunch a production server instance&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$sudo apt install open-jdk&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$sudo apt install docker&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Go to jenkins &lt;br&gt;
add a new node called prod server and the location is /home/ubuntu/jenkins &lt;br&gt;
run the jnlp file &lt;/p&gt;

&lt;p&gt;next create a new job as a prod branch without webhook&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo &lt;/span&gt;hello
&lt;span class="nb"&gt;sudo &lt;/span&gt;docker &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;docker &lt;span class="nt"&gt;-ps&lt;/span&gt; &lt;span class="nt"&gt;-q&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;docker build /home/ubuntu/jenkins/workspace/test-job/. &lt;span class="nt"&gt;-t&lt;/span&gt; prod
&lt;span class="nb"&gt;sudo &lt;/span&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 80:80 &lt;span class="nt"&gt;-d&lt;/span&gt; prod 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;jenkins 
&lt;span class="nb"&gt;cd &lt;/span&gt;workspace 
&lt;span class="nb"&gt;cd &lt;/span&gt;test-job
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;create a new job called &lt;strong&gt;test-job&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;same github url&lt;/li&gt;
&lt;li&gt;label expression &lt;strong&gt;test-server&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo cp&lt;/span&gt; ./hello.jar /home/ubuntu
&lt;span class="nb"&gt;sudo &lt;/span&gt;java &lt;span class="nt"&gt;-jar&lt;/span&gt; /home/ubuntu/hello.jar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;test-github-webhook&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;post-build-action&lt;/strong&gt; build-website&lt;/li&gt;
&lt;li&gt;&lt;p&gt;save&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;build-website &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;remove build triggers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;add test-website post-build&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;test-website&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;build-other-project -- test-job&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;add a new pipeline view &lt;br&gt;
define the initial job other will be handeled by post-build action&lt;br&gt;
&lt;strong&gt;test-github-webhook&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inside the test-server&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo mv&lt;/span&gt; ./hello.jar /home/ubuntu/website
&lt;span class="nb"&gt;cd &lt;/span&gt;website
git add &lt;span class="nb"&gt;.&lt;/span&gt; 
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"test jar added"&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin master 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Lets go to master server for configuration management &lt;br&gt;
cd jenkins/workspace/test-job&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The ip address of production server paste in on browser .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Modify it on &lt;strong&gt;test server&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;website
change something
commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Final commit"&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;push &lt;span class="nt"&gt;-u&lt;/span&gt; origin master 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;New job named as Develop-branch&lt;br&gt;
restrict it to the test-server&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;docker &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;docker ps &lt;span class="nt"&gt;-t&lt;/span&gt; &lt;span class="nt"&gt;-q&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;docker build /home/ubuntu/. &lt;span class="nt"&gt;-t&lt;/span&gt; test1
&lt;span class="nb"&gt;sudo &lt;/span&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 85:80 &lt;span class="nt"&gt;-d&lt;/span&gt; test1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;Configuration management using ansible:&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;In this phase we have to install a &lt;strong&gt;Configuration management&lt;/strong&gt; which is ansible in our case . which helps achieve &lt;strong&gt;infrastructure as a code&lt;/strong&gt; basically writing code for our infrastructure .&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Continuous monitoring using Nagios :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;The Final step in our loop and most important phase . &lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;a href="https://dev.to/rahulku48837211/ansible-architecture-and-setup-2355" alt="Ansible image"&gt;
  
    &lt;img width="800" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--r4FESc_R--%2Fc_imagga_scale%2Cf_auto%2Cfl_progressive%2Ch_420%2Cq_auto%2Cw_1000%2Fhttps%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fc819w2e2mue3j204clau.png" height="400"&gt;
&lt;br&gt; Ansible setup and architecture
    
  
&lt;/a&gt;  
    &lt;/td&gt;
        &lt;td&gt;
      &lt;a href="https://dev.to/rahulku48837211/continuous-monitoring-using-nagios-205h" alt="Nagios image"&gt;
  
    &lt;img width="800" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--OJFRT0kj--%2Fc_imagga_scale%2Cf_auto%2Cfl_progressive%2Ch_420%2Cq_auto%2Cw_1000%2Fhttps%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftd2ghznu2edhbvnlmntc.jpg" height="400"&gt;
&lt;br&gt; Nagios setup and architecture 
    
  
&lt;/a&gt;  
    &lt;/td&gt;
  &lt;/tr&gt;
  
&lt;/table&gt;&lt;/div&gt; 

&lt;h1&gt;
  
  
  &lt;strong&gt;Thank You for reading 🤖🤖🤖&lt;/strong&gt;
&lt;/h1&gt;

</description>
      <category>devops</category>
      <category>monitoring</category>
      <category>webdev</category>
    </item>
    <item>
      <title>configure Nagios in our server :</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Mon, 14 Dec 2020 07:35:52 +0000</pubDate>
      <link>https://dev.to/machine_coder/continuous-monitoring-using-nagios-205h</link>
      <guid>https://dev.to/machine_coder/continuous-monitoring-using-nagios-205h</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;Why we need Continuous Monitoring :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;In a large scale distributed applications we never know what kind issue we may ran into . &lt;/li&gt;
&lt;li&gt;some of them are : &lt;/li&gt;
&lt;li&gt;Failure in CI/CD pipeline .
&lt;/li&gt;
&lt;li&gt;Static code analysis .&lt;/li&gt;
&lt;li&gt;Application side issue .&lt;/li&gt;
&lt;li&gt;Infrastructure side issue .&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And in big organizations &lt;strong&gt;server health&lt;/strong&gt; and &lt;strong&gt;application Security&lt;/strong&gt; can not be compromised at any cost . &lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What is continuous monitoring :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Continuous monitoring is a phase in our application development lifecycle which make sure that our application is getting continuously monitored and debugged if any issue .&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Phases of continuous monitoring :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;Define&lt;/li&gt;
&lt;li&gt;Establish&lt;/li&gt;
&lt;li&gt;Implement &lt;/li&gt;
&lt;li&gt;Analyze&lt;/li&gt;
&lt;li&gt;Respond&lt;/li&gt;
&lt;li&gt;Review and Update &lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What is Nagios :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Nagios monitors your entire IT lifecycle to ensures systems, applications , services and business process are functioning properly .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffvkbpa4pjjg17hadp5cw.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffvkbpa4pjjg17hadp5cw.jpg" alt="Alt Text" width="800" height="272"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Features of Nagios :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Using a master slave architecture .&lt;/li&gt;
&lt;li&gt;Easy to write plugins .&lt;/li&gt;
&lt;li&gt;Good web interface for visualization purpose .&lt;/li&gt;
&lt;li&gt;Automate the e-mail sending in case of any network failure .&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Architecture of Nagios :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffjawyebmufq3clw3fcy2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffjawyebmufq3clw3fcy2.png" alt="Alt Text" width="800" height="345"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;How install Nagios (Ubuntu):&lt;/strong&gt;
&lt;/h1&gt;



&lt;p&gt;&lt;code&gt;$ sudo apt update&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ sudo apt install build-essentials libgd-dev openssl libssl-dev unzip apache2 gcc&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nagios user and group are used to run Nagios process&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ sudo useradd nagios&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ sudo groupadd nagcmd&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ sudo usermod -a -G nagcmd nagios&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.6.tar.gz&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ tar xpf nagios-*.tar.gz&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ cd nagios-4.4.6&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ ./configure --with-nagios-group=nagios --with-command-group=nagcmd&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You can see the configuration using the &lt;strong&gt;configure&lt;/strong&gt; command :&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now we have to build the project using the make command and then install it :&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ make -j4 all&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ sudo make install&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now run these commands to install Nagios sample files, binary files and it's sample config files .
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo make install
sudo make install-daemoninit
sudo make install-commandmode
sudo make install-config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;We are using apache to serve Nagios web interface .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ sudo make install-webconf&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enable the Apache rewrite and cgi modules with the a2enmod command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ sudo a2enmod rewrite&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ sudo a2enmod cgi&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In order to execute  commands via the web interface to Nagios add the web server user, www-data, to the nagios group:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$sudo usermod -a -G nagios www-data&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next we have to create a username and password for our user which can enable our user to login to the web interface .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ sudo apt install htpasswd&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Enter Your Password :
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Warning: If you create a user with a name other than nagiosadmin
you will need to edit /usr/local/nagios/etc/cgi.cfg 
and change all the nagiosadmin references to the user you created.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Restart the Apache server
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ sudo systemctl restart apache2&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Installing the Nagios plugin :&lt;/strong&gt;
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~
$ http://www.nagios-plugins.org/download/nagios-plugins-2.3.3.tar.gz
$ tar zxf nagios-plugins-2.2.1.tar.gz
$ cd nagios-plugins-2.2.1

*configure their installation 
$ ./configure

* Now build and install the plugin

$ make
$ sudo make install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Now we need to install check_nrpe plugin to monitor the remote plugins :
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~
curl -L -O https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-3.2.1/nrpe-3.2.1.tar.gz
tar zxf nrpe-3.2.1.tar.gz
cd nrpe-3.2.1
./configure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now build and install check_nrpe :
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;make check_nrpe
sudo make install-plugin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;Configure Nagios :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the Nagios configuration file
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$sudo nano /usr/local/nagios/etc/nagios.cfg&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add this line to the config file
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
#cfg_dir=/usr/local/nagios/etc/servers
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Uncomment this line
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cfg_dir=/usr/local/nagios/etc/servers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now we have to create a directory so that we can store our configuration file for each server .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$sudo mkdir /usr/local/nagios/etc/servers&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;open the Nagios contact file :&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ sudo nano /usr/local/nagios/etc/objects/contacts.cfg&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Find the email directive and replace it with yours&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user
        email                           your_email@your_domain.com        ; &amp;lt;&amp;lt;***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Navigate to the directory and add a new command which is for defining check_nrpe command .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ sudo nano /usr/local/nagios/etc/objects/commands.cfg&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
define command{
        command_name check_nrpe
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This defines the name and specifies the command-line options to execute the plugin.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ sudo systemctl start nagios&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Access the Nagios web interface :&lt;/strong&gt;
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://nagios_server_public_ip/nagios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enter the login credentials .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fce35074u4unhw6qz856a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fce35074u4unhw6qz856a.png" alt="Nagios dashboard" width="800" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Monitoring :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;ssh into the server you want to monitor.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ ssh ubuntu@server_ip&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ sudo useradd nagios&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~
curl -L -O https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tar zxf nagios-plugins-2.2.1.tar.gz
cd nagios-plugins-2.2.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then configure and build it&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ ./configure&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ make&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ sudo make install&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install nrpe daemon find the latest url at &lt;a href="https://github.com/NagiosEnterprises/nrpe/releases" rel="noopener noreferrer"&gt;github pages&lt;/a&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~
curl -L -O https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-4.0.0/nrpe-4.0.0.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tar zxf nrpe-4.0.0.tar.gz
cd nrpe-4.0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;p&gt;&lt;code&gt;$ ./configure&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now build and install NRPE and its startup script with these commands:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;make nrpe
sudo make install-daemon
sudo make install-config
sudo make install-init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;p&gt;&lt;code&gt;$ sudo nano /usr/local/nagios/etc/nrpe.cfg&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;server_address: Set to the private IP address of the monitored server.&lt;/li&gt;
&lt;li&gt;allowed_hosts: Add the private IP address of your Nagios server to the comma-delimited list.&lt;/li&gt;
&lt;li&gt;command[check_hda1]: Change /dev/hda1 to whatever your root filesystem is called.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
server_address=second_ubuntu_server_private_ip
...
allowed_hosts=127.0.0.1,::1,your_nagios_server_private_ip
...
command[check_vda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/vda1
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;p&gt;&lt;code&gt;$ sudo systemctl start nrpe.service&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ sudo ufw allow 5666/tcp&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now you can check the communication with the remote NRPE server. Run the following command on the Nagios server:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ /usr/local/nagios/libexec/check_nrpe -H second_ubuntu_server_ip&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On your Nagios server, create a new configuration file for each of the remote hosts that you want to monitor in /usr/local/nagios/etc/servers/. Replace the highlighted word, monitored_server_host_name with the name of your host:
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ sudo nano /usr/local/nagios/etc/servers/your_monitored_server_host_name.cfg&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the following host definition, replacing the &lt;strong&gt;host_name&lt;/strong&gt; value with your &lt;strong&gt;remote hostname&lt;/strong&gt;, the &lt;strong&gt;alias&lt;/strong&gt; value with a &lt;strong&gt;description&lt;/strong&gt; of the &lt;strong&gt;host&lt;/strong&gt;, and the address value with the &lt;strong&gt;private IP&lt;/strong&gt; address of the &lt;strong&gt;remote host&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;define host {
        use                             linux-server
        host_name                       your_monitored_server_host_name
        alias                           My client server
        address                         your_monitored_server_private_ip
        max_check_attempts              5
        check_period                    24x7
        notification_interval           30
        notification_period             24x7
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add some sevices &lt;/li&gt;
&lt;li&gt;First, add this block to monitor load average:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;define service {
        use                             generic-service
        host_name                       your_monitored_server_host_name
        service_description             Load average
        check_command                   check_nrpe!check_load
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Next, add this block to monitor disk usage:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;define service {
        use                             generic-service
        host_name                       your_monitored_server_host_name
        service_description             /dev/vda1 free space
        check_command                   check_nrpe!check_vda1
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now restart and navigate to the web interface :&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ sudo systemctl restart nagios&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjmo6bdxhafp55bp5gng1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjmo6bdxhafp55bp5gng1.png" alt="nagios" width="800" height="167"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Thanks for reading&lt;/strong&gt; 🤖🤖🤖
&lt;/h1&gt;

</description>
      <category>monitoring</category>
      <category>devops</category>
    </item>
    <item>
      <title>AWS multi-tire architecture Project :</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Wed, 09 Dec 2020 17:26:08 +0000</pubDate>
      <link>https://dev.to/machine_coder/aws-multi-tire-architecture-project-2gib</link>
      <guid>https://dev.to/machine_coder/aws-multi-tire-architecture-project-2gib</guid>
      <description>&lt;p&gt;As we all know in today's era everybody is moving towards cloud because deploying and maintaining applications in our local environment could be compound and costly .&lt;/p&gt;

&lt;p&gt;Here is the &lt;strong&gt;architecture diagram&lt;/strong&gt; below .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffy6e0fipzja2nnyeo3c8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffy6e0fipzja2nnyeo3c8.png" alt="Alt Text" width="800" height="568"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Explain :&lt;br&gt;
The architecture comprises of a private network and a public network in which the load balancer resides where we can basically implement a path based routing . The separation of private network is to strength the security of our application where we make sure the integrity of our application .&lt;br&gt;
This is a multi-tire architecture project which comprises of individual business logics individually scalable and monitorable .&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Steps :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;This project is build on &lt;code&gt;AWS&lt;/code&gt; so you must have a &lt;code&gt;AWS&lt;/code&gt; account and &lt;code&gt;ssh-client&lt;/code&gt; like &lt;code&gt;putty&lt;/code&gt; if you are on windows or for mac or Linux use &lt;code&gt;openssh&lt;/code&gt; .&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;First we have to create a VPC&lt;/strong&gt; :
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;VPC is an isolated space inside our region &lt;a href="https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html" rel="noopener noreferrer"&gt;More info for click me&lt;/a&gt; .&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;creating a &lt;strong&gt;VPC&lt;/strong&gt; with a name and with a &lt;strong&gt;ipv4 CIDR(classes inter-Domain Routing is a method used to allocate IP address) block 10.1.0.0/16 range&lt;/strong&gt; where the application is going to deploy . &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fna1jis5xji7pxa9439jf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fna1jis5xji7pxa9439jf.png" alt="VPC creation" width="800" height="495"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Creating a subnet for the access :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Partitioning the network according to the public and private access . &lt;br&gt;
Let's define 4 regions (You can choose the number according to your need)  and later in the configuration part we can decide which one to deploy in the public and in the private network .&lt;/p&gt;

&lt;p&gt;In our network all the internet access and non-internet access part is going to deploying in public and private &lt;strong&gt;subnet&lt;/strong&gt; respectively .&lt;/p&gt;

&lt;p&gt;So the public subnet is having a public IP address and the private subnet is having a private IP address .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Configuration for our subnet :&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftq5lfudp9vb0a7cz7tz2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftq5lfudp9vb0a7cz7tz2.png" alt="Alt Text" width="800" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's have a look at the configuration of four of our subnets . &lt;/p&gt;

&lt;p&gt;tag - public-2a&lt;br&gt;
region - 2a&lt;br&gt;
VPC - main network&lt;br&gt;
ipv4 - 10.1.1.0/24 this range is a part of the main network range &lt;/p&gt;

&lt;p&gt;tag - public-2b&lt;br&gt;
region - 2b&lt;br&gt;
VPC - main network&lt;br&gt;
ipv4 - 10.1.2.0/24&lt;/p&gt;

&lt;p&gt;tag - private-2a&lt;br&gt;
region - 2a&lt;br&gt;
VPC - main network&lt;br&gt;
ipv4 - 10.1.3.0/24&lt;/p&gt;

&lt;p&gt;tag - private-2b&lt;br&gt;
region - 2b&lt;br&gt;
VPC - main network&lt;br&gt;
ipv4 - 10.1.4.0/24&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Create an Internet gateway :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;suppose you want to have a internet access in your home then you contact to the internet service provide to bring up a connection to your home . similarly here we have to create a &lt;strong&gt;internet gateway&lt;/strong&gt; for the same purpose .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F47rfqg1ga7hh0ccgmgmj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F47rfqg1ga7hh0ccgmgmj.png" alt="Internet-gateway" width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;steps :&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;create a new internet gateway .&lt;/li&gt;
&lt;li&gt;attach it to your VPC&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;when you deploy a resource in the cloud it is always deployed in the subparts . just like you have WIFI in the home and you do not have a active connection to that then your laptop does not know weather to connect to the WIFI or not .&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Creating route tables :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;So we have created 4 subparts of our main network then we just have to define which one to give the internet access and which one to not .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhliqv8n34136pefrt4gs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhliqv8n34136pefrt4gs.png" alt="route-table" width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;create two one is &lt;strong&gt;Active&lt;/strong&gt; and another one is &lt;strong&gt;non-active&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;Go to the actions -- connect the &lt;strong&gt;public subnets&lt;/strong&gt; to the &lt;strong&gt;Active route-table&lt;/strong&gt; and then
the &lt;strong&gt;private subnets&lt;/strong&gt; to the -- &lt;strong&gt;non-active route-table&lt;/strong&gt; .&lt;/li&gt;
&lt;li&gt;Make sure you have deployed both of them in your main network (VPC) .&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Now we have to specify the route to the gateway .&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Steps :&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Select the gateway which we want to give the internet access and in our case it is named as &lt;strong&gt;Internet&lt;/strong&gt; .&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Edit routes --&amp;gt; Add a route &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;0.0.0.0/0 internet gateway&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;we connected two subnets to the route table and they can connect to the internet by using the internet gateway .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;All the resources that we are going to communicate with each other because they are the part of the same network .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;So consider a scenario where&lt;/strong&gt; in your &lt;strong&gt;home network&lt;/strong&gt; your laptop and mobile is connected which leads the communication between two . &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The subparts can communicate with each other whether they have the internet access or not . Which make sure the communication to our private network . This kind of division ensures the security of our infrastructure .&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fc6chl14cvs81viyw1grk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fc6chl14cvs81viyw1grk.png" alt="Alt Text" width="680" height="453"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;h3&gt;
  
  
  The resources which are public subnet we have to assign a public &lt;strong&gt;IP address&lt;/strong&gt; to them  in order to talk to them .
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Just select your public network and then go to actions modify auto assign IP and then tick the enable public assign IP .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;steps:&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;subnets &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;public-2a&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;modify auto.... &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;enable auto assign &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;save&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5yr3y4fvfliat0zvp627.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5yr3y4fvfliat0zvp627.png" alt="assign IP address" width="800" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ixdd2kzk8tlfp7gjh92.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ixdd2kzk8tlfp7gjh92.png" alt="assign IP address" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Public IP address is the address which can be reach out to the network .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All the address we have specified earlier are the &lt;strong&gt;local IP address.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Lets Move to the application deployment part :&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Steps :&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create a new EC2 instance
&lt;/li&gt;
&lt;li&gt;in the configure instance &lt;/li&gt;
&lt;li&gt;network -- main-network &lt;/li&gt;
&lt;li&gt;subnet -- public subnet&lt;/li&gt;
&lt;li&gt;go with the &lt;strong&gt;default firewall&lt;/strong&gt; as of now and then we have to restrict the firewall later .&lt;/li&gt;
&lt;li&gt;Then lunch it .&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;select the security group &lt;/li&gt;
&lt;li&gt;edit inbound rule -- &amp;gt; my IP
&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Connect it to your machine :
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;ssh -i pem file and host@ipaddr&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Installing the webserver for the access to our webpage .&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt install apache2&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;$ cd /var/www/html&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;So this is a sample blogging project . where i have two routes as home and the about route . Obviously same steps can be followed in different real life projects . &lt;/p&gt;

&lt;p&gt;create a new index.html page with the content as follows :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt; Welcome to the homepage &lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Create an AMI of the home-page :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;home page is now ready to deploy in the private subnet .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Steps:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F69jv693o0dvmdmlkt0os.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F69jv693o0dvmdmlkt0os.png" alt="Alt Text" width="800" height="292"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And then name it as you wish here i name it as &lt;strong&gt;blog-home&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lets again go to the same path where our home page id resides  and then change the index.html .&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;This is the about page&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Then create an AMI out of it . By following the same steps but here we have to name it as &lt;strong&gt;about-page&lt;/strong&gt; .&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Configure both of the images :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;We have to give two of our web pages public-2a and public-2b as the subnet . And make sure they reside in our main-network(VPC) .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Steps :&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Lunch Instances&lt;/li&gt;
&lt;li&gt;My AMIs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmic5gr07m0qrcju3hevs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmic5gr07m0qrcju3hevs.png" alt="Alt Text" width="800" height="376"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select main-network(VPC) &lt;/li&gt;
&lt;li&gt;private-2a (For the home page) &lt;/li&gt;
&lt;li&gt;default security group .&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;And for our about page select the subnet in the private-2b and rest of all are same .&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Note :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If you see it not has a public IP and it has a private IP address, &lt;br&gt;
which is only reachable from our &lt;strong&gt;public instance&lt;/strong&gt; . which in our case the &lt;strong&gt;proxy-server&lt;/strong&gt; .&lt;/p&gt;

&lt;p&gt;After creating both the AMI's we now can have a look at our next architecture .&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwi8rs6aq3bdo6re8awud.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwi8rs6aq3bdo6re8awud.png" alt="Alt Text" width="800" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As per the diagram we have to define a load-balancer which can indeed talk to our AMIs . As per the path based routing specified routing .&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Make sure we can connect to our private networks through the proxy-sever :&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Steps:&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Copy the pem file which is in our local system to the proxy server .
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ scp -i pemfile ubuntu@publicip:/home/ubuntu&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Next connect to the private server(blog-home) through &lt;strong&gt;private IP .&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;$ ssh -i pemfile ubuntu@privateip&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;If you are trying to connect to one of our machine which is deployed in the private subnet it could not because it is not a part of our main network .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;check in both home and about server if the apache server is running or not .&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Configure our load balancer to connect to the server .&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwbycj12kdoattn8gp63e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwbycj12kdoattn8gp63e.png" alt="cloud-load-balncer" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Steps :&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;load-balancer&lt;/li&gt;
&lt;li&gt;create a load balance&lt;/li&gt;
&lt;li&gt;&lt;p&gt;application load balancer (which helps in path based routing) &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Configuration :&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;name --&amp;gt; blog-demo&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Protocol --&amp;gt; HTTP&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;VPC--&amp;gt; main&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;availability jones public-2a and public-2b&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;default firewall&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Make sure you have the security group same as your servers . otherwise it will throw an error says server is not healthy&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsr2m1tbi2t0ehaf0anti.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsr2m1tbi2t0ehaf0anti.png" alt="Alt Text" width="800" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;routing give it a name and then select the blog-demo and blog-about .&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;target group (set of severs that you can connect to)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;1.name --&amp;gt; home-page-server&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;next --&amp;gt; select main-home&lt;/li&gt;
&lt;li&gt;home target group should have the home server attached if not then edit it .&lt;/li&gt;
&lt;li&gt;create one target group for about-page-server &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Then edit rules for the Load-balancer :&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Steps :&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;load balancer &lt;/li&gt;
&lt;li&gt;in the listeners &lt;/li&gt;
&lt;li&gt;edit rules &lt;/li&gt;
&lt;li&gt;configure the path /about* --&amp;gt; about-page-server --&amp;gt; save&lt;/li&gt;
&lt;li&gt;configure the path /home* --&amp;gt; home-page-server --&amp;gt; save&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fr8ofuujmwdhy0gyx3df8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fr8ofuujmwdhy0gyx3df8.png" alt="Alt Text" width="800" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then copy the load balancer DNS URL and paste it in the browser .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh to stream server .

cd /var/www/html
mkdir watch
cp index.html /about

ssh to home server . 

cd /var/www/html
mkdir home
cp index.html /home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now our servers are inside a private subnet and we can only connect to them through using a proxy server that we have deployed in our public region .&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;NAT Gateway :&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In case we need to update our server or the application then we could not do in our current architecture . We have to configure &lt;code&gt;NAT&lt;/code&gt; (Network address translation) which converts the private IP to public and then we can communicate to the Internet .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcllgvzmsoywf6ni2kf3z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcllgvzmsoywf6ni2kf3z.png" alt="AWS NAT gateway" width="625" height="417"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h4&gt;
  
  
  Steps to attach a NAT gateway
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the Nat Gateways &lt;/li&gt;
&lt;li&gt;&lt;p&gt;create a NAT Gateway&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqwyaq3cn9xniozsczzvs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqwyaq3cn9xniozsczzvs.png" alt="Nat setup" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Edit the private route table routing configuration .&lt;br&gt;
Destination : 0.0.0.0/0 &lt;br&gt;
Target : NAT-gateway&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdd72ypu6iot3xj6zg7ld.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdd72ypu6iot3xj6zg7ld.png" alt="create nat" width="800" height="484"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Now your private instance is attached to the internet .&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;$ping www.google.com&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h1&gt;
  
  
  Thank You For reading 🔥🔥🔥
&lt;/h1&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Prometheus architecture and use cases :</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Sun, 29 Nov 2020 15:10:17 +0000</pubDate>
      <link>https://dev.to/machine_coder/prometheus-architecture-and-use-cases-3ndi</link>
      <guid>https://dev.to/machine_coder/prometheus-architecture-and-use-cases-3ndi</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;What is Prometheus :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Prometheus is an open source automated monitoring and Alerting tool used for analyze the logs and send the alerts in case of any failure .&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Why use Prometheus :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;As we all know &lt;strong&gt;monitoring&lt;/strong&gt; our application as well as the infrastructure is really an essence and monitoring distributed applications is a real challenge .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Prometheus&lt;/strong&gt; helps us in that area where it scrapes the metrics data from the endpoint using query language(PromQL).&lt;/li&gt;
&lt;li&gt;Can be configured with Grafana which is a data visualization tool used for analyze the metrics data .&lt;/li&gt;
&lt;li&gt;Trigger the alters in case of any misconfiguration in our application .&lt;/li&gt;
&lt;li&gt;And the best part that it is free so community support is good . &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Prometheus Components :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Prometheus server&lt;/strong&gt; :&lt;br&gt;
Is the core component of &lt;strong&gt;Prometheus&lt;/strong&gt; consists of three components .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Client Libraries :&lt;/strong&gt;&lt;br&gt;
Provides language support for monitoring different applications . &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Push gateway :&lt;/strong&gt;&lt;br&gt;
Push all the collected data to the database but only for short-lived jobs .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Exporters :&lt;/strong&gt;&lt;br&gt;
It is a script needed for configuration like exposing the /metrics endpoint . &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Alert Manager :&lt;/strong&gt;&lt;br&gt;
Send alerts in case of misconfiguration to different channels like slack, email, notification .&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Prometheus Architecture :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fprometheus.io%2Fassets%2Farchitecture.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fprometheus.io%2Fassets%2Farchitecture.png" alt="Prometheus architecture" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Prometheus server :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;Data retrieval worker &lt;/li&gt;
&lt;li&gt;Time series database&lt;/li&gt;
&lt;li&gt;HTTP server&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data retriever&lt;/strong&gt; helps us to retrieve the data from the application endpoint .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Time series database&lt;/strong&gt; stores the metrics data so later they can be retrieved and analyzed .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTP server&lt;/strong&gt; accepts PromQL query language push the collected data to the dashboard for visualization purpose .&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;push gateway :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;In case of pull mechanism &lt;strong&gt;data retrieval worker&lt;/strong&gt; pull all the metrics data from the endpoint .&lt;/li&gt;
&lt;li&gt;As a result multiple Prometheus instances can pull metrics data .&lt;/li&gt;
&lt;li&gt;But for short lived jobs like batch jobs which can be pushed to the Prometheus database . In that can we can use the push gateway .&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Alert Manager :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Responsible for sending the alters in case of any failure in the system .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5wog1c7gxq1ycxm2zxee.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5wog1c7gxq1ycxm2zxee.png" alt="Alt Text" width="800" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Prometheus web UI :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Prometheus have it's own UI to visualize the logs but can be configured with Grafana .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq7lhwvtwu0af166j5txm.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq7lhwvtwu0af166j5txm.jpg" alt="Grafana" width="800" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What does Prometheus monitor :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Linux/windows server&lt;/li&gt;
&lt;li&gt;Web server&lt;/li&gt;
&lt;li&gt;Stateless application&lt;/li&gt;
&lt;li&gt;Statefull application &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;which units are monitored of those targets ?&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It totally depends if we are analyzing log of an application or an operating system .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CPU states &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Memory and disk usages&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;request count&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;request Duration&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Exception count &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These all are known as metrics which got saved into time series database which then can be visualized .&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;How does Prometheus collects the data :&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;The third component in our &lt;strong&gt;Prometheus server&lt;/strong&gt; which is a HTTP server which uses &lt;strong&gt;PromQL&lt;/strong&gt; query language and then scrapes the  metric data form worker nodes through a &lt;strong&gt;HTTP endpoint - hostaddress/metrics&lt;/strong&gt;   &lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Target endpoint and exporters :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Some services are exposing to &lt;strong&gt;/metrics&lt;/strong&gt; endpoint by default but many services have not .&lt;/li&gt;
&lt;li&gt;exporter is a script and that fetches metric from the target so that Prometheus can understand that .&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example of a Linux server exporter :&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;download node expoter&lt;/li&gt;
&lt;li&gt;untar and execute &lt;/li&gt;
&lt;li&gt;converts metrics of the server&lt;/li&gt;
&lt;li&gt;exposes /metrics endpoint&lt;/li&gt;
&lt;li&gt;configure Prometheus to scrape this endpoint
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Client libraries :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Client libraries have different language support for monitoring your application .&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Data storage :&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Prometheus stores its on-disk time series data under the directory specified by the flag &lt;strong&gt;storage.local.path&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;But can be configured to store the data on a remote location .&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fprometheus.io%2Fdocs%2Fprometheus%2Flatest%2Fimages%2Fremote_integrations.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fprometheus.io%2Fdocs%2Fprometheus%2Flatest%2Fimages%2Fremote_integrations.png" alt="remote data storage" width="800" height="400"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Configuring Prometheus&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In &lt;strong&gt;Prometheus.yaml&lt;/strong&gt; file you can define your desired configuration .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;global config&lt;/strong&gt; defines how often Prometheus will scrape it's targets . &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;rules&lt;/strong&gt; for aggregating metric values or creating alerts when condition met .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scrape config&lt;/strong&gt; for what resources Prometheus monitor . &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>prometheus</category>
      <category>devops</category>
      <category>monitoring</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
