<?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>Forem: Deepak Patil</title>
    <description>The latest articles on Forem by Deepak Patil (@deepcodr).</description>
    <link>https://forem.com/deepcodr</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%2F506947%2F8e927f68-a70c-40fd-9b85-94a5dd1b5137.png</url>
      <title>Forem: Deepak Patil</title>
      <link>https://forem.com/deepcodr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/deepcodr"/>
    <language>en</language>
    <item>
      <title>How to Efficiently Run Meta LLaMA on a MacBook Air M1 with Limited RAM</title>
      <dc:creator>Deepak Patil</dc:creator>
      <pubDate>Fri, 06 Dec 2024 15:16:20 +0000</pubDate>
      <link>https://forem.com/deepcodr/how-to-efficiently-run-meta-llama-on-a-macbook-air-m1-with-limited-ram-5c7l</link>
      <guid>https://forem.com/deepcodr/how-to-efficiently-run-meta-llama-on-a-macbook-air-m1-with-limited-ram-5c7l</guid>
      <description>&lt;p&gt;Running advanced AI models like Meta’s LLaMA on a MacBook might seem ambitious specifically when you have M1 with 8 GB of RAM, But with the right steps, you can start building AI apps locally on your Mac easily. Thanks to Apple’s processor architecture and efficient libraries like &lt;strong&gt;Llama.cpp&lt;/strong&gt;, you can unlock the power of large language models right from your lightweight laptop.&lt;/p&gt;

&lt;p&gt;Let's get you started with the MacBook Air M1 for running these models efficiently.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Download the entire model from Meta's official site by providing your information &amp;amp; details for usage.&lt;/p&gt;

&lt;p&gt;Install the necessary packages as mentioned in the readme file.&lt;/p&gt;

&lt;p&gt;Run the below command to run the model&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;torchrun \
  --nproc_per_node=$NGPUS \
  llama_models/scripts/example_chat_completion.py $CHECKPOINT_DIR \
  --model_parallel_size $NGPUS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Definitely, this is not going to work ☹️. To solve this issue we will be following two methods below&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;first, we will be using &lt;em&gt;llama.cpp&lt;/em&gt; which provides lightweight C++ implementation for running models on various hardware.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;We will use quantization to reduce the model size so that we will be able to run it easily.&lt;br&gt;
&lt;/p&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Step 1 (This one will work):&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Install llama.cpp using brew.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install llama.cpp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now let's quantize the llama model. To perform this we have a very good space on HuggingFace called GGUF-My-Repo. Follow the below link to go to space.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://huggingface.co/spaces/ggml-org/gguf-my-repo" rel="noopener noreferrer"&gt;GGUF-MY-REPO&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On this space login with your HuggingFace credentials. Then select the model repository that you want to quantize. For llama, you need to get access to the repo. Select the checkbox for 'Create a private repo under your username'. If you are a beginner then leave other options to default and proceed.&lt;/p&gt;

&lt;p&gt;Once the process is done you will have a quantized model created in your private repository.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Clone the HuggingFace repo just created on your Mac. Run the model using the command below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;llama-cli -m GGUF_MODEL_FILE_NAME -n 1024 -ngl 1 -c 512 --prompt PROMT cnv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;llama-cli -m meta-llama-3.1-8b-q4_k_m.gguf -n 1024 -ngl 1 -c 512 --prompt "Hello" -cnv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also run directly from the repository name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;llama-cli --hf-repo Deepcodr/llama_sample_chat-Q4_K_M-GGUF --hf-file llama_sample_chat-q4_k_m.gguf -p "The meaning to life and the universe is"

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

&lt;/div&gt;






&lt;br&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Tip:&lt;/strong&gt;&lt;/em&gt; If you are a beginner avoid using base models if you don't want to get some gibberish or random responses. Instead use instruct models such as chat, or text. etc. You can find some already quantized models &lt;a href="https://huggingface.co/Deepcodr" rel="noopener noreferrer"&gt;here&lt;/a&gt;

</description>
      <category>deepcodr</category>
      <category>ai</category>
      <category>machinelearning</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to upload react build files to S3 from GitHub Actions</title>
      <dc:creator>Deepak Patil</dc:creator>
      <pubDate>Tue, 08 Oct 2024 07:25:07 +0000</pubDate>
      <link>https://forem.com/deepcodr/how-to-upload-react-build-files-to-s3-from-github-actions-15fc</link>
      <guid>https://forem.com/deepcodr/how-to-upload-react-build-files-to-s3-from-github-actions-15fc</guid>
      <description>&lt;p&gt;Every time you push new changes to your React app, it’s live on the web within minutes—no manual uploads, no repetitive commands, just pure automation magic. With GitHub Actions and Amazon S3, you can make it happen but there is a catch, Very few prebuilt scripts are available for uploading react build files to S3 from GitHub actions. In this post, Let's see how to connect the dots between your React project and AWS S3 using GitHub Actions, turning every code push into an automatic deployment.&lt;/p&gt;

&lt;p&gt;To begin with we need to create a script that will iterate over all files in the build folder and then use &lt;em&gt;&lt;strong&gt;aws-sdk&lt;/strong&gt;&lt;/em&gt; to upload all files to the S3 bucket configured with static website hosting. First we will import required packages to JS script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const S3 = require('aws-sdk/clients/s3');
const path =require('path');
const fs = require('fs');
const klawSync = require('klaw-sync');
const {lookup} = require('mime-types')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we will initialize the S3 client and get build folder path which will be generated from github action with &lt;code&gt;npm run build&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;var awsoptions = {
    accessKeyId : process.env.AWS_ACCESS_KEY_ID,
    secretAccessKey : process.env.AWS_ACCESS_KEY
}

const buildFolderPath = path.join(__dirname,'build')

var s3 = new S3(awsoptions);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we will use &lt;strong&gt;&lt;em&gt;klaw-sync&lt;/em&gt;&lt;/strong&gt; to get file path for each file and then upload that file to the S3 bucket using upload() function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const filePaths = klawSync(buildFolderPath,{
    nodir : true
});

filePaths.map((filePath)=&amp;gt;{
    const fileContent = fs.createReadStream(filePath.path);
    const bucketPath = path.join('',path.relative(buildFolderPath,filePath.path));


    config ={
        Bucket : 'YOUR_BUCKET_NAME',
        Body : fileContent,
        Key : bucketPath,
        ContentType : lookup(filePath.path) || "text/plain"
    }

    upload(config);
})

function upload(config){
    return new Promise((resolve) =&amp;gt; {
        s3.upload(config, (err, data) =&amp;gt; {
          if (err) console.error(err);
          console.log(`uploaded - ${data.Key}`);
          console.log(`located - ${data.Location}`);
          resolve(data.Location);
        });
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thats it place this script file in react project directory where package.json is present. Run this script from your github action workflow after building the react project. Once called it will upload all files from build folder to bucket. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Example job steps for building &amp;amp; uploading files&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    steps :
      - uses : actions/checkout@v4
      - uses : actions/setup-node@v4
        with :
          node-version : 20
      - name : Install node modules
        run : npm install
      - name : Build the project for production
        run : npm run build
      - name : Upload Files to S3
        run : node s3upload.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With GitHub Actions and S3 working together, deploying your React static site is no longer a tedious task but an automated part of your workflow. This setup not only saves time but also ensures that every time your static files get pushed to the bucket while developer can focus on development.&lt;/p&gt;

</description>
      <category>deepcodr</category>
      <category>react</category>
      <category>aws</category>
      <category>github</category>
    </item>
    <item>
      <title>What are AI accelerators or NPUs?</title>
      <dc:creator>Deepak Patil</dc:creator>
      <pubDate>Thu, 12 Sep 2024 14:46:50 +0000</pubDate>
      <link>https://forem.com/deepcodr/what-are-ai-accelerators-or-npus-187e</link>
      <guid>https://forem.com/deepcodr/what-are-ai-accelerators-or-npus-187e</guid>
      <description>&lt;p&gt;   With the increasing popularity of AI software &amp;amp; technologies, there is a need for specialized hardware units to provide high performance to AI services. Traditional processors like CPUs and GPUs often struggle with the massive computational load required by advanced machine learning models. &lt;strong&gt;Neural Processing Units (NPUs)&lt;/strong&gt;, often known as &lt;em&gt;AI accelerators&lt;/em&gt; or &lt;em&gt;DL(Deep Learning) Accelerators&lt;/em&gt;, are the answer to this problem. NPUs are specialized hardware designed to boost AI tasks by optimizing performance and energy efficiency. These purpose-built processors are revolutionizing AI application performance and data processing.&lt;br&gt;
   NPUs perform various complex computational operations required by AI efficiently compared to GPUs which are more power-consuming and come at cost. NPUs have dedicated hardware circuits for training models on Trillions of parameters. Currently, GPUs are gaining popularity due to their performance in training the models. But upcoming NPUs are disrupting this trend providing much more performance than GPUs.NPUs implement in-memory computing architecture allowing them to replicate human brain-like working.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flcfa9b1asf4vuwya8w44.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flcfa9b1asf4vuwya8w44.png" alt="AWS NPUs" width="800" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  &lt;em&gt;source : AWS&lt;/em&gt;
&lt;/h6&gt;

&lt;p&gt;   These devices can help build the most complex neural networks and vision applications. Implementing the circuit for performing three types of computations (scalar, vector, tensor) makes them the elite hardware for next-generation computers. Companies like Google, Intel, and AWS have already begun constructing their NPUs dedicated for computing devices and cloud infrastructures.AWS Inferentia &amp;amp; Trainium are the NPUs powering modern AI workloads in Cloud infrastructure. &lt;br&gt;
   With the research still going on to develop more efficient NPUs it is interesting to see what next things will come to the AI evolution.&lt;/p&gt;

</description>
      <category>deepcodr</category>
      <category>aws</category>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>How to install Nginx on Mac</title>
      <dc:creator>Deepak Patil</dc:creator>
      <pubDate>Wed, 04 Sep 2024 19:25:32 +0000</pubDate>
      <link>https://forem.com/deepcodr/how-to-install-nginx-on-mac-157i</link>
      <guid>https://forem.com/deepcodr/how-to-install-nginx-on-mac-157i</guid>
      <description>&lt;p&gt;Nginx is a widely used web server, valued for its speed and reliability in serving web content. Installing Nginx on macOS allows you to leverage its local development or testing capabilities. In this post, let's understand the steps to install Nginx smoothly on your Mac, making it easy to manage and serve your web projects.&lt;/p&gt;

&lt;p&gt;Although you can install Nginx from the source code on MacOS, it is a bit complex. So, HomeBrew is the best option for installing Nginx.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Steps to install Nginx on MacOS&lt;br&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;h6&gt;
  
  
  Install Homebrew Package Manager
&lt;/h6&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can install Homebrew from official &lt;a href="https://brew.sh/" rel="noopener noreferrer"&gt;website&lt;/a&gt; or Just enter below command to install.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;h6&gt;
  
  
  Install Nginx
&lt;/h6&gt;
&lt;/blockquote&gt;

&lt;p&gt;Use the homebrew command below to install nginx.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;h6&gt;
  
  
  Start &amp;amp; Use Nginx
&lt;/h6&gt;
&lt;/blockquote&gt;

&lt;p&gt;Start the Nginx service using brew.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew services start nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now go to &lt;a href="http://localhost:8080" rel="noopener noreferrer"&gt;http://localhost:8080&lt;/a&gt; and you should see the Nginx welcome page.&lt;br&gt;
Below are some commands you can use for managing nginx service.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Stop&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;brew services stop nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Restart&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;brew services restart nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Status&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;brew services status nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By default nginx on Mac uses 8080 port. You can change nginx.conf and update the port number to 80 so that it will serve directly on &lt;em&gt;&lt;em&gt;localhost&lt;/em&gt;&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;With Nginx now running on your macOS, you're ready to explore and deploy web apps with nginx.&lt;br&gt;&lt;br&gt;
&lt;/p&gt;


</description>
      <category>deepcodr</category>
      <category>webdev</category>
      <category>devops</category>
      <category>macos</category>
    </item>
    <item>
      <title>Using S3 Bucket to host React Application</title>
      <dc:creator>Deepak Patil</dc:creator>
      <pubDate>Mon, 26 Aug 2024 18:15:25 +0000</pubDate>
      <link>https://forem.com/deepcodr/using-s3-bucket-to-host-react-application-2cc</link>
      <guid>https://forem.com/deepcodr/using-s3-bucket-to-host-react-application-2cc</guid>
      <description>&lt;p&gt;It becomes confusing when it comes to deploying a React application in production. Because there are several ways we can deploy a React application in production. But considering a static single-page website hosting, there is one popular way: AWS S3.&lt;/p&gt;

&lt;p&gt;Hosting the React application in S3 not only provides a simple yet highly available deployment option but also brings other features to the table.S3 provides versioning, logging, and security features to make the experience more seamless. Integrating it with CloudFront makes it highly available, cacheable, and faster. S3 also allows CORS configuration, which can help to control access to the resources. Along with this bucket, it can be attached to a custom domain name configured with Route 53 or DNS, making a complete, full-fledged web application.&lt;/p&gt;

&lt;p&gt;Considering these features, S3 becomes the best option for deploying React in production. It only takes a few steps to deploy a React application to S3.&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Create a S3 bucket in AWS&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Create an S3 bucket as per the required configuration and storage class. Make sure to allow public access to all objects and remove any other blocking access options.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Generate a Production Build of React application&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Run the below command in the project root to generate a production build.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this will create a build folder in the project directory with all static files.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Upload the build folder to S3 Bucket&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Upload the contents of the build folder to the bucket along with the static folder.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Add a policy to a bucket for getObject&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Edit the bucket policy to provide public access to get objects in the bucket. The policy will look like below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "Id": "Policy1729235341904",
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1729235340511",
      "Action": [
        "s3:GetObject"
      ],
      "Effect": "Allow",
      "Resource": "YOUR-S3-BUCKET-ARN/*",
      "Principal": "*"
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Enable Static hosting for S3 Bucket&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the properties of the bucket enable static website hosting. Specify index and error document as index.html (Other names if differ). Save the changes.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Test the running website using the link&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Copy the generated link and paste it into the browser to view your website running. Add a custom domain if required.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;


&lt;p&gt;Thats it! In just a few clicks the React site is live using S3.&lt;br&gt;&lt;br&gt;
&lt;/p&gt;


</description>
      <category>deepcodr</category>
      <category>react</category>
      <category>javascript</category>
      <category>aws</category>
    </item>
    <item>
      <title>Which is the best stack for the web today? MERN vs MEAN vs Spring Boot</title>
      <dc:creator>Deepak Patil</dc:creator>
      <pubDate>Mon, 12 Aug 2024 13:37:15 +0000</pubDate>
      <link>https://forem.com/deepcodr/which-is-the-best-stack-for-the-web-today-mern-vs-mean-vs-spring-boot-5gkk</link>
      <guid>https://forem.com/deepcodr/which-is-the-best-stack-for-the-web-today-mern-vs-mean-vs-spring-boot-5gkk</guid>
      <description>&lt;p&gt;Many devs nowadays have a common question in their mind, which web frameworks and stacks are best to make a career? Well the question itself is unanswerable looking at the circumstances today. However, I will try to provide the best answer based on my experience and current market trends.&lt;/p&gt;

&lt;p&gt;Let's consider the three most used and popular stacks in the market today which are MERN, MEAN and Spring. All three of these stacks come with unique functionalities and applications fulfilling different use cases. If we look at MERN Or MEAN, They are more likely to be used for complete dynamic web application development while on the other hand, spring boot is suited for microservices and loosely coupled REST API-based enterprise applications.&lt;/p&gt;

&lt;p&gt;MERN and MEAN use javascript which makes it easy to write but still allows us to use it with modern features like NoSQL datasets, Caching etc. Similarly, Spring boot uses Java which is a language that is part of most of the legacy applications. Spring Boot makes a powerful framework that allows us to develop loosely coupled and serverless architectures. Looking at other features all stacks allow support for REST APIs, Scalability, and Fault tolerance by integrating with the cloud. &lt;/p&gt;

&lt;p&gt;key features of &lt;strong&gt;MEAN&lt;/strong&gt;, &lt;strong&gt;MERN&lt;/strong&gt;, and &lt;strong&gt;Spring Boot&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Aspect&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;MEAN Stack&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;MERN Stack&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Spring Boot&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Database&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MongoDB (NoSQL)&lt;/td&gt;
&lt;td&gt;MongoDB (NoSQL)&lt;/td&gt;
&lt;td&gt;SQL/NoSQL Databases&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Server-Side Framework&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Express.js&lt;/td&gt;
&lt;td&gt;Express.js&lt;/td&gt;
&lt;td&gt;Spring Framework&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Development Paradigm&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Full-Stack JavaScript, Single Page Application (SPA)&lt;/td&gt;
&lt;td&gt;Full-Stack JavaScript, Component-Based Architecture&lt;/td&gt;
&lt;td&gt;Enterprise-Level Application, Microservices Architecture&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Auto-Configuration&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Embedded Servers&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes (e.g., Tomcat, Jetty, Undertow)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Microservices Support&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Limited, typically not the primary focus&lt;/td&gt;
&lt;td&gt;Limited, typically not the primary focus&lt;/td&gt;
&lt;td&gt;Strong support for microservices&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Production-Ready Features&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Depends on configuration&lt;/td&gt;
&lt;td&gt;Depends on configuration&lt;/td&gt;
&lt;td&gt;Yes, includes metrics, health checks, etc.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Security&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Depends on additional libraries&lt;/td&gt;
&lt;td&gt;Depends on additional libraries&lt;/td&gt;
&lt;td&gt;Built-in with Spring Security&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MongoDB provides scalability for data&lt;/td&gt;
&lt;td&gt;MongoDB provides scalability for data&lt;/td&gt;
&lt;td&gt;High scalability, especially in microservices architecture&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ecosystem&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Angular ecosystem for front-end&lt;/td&gt;
&lt;td&gt;React ecosystem for front-end&lt;/td&gt;
&lt;td&gt;Comprehensive Spring ecosystem, including Spring Cloud, Spring Data, etc.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Development Speed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Fast due to full-stack JavaScript and easy to understand&lt;/td&gt;
&lt;td&gt;Fast due to full-stack JavaScript and easy to understand&lt;/td&gt;
&lt;td&gt;Fast with Spring Boot’s auto-configuration and Spring Initializr but little bit complicated&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So deciding which is better is not possible. But according to me for learning a framework as a novice, MERN or MEAN stacks are the best. Because it will give a proper understanding of how web applications or REST APIs work. On another hand, if you are already well familiar with working with Java-based applications and technologies like servlets, hibernate etc. It is better to advance yourself with the power of Spring Boot.&lt;/p&gt;

&lt;p&gt;Whichever framework you choose I prefer to dive deeper into it unless you feel lost in it and then you start exploring endless possibilities with it. Once you gain so much knowledge about a particular technology the question of the best stack to make career? becomes trivial.&lt;/p&gt;

</description>
      <category>deepcodr</category>
      <category>java</category>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>v0.dev :) Future of Web UI. Will UI and Frontend Devs exist in future?</title>
      <dc:creator>Deepak Patil</dc:creator>
      <pubDate>Fri, 26 Jul 2024 13:05:52 +0000</pubDate>
      <link>https://forem.com/deepcodr/v0dev-future-of-web-ui-will-ui-and-frontend-devs-exist-in-future-5h2</link>
      <guid>https://forem.com/deepcodr/v0dev-future-of-web-ui-will-ui-and-frontend-devs-exist-in-future-5h2</guid>
      <description>&lt;p&gt;Building and designing UIs from UI/UX tools like Figma and XD with languages like HTML, CSS, and JS is way too far for today's GenAI Web Development. From these tools to website builders like WordPress and Wix, and from these platforms to AI website builders, is the next step in the world of web development. &lt;strong&gt;v0.dev&lt;/strong&gt; by Vercel is the revolutionary platform that's turning the web development community on its head. With its innovative approach to design and automation, v0.dev raises the important question of &lt;em&gt;whether frontend and UI developers will soon be extinct?&lt;/em&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;In modern web development scenarios, implementing and leveraging the powers of GenAI is a powerful way of automating the entire web development cycle. &lt;strong&gt;v0.dev&lt;/strong&gt; implements a prompt-based UI creation tool based on Shadcn UI components and layouts. It is capable of generating UI within seconds with an elegant combination of components. &lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Have a look at what it has generated within just a few clicks and prompts.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Generate a UI for product catalog of ecom website&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ja4r41uevrg0j7hhiv9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ja4r41uevrg0j7hhiv9.png" alt="Image description" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;It will take a lot of time for an experienced developer to develop such a page as compared to v0. Not only this, it also provides theming and customization options to make it more beautiful and brandy. We can copy the whole code for the UI in JSX or HTML. Just some configuration for the backend and the full-fledged site will be ready within a few minutes. And how can we forget Vercel? Using which site can be deployed and made live within another few clicks.&lt;/p&gt;

&lt;p&gt;Thus, using v0.dev and Vercel makes it a deadly combination for building web applications. Well, will it kill the jobs of web developers or UI designers is still a question. But the radical evolution in the field of web development with AI is an interesting thing to watch and observe what more it will bring to the table.&lt;/p&gt;

</description>
      <category>deepcodr</category>
      <category>webdev</category>
      <category>ui</category>
      <category>genai</category>
    </item>
    <item>
      <title>Using Scratch Base image provided by Docker</title>
      <dc:creator>Deepak Patil</dc:creator>
      <pubDate>Thu, 11 Jul 2024 15:38:18 +0000</pubDate>
      <link>https://forem.com/deepcodr/using-scratch-base-image-provided-by-docker-5a7a</link>
      <guid>https://forem.com/deepcodr/using-scratch-base-image-provided-by-docker-5a7a</guid>
      <description>&lt;p&gt;Building Base images in docker is not recommended but for those who are a bit interested in diving deeper in docker, this is a must-know thing. Even though the docker hub provides a huge collection of images for a variety of uses there are some cases where we would want to create something complex from SCRATCH !!!!.&lt;/p&gt;

&lt;p&gt;That's where the Scratch base image from Docker comes in handy. There are several ways to generate base images, such as using an already-existing Linux machine or a running container, but for now, let's utilize a Docker &lt;a href="https://hub.docker.com/_/scratch/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;scratch image&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To use scratch we just need to add &lt;strong&gt;FROM Scratch&lt;/strong&gt; in our Dockerfiles. Yes, &lt;em&gt;that's it!&lt;/em&gt; above this, you can add anything to configure your base image, Build it and it's ready to use. &lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;For Example, let's create one. Create and Add the following to the Dockerfile.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM scratch
ADD hellofromdocker /
CMD ["/hellofromdocker"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it here &lt;a href="https://github.com/Deepcodr/DOCKER/blob/main/scratch-base-image/hellofromdocker" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;hellofromdocker&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; is a static executable that does not have any runtime or linked dependencies. Since the scratch image only contains the bare minimum of runtime and settings needed to create base images, using other executables or apps may not work.&lt;/p&gt;

&lt;p&gt;Once the Dockerfile is done. build an image using docker.&lt;br&gt;
&lt;code&gt;docker build -t helloscratchimg .&lt;/code&gt;&lt;/p&gt;


&lt;p&gt;Spin up a container from a newly created base image and get hello from Docker! 🤩&lt;br&gt;&lt;br&gt;
&lt;/p&gt;


</description>
      <category>deepcodr</category>
      <category>docker</category>
      <category>devops</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to automate NPM authentication to avoid providing credentials every time</title>
      <dc:creator>Deepak Patil</dc:creator>
      <pubDate>Thu, 27 Jun 2024 18:29:20 +0000</pubDate>
      <link>https://forem.com/deepcodr/how-to-automate-npm-authentication-to-avoid-providing-credentials-every-time-2e1m</link>
      <guid>https://forem.com/deepcodr/how-to-automate-npm-authentication-to-avoid-providing-credentials-every-time-2e1m</guid>
      <description>&lt;p&gt;You must have used npm for publishing your javascript packages or using private libraries and packages. For developers using npm is a daily habit for building projects. However, It becomes tedious when authenticating NPM for using or publishing any package.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;We can avoid this by automating npm authentication. To do so follow the steps below.&lt;/p&gt;


&lt;h3&gt;
  
  
  Approach 1:
&lt;/h3&gt;

&lt;p&gt;So the naive approach is setting up credentials as environment variables. You can add the following environment variables.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;export NPM_CONFIG_EMAIL=&amp;lt;EMAIL&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;export NPM_CONFIG__AUTH=&amp;lt;AUTHENTICATION_TOKEN&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;export NPM_CONFIG_USERNAME=&amp;lt;USERNAME&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;export NPM_CONFIG_PASSWORD=&amp;lt;PASSWORD&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can get the Auth token from the NPMJS account settings page under Access tokens.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhh74ndby0z51e9vj56yw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhh74ndby0z51e9vj56yw.png" alt="Image description" width="800" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can create two types of tokens Granular access token or classic token.&lt;/p&gt;

&lt;p&gt;Under classic token, you can create use read-only, automation or publish token. Among these tokens, automation tokens bypass 2Factor Authentication.&lt;/p&gt;

&lt;p&gt;While Granular Access tokens provide more security by configuring multiple options such as Validity, IP addresses and permissions.&lt;/p&gt;



&lt;h3&gt;
  
  
  Approach 2
&lt;/h3&gt;

&lt;p&gt;Another way to perform this is by just updating the &lt;strong&gt;&lt;em&gt;.npmrc&lt;/em&gt;&lt;/strong&gt; file in the user's directory. We need to add the following line to the file. Add your auth token in place of .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//registry.npmjs.org/:_authToken=&amp;lt;YOUR_AUTH_TOKEN&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next time you perform any operations related to NPM you can focus on development as there is no more need to provide credentials every time.&lt;/p&gt;

</description>
      <category>deepcodr</category>
      <category>npm</category>
      <category>javascript</category>
      <category>javascriptlibraries</category>
    </item>
    <item>
      <title>How I have added a custom ASCII Art Banner to the React Server</title>
      <dc:creator>Deepak Patil</dc:creator>
      <pubDate>Sun, 16 Jun 2024 08:03:16 +0000</pubDate>
      <link>https://forem.com/deepcodr/how-i-have-added-a-custom-ascii-art-banner-to-the-react-server-5eig</link>
      <guid>https://forem.com/deepcodr/how-i-have-added-a-custom-ascii-art-banner-to-the-react-server-5eig</guid>
      <description>&lt;p&gt;While working with React, I wanted to have a cool ASCII art banner while running the React application in the terminal. I have tried so many NPM packages and libraries but none helped. So I have decided to make a package and built &lt;strong&gt;reactasciibanner&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This package will help to add custom ASCII art while running React applications like below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6w9ynnxbv22tvd1p65cm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6w9ynnxbv22tvd1p65cm.png" alt="Image description" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To use this package. We just have to install it in the React application using npm.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i @deepcodr/reactasciibanner
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;br&gt;&lt;br&gt;
Once installed add the ASCII art text to the file called &lt;strong&gt;ReactBannerArt.txt&lt;/strong&gt; and put this file in the src folder of the application.&lt;/p&gt;

&lt;p&gt;Then update the package.json start script command from&lt;/p&gt;

&lt;p&gt;&lt;code&gt;react-scripts start&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;to&lt;/p&gt;

&lt;p&gt;&lt;code&gt;react-banner start&lt;/code&gt;&lt;/p&gt;



&lt;p&gt;And that's it you will see ASCII art in the terminal after running the application using &lt;code&gt;npm start&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9v5zvaz1gd1cp5cf4juc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9v5zvaz1gd1cp5cf4juc.png" alt="Image description" width="800" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/@deepcodr/reactasciibanner" rel="noopener noreferrer"&gt;package link @deepcodr/reactasciibanner&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Video Tutorial To Use Package : &lt;br&gt;
&lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://www.youtube.com/watch?si=5y8ljaAIP3duP20e&amp;amp;v=huxY59XMscA&amp;amp;feature=youtu.be" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--xHMY4Y1v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.ytimg.com/vi/huxY59XMscA/maxresdefault.jpg" height="450" class="m-0" width="800"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://www.youtube.com/watch?si=5y8ljaAIP3duP20e&amp;amp;v=huxY59XMscA&amp;amp;feature=youtu.be" rel="noopener noreferrer" class="c-link"&gt;
          How I have added custom ASCII art banner in React Application | ASCII art banner in React terminal - YouTube
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          How I have added a custom ASCII art banner in React Application | ASCII art banner in React terminal | How to add custom ASCII art banner in React while runn...
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--xqgoOdha--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.youtube.com/s/desktop/0c61234c/img/favicon.ico" width="16" height="16"&gt;
        youtube.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>deepcodr</category>
      <category>webdev</category>
      <category>npm</category>
      <category>react</category>
    </item>
    <item>
      <title>Running Django Application On Kubernetes</title>
      <dc:creator>Deepak Patil</dc:creator>
      <pubDate>Mon, 03 Jun 2024 19:16:31 +0000</pubDate>
      <link>https://forem.com/deepcodr/running-django-application-on-kubernetes-53ah</link>
      <guid>https://forem.com/deepcodr/running-django-application-on-kubernetes-53ah</guid>
      <description>&lt;p&gt;Imagine your Django application running in Kubernetes equipped with features of Kubernetes building a strong scalable and highly available application. In this post let's see how to dockerize and deploy a Django application on Kubernetes.&lt;/p&gt;

&lt;p&gt;Deployment of an application always starts with having a nice and error-free application. To begin with, we will use a sample Django application with a sample view to provide Hello World! response.&lt;/p&gt;

&lt;p&gt;&amp;lt;-- You can use your application or To follow along you can refer to the code from the below repo --&amp;gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Deepcodr" rel="noopener noreferrer"&gt;
        Deepcodr
      &lt;/a&gt; / &lt;a href="https://github.com/Deepcodr/django-hello-world" rel="noopener noreferrer"&gt;
        django-hello-world
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;





&lt;p&gt;Now that the application is ready, start with dockerizing and building an image. For this, we will create a requirements.txt of required modules.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

pip freeze &amp;gt; "requirements.txt"


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

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
Lets write a recipe for our docker image in Dockerfile. The minimal configuration for Dockerfile is provided below you can modify it accordingly.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

FROM python:3.9.19-alpine
RUN mkdir /DjangoHelloWorld
WORKDIR /DjangoHelloWorld
COPY / .
RUN pip install -r requirements.txt
EXPOSE 8000
CMD python manage.py runserver 0.0.0.0:8000


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

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;To use SQLite database you can simply add migrations and make migration commands in CMD at the last line&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

CMD python manage.py makemigrations &amp;amp;&amp;amp; python manage.py migrate &amp;amp;&amp;amp; python manage.py runserver 0.0.0.0:8000


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

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
Done!✅ Build the docker image using below using Docker.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

docker build -t deepcodr/node-hello-world .


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

&lt;/div&gt;

&lt;p&gt;That should create image for our application. Spin up a container if you want to test the application.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

docker run -dp 8000:8000 deepcodr/node-hello-world


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

&lt;/div&gt;

&lt;p&gt;Test the application thoroughly and then we are ready for deployment.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Lets provide YAML configuration for Kubernetes Deployment and Service. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

apiVersion : v1
kind : Service
metadata :
  name : djangohelloworld
spec :
  selector :
    app : djangohelloworld
  type : LoadBalancer
  ports :
    - port : 8000
      targetPort : 8000
---
apiVersion : apps/v1
kind : Deployment
metadata :
  name : djangohelloworld
spec :
  replicas : 1
  selector :
    matchLabels :
      app : djangohelloworld
  template :
    metadata :
      labels :
        app : djangohelloworld
    spec :
      containers :
      - name : djangohelloworld
        image : deepcodr/django-hello-world
        ports :
          - containerPort : 8000
        imagePullPolicy : Always


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

&lt;/div&gt;

&lt;p&gt;The above configuration is sufficient to run our application with minimal configuration. Save the configuration and apply it with kubectl&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl apply -f nodehelloworld.yaml


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

&lt;/div&gt;

&lt;p&gt;This should create a service and deployment in Kubernetes.Lets view running pods and services in cluster.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl get svc
kubectl get pods


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

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fhht7lrjbqpdemjpp170h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fhht7lrjbqpdemjpp170h.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
If you see a service and pods running. Your application should work 🎉&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Test the application by hitting URL in browser. You will see your homepage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F0bu32sf620obmcusf7d5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F0bu32sf620obmcusf7d5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that you know how to deploy Django application on Kubernetes 🗿, You are ready to build and configure more complex scenarios for Django with Kubernetes and explore Kubernetes in depth.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>kubernetes</category>
      <category>django</category>
      <category>deepcodr</category>
    </item>
    <item>
      <title>React App Deployment On Azure VM (NGINX) ⚛︎</title>
      <dc:creator>Deepak Patil</dc:creator>
      <pubDate>Sun, 26 May 2024 14:40:17 +0000</pubDate>
      <link>https://forem.com/deepcodr/react-app-deployment-on-azure-vm-nginx-kag</link>
      <guid>https://forem.com/deepcodr/react-app-deployment-on-azure-vm-nginx-kag</guid>
      <description>&lt;p&gt;Let's see how to deploy the React web application to Microsoft Azure Virtual Machine in this post. There are multiple ways to deploy React applications on a VM but we will see the most basic and easy one with the NGINX server with reverse proxy. So let's get to it.&lt;/p&gt;

&lt;p&gt;We will start by setting up a sample virtual machine in Azure.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a VM with Ubuntu Server or Windows server I will recommend using Ubuntu.&lt;/li&gt;
&lt;li&gt;Select the size of the VM and provide a username and password for accessing SSH.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Make Sure to enable HTTP and HTTPS ports on the VM&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once the VM is ready SSH to the VM using credentials&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh username@&amp;lt;PUBLIC-IP-ADDRESS&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;let's upload and get the application running.&lt;/p&gt;

&lt;p&gt;To upload the project we can use either AzCopy Or Azure Storage. But as this is a basic deployment :), We will clone the project from GitHub. You can also refer to my project from below.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://github.com/Deepcodr/react-hello-world"&gt;React Hello World Project&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Install NodeJS using NVM or any other option. If decide to go with NVM follow the instructions on the below page.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://www.freecodecamp.org/news/how-to-install-node-js-on-ubuntu/"&gt;Node Installation&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once the project is uploaded start and test the project whether it is running correctly.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Configure NGINX with Reverse Proxy 💡
&lt;/h2&gt;

&lt;p&gt;Install the nginx server&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check whether the service has started using the below command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl status nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it now let's add configuration for our VM Public IP in NGINX.&lt;br&gt;
copy the default configuration from sites-available directory and save it with name as Public IP of VM&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp /etc/nginx/sites-available/default /etc/nginx/sites-available/&amp;lt;PUBLIC-IP&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the newly created configuration file and update the configuration as below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
    listen 80%;
    listen [::]:80;
    # SSL configuration 
    #   
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    #3 Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;
    #3 root /var/www/html;
    # Add index.php to the list if you are using PHP
    server_name 172.203.177.104;
    location / {
        proxy_pass http://127.0.0.1:3000;
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        # try_files $uri $uri/ =404;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the file and create a symlink of the file in sites-enabled directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ln -s /etc/nginx/sites-available/&amp;lt;PUBLIC-IP&amp;gt; /etc/nginx/sites-enabled/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart the nginx server&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl restart nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now start the React server and hit the public Ip in the browser you should see a similar output as below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffh9byrir7ku9rj9dn24c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffh9byrir7ku9rj9dn24c.png" alt="Image description" width="800" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;move the react server running in background and close the SSH session. This will persist react server from stopping and we will be able to access the application directly.&lt;/p&gt;

&lt;p&gt;use ctrl+Z to stop the server. then use bg command to add process to background.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;now disown the process to make keep it running in bg.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;disown -h
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Close the SSH session we are done with deployment 🎉.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;logout
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally hit the public IP you should be able to access the application deployed.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>deepcodr</category>
      <category>webdev</category>
      <category>react</category>
    </item>
  </channel>
</rss>
