<?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: Maryjane Enechukwu</title>
    <description>The latest articles on Forem by Maryjane Enechukwu (@maryjane_enechukwu).</description>
    <link>https://forem.com/maryjane_enechukwu</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%2F1874148%2F78dd2545-21c6-445b-8f95-c7146056207f.jpg</url>
      <title>Forem: Maryjane Enechukwu</title>
      <link>https://forem.com/maryjane_enechukwu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/maryjane_enechukwu"/>
    <language>en</language>
    <item>
      <title>"Streamlined DevOps: Node.js CI/CD Pipeline with GitHub Actions"</title>
      <dc:creator>Maryjane Enechukwu</dc:creator>
      <pubDate>Sun, 08 Sep 2024 20:03:11 +0000</pubDate>
      <link>https://forem.com/maryjane_enechukwu/streamlined-devops-nodejs-cicd-pipeline-with-github-actions-4ke0</link>
      <guid>https://forem.com/maryjane_enechukwu/streamlined-devops-nodejs-cicd-pipeline-with-github-actions-4ke0</guid>
      <description>&lt;p&gt;This project demonstrates a robust Continuous Integration and Continuous Deployment (CI/CD) pipeline setup using GitHub Actions. &lt;/p&gt;

&lt;p&gt;CI/CD which stands for Continuous Integration and Continuous Delivery/Deployment is a set of practices and tools used in software development to improve the speed and quality of code delivery. &lt;/p&gt;

&lt;p&gt;Continuous Integration (CI): Developers frequently merge their code changes into a central repository where Automated builds and tests are run.&lt;br&gt;
This helps catch and fix integration issues early.&lt;/p&gt;

&lt;p&gt;Continuous Delivery (CD): This process automatically prepare code changes for release to production by ensuring that the code is always in a deployable state.&lt;br&gt;
It automatically deploys every change that passes all stages of the production pipeline.&lt;br&gt;
And no human intervention is required.&lt;/p&gt;

&lt;p&gt;The Key benefits of CI/CD:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Improved code quality and reliability&lt;/li&gt;
&lt;li&gt;Reduced manual errors&lt;/li&gt;
&lt;li&gt;Increased developer productivity&lt;/li&gt;
&lt;li&gt;More frequent releases and faster feedback. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This project is designed for developers who want to automate their build, test, and deployment processes for a Node.js application. &lt;/p&gt;

&lt;p&gt;The pipeline is configured to trigger on pushes to the main branch, ensuring that every code change is automatically built, tested, and deployed to a staging environment.&lt;/p&gt;

&lt;p&gt;Prerequisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A GitHub account&lt;/li&gt;
&lt;li&gt;A Docker Hub account&lt;/li&gt;
&lt;li&gt;Node.js and npm installed on your local machine&lt;/li&gt;
&lt;li&gt;Basic knowledge of Node.js, Docker, and YAML&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Automated Build Process: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Utilizes Docker to build the application&lt;/li&gt;
&lt;li&gt;Pushes the Docker image to Docker Hub for easy distribution&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Automated Testing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integrates Jest for running unit tests&lt;/li&gt;
&lt;li&gt;Configures the pipeline to run tests automatically on each push&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Automated Deployment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploys successful builds to a staging environment.&lt;/li&gt;
&lt;li&gt;Easily customizable for different deployment targets.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;GitHub Actions Workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Uses GitHub Actions for CI/CD, providing a free and powerful automation tool&lt;/li&gt;
&lt;li&gt;Clearly defined workflow stages: build, test, and deploy stages.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Secure Credential Management:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Utilizes GitHub Secrets for storing sensitive information like Docker Hub credentials&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To get started with this project:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Clone the repository:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   git clone https://github.com/Lumen-jane/CI-CD-for-my-Resume.git
   cd CI-CD-for-my-Resume
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install dependencies:
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;/div&gt;



&lt;p&gt;This will install all the key dependencies. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set up GitHub Secrets:
You need to integrate your own Docker Hub accounts with the CI/CD pipeline, this will allow automated building and pushing of Docker images as part of the deployment process. &lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;In your GitHub repository, go to Settings &amp;gt; Secrets and variables &amp;gt; Actions
  Add the following secrets:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;DOCKER_USERNAME&lt;/code&gt;: Your Docker Hub username&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;DOCKER_PASSWORD&lt;/code&gt;: Your Docker Hub password&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Customize your workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open &lt;code&gt;.github/workflows/maryjane_pipeline.yml&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Modify the Docker image name and deployment steps as needed&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Push changes to the main branch to trigger the workflow:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   git add .
   git commit -m "Customize CI/CD pipeline"
   git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Monitor the workflow:

&lt;ul&gt;
&lt;li&gt;Go to the "Actions" tab in your GitHub repository to see the workflow in action.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Customization Options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dockerfile: You can Modify the &lt;code&gt;Dockerfile&lt;/code&gt; in the root directory to change how your application is containerized.&lt;/li&gt;
&lt;li&gt;Tests: You can Add or modify your app.test.js, mine is just a placeholder.&lt;/li&gt;
&lt;li&gt;Deployment: Update the deployment step in the workflow file to match your staging environment setup.&lt;/li&gt;
&lt;li&gt;Dependencies: You need to add or modify dependencies, update the &lt;code&gt;package.json&lt;/code&gt; file if you want to and run &lt;code&gt;npm install&lt;/code&gt; to install dependencies as they are not included in the repository due to &lt;code&gt;.gitignore&lt;/code&gt; settings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Conclusion:&lt;/p&gt;

&lt;p&gt;This project provides a solid foundation for implementing CI/CD in your Node.js applications. By cloning this repository, you save time setting up the pipeline from scratch and can focus on customizing it to your specific needs. &lt;/p&gt;

&lt;p&gt;Please Feel free to contribute, raise issues, or suggest improvements to make this CI/CD pipeline even better!&lt;/p&gt;

</description>
      <category>cicd</category>
      <category>githubactions</category>
      <category>devops</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
