<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jalal Jahangir on Medium]]></title>
        <description><![CDATA[Stories by Jalal Jahangir on Medium]]></description>
        <link>https://medium.com/@jalaljahangir?source=rss-5e2d0a45be90------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*KCz-eI_cyq0JL5Z7</url>
            <title>Stories by Jalal Jahangir on Medium</title>
            <link>https://medium.com/@jalaljahangir?source=rss-5e2d0a45be90------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 09:53:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jalaljahangir/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to use Terraform: A Simple Demo]]></title>
            <link>https://medium.com/@jalaljahangir/how-to-use-terraform-a-simple-demo-397750d77aef?source=rss-5e2d0a45be90------2</link>
            <guid isPermaLink="false">https://medium.com/p/397750d77aef</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[terraform-docker]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[terraform-provider]]></category>
            <dc:creator><![CDATA[Jalal Jahangir]]></dc:creator>
            <pubDate>Thu, 01 Dec 2022 16:41:25 GMT</pubDate>
            <atom:updated>2022-12-01T16:41:25.907Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*59QDtuNe4bX3UTB5.png" /></figure><p>We have come a long way in the journey of automation and Terraform is just another step forward in that journey.</p><h3>What is Terraform?</h3><p>Traditionally, when you need to setup your infrastructure on some cloud platform like Google Cloud, AWS, Azure etc., you have to do it manually using their provided GUI. Now, for a one time thing, this is optimal to get the job done. But, it becomes really hectic when you have to manually replicate or change the infrastructure whenever it is needed. It would be really convenient if you could just write down what you need in one single place and everything is created automatically, wouldn’t it? Well, that&#39;s exactly what IaC tools are for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*4BNWQX-cWFrmUCBA.jpg" /></figure><p>Infrastructure as Code (IaC) tools allow you to manage and provision your infrastructure using code instead of doing it manually. One such tool is HashiCorp’s Terraform.</p><h3>How to use Terraform?</h3><p>To demonstrate how Terraform works, I will be using one of the tutorials provided by them on Docker.</p><h4>Prerequisites</h4><p>You need the following installed on your PC to perform this demo:</p><ul><li>Windows 10 or above</li><li>Terraform</li><li>Docker Desktop</li></ul><p>Here is a <a href="https://developer.hashicorp.com/terraform/tutorials/docker-get-started/install-cli">guide</a> for installation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2lBcWAGJzfCLZpna.jpg" /></figure><h3>Demo</h3><p>1) Create a directory with a name of your choice and move to that directory. For the purpose of this demo, lets name it terraform-docker.</p><pre>mkdir terraform-docker<br>cd terraform-docker</pre><p>2) Create a file to define your infrastructure.</p><pre>wsl touch main.tf<br>main.tf</pre><p>This will open main.tf.</p><p>3) Paste the following configuration in the file, save it and then close the file.</p><pre>terraform {<br>  required_providers {<br>    docker = {<br>      source  = &quot;kreuzwerker/docker&quot;<br>      version = &quot;&gt;= 2.13.0&quot;<br>    }<br>  }<br>}<br><br>provider &quot;docker&quot; {<br>  host    = &quot;npipe:////.//pipe//docker_engine&quot;<br>}<br><br>resource &quot;docker_image&quot; &quot;nginx&quot; {<br>  name         = &quot;nginx:latest&quot;<br>  keep_locally = false<br>}<br><br>resource &quot;docker_container&quot; &quot;nginx&quot; {<br>  image = docker_image.nginx.latest<br>  name  = &quot;tutorial&quot;<br>  ports {<br>    internal = 80<br>    external = 8000<br>  }<br>}</pre><p>This file consists of 3 main things.</p><h4>Terraform Block</h4><p>The terraform {} block contains configurations for Terraform including the provider(s) used for provisioning of your infrastructure. Terraform installs these providors from the <a href="https://registry.terraform.io/">Terraform Registry</a> by default.</p><h4>Providers</h4><p>The provider &quot;&quot; {} block contains configuration for the provider(s) used. You can use different providers separately or together in this block. For example, you could pass the Docker image ID to a Kubernetes service.</p><h4>Resources</h4><p>The resource block is used to define components of your infrastructure. It contains information like name and version of the docker image to use.</p><p>4) Initialize the directory with terraform init. You should see the following result or something similar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*rg3eBkvpwSCSUeDPvLxADg.png" /></figure><p>5) Format and validate the configuration.</p><pre>terraform fmt<br>terraform validate</pre><p>6) Finally, create your infrastructure using the terraform apply command. Before execution, an execution plan is printed out which looks like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qjn67zBPeE9c-Ge2tH6EHw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*8lp-WO-07IYUPt2WC9Ib7w.png" /></figure><p>Followed by a prompt for proceeding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*etKfTP-iOO4SbsrmJ3H2iQ.png" /></figure><p>Now, you can verify the existence of the NGINX container by visiting <a href="http://localhost:8000/">localhost:8000</a> in your web browser.</p><p>To destroy your infrastructure, you just need 2 words.</p><pre>terraform destroy</pre><h3>Conclusion</h3><p>Walk in the park, wasn’t it? This was a very simple demo on how to use Terraform. Consider this a starting point and continue your journey by following some of <a href="https://developer.hashicorp.com/terraform/tutorials/docker-get-started">Terraform’s own tutorials</a> on updating infrastructures like this one.</p><p>Terraform makes it that easy for you to automate creating not only docker infrastructures, but many more as well. Including infrastructures for major cloud platforms like AWS, Azure, GCP etc.</p><h3>References</h3><ul><li><a href="https://developer.hashicorp.com/terraform/tutorials/docker-get-started">Docker | Terraform | HashiCorp Developer</a></li><li><a href="https://developer.hashicorp.com/terraform/tutorials">Tutorials | Terraform | HashiCorp Developer</a></li><li><a href="https://github.com/kreuzwerker/terraform-provider-docker">GitHub - kreuzwerker/terraform-provider-docker: Terraform Docker provider</a></li><li><a href="https://github.com/HammasJalal/terraform-tut">GitHub - HammasJalal/terraform-tut</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=397750d77aef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s do DevOps with GitLab — A hands-on approach]]></title>
            <link>https://medium.com/@jalaljahangir/lets-do-devops-with-gitlab-a-hands-on-approach-7183492d8e02?source=rss-5e2d0a45be90------2</link>
            <guid isPermaLink="false">https://medium.com/p/7183492d8e02</guid>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[gitlab-cicd]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[gitlab-runner]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <dc:creator><![CDATA[Jalal Jahangir]]></dc:creator>
            <pubDate>Tue, 25 Oct 2022 15:28:05 GMT</pubDate>
            <atom:updated>2022-10-25T15:28:05.258Z</atom:updated>
            <content:encoded><![CDATA[<h3>Let’s do DevOps with GitLab — A hands-on approach</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QYkbuLGVVPdCJhwn.png" /></figure><h3>Introduction</h3><p>GitLab is a software platform that helps you automate the builds, integration, and verification of your code. With SAST, DAST, code quality analysis, plus pipelines that enable concurrent testing and parallel execution, teams get quick insights about every commit so they can deliver higher quality code faster.</p><p><a href="https://medium.com/@hammasjalal/lets-do-devops-with-gitlab-an-intro-to-gitlab-85c582c71ac9">Let’s do DevOps with GitLab — an intro to GitLab</a></p><p>In this article, I will be demonstrating how GitLab can be used to create a ReactJs application with the help of pipelines.</p><h3>Prerequisite Knowledge</h3><p>To avoid any confusion, make sure that you know some basics about the following technologies:</p><ul><li>Node (Basic commands to create a react app)</li><li>ReactJs</li><li>Docker &amp; Containers</li></ul><p>You also need to create an account on GitLab and validate it using their website.</p><p><a href="https://gitlab.com/">The most-comprehensive AI-powered DevSecOps platform</a></p><h3>Demo</h3><p>When we create a GitLab account, a group and project are created. Each project has its separate Git repository and CI/CD pipelines.</p><p>I have created the project with the name ‘ci-demo’ but you can name it anything you want.<br>Once the project is created you can clone its Git repository, using the Git command or using the ‘Open in your IDE’ option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ro8X5Kd2nc5syIm8heUjQg.png" /><figcaption>Git clone options in GitLab from repositories Tab</figcaption></figure><p>Once the repository is cloned, create the react app using the command:</p><pre>npx create-react-app .</pre><p>This will create the default template for a react app. Make sure to commit afterward.</p><p>Now comes the fun part! :)</p><h3>Using CI/CD Pipeline</h3><p>To test the react app, we need to run a CI/CD pipeline. To do that we need to create a file named ‘.gitlab-ci.yml’. But before that let’s see what this file actually does.</p><h3>GitLab CI yml file</h3><p>To perform the main tasks of a pipeline like testing, building, and deploying images, they first need to be configured. These tasks are configured as jobs in the file ‘.gitlab-ci.yml’.</p><p>Jobs are the fundamental building block of the ‘.gitlab-ci.yml’ file and they define what needs to be done. These jobs are executed by GitLab runner servers, which are machines that run the code. They can be run online, locally, or on a docker container.</p><p><a href="https://docs.gitlab.com/runner/">GitLab Runner</a></p><p>This is the ‘.gitlab-ci.yml’ file for this demo.</p><pre>run_test:<br>    # base image for running reactjs app<br>    image: node:19-alpine3.15<br>    before_script:<br>        - apk update &amp;&amp; apk upgrade<br>    script:<br>        - npm install<br>        - npm run build<br>        # for running all tests<br>        - CI=true npm test</pre><p>Here, ‘run_test’ is the name of the job. ‘image’ specifies the base image to be used by the docker container that the pipeline will run on. ‘before_script’ runs commands before the execution of the job. And finally ‘script’ runs the actual commands of the job.</p><h3>Executing the pipeline</h3><p>Once this file is created and committed, GitLab automatically detects it and runs the pipeline.</p><p>To see the execution of the pipeline, we need to go to the pipelines tab in CI/CD from the left navigation bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*LlfcTzdCmLcKlT0cFQ4QnA.png" /></figure><p>Here we can see the status of all our pipelines. We can also view the logs afterward for debugging purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8vm97Y7Pqp4a24nb5R0J3w.png" /></figure><h3>Viewing pipeline logs</h3><p>Let’s look at the logs for our container. First, the GitLab runner creates a docker container with the specified base image.</p><p>After the container is created and running, the content from the project’s Git repositories is fetched. Followed by the ‘before_script’ and ‘script’ commands execution. This finally completes the job execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y4Feknmkx2xH3ZGui4Ow4g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jW2lC2yUiHpE6sj1YKFWqg.png" /></figure><h3>Conclusion</h3><p>And with that, this demo comes to an end. After this, you can further update your application according to your needs. You can even perform further tasks like deployment, where you need to execute other jobs. But that’s a story for another time. ;)</p><p>I hope this article was helpful to you in some way. If you have any feedback for me please leave a comment. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7183492d8e02" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s do DevOps with GitLab — an intro to GitLab]]></title>
            <link>https://medium.com/@jalaljahangir/lets-do-devops-with-gitlab-an-intro-to-gitlab-85c582c71ac9?source=rss-5e2d0a45be90------2</link>
            <guid isPermaLink="false">https://medium.com/p/85c582c71ac9</guid>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[devops-platform]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[gitlab-cicd]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Jalal Jahangir]]></dc:creator>
            <pubDate>Sun, 23 Oct 2022 20:01:02 GMT</pubDate>
            <atom:updated>2022-10-23T20:01:02.218Z</atom:updated>
            <content:encoded><![CDATA[<h3>Let’s do DevOps with GitLab — an intro to GitLab</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*KEjBWEMsxUw2_anF.png" /></figure><h3>Introduction</h3><p>A common problem faced by most DevOps engineers is that there are so many tools we have to use for a single product and then integrate all the work afterward. This adds complexity to the process and as a result, mounts up time, effort, and cost utilized drastically. Migrating to a DevOps platform, such as GitLab, is the way to get out from under all of that hassle.</p><h3>What’s GitLab?</h3><p>GitLab is a software package that offers all the tools one needs as a DevOps Engineer in just one platform. Whatever you need, GitLab’s got it. It’s a platform on which developers can manage their complete DevOps workflow, anything from planning a team for a project to creating and managing code to finally, deploying and monitoring everything about the final product.</p><h3>Why GitLab?</h3><p>One of the biggest problems all DevOps Engineers face is the number of different tools to use and the integration of these tools for every project. These processes take a lot of time and effort. GitLab makes it so that we don’t need to go through any of that hassle, and as a result, has guaranteed efficiency for our software development process. GitLab has automated most processes of development from building to deployment and monitoring and provides many more features.</p><p>GitLab has distributed the process of development and deployment into 10 different stages:</p><ol><li>Planning</li><li>Creating</li><li>Verifying</li><li>Packaging</li><li>Securing</li><li>Releasing</li><li>Configuring</li><li>Monitoring</li><li>Governing</li><li>Managing</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lkbb8JBwtwGw1sFII2j8CA.png" /><figcaption>The stages of GitLab map very clearly to the DevOps workflow</figcaption></figure><p>If you want to learn more about these processes then stay tuned for more information on GitLab or you can refer to their website:</p><p><a href="https://about.gitlab.com/">The most-comprehensive AI-powered DevSecOps platform</a></p><h3>GitLab CI/CD</h3><p>Working with CI/CD pipelines is a big part of the DevOps workflow. For developing software that use CI/CD methodologies, GitLab provides the tool named GitLab CI/CD. It consists of multiple features for the configuration of CI/CD pipelines and more. For example, GitLab CI/CD uses a feature known as Auto DevOps, which, as the name suggests, automates the processes of building, testing, deploying, and monitoring our applications. It automatically detects the programming language used and uses pre-saved CI/CD templates to create and run default pipelines to build and test our applications.</p><h3>GitLab CI/CD Architecture</h3><p>The actual architecture is more complex, but for a basic understanding it looks something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/0*Lg6pZdXur6glzE_m.png" /></figure><p>There are two main parts:</p><ol><li>GitLab server: manages the application code and configurations, and runs runner servers. (knows what to do)</li><li>Runner server: executes the pipelines. (knows how to do)</li></ol><p>Runner servers can be run locally, in a docker container, or online. GitLab offers already managed GitLab servers and runner servers to make the process easier as you can start working without any setup or extra effort, but if you prefer, you can configure them yourself as well.</p><h3>Conclusion</h3><p>GitLab is a platform that can be used by professionals and beginners alike. There are multiple subscription options for GitLab, but there is also a free option that offers most of the required features for a beginner in DevOp.</p><p>If you want to learn more about GitLab, check out the documentation. It provides tutorials for beginners as well:</p><p><a href="https://docs.gitlab.com/ee/">GitLab Docs | GitLab</a></p><p>I hope this article was helpful to you in some way. If you have any feedback for me, feel free to comment. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85c582c71ac9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>