<?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: Dhaval Upadhyay</title>
    <description>The latest articles on DEV Community by Dhaval Upadhyay (@dhaval_upadhyay_30f8292a8).</description>
    <link>https://dev.to/dhaval_upadhyay_30f8292a8</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%2F1895839%2F8b85889b-dcad-4fcb-b5f7-e2066845e74f.jpg</url>
      <title>DEV Community: Dhaval Upadhyay</title>
      <link>https://dev.to/dhaval_upadhyay_30f8292a8</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dhaval_upadhyay_30f8292a8"/>
    <language>en</language>
    <item>
      <title>[Boost]</title>
      <dc:creator>Dhaval Upadhyay</dc:creator>
      <pubDate>Fri, 07 Mar 2025 11:53:43 +0000</pubDate>
      <link>https://dev.to/dhaval_upadhyay_30f8292a8/-1did</link>
      <guid>https://dev.to/dhaval_upadhyay_30f8292a8/-1did</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/dhaval_upadhyay_30f8292a8" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F1895839%2F8b85889b-dcad-4fcb-b5f7-e2066845e74f.jpg" alt="dhaval_upadhyay_30f8292a8"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/dhaval_upadhyay_30f8292a8/install-docker-using-command-line-and-pull-code-from-github-2l6c" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Install Docker using command line and pull code from github&lt;/h2&gt;
      &lt;h3&gt;Dhaval Upadhyay ・ Mar 5&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#docker&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#devops&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#aws&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>docker</category>
      <category>webdev</category>
      <category>devops</category>
      <category>aws</category>
    </item>
    <item>
      <title>Upload docker code using CI/CD pipeline of github action</title>
      <dc:creator>Dhaval Upadhyay</dc:creator>
      <pubDate>Fri, 07 Mar 2025 11:19:11 +0000</pubDate>
      <link>https://dev.to/dhaval_upadhyay_30f8292a8/upload-docker-code-using-cicd-pipeline-of-github-action-549g</link>
      <guid>https://dev.to/dhaval_upadhyay_30f8292a8/upload-docker-code-using-cicd-pipeline-of-github-action-549g</guid>
      <description>&lt;h2&gt;
  
  
  1. Install Docker on your server
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://dev.to/dhaval_upadhyay_30f8292a8/install-docker-using-command-line-and-pull-code-from-github-2l6c"&gt;Click Here to get detailed description on how to upload your code on server using docker&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Run " docker ps " command to get the image and container name
&lt;/h2&gt;

&lt;h2&gt;
  
  
  3. Store Secrets in GitHub
&lt;/h2&gt;

&lt;p&gt;Go to GitHub Repo → Settings → Secrets and variables → Actions → New Repository Secret, and add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- DOCKER_USERNAME → Your Docker Hub username
- DOCKER_PASSWORD → Your Docker Hub password/token
- SERVER_HOST → AWS Server IP
- SERVER_USER → ubuntu
- SSH_PRIVATE_KEY → Paste your AWS SSH Private Key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Create GitHub Actions Workflow
&lt;/h2&gt;

&lt;p&gt;Create .github/workflows/deploy.yml in your repo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: Deploy to QA

on:
  push:
    branches:
      - master  # Runs on direct push to 'qa'

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Code
        uses: actions/checkout@v3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2

      - name: Log in to Docker Hub
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      - name: Build and Push Docker Image
        run: |
          docker build -t dockerusername/myapp:${{ github.sha }} .
          docker push dockerusername/myapp:${{ github.sha }}

      - name: Deploy to Server
        uses: appleboy/ssh-action@v0.1.10
        with:
          host: ${{ secrets.SERVER_HOST }}
          username: ubuntu
          key: ${{ secrets.SSH_PRIVATE_KEY }}
          port: 22
          script: |
            docker pull dockerusername/myapp:${{ github.sha }}
            docker ps -a  # Debugging step to check existing containers
            docker stop myapp || true
            docker rm -f myapp || true
            docker run -d -p 3000:3000 --restart unless-stopped --name myapp dockerusername/myapp:${{ github.sha }}
            docker image prune -f

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;myapp - docker image name&lt;/li&gt;
&lt;li&gt;create account on dockerhub&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;this process will login to docker hub , build your image and pull that image to your server&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;comment if you are facing any problem or need any help &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>aws</category>
      <category>programming</category>
    </item>
    <item>
      <title>Install Docker using command line and pull code from github</title>
      <dc:creator>Dhaval Upadhyay</dc:creator>
      <pubDate>Wed, 05 Mar 2025 10:15:09 +0000</pubDate>
      <link>https://dev.to/dhaval_upadhyay_30f8292a8/install-docker-using-command-line-and-pull-code-from-github-2l6c</link>
      <guid>https://dev.to/dhaval_upadhyay_30f8292a8/install-docker-using-command-line-and-pull-code-from-github-2l6c</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Briefly introduce the importance of CI/CD in modern application development.&lt;/li&gt;
&lt;li&gt;Highlight the benefits of deploying Node.js Docker applications using aws command line and GitHub Actions.&lt;/li&gt;
&lt;li&gt;Outline the steps that will be covered in the blog.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;aws account.&lt;/li&gt;
&lt;li&gt;GitHub repository with your Node.js application.&lt;/li&gt;
&lt;li&gt;Basic knowledge of Docker and GitHub Actions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Follow Below steps to install docker first
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. update the package list
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt upgrade -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Install prerequisite packages
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install -y apt-transport-https ca-certificates curl software-properties-common

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Add Docker's official GPG key
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Set up the Docker stable repository
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Install Docker
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Verify Docker installation
&lt;/h2&gt;



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

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. Verify Docker installation
&lt;/h2&gt;



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

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Install Docker Compose
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Download and install Docker Compose
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Set executable permissions
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chmod +x /usr/local/bin/docker-compose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Verify installation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker-compose --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Clone Your Node.js Project from GitHub
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Install Git
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Clone the repository
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone "git_url"
cd "repo_name"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create Dockerfile for Node.js Application
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Inside the project directory, create a Dockerfile
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Use Node.js base image
FROM node:16-alpine

# Set working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy application code
COPY . .

# Expose the application port (e.g., 3000)
EXPOSE 3000

# Start the application
CMD ["npm", "start"]

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Build and Run Docker Container
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Build the Docker image
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker-compose build (if you have docker-compose.yml)

docker run -d -p 3000:3000 --name node_structure node:20 tail -f /dev/null  
(if you do not have docker-compose.yml)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Run the container
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker-compose up -d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Verify running container
&lt;/h2&gt;



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

&lt;/div&gt;



</description>
      <category>docker</category>
      <category>webdev</category>
      <category>devops</category>
      <category>aws</category>
    </item>
    <item>
      <title>How to Secure PHP Applications from SQL Injection Attacks</title>
      <dc:creator>Dhaval Upadhyay</dc:creator>
      <pubDate>Sun, 06 Oct 2024 07:51:56 +0000</pubDate>
      <link>https://dev.to/dhaval_upadhyay_30f8292a8/how-to-secure-php-applications-from-sql-injection-attacks-20b3</link>
      <guid>https://dev.to/dhaval_upadhyay_30f8292a8/how-to-secure-php-applications-from-sql-injection-attacks-20b3</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;SQL Injection (SQLi) is one of the most dangerous vulnerabilities that can affect web applications, especially those built using PHP. It occurs when an attacker manipulates a query by injecting malicious SQL code, potentially gaining access to sensitive data or even compromising the entire database. Despite being an old vulnerability, SQL injection is still prevalent due to poor coding practices. This blog will guide you through understanding SQL injection and implementing the best practices to secure your PHP applications from this threat.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is SQL Injection?
&lt;/h2&gt;

&lt;p&gt;SQL injection happens when an application allows user input to be passed directly into an SQL query without proper validation or escaping. This enables attackers to execute arbitrary SQL code on the database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example of SQL Injection Vulnerability:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";
$result = mysqli_query($conn, $query);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, if a malicious user enters admin' -- as the username and leaves the password blank, the query becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * FROM users WHERE username = 'admin' -- ' AND password = '';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The -- comments out the rest of the SQL statement, allowing the attacker to bypass authentication and potentially gain admin access.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of SQL Injection Attacks
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;In-band SQLi:&lt;/strong&gt; The attacker uses the same communication channel (e.g., HTTP) to launch and receive the results of the attack.&lt;br&gt;
&lt;strong&gt;Blind SQLi:&lt;/strong&gt; The attacker cannot see the result of the attack directly, but can infer information based on the web application's behavior.&lt;br&gt;
&lt;strong&gt;Out-of-band SQLi:&lt;/strong&gt; This type relies on a separate communication channel to receive the attack results.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to Prevent SQL Injection in PHP
&lt;/h2&gt;

&lt;p&gt;To prevent SQL injection, you must ensure that user inputs are never directly embedded into SQL queries. Below are several methods to mitigate SQL injection vulnerabilities.&lt;/p&gt;
&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use prepared statements (parameterized queries) to prevent SQL injection.&lt;/li&gt;
&lt;li&gt;Validate and escape all user inputs, especially in scenarios where prepared statements aren't feasible.&lt;/li&gt;
&lt;li&gt;Limit database user privileges to minimize potential damage.&lt;/li&gt;
&lt;li&gt;Keep your application and database software up-to-date with security patches.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  1. Use Prepared Statements (Parameterized Queries)
&lt;/h2&gt;

&lt;p&gt;Prepared statements ensure that SQL code and user input are strictly separated. This method is the most effective and recommended practice for preventing SQL injection.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Secure code using prepared statements
$stmt = $conn-&amp;gt;prepare("SELECT * FROM users WHERE username = ? AND password = ?");
$stmt-&amp;gt;bind_param("ss", $username, $password);  // "ss" represents the data types (string, string)
$stmt-&amp;gt;execute();
$result = $stmt-&amp;gt;get_result();

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

&lt;/div&gt;



&lt;p&gt;In this case, ? placeholders are used for user inputs, and the bind_param() function ensures the user inputs are treated as data rather than executable code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example with PDO:&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;// Secure code using PDO
$stmt = $conn-&amp;gt;prepare("SELECT * FROM users WHERE username = :username AND password = :password");
$stmt-&amp;gt;bindParam(':username', $username);
$stmt-&amp;gt;bindParam(':password', $password);
$stmt-&amp;gt;execute();
$result = $stmt-&amp;gt;fetchAll();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Use Proper Data Validation and Escaping
&lt;/h2&gt;

&lt;p&gt;Input validation ensures that user inputs conform to the expected format. For instance, if the input should be an integer, make sure it's validated as such.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Input validation example
if (!filter_var($user_id, FILTER_VALIDATE_INT)) {
    die('Invalid user ID');
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In cases where prepared statements cannot be used, escaping input with functions like mysqli_real_escape_string() or htmlspecialchars() helps mitigate risks by neutralizing harmful characters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Escaping example
$username = mysqli_real_escape_string($conn, $_POST['username']);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Limit User Privileges in the Database
&lt;/h2&gt;

&lt;p&gt;Minimize the privileges of the database user account used by the PHP application. For example, an application account should not have DROP or DELETE privileges if they are not needed. This limits the damage an attacker can cause even if they manage to exploit an SQL injection vulnerability.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Avoid Displaying SQL Errors to Users
&lt;/h2&gt;

&lt;p&gt;Do not expose database error messages to users, as they may provide useful information to attackers. Instead, log errors securely and show generic error messages to users.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Example of handling errors
if (!$result) {
    error_log("Database query failed: " . mysqli_error($conn));
    echo "An error occurred. Please try again later.";
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Use Web Application Firewalls (WAF)
&lt;/h2&gt;

&lt;p&gt;A Web Application Firewall (WAF) can provide an additional layer of security by filtering out malicious SQL queries before they reach your application. While WAFs are not a substitute for proper coding practices, they can be a valuable tool in detecting and blocking SQL injection attempts.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Keep Software Updated
&lt;/h2&gt;

&lt;p&gt;Regularly update your PHP version and database systems to patch known vulnerabilities. Outdated versions of PHP or database systems can have security flaws that may be exploited.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;SQL injection remains a prevalent threat to PHP applications, but it can be easily avoided by following the best practices outlined above. Prepared statements are the most effective defense against SQL injection, but data validation, escaping, and secure error handling also play vital roles in protecting your application. By adopting these strategies, you can safeguard your web applications and maintain a secure development environment.&lt;/p&gt;

</description>
      <category>websecurity</category>
      <category>sql</category>
      <category>programming</category>
      <category>security</category>
    </item>
    <item>
      <title>Upload Node.Js Code to azure using CI/CD pipeline using github actions</title>
      <dc:creator>Dhaval Upadhyay</dc:creator>
      <pubDate>Sat, 24 Aug 2024 18:26:58 +0000</pubDate>
      <link>https://dev.to/dhaval_upadhyay_30f8292a8/upload-nodejs-code-to-azure-using-cicd-pipeline-using-github-actions-38mo</link>
      <guid>https://dev.to/dhaval_upadhyay_30f8292a8/upload-nodejs-code-to-azure-using-cicd-pipeline-using-github-actions-38mo</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In today’s agile development environment, continuous integration and continuous deployment (CI/CD) pipelines are essential for streamlining the software delivery process. In this blog, I’ll guide you through setting up a CI/CD pipeline using GitHub Actions to deploy your Node.js application to Azure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we start, ensure you have the following:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Azure Account:&lt;/strong&gt; If you don’t have one, sign up for a free Azure account.&lt;br&gt;
&lt;strong&gt;Azure Web App:&lt;/strong&gt; Create a Web App in the Azure portal to host your Node.js application.&lt;br&gt;
&lt;strong&gt;GitHub Repository:&lt;/strong&gt; Store your Node.js application code in a GitHub repository.&lt;br&gt;
&lt;strong&gt;Node.js Application:&lt;/strong&gt; A basic Node.js application to deploy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Create an Azure Web App
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Login to Azure Portal:&lt;/strong&gt; Go to the Azure Portal.&lt;/p&gt;

&lt;p&gt;Here’s a draft blog post on deploying Node.js code to Azure using a CI/CD pipeline with GitHub Actions. Feel free to modify it to match your style and preferences.&lt;/p&gt;

&lt;p&gt;Title: Node.js Deployment Using Azure CI/CD Pipeline&lt;/p&gt;

&lt;p&gt;Introduction&lt;br&gt;
In today’s agile development environment, continuous integration and continuous deployment (CI/CD) pipelines are essential for streamlining the software delivery process. In this blog, I’ll guide you through setting up a CI/CD pipeline using GitHub Actions to deploy your Node.js application to Azure.&lt;/p&gt;

&lt;p&gt;Prerequisites&lt;br&gt;
Before we start, ensure you have the following:&lt;/p&gt;

&lt;p&gt;Azure Account: If you don’t have one, sign up for a free Azure account.&lt;br&gt;
Azure Web App: Create a Web App in the Azure portal to host your Node.js application.&lt;br&gt;
GitHub Repository: Store your Node.js application code in a GitHub repository.&lt;br&gt;
Node.js Application: A basic Node.js application to deploy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Create an Azure Web App&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Login to Azure Portal:&lt;/strong&gt; Go to the Azure Portal.&lt;/p&gt;

&lt;p&gt;Click on “Create a resource” and choose “Web App.”&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%2F7uc0xiu6lf9cm80ai2nm.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%2F7uc0xiu6lf9cm80ai2nm.png" alt="Image description" width="800" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fill in the required details, including the resource group, app name, and runtime stack (choose Node.js).&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%2F2zstd9rq9769821j3p0m.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%2F2zstd9rq9769821j3p0m.png" alt="Image description" width="800" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Set Up GitHub Actions for CI/CD
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Create a .github/workflows Directory:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Go To Deployment center&lt;/strong&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%2Fylc1l5323uelombjqzli.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%2Fylc1l5323uelombjqzli.png" alt="Image description" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Select Code Resource and select github&lt;/strong&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%2Fvsmxnhqsm7h6iq7g5l1k.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%2Fvsmxnhqsm7h6iq7g5l1k.png" alt="Image description" width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now Select github accout , repo and branch you want to deploy &lt;/p&gt;

&lt;p&gt;Now click on preview you can see .yaml file structre here &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%2F02w2d3ug1rlflxskyg25.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%2F02w2d3ug1rlflxskyg25.png" alt="Image description" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In your github directory, you can see .github/workflows directory.&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%2Fgfy3tq70ix85nkazv4km.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%2Fgfy3tq70ix85nkazv4km.png" alt="Image description" width="381" height="131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Commit and Push Changes
&lt;/h2&gt;

&lt;p&gt;Once your workflow file is set up, commit and push it to the main branch of your repository.&lt;/p&gt;

&lt;p&gt;The pipeline will trigger automatically on every push to the main branch.&lt;/p&gt;

&lt;p&gt;GitHub Actions will build your Node.js application, run tests, and deploy it to Azure.&lt;/p&gt;

&lt;p&gt;You can also check the deployment logs in the GitHub Actions tab of your repository.&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%2Fhy6xy6y23riweemhtc94.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%2Fhy6xy6y23riweemhtc94.png" alt="Image description" width="800" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this blog, we walked through the process of setting up a CI/CD pipeline using GitHub Actions to deploy a Node.js application to Azure. This setup not only automates the deployment process but also ensures that your application is always up-to-date with the latest code changes.&lt;/p&gt;

&lt;p&gt;By leveraging Azure’s scalability and GitHub’s seamless integration, you can easily maintain and deploy your Node.js applications, allowing you to focus more on building features and less on managing deployments.&lt;/p&gt;

&lt;p&gt;You can check Simple deployment without pipeline here  &lt;a href="https://dev.tourl"&gt;https://dev.to/dhaval_upadhyay_30f8292a8/uploading-your-first-nodejs-code-to-azure-a-step-by-step-guide-43k5&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>azure</category>
      <category>githubactions</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Uploading Your First Node.js Code to Azure: A Step-by-Step Guide</title>
      <dc:creator>Dhaval Upadhyay</dc:creator>
      <pubDate>Sun, 11 Aug 2024 09:19:06 +0000</pubDate>
      <link>https://dev.to/dhaval_upadhyay_30f8292a8/uploading-your-first-nodejs-code-to-azure-a-step-by-step-guide-43k5</link>
      <guid>https://dev.to/dhaval_upadhyay_30f8292a8/uploading-your-first-nodejs-code-to-azure-a-step-by-step-guide-43k5</guid>
      <description>&lt;p&gt;Hello everyone! In this post, we'll walk through the process of uploading your first Node.js code to Azure. Whether you're new to Azure or just need a refresher, this guide will help you deploy your Node.js application with ease.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we begin, ensure you have the following:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Node.js Installed&lt;/strong&gt;: Make sure you have Node.js installed on your machine. You can download it from Node.js official website.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Azure Account&lt;/strong&gt;: If you haven't already, sign up for an Azure account at azure.com.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Git Installed&lt;/strong&gt;: You'll need Git to manage your code and push it to Azure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Create a Simple Node.js Application
&lt;/h2&gt;

&lt;p&gt;Create one simple Node.js application and upload to github&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Prepare for Deployment
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Login to azure&lt;/li&gt;
&lt;li&gt;Click on App Services and click Create
&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%2Ff26k32pri0pb9me1gj0u.png" alt="Image description" width="800" height="365"&gt;
&lt;/li&gt;
&lt;li&gt;click on create button and go to web app or click as per your requirement
&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%2Fkxepnccky44omkh2xmtu.png" alt="Image description" width="800" height="411"&gt;
&lt;/li&gt;
&lt;li&gt;create new resource group 
&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%2Fdov55008nwbbgs9ik1uu.png" alt="Image description" width="800" height="411"&gt;
&lt;/li&gt;
&lt;li&gt;Fill all necessary details and select pricing plans as per your requirement&lt;/li&gt;
&lt;li&gt;go next and finally click Review &amp;amp; Create button &lt;/li&gt;
&lt;li&gt;After creating you will see the overview of your app
&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%2Fd14j0wqe1sdjqtco7vbu.png" alt="Image description" width="800" height="408"&gt;
&lt;/li&gt;
&lt;li&gt;click on deployment center
&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%2Fsi0iuuzy926udoak9wba.png" alt="Image description" width="255" height="477"&gt;
&lt;/li&gt;
&lt;li&gt;Here you will get FTP Creds to upload code. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In next step we will see how we can upload using github repo actions&lt;/p&gt;

&lt;h1&gt;
  
  
  azure #Node.js #devops #azureintegration #server #uploadNodecode
&lt;/h1&gt;

</description>
      <category>node</category>
      <category>azure</category>
      <category>devops</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
