<?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 Sajinitharushika on Medium]]></title>
        <description><![CDATA[Stories by Sajinitharushika on Medium]]></description>
        <link>https://medium.com/@sajinitharushika3655?source=rss-e1a9a8dbe515------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*UQmmoIzs8xipODQ4</url>
            <title>Stories by Sajinitharushika on Medium</title>
            <link>https://medium.com/@sajinitharushika3655?source=rss-e1a9a8dbe515------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 09:18:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sajinitharushika3655/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[Deploying a Dockerized Spring Boot Application on AWS EC2]]></title>
            <link>https://medium.com/@sajinitharushika3655/deploying-a-dockerized-spring-boot-application-on-aws-ec2-0cd3812f898e?source=rss-e1a9a8dbe515------2</link>
            <guid isPermaLink="false">https://medium.com/p/0cd3812f898e</guid>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Sajinitharushika]]></dc:creator>
            <pubDate>Wed, 18 Nov 2026 18:03:49 GMT</pubDate>
            <atom:updated>2026-11-18T18:03:49.227Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>DevOps From Zero to Production — Article 10</strong></p><p><em>A practical beginner-friendly guide to deploying a Java application on an Ubuntu cloud server using Docker, SSH, and Amazon EC2.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nba6k6fJ8oyAIER23fzilQ.png" /></figure><h3>Introduction</h3><p>In the previous articles of my <em>DevOps From Zero to Production</em> series, we explored Docker, Docker Compose, cloud computing, and Amazon Web Services (AWS).</p><p>We learned how Docker packages applications into containers and how AWS provides infrastructure that can run our applications without depending on our personal computers.</p><p>Now it’s time to connect those concepts.</p><p>Imagine developing a Spring Boot application on your laptop.</p><p>You can start it locally and access it at:</p><p><a href="http://localhost:8080/">http://localhost:8080</a></p><p>But your friends or other users cannot automatically access that application from their computers.</p><p>How can we make it available through a cloud server?</p><p>In this tutorial, we’ll build a Docker image for a Spring Boot application, launch an Ubuntu server using Amazon EC2, connect to it using SSH, install Docker, and run our application.</p><p>By the end, we’ll understand the basic journey from local development to cloud deployment.</p><p><strong>Important:</strong> This tutorial is for learning. It uses HTTP for a temporary demonstration, not a production-ready HTTPS deployment. Creating AWS resources may result in charges.</p><h3>1. Understanding What We’re Building</h3><p>Before starting, let’s understand our application architecture.</p><p>Our deployment will contain four main components:</p><ul><li><strong>Spring Boot:</strong> The Java application that handles HTTP requests.</li><li><strong>Docker:</strong> Packages and runs the application inside a container.</li><li><strong>Amazon EC2:</strong> Provides the virtual server that hosts the container.</li><li><strong>Security Group:</strong> Controls which network connections can reach our EC2 instance.</li></ul><p>The workflow looks like this:</p><p><strong>Spring Boot Source Code → JAR File → Docker Image → AWS EC2 → Running Docker Container → Browser</strong></p><p>Here, the application runs on an AWS virtual server instead of our laptop.</p><p>This is our first practical step toward understanding cloud deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XLj8XBzNGwPb_yPizDhuiQ.png" /></figure><h3>2. Prerequisites</h3><p>Before following this tutorial, we need:</p><ul><li>An AWS account with permission to create EC2 resources.</li><li>Docker installed and running on our local computer.</li><li>Java 21.</li><li>Maven or a Maven Wrapper.</li><li>A simple Spring Boot project.</li><li>A terminal such as PowerShell, Bash, or a Linux terminal.</li><li>Basic familiarity with Git and Linux commands.</li></ul><p>We’ll use a laptop to build the application, then upload the necessary deployment files to EC2.</p><p>Before creating AWS resources, review your account’s pricing eligibility and configure a billing budget or alert.</p><p>A budget notification is useful, but it does not automatically prevent spending.</p><h3>3. Create a Simple Spring Boot Application</h3><p>We’ll start with a very small application.</p><p>Visit:</p><p><a href="https://start.spring.io/">https://start.spring.io/</a></p><p>Choose:</p><ul><li>Project: Maven</li><li>Language: Java</li><li>Java: 21</li><li>Dependency: Spring Web</li><li>Packaging: Jar</li></ul><p>Choose a currently supported Spring Boot version compatible with Java 21.</p><p>Generate the project and open it in your preferred editor.</p><h3>Create a REST Controller</h3><p>Inside the main application package, create a controller such as HelloController.java.</p><pre>package com.example.demo;</pre><pre>import org.springframework.web.bind.annotation.GetMapping;<br>import org.springframework.web.bind.annotation.RestController;</pre><pre>@RestController<br>public class HelloController {</pre><pre>    @GetMapping(&quot;/hello&quot;)<br>    public String hello() {<br>        return &quot;Hello from AWS EC2 and Docker!&quot;;<br>    }<br>}</pre><p>If your project uses another package name, change the package declaration accordingly.</p><p>This endpoint returns a simple message when someone visits /hello.</p><h3>Test the Application Locally</h3><p>From the project root, run:</p><pre>./mvnw spring-boot:run</pre><p>On Windows PowerShell, use:</p><pre>.\mvnw.cmd spring-boot:run</pre><p>Open:</p><p><a href="http://localhost:8080/hello">http://localhost:8080/hello</a></p><p>Expected response:</p><pre>Hello from AWS EC2 and Docker!</pre><p>Our application now works locally.</p><p>Next, we’ll package it.</p><h3>4. Package the Spring Boot Application</h3><p>A Spring Boot application can be packaged into an executable JAR file.</p><p>A JAR contains the compiled application and the resources required to run it.</p><p>From the project root, run:</p><pre>./mvnw clean package</pre><p>On Windows:</p><pre>.\mvnw.cmd clean package</pre><p>Maven compiles the project and runs its configured tests.</p><p>After a successful build, look inside the target directory.</p><p>You should find an executable JAR similar to:</p><pre>target/demo-0.0.1-SNAPSHOT.jar</pre><p>For this tutorial, copy the executable JAR to a file named app.jar in the project root.</p><p>Our deployment files will then look like this:</p><pre>demo/<br>├── src/<br>├── pom.xml<br>├── Dockerfile<br>├── app.jar<br>└── target/</pre><p>We will build our Docker image using app.jar.</p><h3>5. Create a Dockerfile</h3><p>A Dockerfile contains instructions for building a Docker image.</p><p>Create a file named Dockerfile in the project root.</p><pre>FROM eclipse-temurin:21-jre</pre><pre>WORKDIR /app</pre><pre>COPY app.jar app.jar</pre><pre>EXPOSE 8080</pre><pre>ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;app.jar&quot;]</pre><p>Let’s understand each instruction.</p><h3>FROM</h3><pre>FROM eclipse-temurin:21-jre</pre><p>Uses a base image containing the Java 21 runtime.</p><h3>WORKDIR</h3><pre>WORKDIR /app</pre><p>Sets /app as the working directory inside the image.</p><h3>COPY</h3><pre>COPY app.jar app.jar</pre><p>Copies our executable JAR into the Docker image.</p><h3>EXPOSE</h3><pre>EXPOSE 8080</pre><p>Documents that the application listens on port 8080.</p><p>This instruction does not automatically publish the port.</p><h3>ENTRYPOINT</h3><pre>ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;app.jar&quot;]</pre><p>Defines the command executed when the container starts.</p><p>Now we’re ready to build our image.</p><h3>6. Build and Test the Docker Image Locally</h3><p>Open your terminal in the folder containing the Dockerfile and app.jar.</p><p>Build the image:</p><pre>docker build -t spring-ec2-demo .</pre><p>This command creates a Docker image named spring-ec2-demo.</p><p>Check that it exists:</p><pre>docker images</pre><p>Next, run the image:</p><pre>docker run -d \<br>  --name spring-local \<br>  -p 127.0.0.1:8080:8080 \<br>  spring-ec2-demo</pre><p>On Windows PowerShell, you can run the same command on one line:</p><pre>docker run -d --name spring-local -p 127.0.0.1:8080:8080 spring-ec2-demo</pre><p>Now test:</p><p><a href="http://localhost:8080/hello">http://localhost:8080/hello</a></p><p>If it works, we have successfully containerized our application.</p><p>Check the running container:</p><pre>docker ps</pre><p>View its logs:</p><pre>docker logs spring-local</pre><p>Stop the local container when testing is complete:</p><pre>docker stop spring-local</pre><p>At this point, Docker is working locally.</p><p>Next, we’ll prepare a cloud server.</p><h3>7. Create an AWS EC2 Instance</h3><p>EC2 stands for <strong>Elastic Compute Cloud</strong>.</p><p>It provides virtual servers called instances.</p><p>An instance is similar to renting a computer in AWS.</p><h3>Step 1 — Open the AWS Console</h3><p>Sign in to AWS and open the EC2 dashboard.</p><p><a href="https://console.aws.amazon.com/ec2/">https://console.aws.amazon.com/ec2/</a></p><p>Select an AWS Region suitable for your location and requirements.</p><p>For example, you might choose the Singapore Region.</p><p>Remember that instance prices and available instance types can vary between Regions.</p><h3>Step 2 — Launch an Instance</h3><p>Select <strong>Launch instance</strong>.</p><p>Give your instance a descriptive name, such as:</p><p>spring-boot-docker-demo</p><h3>Step 3 — Choose an Operating System</h3><p>Select an official Ubuntu Server LTS AMI.</p><p>An <strong>AMI (Amazon Machine Image)</strong> is the template used to create an EC2 instance.</p><p>For this example, Ubuntu Server 24.04 LTS is a suitable choice when available.</p><h3>Step 4 — Choose an Instance Type</h3><p>Choose an instance type that can support Docker and our small Java application.</p><p>Check the current price and any account-specific free-usage eligibility before selecting it.</p><p>The cheapest option is not necessarily appropriate for every Spring Boot workload, especially when memory is limited.</p><h3>Step 5 — Create a Key Pair</h3><p>If using SSH authentication, create a key pair.</p><p>For example:</p><p>spring-demo-key</p><p>Download the private key file, such as:</p><p>spring-demo-key.pem</p><p>Store it securely.</p><p>The private key allows an authorized user to authenticate to the EC2 instance.</p><p>Never upload the private key to GitHub or share it publicly.</p><h3>Step 6 — Configure Networking</h3><p>For this learning exercise, choose a subnet with appropriate internet routing and enable a public IP address if required for direct access.</p><p>Ensure the instance is protected by a security group.</p><p>We’ll configure its rules next.</p><h3>Step 7 — Review Storage</h3><p>The instance needs storage for Ubuntu, Docker images, and application files.</p><p>Review the default EBS volume size and price before launching.</p><p><strong>EBS (Elastic Block Store)</strong> provides block storage used by EC2 instances.</p><h3>Step 8 — Launch</h3><p>Review the configuration and choose <strong>Launch instance</strong>.</p><p>Wait until the EC2 instance reaches the Running state and its status checks pass.</p><p>We now have a virtual Linux server in AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VKOPfZs-1ZsT1H-LCe_KZA.png" /></figure><h3>8. Configure the EC2 Security Group</h3><p>A security group acts as a virtual firewall for the instance.</p><p>It determines which incoming and outgoing network traffic is allowed.</p><p>For our tutorial, we need to consider two ports.</p><h3>Port 22 — SSH</h3><p>SSH lets us connect remotely to the Linux server.</p><p>If using direct SSH, allow inbound TCP port 22 only from your current public IP address or another trusted source.</p><p>Do not unnecessarily expose SSH to the entire internet.</p><h3>Port 8080 — Spring Boot</h3><p>Our Spring Boot container will listen on port 8080.</p><p>For temporary testing, allow inbound TCP port 8080 from your own public IP address.</p><p>This lets us test the application from our browser while limiting who can reach it.</p><p>A simple security-group configuration is:</p><p>TypePortSourceSSH22Your IP addressCustom TCP8080Your IP address</p><p>For this demonstration, we do not need to expose PostgreSQL, Redis, or any other database ports.</p><p>Remember that this is a temporary learning configuration.</p><p>For production applications, we would normally use HTTPS on port 443 with an appropriate reverse proxy or load balancer.</p><h3>9. Connect to the EC2 Instance Using SSH</h3><p>Our server is running, but how do we control it?</p><p>We can use SSH.</p><p><strong>SSH stands for Secure Shell.</strong></p><p>SSH allows us to securely access another computer through a terminal.</p><p>Find your instance’s public IP address in the EC2 console.</p><p>For example:</p><p>203.0.113.10</p><p>This is a documentation-only example address. Replace it with your actual instance address.</p><h3>Linux or macOS</h3><p>If the key is stored in your current directory, restrict its permissions:</p><pre>chmod 400 spring-demo-key.pem</pre><p>Then connect:</p><pre>ssh -i spring-demo-key.pem ubuntu@203.0.113.10</pre><h3>Windows PowerShell</h3><p>Open PowerShell in the folder containing your key file.</p><p>Run:</p><pre>ssh -i .\spring-demo-key.pem ubuntu@203.0.113.10</pre><p>Windows SSH may require you to restrict the private key file’s permissions if they are too broad.</p><p>The default username for a typical official Ubuntu EC2 AMI is ubuntu.</p><p>Once the connection succeeds, you’ll have a Linux terminal running on your EC2 instance.</p><p>AWS also provides browser-based connection methods such as EC2 Instance Connect and Systems Manager Session Manager, subject to their prerequisites.</p><h3>10. Install Docker on Ubuntu EC2</h3><p>Now we’re working inside the Ubuntu server.</p><p>We need Docker to run our application container.</p><p>First, update the package lists:</p><pre>sudo apt update</pre><p>Before proceeding, check whether Docker is already installed:</p><pre>docker --version</pre><p>If Docker is not installed, we can use Docker’s official Ubuntu package repository.</p><h3>Step 1 — Install Required Packages</h3><pre>sudo apt install -y ca-certificates curl</pre><h3>Step 2 — Add Docker’s Signing Key</h3><pre>sudo install -m 0755 -d /etc/apt/keyrings</pre><pre>sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg \<br>  -o /etc/apt/keyrings/docker.asc</pre><pre>sudo chmod a+r /etc/apt/keyrings/docker.asc</pre><h3>Step 3 — Add Docker’s Repository</h3><pre>sudo tee /etc/apt/sources.list.d/docker.sources &gt; /dev/null &lt;&lt;EOF<br>Types: deb<br>URIs: https://download.docker.com/linux/ubuntu<br>Suites: $(. /etc/os-release &amp;&amp; echo &quot;${UBUNTU_CODENAME:-$VERSION_CODENAME}&quot;)<br>Components: stable<br>Architectures: $(dpkg --print-architecture)<br>Signed-By: /etc/apt/keyrings/docker.asc<br>EOF</pre><p>Update package information:</p><pre>sudo apt update</pre><h3>Step 4 — Install Docker</h3><pre>sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin</pre><p>These commands assume a fresh, supported Ubuntu installation without conflicting older Docker packages.</p><p>If Docker or container runtime packages are already installed, follow the official Docker documentation to resolve package conflicts safely.</p><h3>Step 5 — Verify Docker</h3><pre>sudo systemctl status docker</pre><p>Check the version:</p><pre>sudo docker --version</pre><p>Run Docker’s test container:</p><pre>sudo docker run --rm hello-world</pre><p>A successful test displays a message confirming Docker can run containers.</p><p>We’re keeping Docker commands under sudo for this example.</p><p>Adding a user to the docker group can grant root-equivalent capabilities, so it shouldn&#39;t be treated as a harmless convenience.</p><h3>11. Transfer the Application to EC2</h3><p>We have two main deployment options.</p><p>We could publish our Docker image to a container registry, then download it on EC2.</p><p>Or we could transfer the application package and Dockerfile to the server and build the image there.</p><p>For our first tutorial, we’ll use the second approach because it’s easier to understand and doesn’t require a container registry account.</p><p>We’ll use <strong>SCP (Secure Copy Protocol)</strong> to transfer files over SSH.</p><h3>Step 1 — Return to Your Local Terminal</h3><p>Keep the EC2 session available, but open another terminal on your laptop.</p><p>Make sure you have:</p><ul><li>app.jar</li><li>Dockerfile</li><li>spring-demo-key.pem</li></ul><h3>Step 2 — Create an Application Directory on EC2</h3><p>In your EC2 terminal, run:</p><pre>mkdir -p ~/spring-demo</pre><h3>Step 3 — Upload the Files</h3><p>From your local terminal, run:</p><pre>scp -i spring-demo-key.pem app.jar Dockerfile \<br>  ubuntu@203.0.113.10:~/spring-demo/</pre><p>Replace the sample IP address with your instance’s actual public address.</p><p>If the files are in different folders, use their correct paths.</p><p>On Windows PowerShell, the equivalent one-line command is:</p><pre>scp -i .\spring-demo-key.pem .\app.jar .\Dockerfile ubuntu@203.0.113.10:~/spring-demo/</pre><p>SCP securely transfers both files to our cloud server.</p><h3>Step 4 — Check the Uploaded Files</h3><p>Return to the EC2 terminal:</p><pre>cd ~/spring-demo</pre><p>List the files:</p><pre>ls -l</pre><p>You should see:</p><pre>Dockerfile<br>app.jar</pre><p>Now we’re ready to build our Docker image on EC2.</p><h3>12. Build and Run the Docker Container on EC2</h3><p>Make sure you’re inside:</p><p>~/spring-demo</p><p>Build the image:</p><pre>sudo docker build -t spring-ec2-demo .</pre><p>After a successful build, check the image:</p><pre>sudo docker images</pre><p>Start the container:</p><pre>sudo docker run -d \<br>  --name spring-app \<br>  --restart unless-stopped \<br>  -p 8080:8080 \<br>  spring-ec2-demo</pre><p>Let’s understand this command.</p><p><strong>-d:</strong> Runs the container in the background.</p><p><strong>--name spring-app:</strong> Names the container.</p><p><strong>--restart unless-stopped:</strong> Configures Docker to restart the container after certain failures or daemon restarts, unless it was explicitly stopped.</p><p><strong>-p 8080:8080:</strong> Publishes port 8080 on the EC2 host and forwards it to port 8080 inside the container.</p><p><strong>spring-ec2-demo:</strong> The Docker image used to create the container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qV1dtfRtsmfRTx2HHvhTtw.png" /></figure><p>Check its status:</p><pre>sudo docker ps</pre><p>View its logs:</p><pre>sudo docker logs spring-app</pre><p>Our Spring Boot application should now be running on the EC2 instance.</p><h3>13. Test the Application</h3><p>First, test it directly from the EC2 terminal:</p><pre>curl http://localhost:8080/hello</pre><p>Expected response:</p><pre>Hello from AWS EC2 and Docker!</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QFoLXmmdv-CnEs6ZwbIk2w.png" /></figure><p>If this works, the application is responding locally on the server.</p><p>Now open a browser on your laptop.</p><p>Enter your actual EC2 public IP address followed by port 8080 and the endpoint:</p><pre>http://203.0.113.10:8080/hello</pre><p>Replace the example IP address.</p><p>If the container is running and the network rules are correct, the response should appear in your browser.</p><p>Congratulations!</p><p>You’ve deployed a Dockerized Spring Boot application on an AWS EC2 instance.</p><p>Our application is no longer running only on our laptop.</p><p>It’s running on a cloud server.</p><p><strong>Security reminder:</strong> This example uses unencrypted HTTP. Do not send passwords, personal information, or other sensitive data through this demonstration endpoint.</p><h3>14. Common Deployment Problems and Troubleshooting</h3><p>Deployments don’t always work the first time.</p><p>Troubleshooting is an important DevOps skill.</p><h3>Problem 1 — SSH Connection Times Out</h3><p>Possible causes include:</p><ul><li>The security group doesn’t allow SSH from your IP.</li><li>The instance doesn’t have the required public network access.</li><li>The IP address is incorrect.</li><li>The instance is not ready.</li></ul><p>Check the instance status, public address, route configuration, and security-group rules.</p><h3>Problem 2 — Permission Denied When Connecting</h3><p>Possible causes include:</p><ul><li>Using the wrong private key.</li><li>Using the wrong Linux username.</li><li>Incorrect key-file permissions.</li></ul><p>Check that the key matches the EC2 instance and that you’re using the correct username.</p><h3>Problem 3 — Docker Permission Denied</h3><p>If a Docker command fails because you lack permissions, try the authorized command with sudo.</p><pre>sudo docker ps</pre><p>Avoid changing system permissions without understanding their security implications.</p><h3>Problem 4 — Spring Boot Container Exits Immediately</h3><p>Check the container logs:</p><pre>sudo docker logs spring-app</pre><p>Possible causes include a missing dependency, incompatible Java version, or incorrect application configuration.</p><h3>Problem 5 — Application Works on EC2 but Not in Your Browser</h3><p>Suppose this works:</p><pre>curl http://localhost:8080/hello</pre><p>But the public address doesn’t respond.</p><p>This suggests checking network access.</p><p>Verify:</p><ul><li>EC2’s public IP address.</li><li>Inbound TCP port 8080 rules.</li><li>The source IP allowed by the rule.</li><li>Docker port publishing.</li><li>The instance’s routing and firewall configuration.</li></ul><h3>Problem 6 — Port 8080 Is Already in Use</h3><p>Another application or container may already be using that host port.</p><p>You can investigate with:</p><pre>sudo ss -tuln</pre><p>Or inspect running containers:</p><pre>sudo docker ps</pre><p>Avoid stopping unfamiliar applications on a shared server.</p><h3>15. How Would We Update the Application?</h3><p>Imagine we’ve fixed a bug in our Spring Boot application.</p><p>How do we deploy the updated version?</p><p>A simple manual process is:</p><ol><li>Update the source code.</li><li>Run tests.</li><li>Build a new JAR.</li><li>Upload the updated JAR to EC2.</li><li>Build an updated Docker image.</li><li>Replace the old application container.</li></ol><p>For example, after rebuilding the image on EC2:</p><pre>sudo docker stop spring-app</pre><pre>sudo docker rm spring-app</pre><pre>sudo docker build -t spring-ec2-demo .</pre><pre>sudo docker run -d \<br>  --name spring-app \<br>  --restart unless-stopped \<br>  -p 8080:8080 \<br>  spring-ec2-demo</pre><p>This demonstrates the basic idea.</p><p>However, this manual update process introduces downtime while the old container is stopped and the new one starts.</p><p>In production, teams often use CI/CD pipelines, image registries, health checks, rolling deployments, and rollback strategies to make updates safer.</p><p>Our goal here is to understand the deployment fundamentals before automating them.</p><h3>16. Important AWS Cost Management</h3><p>One of the most important things beginners should understand is that AWS resources may cost money.</p><p>Costs can come from:</p><ul><li>EC2 compute usage.</li><li>Amazon EBS storage.</li><li>Public IPv4 addresses.</li><li>Internet data transfer.</li><li>Other services created as part of the deployment.</li></ul><p>Stopping an EC2 instance generally stops instance compute usage charges, but associated resources such as EBS volumes may continue to incur charges.</p><p>AWS also charges for public IPv4 address usage, subject to its current pricing and any applicable offers.</p><h3>Cleaning Up After the Tutorial</h3><p>When the demonstration is complete, go to the EC2 console.</p><p>Select the instance.</p><p>If you no longer need it, choose <strong>Terminate instance</strong>.</p><p>Before termination, make sure there’s no important data that must be preserved.</p><p>Termination can permanently delete attached storage when the relevant volumes are configured for deletion on termination.</p><p>Also review:</p><ul><li>Remaining EBS volumes.</li><li>EBS snapshots.</li><li>Elastic IP addresses.</li><li>Other resources that may continue generating charges.</li></ul><p>Finally, check AWS Billing and Cost Management.</p><p><strong>A useful habit:</strong> Don’t leave learning resources running just because you’ve finished the tutorial.</p><h3>17. Is This Production-Ready?</h3><p>Our deployment demonstrates the fundamentals of running a Dockerized application on EC2.</p><p>But a production system needs additional considerations.</p><p>For example:</p><p><strong>HTTPS:</strong> Secure browser communication using TLS.</p><p><strong>Domain Name:</strong> Use a domain instead of requiring users to remember an IP address.</p><p><strong>Secrets Management:</strong> Store credentials securely rather than placing them in source code or Docker images.</p><p><strong>Monitoring:</strong> Track application availability, errors, performance, and resource consumption.</p><p><strong>Backups:</strong> Protect important application and database data.</p><p><strong>CI/CD:</strong> Automate testing, image creation, and controlled deployment.</p><p><strong>Availability:</strong> Plan for server failures and recovery.</p><p><strong>Scaling:</strong> Adjust capacity as the number of users grows.</p><p><strong>Security Updates:</strong> Keep the host operating system, application, and container dependencies maintained.</p><p>For serious applications, hosting the application on a single public EC2 instance may not be sufficient.</p><p>However, understanding this simple architecture is a valuable first step.</p><h3>18. How This Connects to DevOps</h3><p>Let’s connect this tutorial to the DevOps concepts we’ve already learned.</p><p><strong>Git:</strong> Tracks application source-code changes.</p><p><strong>CI/CD:</strong> Automates checks and software delivery.</p><p><strong>Docker:</strong> Packages applications into images and runs containers.</p><p><strong>Linux:</strong> Provides the operating system on our EC2 server.</p><p><strong>Networking:</strong> Makes it possible to connect to the server and application.</p><p><strong>AWS EC2:</strong> Provides the computing environment.</p><p><strong>Monitoring:</strong> Helps us understand whether the application is working correctly.</p><p>Together, these technologies form the foundation of a basic DevOps deployment workflow.</p><p>Our current process is mostly manual.</p><p>The next improvement would be to automate it.</p><h3>Final Thoughts</h3><p>Deploying an application to the cloud is an important step in understanding real-world DevOps.</p><p>In this tutorial, we:</p><ol><li>Created a simple Spring Boot application.</li><li>Built an executable JAR.</li><li>Created a Dockerfile.</li><li>Built and tested a Docker image.</li><li>Launched an Ubuntu AWS EC2 instance.</li><li>Configured network access.</li><li>Connected to Linux using SSH.</li><li>Installed Docker.</li><li>Transferred our application to EC2.</li><li>Built and started the container.</li><li>Tested the application through the EC2 public address.</li><li>Learned how to troubleshoot and clean up cloud resources.</li></ol><p>We now understand the basic journey from local source code to a running cloud application.</p><p>This foundation helps us understand how more advanced deployment platforms and automation systems work.</p><h3>What’s Next?</h3><p><strong>Article 11 — Automating Docker Deployment to AWS EC2 with GitHub Actions</strong></p><p>In the next article, we’ll connect CI/CD with our EC2 deployment.</p><p>Instead of manually copying files and restarting containers, we’ll explore how a GitHub Actions workflow can build, test, package, and deploy application updates.</p><h3>References and Further Reading</h3><ul><li><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html">Getting Started with Amazon EC2</a></li><li><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-to-linux-instance.html">Connecting to Linux EC2 Instances</a></li><li><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-security-group.html">Creating EC2 Security Groups</a></li><li><a href="https://docs.docker.com/engine/install/ubuntu/">Installing Docker Engine on Ubuntu</a></li><li><a href="https://docs.docker.com/reference/dockerfile/">Dockerfile Reference</a></li><li><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html">Amazon EC2 Instance Lifecycle</a></li><li><a href="https://aws.amazon.com/vpc/pricing/">Amazon VPC Pricing</a></li><li><a href="https://calculator.aws/">AWS Pricing Calculator</a></li></ul><p><em>Part of the DevOps From Zero to Production series.</em></p><p><em>Written by Sajini Tharushika.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0cd3812f898e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cloud Computing and AWS Explained: From Local Servers to the Cloud]]></title>
            <link>https://medium.com/@sajinitharushika3655/cloud-computing-and-aws-explained-from-local-servers-to-the-cloud-d4a0c8b01716?source=rss-e1a9a8dbe515------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4a0c8b01716</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[cloud-infrastructure]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <dc:creator><![CDATA[Sajinitharushika]]></dc:creator>
            <pubDate>Wed, 18 Nov 2026 17:49:18 GMT</pubDate>
            <atom:updated>2026-11-18T17:49:18.875Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>DevOps From Zero to Production — Article 09</strong></p><p><em>Understand cloud computing, AWS, EC2, S3, RDS, IAM, VPC, and how applications move from local development to cloud infrastructure.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ipn0YUkkevcdPbo7DseIpg.png" /></figure><h3>Introduction</h3><p>Imagine you’ve developed a Spring Boot application on your laptop.</p><p>Everything works perfectly.</p><p>Your backend runs on port 8080, PostgreSQL stores the application’s data, and Redis helps improve performance.</p><p>In the previous two articles of my <em>DevOps From Zero to Production</em> series, we learned how Docker packages applications into containers and how Docker Compose manages multiple containers together.</p><p>But there’s still an important question.</p><p><strong>How can people around the world access our application?</strong></p><p>We can’t simply leave our personal laptop running forever and expect it to handle thousands of users.</p><p>We need infrastructure that can host our application reliably.</p><p>One option is buying physical servers and maintaining them ourselves.</p><p>Another option is using cloud computing.</p><p>This is where platforms like Amazon Web Services (AWS) become useful.</p><p>In this article, we’ll explore cloud computing from the beginning, understand important AWS services, and see how an application can move from a local development environment to the cloud.</p><h3>1. What Is Cloud Computing?</h3><p>Cloud computing means accessing computing resources over a network, typically the internet, instead of owning and maintaining all the physical infrastructure yourself.</p><p>These resources can include:</p><ul><li>Servers to run applications.</li><li>Storage to save files.</li><li>Databases to manage information.</li><li>Networking to connect services.</li><li>Tools for monitoring, security, and automation.</li></ul><p>For example, imagine we need a server to run our Spring Boot backend.</p><p>Instead of buying a physical computer, we can create a virtual server on AWS.</p><p>We choose the amount of CPU, memory, storage, and other resources required.</p><p>AWS provides the infrastructure, while we pay according to the applicable pricing model.</p><p>This makes it possible to access computing resources without maintaining an entire physical data center.</p><h3>A Real-Life Example</h3><p>Think about electricity.</p><p>We don’t normally build our own power station for our homes.</p><p>Instead, we use electricity supplied by a provider and pay for our consumption.</p><p>Cloud computing follows a somewhat similar idea.</p><p>We use computing resources provided by a cloud company rather than building everything ourselves.</p><p>However, cloud pricing can include fixed charges, usage-based charges, and other costs. It isn’t always as simple as paying only when an application is actively receiving requests.</p><h3>2. Physical Servers vs Cloud Servers</h3><p>Before cloud computing became common, many companies hosted their applications on physical servers they owned or rented.</p><p>This approach is called <strong>on-premises infrastructure</strong> when the systems are hosted and managed at an organization’s own facilities.</p><p>Imagine a company operating a shopping website.</p><p>With on-premises infrastructure, it may need to purchase servers, provide electricity and cooling, replace failed hardware, and maintain the physical environment.</p><p>With cloud infrastructure, the provider operates the underlying physical facilities.</p><p>The company can provision computing resources remotely.</p><h3>Key Differences</h3><p><strong>On-Premises Infrastructure</strong></p><ul><li>The organization manages or arranges its physical infrastructure.</li><li>Hardware capacity may need to be planned and purchased in advance.</li><li>The organization has greater direct control over its hardware.</li><li>Physical maintenance is its responsibility.</li></ul><p><strong>Cloud Infrastructure</strong></p><ul><li>The cloud provider manages the underlying physical facilities.</li><li>Computing resources can often be provisioned quickly.</li><li>Capacity can be adjusted based on demand.</li><li>Customers still manage their own applications, configurations, and security responsibilities.</li></ul><p>Cloud computing isn’t automatically cheaper or better for every organization.</p><p>The right choice depends on requirements, costs, regulations, technical needs, and existing infrastructure.</p><h3>3. Understanding IaaS, PaaS, and SaaS</h3><p>Cloud services are often grouped into three traditional categories.</p><h3>IaaS — Infrastructure as a Service</h3><p>IaaS provides basic computing resources such as virtual servers, networking, and storage.</p><p>The cloud provider manages the physical hardware.</p><p>We manage important parts of the operating system, application, and configuration.</p><p><strong>Example: Amazon EC2</strong></p><p>With EC2, we can create a virtual server, install Java or Docker, and run our application.</p><h3>PaaS — Platform as a Service</h3><p>PaaS provides a managed platform for developing and deploying applications.</p><p>The provider handles more of the underlying infrastructure and runtime environment.</p><p>This reduces the amount of server management required from developers.</p><p><strong>Example: AWS Elastic Beanstalk</strong></p><p>Elastic Beanstalk helps deploy and manage supported applications while AWS handles several infrastructure-related tasks.</p><h3>SaaS — Software as a Service</h3><p>SaaS provides complete applications that users access through the internet.</p><p>Users generally don’t need to manage the application’s servers or operating system.</p><p><strong>Examples: Gmail, Google Docs, and Microsoft 365</strong></p><p>We use these applications without installing and managing their backend infrastructure ourselves.</p><h3>Easy Way to Remember</h3><p><strong>IaaS:</strong> Rent computing infrastructure.</p><p><strong>PaaS:</strong> Use a managed application platform.</p><p><strong>SaaS:</strong> Use a ready-made software application.</p><p>These categories are useful for learning, although real cloud services don’t always fit perfectly into just one category.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fsLnsnrcuAR8HmA3zUlBnw.png" /></figure><h3>4. What Is AWS?</h3><p>AWS stands for <strong>Amazon Web Services</strong>.</p><p>It is Amazon’s cloud computing platform.</p><p>AWS provides services for computing, storage, databases, networking, security, analytics, monitoring, and more.</p><p>For example, a company developing an e-commerce application might use:</p><ul><li>Amazon EC2 to run its backend.</li><li>Amazon RDS to host a relational database.</li><li>Amazon S3 to store product images.</li><li>Amazon VPC to organize network access.</li><li>AWS IAM to control access to AWS resources.</li><li>Amazon CloudWatch to monitor applications and infrastructure.</li></ul><p>An important point is that we don’t need to use every AWS service.</p><p>A simple application may need only a few services.</p><p>The goal is to choose services based on the application’s actual requirements.</p><h3>5. Understanding AWS Regions and Availability Zones</h3><p>AWS operates infrastructure across multiple geographical locations around the world.</p><p>Two important concepts are <strong>Regions</strong> and <strong>Availability Zones</strong>.</p><h3>What Is an AWS Region?</h3><p>A Region is a geographical area where AWS operates cloud infrastructure.</p><p>For example:</p><p>ap-south-1 — Asia Pacific (Mumbai)</p><p>ap-southeast-1 — Asia Pacific (Singapore)</p><p>us-east-1 — US East (N. Virginia)</p><p>When creating resources, we generally select a Region.</p><p>The choice can affect network latency, service availability, data residency, and costs.</p><h3>What Is an Availability Zone?</h3><p>An Availability Zone, often called an AZ, is an isolated infrastructure location within an AWS Region.</p><p>Each Region contains multiple Availability Zones.</p><p>For example, a Region might contain:</p><p>AZ A, AZ B, and AZ C.</p><p>These labels are simplified illustrations. Actual AZ names and mappings depend on the AWS account and Region.</p><h3>Why Are Availability Zones Important?</h3><p>Imagine we run our entire application in just one Availability Zone.</p><p>If that AZ experiences a major outage, our application may become unavailable.</p><p>For systems requiring higher availability, we can distribute appropriate resources across multiple Availability Zones.</p><p>This reduces dependence on a single location.</p><p>However, simply using multiple AZs doesn’t automatically make an application highly available. The system must also be designed to handle failures correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3vLPx7fI9DlK44_YnfdDYQ.png" /></figure><h3>6. Amazon EC2 — Running Applications in the Cloud</h3><p><strong>EC2 stands for Elastic Compute Cloud.</strong></p><p>Amazon EC2 provides virtual computing resources called instances.</p><p>An EC2 instance is similar to renting a computer in the cloud.</p><p>We can choose an operating system, instance size, storage, and network settings.</p><p>For example, we could create an Ubuntu Linux EC2 instance and install Docker.</p><p>Then we could run our Spring Boot application on that instance.</p><h3>Important EC2 Terms</h3><p><strong>Instance:</strong> A virtual server running in AWS.</p><p><strong>AMI (Amazon Machine Image):</strong> A template used to launch an EC2 instance, including an operating system and configuration.</p><p><strong>Instance Type:</strong> Defines the compute resources available to an instance, such as CPU and memory.</p><p><strong>Key Pair:</strong> A public/private key pair that can be used for authentication when connecting to certain EC2 instances.</p><p><strong>Security Group:</strong> A virtual firewall that controls allowed network traffic to and from supported AWS resources.</p><p><strong>Public IP Address:</strong> An address that may allow an instance to communicate over the public internet, depending on network and security configuration.</p><h3>How Would We Access a Linux EC2 Instance?</h3><p>One method is SSH, which we learned about earlier in the series.</p><p>For example:</p><pre>ssh -i my-key.pem ubuntu@203.0.113.10</pre><p>Here:</p><ul><li>ssh starts a secure remote connection.</li><li>my-key.pem is an example private key file.</li><li>ubuntu is the remote username.</li><li>203.0.113.10 is a documentation-only example IP address.</li></ul><p>Real connection details depend on the instance’s operating system, networking, and authentication setup.</p><p>AWS also offers alternatives such as Systems Manager Session Manager.</p><p>Never share SSH private keys or upload them to public repositories.</p><h3>7. Amazon S3 — Storing Files in the Cloud</h3><p><strong>S3 stands for Simple Storage Service.</strong></p><p>Amazon S3 provides object storage.</p><p>Object storage is designed to store and retrieve data as objects.</p><p>An object usually includes file content and associated information.</p><p>Imagine our e-commerce application allows administrators to upload product images.</p><p>Instead of storing every image directly on the backend server, we could store the files in S3.</p><p>For example:</p><p>products/shoes.jpg</p><p>products/tshirt.jpg</p><p>products/bag.jpg</p><p>These files are stored as objects within an S3 bucket.</p><h3>What Is an S3 Bucket?</h3><p>A bucket is a container for objects stored in S3.</p><p>For example, an application might use a bucket named:</p><p>example-shop-images</p><p>The application can upload and retrieve objects using AWS-supported APIs and permissions.</p><h3>Why Use S3?</h3><p>S3 is useful for storing files such as:</p><ul><li>Product images.</li><li>Documents.</li><li>User-uploaded content.</li><li>Log archives.</li><li>Backup files.</li></ul><p>S3 is object storage, not a traditional relational database or a normal operating-system disk.</p><p>Also, S3 objects are private by default unless access is deliberately configured otherwise.</p><h3>8. Amazon RDS — Managed Relational Databases</h3><p>In our Docker Compose article, we ran PostgreSQL inside a container.</p><p>That’s useful for local development and testing.</p><p>But running a database in production introduces more responsibilities.</p><p>We need to think about backups, software updates, recovery, monitoring, and availability.</p><p><strong>Amazon RDS stands for Relational Database Service.</strong></p><p>RDS is a managed relational database service.</p><p>It supports multiple database engines, including PostgreSQL and MySQL.</p><p>AWS handles several infrastructure and database administration tasks, such as automated backups and certain maintenance operations, depending on the configuration.</p><p>However, developers still need to manage application queries, database design, access permissions, and other responsibilities.</p><h3>A Simple Example</h3><p>Imagine our Spring Boot application is running on EC2.</p><p>Instead of running PostgreSQL in another container on the same server, we could create a PostgreSQL database using RDS.</p><p>Our backend would connect to the database using its endpoint and credentials.</p><p>This separates application hosting from database management.</p><p>For production systems, databases should generally be kept private and accessible only to authorized applications and administrators.</p><h3>9. AWS IAM — Controlling Access</h3><p><strong>IAM stands for Identity and Access Management.</strong></p><p>IAM helps control who or what can access AWS resources and which actions they can perform.</p><p>Imagine a company has three employees.</p><p>One developer needs permission to view application logs.</p><p>Another engineer needs permission to deploy applications.</p><p>A finance employee needs permission to view billing information.</p><p>Not everyone should receive full administrator access.</p><p>IAM allows organizations to define permissions for different identities and workloads.</p><h3>Important IAM Concepts</h3><p><strong>User:</strong> An IAM identity that can have credentials and permissions. For human workforce access, AWS generally recommends federation with temporary credentials where possible.</p><p><strong>Role:</strong> An identity that can be assumed to obtain temporary permissions.</p><p><strong>Policy:</strong> A document defining which actions are allowed or denied under specified conditions.</p><h3>Principle of Least Privilege</h3><p>An important security principle is <strong>least privilege</strong>.</p><p>It means giving an identity only the permissions required to perform its tasks.</p><p>For example, if an application needs to read product images from one S3 bucket, it should not receive unrestricted administrator access to the entire AWS account.</p><p>AWS security is not only about protecting servers.</p><p>It’s also about controlling access to cloud resources.</p><h3>10. Amazon VPC — Networking in AWS</h3><p><strong>VPC stands for Virtual Private Cloud.</strong></p><p>A VPC is a logically isolated virtual network inside AWS.</p><p>Imagine you’re building a shopping platform.</p><p>You need the application to communicate with the database, but you don’t want the database to be directly accessible to everyone on the internet.</p><p>A VPC helps organize the network where these AWS resources operate.</p><h3>Important VPC Concepts</h3><p><strong>Subnet:</strong> A range of IP addresses within a VPC. Each subnet belongs to one Availability Zone.</p><p><strong>Public Subnet:</strong> A subnet whose route table has a route to an internet gateway.</p><p><strong>Private Subnet:</strong> A subnet without a direct route to an internet gateway.</p><p><strong>Route Table:</strong> A collection of rules that determine where network traffic is directed.</p><p><strong>Internet Gateway:</strong> A VPC component that supports communication between appropriately configured resources and the internet.</p><p><strong>Security Group:</strong> A stateful virtual firewall used to control traffic for supported resources.</p><h3>Example Architecture</h3><p>A simple AWS application might use:</p><p><strong>Internet → Public Load Balancer → Spring Boot Application → Private RDS Database</strong></p><p>A load balancer distributes incoming traffic across available application targets.</p><p>The application and database can be placed in suitable subnets with security groups controlling which connections are allowed.</p><p>This is only a simplified example. A secure and reliable production network also requires correct routing, authentication, encryption, monitoring, and availability planning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gxXI_-TO8eZvf9lg5E9rFg.png" /></figure><h3>11. Moving Our Docker Application to AWS</h3><p>Now let’s connect this article with our previous Docker and Docker Compose lessons.</p><p>In local development, our application contains:</p><ul><li>Spring Boot.</li><li>PostgreSQL.</li><li>Redis.</li></ul><p>We run these services with Docker Compose.</p><p>But how could we host them in AWS?</p><p>One possible approach is to use an EC2 instance.</p><h3>Step 1 — Prepare the Application</h3><p>Build and test the Spring Boot application.</p><p>Then build a Docker image using the application’s Dockerfile.</p><h3>Step 2 — Choose Cloud Infrastructure</h3><p>Create an appropriately configured EC2 Linux instance.</p><p>Choose the instance type, operating system, storage, networking, and security settings.</p><h3>Step 3 — Install the Container Runtime</h3><p>Install a supported Docker environment on the server.</p><h3>Step 4 — Transfer or Retrieve the Application Image</h3><p>We could store the Docker image in a registry, such as Amazon Elastic Container Registry (ECR), then retrieve it on the server.</p><p>ECR is AWS’s managed container image registry.</p><h3>Step 5 — Configure Dependencies</h3><p>For a learning environment, PostgreSQL and Redis might run alongside the application using Docker Compose.</p><p>For a production environment, managed services such as Amazon RDS and Amazon ElastiCache may be more suitable depending on requirements.</p><h3>Step 6 — Start the Application</h3><p>On a server configured with Docker Compose, we might run:</p><pre>docker compose up -d</pre><p>The application then runs on the cloud server rather than our personal laptop.</p><h3>Step 7 — Configure Access and Security</h3><p>We need to configure network access, security groups, and application exposure.</p><p>For a public application, we would normally configure a domain name and HTTPS using an appropriate web server or load balancer and TLS certificate.</p><h3>Step 8 — Monitor the Application</h3><p>Once deployed, we need visibility into application health, errors, and resource consumption.</p><p>Tools such as CloudWatch, Prometheus, and Grafana can help with monitoring, depending on the architecture.</p><p>This is a simplified deployment journey, not a complete production deployment procedure.</p><h3>12. Understanding the AWS Shared Responsibility Model</h3><p>A common beginner mistake is assuming that AWS handles every security responsibility.</p><p>That isn’t how cloud computing works.</p><p>AWS is responsible for the security <strong>of</strong> the cloud.</p><p>This includes protecting the underlying physical infrastructure and facilities.</p><p>Customers are responsible for security <strong>in</strong> the cloud, according to the services they use.</p><p>For example, when using EC2, customers are normally responsible for configuring the operating system, securing applications, managing access, and maintaining relevant software updates.</p><p>With managed services, AWS may take responsibility for more of the underlying infrastructure and operations.</p><p>The exact division depends on the service.</p><p>Understanding this model is essential when moving applications to the cloud.</p><h3>13. Cloud Costs — An Important Beginner Warning</h3><p>Cloud computing makes it easy to create resources, but that also means costs can increase if resources are left running unnecessarily.</p><p>For example, creating an EC2 instance, a database, storage volumes, load balancers, or public IP resources may result in charges.</p><p>Even a small learning project can become expensive if resources aren’t managed carefully.</p><p>Useful habits include:</p><ul><li>Review AWS pricing before creating resources.</li><li>Understand which services are eligible for any applicable free usage offers.</li><li>Set up budget notifications.</li><li>Delete resources that are no longer required.</li><li>Check for billable storage and networking resources after stopping or deleting an instance.</li><li>Monitor billing regularly.</li></ul><p>AWS free usage offers have eligibility conditions and limits. Never assume a service is free simply because you’re using it for learning.</p><p>For estimating costs, AWS provides the AWS Pricing Calculator.</p><h3>14. How Does Cloud Computing Connect to DevOps?</h3><p>Cloud computing is important for DevOps because it provides programmable infrastructure.</p><p>Instead of manually configuring physical servers, engineers can provision and manage cloud resources through consoles, command-line tools, APIs, and automation.</p><p>For example, a DevOps workflow might look like this:</p><p><strong>Developer pushes code → CI runs tests → Docker image is built → Image is pushed to a registry → Application is deployed to AWS → Monitoring checks application health</strong></p><p>Cloud infrastructure enables many forms of automated deployment and scaling.</p><p>But cloud computing and DevOps are not the same thing.</p><p>Cloud computing provides infrastructure and managed services.</p><p>DevOps is a combination of practices, culture, and automation that helps teams develop and deliver software more effectively.</p><p>They often work together.</p><h3>15. AWS Best Practices for Beginners</h3><p>Before experimenting with real AWS deployments, it’s important to understand a few basic practices.</p><p><strong>Protect the root account.</strong> Enable multi-factor authentication and avoid using root credentials for everyday tasks.</p><p><strong>Follow least privilege.</strong> Give people and applications only the permissions they need.</p><p><strong>Keep databases private.</strong> Avoid exposing databases to the public internet unnecessarily.</p><p><strong>Use HTTPS.</strong> Protect public application communication with TLS.</p><p><strong>Monitor costs.</strong> Configure billing alerts and remove unused resources.</p><p><strong>Keep secrets out of source code.</strong> Use appropriate credential and secret-management solutions.</p><p><strong>Plan for failures.</strong> Backups, monitoring, recovery procedures, and multi-AZ design matter for important systems.</p><p><strong>Start simple.</strong> A small, well-understood architecture is better than an unnecessarily complicated one.</p><h3>Final Thoughts</h3><p>Cloud computing changes how we build and operate software.</p><p>Instead of owning all the physical infrastructure required to host applications, developers and organizations can access computing resources from cloud providers.</p><p>AWS offers services that support different parts of an application.</p><p>The important concepts to remember are:</p><ul><li><strong>Cloud Computing:</strong> Accessing computing resources as services.</li><li><strong>EC2:</strong> Virtual servers for running applications.</li><li><strong>S3:</strong> Object storage for files and other data.</li><li><strong>RDS:</strong> Managed relational databases.</li><li><strong>IAM:</strong> Identity and permissions management.</li><li><strong>VPC:</strong> A logically isolated virtual network.</li><li><strong>Region:</strong> A geographical area containing AWS infrastructure.</li><li><strong>Availability Zone:</strong> An isolated infrastructure location within a Region.</li></ul><p>Combining cloud computing with Docker, CI/CD, networking, and monitoring gives us a foundation for building modern DevOps workflows.</p><h3>What’s Next?</h3><p><strong>Article 10 — Deploying a Dockerized Spring Boot Application on AWS EC2</strong></p><p>We’ll explore the practical steps of preparing an EC2 instance, connecting to Linux, installing Docker, running our application, configuring access, and understanding common deployment problems.</p><h3>References and Further Reading</h3><ul><li><a href="https://aws.amazon.com/what-is-cloud-computing/">What Is Cloud Computing? — AWS</a></li><li><a href="https://aws.amazon.com/types-of-cloud-computing/">Cloud Computing Service Models — AWS</a></li><li><a href="https://docs.aws.amazon.com/global-infrastructure/latest/regions/aws-regions-availability-zones.html">AWS Regions and Availability Zones</a></li><li><a href="https://docs.aws.amazon.com/ec2/">Amazon EC2 Documentation</a></li><li><a href="https://docs.aws.amazon.com/s3/">Amazon S3 Documentation</a></li><li><a href="https://docs.aws.amazon.com/rds/">Amazon RDS Documentation</a></li><li><a href="https://docs.aws.amazon.com/iam/">AWS IAM Documentation</a></li><li><a href="https://docs.aws.amazon.com/vpc/">Amazon VPC Documentation</a></li><li><a href="https://aws.amazon.com/compliance/shared-responsibility-model/">AWS Shared Responsibility Model</a></li><li><a href="https://calculator.aws/">AWS Pricing Calculator</a></li></ul><p><em>Part of the DevOps From Zero to Production series.</em></p><p><em>Written by Sajini Tharushika.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4a0c8b01716" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker Compose Explained: Running Multiple Containers Together]]></title>
            <link>https://medium.com/@sajinitharushika3655/docker-compose-explained-running-multiple-containers-together-c7f6204c6d40?source=rss-e1a9a8dbe515------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7f6204c6d40</guid>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Sajinitharushika]]></dc:creator>
            <pubDate>Wed, 18 Nov 2026 06:13:02 GMT</pubDate>
            <atom:updated>2026-11-18T06:13:02.865Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>DevOps From Zero to Production — Article 08</strong></p><p><em>Learn how Docker Compose simplifies multi-container applications using Spring Boot, PostgreSQL, and Redis.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gsN2SSyWpaVIHLQd0UNw8A.png" /></figure><h3>Introduction</h3><p>In the previous article of my <em>DevOps From Zero to Production</em> series, we explored Docker, images, containers, Dockerfiles, and how to run a Spring Boot application inside a container.</p><p>But here’s an interesting question.</p><p><strong>What happens when our application needs more than one container?</strong></p><p>Imagine developing an e-commerce application.</p><p>We might need Spring Boot for the backend, PostgreSQL for the database, and Redis for caching.</p><p>We could start each container using separate Docker commands.</p><p>However, as the application grows, managing container commands, networks, ports, and storage can become complicated.</p><p>This is where Docker Compose comes in.</p><p>In this article, we’ll understand Docker Compose from the beginning and explore a practical example using Spring Boot, PostgreSQL, and Redis.</p><h3>1. What Is Docker Compose?</h3><p>Docker Compose is a tool for defining and running applications that use multiple containers.</p><p>Instead of manually starting and configuring each container, we describe our application in a YAML configuration file.</p><p>Then we can start the entire application with one command:</p><pre>docker compose up -d</pre><p>Docker Compose reads the configuration and creates the required containers, networks, and volumes.</p><p>For example, our application could contain three services:</p><ul><li>Spring Boot — Handles API requests and application logic.</li><li>PostgreSQL — Stores users, products, and orders.</li><li>Redis — Provides fast access to temporary or frequently used data.</li></ul><p>Docker Compose helps us manage these services together.</p><h3>Docker vs Docker Compose</h3><p>Docker is the platform used to build and run containers.</p><p>Docker Compose works with Docker to manage applications containing multiple related services.</p><p>We commonly use docker run to start an individual container, while docker compose up starts services defined in a Compose file.</p><p>Docker Compose does not replace Docker. It makes managing multiple containers easier.</p><h3>2. Understanding the Compose Configuration File</h3><p>Docker Compose uses a YAML file.</p><p>YAML is a human-readable format commonly used for configuration.</p><p>The recommended modern filename is:</p><p>compose.yaml</p><p>You may also encounter:</p><p>docker-compose.yml</p><p>Both are supported.</p><p>Let’s look at a simple example:</p><pre>services:<br>  redis:<br>    image: redis:7</pre><p>This configuration defines a service named redis.</p><p>It tells Docker Compose to create a Redis container using the redis:7 image.</p><p>We can start it using:</p><pre>docker compose up -d</pre><p>The -d option means detached mode, allowing containers to run in the background.</p><p>Now that we understand the basic idea, let’s explore the main building blocks.</p><h3>3. Understanding Services</h3><p>A service represents one part of our application.</p><p>For example:</p><pre>services:<br>  backend:<br>    build: .</pre><pre>  database:<br>    image: postgres:17</pre><pre>  redis:<br>    image: redis:7</pre><p>Here, we have three services.</p><p>The backend service builds an image using the Dockerfile in the current directory.</p><p>The database service uses the PostgreSQL image.</p><p>The redis service uses the Redis image.</p><p>Each service normally runs in its own container.</p><p>Docker Compose lets us configure and manage these services as one application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*csZaZVzJg-bekFkElKVteA.png" /></figure><h3>4. Understanding Docker Compose Networks</h3><p>Imagine our Spring Boot backend needs to connect to PostgreSQL.</p><p>How does one container communicate with another?</p><p>Docker Compose normally creates a default network for the application.</p><p>Containers on that network can communicate using their service names.</p><p>For example, if the PostgreSQL service is named postgres, the Spring Boot application can connect using:</p><pre>jdbc:postgresql://postgres:5432/shopdb</pre><p>Here:</p><ul><li>postgres is the service name.</li><li>5432 is the PostgreSQL port.</li><li>shopdb is the database name.</li></ul><p>Notice that we use postgres, not localhost.</p><p>This is important because <strong>localhost inside a container refers to that container itself</strong>.</p><p>Using localhost from the backend container would not normally connect to a separate PostgreSQL container.</p><p>Docker Compose handles service-name resolution, making container communication simpler.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0v8u6i_VI2hskKTvc2f8qQ.png" /></figure><p>We can also define custom networks when an application needs more control over which services can communicate.</p><h3>5. Understanding Docker Volumes</h3><p>Imagine running PostgreSQL inside a container.</p><p>You create users, insert orders, and store customer information.</p><p>Now suppose you remove the container.</p><p>What happens to the data?</p><p>If important database files exist only inside the container’s writable layer, removing the container can delete them.</p><p>Docker volumes help solve this problem.</p><p>A volume stores data independently of a container’s lifecycle.</p><p>For example:</p><pre>services:<br>  postgres:<br>    image: postgres:17<br>    volumes:<br>      - postgres_data:/var/lib/postgresql/data</pre><pre>volumes:<br>  postgres_data:</pre><p>Here, postgres_data is a named volume.</p><p>For the PostgreSQL 17 image, /var/lib/postgresql/data is the database&#39;s data directory inside the container.</p><p>Even if we recreate the container, we can reuse the same volume.</p><p>However, volumes are not substitutes for backups. Important databases still need a proper backup and recovery strategy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ExqdzBQV6rintDlV2naRJw.png" /></figure><h3>6. Understanding Environment Variables</h3><p>Applications often need configuration settings.</p><p>For example:</p><ul><li>Database username.</li><li>Database password.</li><li>Database connection URL.</li><li>Redis hostname.</li><li>Application environment.</li></ul><p>Instead of hardcoding these values into application code, we can provide environment variables.</p><p>A Compose configuration might contain:</p><pre>environment:<br>  SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/shopdb<br>  SPRING_DATASOURCE_USERNAME: shopuser<br>  SPRING_DATASOURCE_PASSWORD: local_dev_password</pre><p>Spring Boot can read these environment variables to configure its database connection.</p><p>We can also use a .env file to provide values for substitution in the Compose configuration.</p><p>For example:</p><pre>POSTGRES_DB=shopdb<br>POSTGRES_USER=shopuser<br>POSTGRES_PASSWORD=local_dev_password</pre><p>Then reference them using:</p><pre>POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}</pre><p>The ${POSTGRES_PASSWORD} expression tells Compose to substitute the provided value.</p><p>An important security point: a .env file is convenient for local development, but it is not a secure secrets vault.</p><p>Never commit real credentials into a public Git repository. Production systems should use appropriate secret-management mechanisms.</p><h3>7. Practical Example: Spring Boot + PostgreSQL + Redis</h3><p>Let’s bring everything together.</p><p>We want to run a small Spring Boot application with PostgreSQL and Redis using Docker Compose.</p><h3>Prerequisites</h3><p>We need:</p><ul><li>Docker with Docker Compose.</li><li>Java 21 and Maven.</li><li>A Spring Boot project that builds successfully.</li><li>Spring Web, Spring Data JPA, PostgreSQL Driver, and Spring Data Redis dependencies.</li></ul><p>For a simple starting point, we can generate a Spring Boot application using Spring Initializr with those dependencies.</p><p>Our example assumes the application uses port 8080 and has a simple GET endpoint at /hello.</p><p>The project structure looks like this:</p><pre>shop-app/<br>├── src/<br>├── pom.xml<br>├── Dockerfile<br>├── compose.yaml<br>└── .env</pre><h3>Step 1 — Create a Simple Spring Boot Endpoint</h3><p>Inside the Spring Boot application, we can create a basic REST controller:</p><pre>package com.example.shop;</pre><pre>import org.springframework.web.bind.annotation.GetMapping;<br>import org.springframework.web.bind.annotation.RestController;</pre><pre>@RestController<br>public class HelloController {</pre><pre>    @GetMapping(&quot;/hello&quot;)<br>    public String hello() {<br>        return &quot;Hello from Docker Compose!&quot;;<br>    }<br>}</pre><p>Place the controller in the application’s package or one of its subpackages so Spring Boot can discover it.</p><p>This simple endpoint allows us to check whether our backend is running.</p><p>The example uses PostgreSQL and Redis connections, but the /hello endpoint itself does not query the database or use Redis.</p><h3>Step 2 — Build the Spring Boot Application</h3><p>Run:</p><pre>mvn clean package</pre><p>Maven packages the application into an executable JAR file inside the target directory.</p><p>For example:</p><pre>target/shop-0.0.1-SNAPSHOT.jar</pre><h3>Step 3 — Create the Dockerfile</h3><p>In the project root, create a file named Dockerfile.</p><pre>FROM eclipse-temurin:21-jre</pre><pre>WORKDIR /app</pre><pre>COPY target/*.jar app.jar</pre><pre>EXPOSE 8080</pre><pre>ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;app.jar&quot;]</pre><p>This Dockerfile:</p><ol><li>Uses a Java 21 runtime image.</li><li>Creates the working directory.</li><li>Copies the packaged JAR into the image.</li><li>Documents the application port.</li><li>Starts the application.</li></ol><p>For this example, ensure that only one executable .jar file matches the target/*.jar pattern.</p><h3>Step 4 — Create the .env File</h3><p>Create a file named .env:</p><pre>POSTGRES_DB=shopdb<br>POSTGRES_USER=shopuser<br>POSTGRES_PASSWORD=local_dev_password</pre><p>These values are for local development only.</p><h3>Step 5 — Create the Docker Compose File</h3><p>Now create compose.yaml:</p><pre>services:</pre><pre>  backend:<br>    build: .<br>    ports:<br>      - &quot;127.0.0.1:8080:8080&quot;<br>    environment:<br>      SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/shopdb<br>      SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER}<br>      SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD}<br>      SPRING_DATA_REDIS_HOST: redis<br>      SPRING_DATA_REDIS_PORT: 6379<br>    depends_on:<br>      postgres:<br>        condition: service_healthy<br>      redis:<br>        condition: service_healthy</pre><pre>  postgres:<br>    image: postgres:17<br>    environment:<br>      POSTGRES_DB: ${POSTGRES_DB}<br>      POSTGRES_USER: ${POSTGRES_USER}<br>      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}<br>    volumes:<br>      - postgres_data:/var/lib/postgresql/data<br>    healthcheck:<br>      test: [&quot;CMD-SHELL&quot;, &quot;pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}&quot;]<br>      interval: 5s<br>      timeout: 5s<br>      retries: 10</pre><pre>  redis:<br>    image: redis:7<br>    healthcheck:<br>      test: [&quot;CMD&quot;, &quot;redis-cli&quot;, &quot;ping&quot;]<br>      interval: 5s<br>      timeout: 3s<br>      retries: 10</pre><pre>volumes:<br>  postgres_data:</pre><p>This single file defines our entire local application stack.</p><p>Let’s understand how it works.</p><h3>Backend Service</h3><p>The backend builds our Spring Boot image using the Dockerfile.</p><p>The port mapping:</p><pre>127.0.0.1:8080:8080</pre><p>allows us to access the application locally on port 8080.</p><p>The environment variables tell Spring Boot how to connect to PostgreSQL and Redis.</p><h3>PostgreSQL Service</h3><p>The PostgreSQL container uses the postgres:17 image.</p><p>Its database name, username, and password come from our .env file.</p><p>The named volume preserves database files independently of the container.</p><h3>Redis Service</h3><p>The Redis container uses the redis:7 image.</p><p>Spring Boot can contact it using the hostname redis and port 6379.</p><p>We do not need to publish the Redis port to our host computer for the backend container to communicate with it.</p><h3>What Does depends_on Mean?</h3><p>The backend depends on PostgreSQL and Redis.</p><p>The depends_on configuration tells Docker Compose about these dependencies.</p><p>In our example, it also uses:</p><pre>condition: service_healthy</pre><p>This tells Compose to wait until the dependency passes its configured health check before starting the backend service.</p><p>But here’s something important.</p><p>Starting successfully does not guarantee that a service will remain available forever.</p><p>Real applications should still handle temporary connection failures and support retries where appropriate.</p><h3>8. Running the Complete Application</h3><p>Now we’re ready to start our application.</p><p>First, open a terminal inside the project directory.</p><p>Check Docker Compose:</p><pre>docker compose version</pre><p>Validate the Compose configuration:</p><pre>docker compose config -q</pre><p>The -q option checks the configuration without printing the fully resolved settings.</p><p>Next, start everything:</p><pre>docker compose up -d --build</pre><p>Docker Compose will:</p><ol><li>Build the Spring Boot image.</li><li>Download the required PostgreSQL and Redis images if needed.</li><li>Create the network and volume.</li><li>Start PostgreSQL and Redis.</li><li>Check the health of those dependencies.</li><li>Start Spring Boot.</li></ol><p>Check the containers:</p><pre>docker compose ps</pre><p>Then open:</p><pre>http://localhost:8080/hello</pre><p>If everything starts successfully, the expected response is:</p><pre>Hello from Docker Compose!</pre><p>We now have a Spring Boot application running alongside PostgreSQL and Redis, managed using Docker Compose.</p><h3>9. Viewing Logs and Troubleshooting</h3><p>What if the application doesn’t start?</p><p>A useful first step is checking container logs.</p><p>To view all service logs:</p><pre>docker compose logs</pre><p>To follow backend logs:</p><pre>docker compose logs -f backend</pre><p>To check PostgreSQL logs:</p><pre>docker compose logs postgres</pre><p>To check Redis logs:</p><pre>docker compose logs redis</pre><p>Some common problems include:</p><p><strong>Database connection errors:</strong> Check the database URL, credentials, and PostgreSQL container status.</p><p><strong>Port already in use:</strong> Another application may already be using port 8080 on your computer.</p><p><strong>Backend exits immediately:</strong> Check Spring Boot’s startup logs for configuration or dependency errors.</p><p><strong>Redis connection errors:</strong> Check whether Redis is running and whether the hostname is configured correctly.</p><p>Troubleshooting is an important part of DevOps. The goal is not just to start containers but also to understand why something fails.</p><h3>10. Useful Docker Compose Commands</h3><p>Here are some commands worth remembering.</p><p><strong>Start services:</strong></p><pre>docker compose up -d</pre><p><strong>Build images and start services:</strong></p><pre>docker compose up -d --build</pre><p><strong>Show service status:</strong></p><pre>docker compose ps</pre><p><strong>Follow logs:</strong></p><pre>docker compose logs -f</pre><p><strong>Stop services:</strong></p><pre>docker compose stop</pre><p><strong>Start previously stopped services:</strong></p><pre>docker compose start</pre><p><strong>Remove containers and the Compose network:</strong></p><pre>docker compose down</pre><p><strong>Remove containers, the network, and Compose-managed volumes:</strong></p><pre>docker compose down -v</pre><p>Be especially careful with the last command.</p><p>Removing volumes can permanently delete locally stored database data.</p><p>For normal local development, docker compose down without -v is usually preferable when you want to keep the database volume.</p><h3>11. Docker Compose vs Kubernetes</h3><p>Another common beginner question is:</p><p><strong>If Docker Compose can manage multiple containers, why do we need Kubernetes?</strong></p><p>Both tools can work with containerized applications, but they serve different operational needs.</p><p>Docker Compose is particularly useful for:</p><ul><li>Local development.</li><li>Integration testing.</li><li>Running related services together.</li><li>Simple deployments.</li></ul><p>Kubernetes is designed to manage containerized applications across clusters of machines.</p><p>It offers capabilities such as scheduling, service discovery, scaling, and automated recovery.</p><p>Docker Compose can also be used outside development, and Kubernetes is not required for every application.</p><p>The right choice depends on the application’s requirements and complexity.</p><h3>12. Where Does Docker Compose Fit in DevOps?</h3><p>Imagine a new developer joins your project.</p><p>Without a consistent environment, they may need to install and configure PostgreSQL, Redis, and other services manually.</p><p>With Docker Compose, they can often start the required local services using one command.</p><p>This improves consistency between developers and makes testing easier.</p><p>Compose is also useful in CI pipelines where integration tests need temporary databases or supporting services.</p><p>However, Compose is not itself a CI/CD pipeline.</p><p>It works alongside tools such as GitHub Actions, Jenkins, and GitLab CI/CD.</p><h3>13. Best Practices for Beginners</h3><p>A few habits can make Docker Compose projects easier to manage:</p><ul><li>Use clear service names such as backend, postgres, and redis.</li><li>Use named volumes for important persistent data.</li><li>Keep credentials out of public repositories.</li><li>Use explicit image versions instead of relying blindly on latest.</li><li>Add appropriate health checks to dependent services.</li><li>Review logs when troubleshooting.</li><li>Avoid publishing database or cache ports unless they’re needed.</li><li>Understand the difference between local development and production requirements.</li></ul><p>Docker Compose simplifies configuration, but it does not automatically provide security, backups, scalability, or high availability.</p><p>Those responsibilities still need careful planning.</p><h3>Final Thoughts</h3><p>Docker Compose is a useful tool for managing applications made up of multiple containers.</p><p>Instead of starting every container manually, we can describe our services, networks, volumes, and configuration in a single YAML file.</p><p>The most important concepts to remember are:</p><p><strong>Services</strong> define the individual parts of an application.</p><p><strong>Networks</strong> allow containers to communicate.</p><p><strong>Volumes</strong> preserve data independently of container lifecycles.</p><p><strong>Environment variables</strong> provide configuration to applications.</p><p><strong>Health checks</strong> help determine whether dependent services are ready.</p><p>And with a single command:</p><pre>docker compose up -d</pre><p>we can bring up an entire application stack.</p><p>Learning Docker Compose provides a strong foundation for understanding containerized development environments and more advanced orchestration tools.</p><h3>What’s Next?</h3><p><strong>Article 09 — Cloud Computing and AWS Explained: From Local Servers to the Cloud</strong></p><p>We’ll explore cloud computing, AWS, EC2, S3, RDS, IAM, and how applications can move from local development to cloud infrastructure.</p><h3>References and Further Reading</h3><ul><li><a href="https://docs.docker.com/compose/">Docker Compose Overview</a></li><li><a href="https://docs.docker.com/compose/gettingstarted/">Docker Compose Quickstart</a></li><li><a href="https://docs.docker.com/compose/how-tos/networking/">Compose Networking</a></li><li><a href="https://docs.docker.com/compose/how-tos/startup-order/">Compose Startup Order</a></li><li><a href="https://docs.docker.com/compose/how-tos/environment-variables/set-environment-variables/">Environment Variables in Compose</a></li><li><a href="https://hub.docker.com/_/postgres">PostgreSQL Official Docker Image</a></li></ul><p><em>Part of the DevOps From Zero to Production series.</em></p><p><em>Written by Sajini Tharushika.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7f6204c6d40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker Explained: Images, Containers, Dockerfiles, and Practical Examples]]></title>
            <link>https://medium.com/@sajinitharushika3655/docker-explained-images-containers-dockerfiles-and-practical-examples-a9338b6c1698?source=rss-e1a9a8dbe515------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9338b6c1698</guid>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Sajinitharushika]]></dc:creator>
            <pubDate>Wed, 18 Nov 2026 05:18:58 GMT</pubDate>
            <atom:updated>2026-11-18T05:18:58.849Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>DevOps From Zero to Production — Article 07</strong></p><p><em>Understanding Docker from the beginning: why containers matter, how Docker images work, and how to containerize a Spring Boot application.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hybwNRlGQxlhMJDeDkWU-g.png" /></figure><h3>Introduction</h3><p>Imagine developing an application on your laptop.</p><p>Everything works perfectly. The application starts without errors, the database connects successfully, and all the features work as expected.</p><p>Then you share the project with another developer.</p><p>Suddenly, the application fails to start.</p><p>Maybe your laptop uses Java 21 while your teammate uses Java 17. Maybe a dependency is missing, or the application needs a different configuration.</p><p>This is a common problem in software development.</p><p><strong>“It works on my machine!”</strong></p><p>But an application needs to work consistently across development, testing, and deployment environments.</p><p>This is where Docker becomes useful.</p><p>In the previous article of my <em>DevOps From Zero to Production</em> series, we explored CI/CD, automated testing, and software delivery.</p><p>Now, let’s understand how Docker helps us package applications into containers and run them more consistently.</p><h3>1. What Is Docker?</h3><p>Docker is a platform used to build, package, and run applications inside containers.</p><p>A container provides an isolated environment that includes the application and the software dependencies it needs.</p><p>Instead of manually configuring the same runtime and dependencies on multiple machines, developers can package the application into a Docker image.</p><p>That image can then be used to create containers.</p><p>For example, imagine a Spring Boot application that requires Java 21.</p><p>Without Docker, developers may need to install and configure Java themselves.</p><p>With Docker, the application’s image can include the required Java runtime.</p><p>This makes the environment more predictable.</p><p>However, Docker does not eliminate every environment problem. Applications still need correct network settings, database connections, configuration, and access to external services.</p><h3>2. What Is a Container?</h3><p>A container is an isolated environment used to run an application or service.</p><p>For example, a shopping application may need:</p><ul><li>Spring Boot to handle APIs and business logic.</li><li>PostgreSQL to store customer and order information.</li><li>Redis to cache frequently accessed information.</li></ul><p>Each service can run in its own container.</p><p>These containers can communicate over a Docker network.</p><h3>Containers vs Virtual Machines</h3><p>Containers and virtual machines both provide isolation, but they work differently.</p><p>A virtual machine normally runs a complete guest operating system with its own kernel.</p><p>A Linux container shares the host’s Linux kernel while isolating application processes and resources.</p><p>Because containers do not require a separate operating system for every application, they are often lighter and faster to start than traditional virtual machines.</p><p>Docker Desktop can use a Linux virtual machine to run Linux containers on Windows and macOS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*72aSQEz-XyqrB09T" /></figure><h3>3. Docker Images vs Containers</h3><p>These are two of the most important Docker concepts.</p><p><strong>A Docker image is a packaged template used to create containers.</strong></p><p><strong>A Docker container is an instance created from an image.</strong></p><p>Think about a cake recipe.</p><p>The recipe describes what is needed to make the cake.</p><p>You can use the same recipe to make several cakes.</p><p>Similarly, one Docker image can be used to create multiple containers.</p><p>For example:</p><pre>docker pull nginx:stable</pre><p>This downloads an Nginx image from a container registry.</p><p>Now run:</p><pre>docker run -d --name web-server -p 8080:80 nginx:stable</pre><p>Docker creates and starts a container from that image.</p><p>You can visit:</p><p><a href="http://localhost:8080/">http://localhost:8080</a></p><p>The Nginx welcome page should appear if the container is running successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/0*T2UYNocsY3iHFRc4" /></figure><h3>4. Understanding Basic Docker Commands</h3><p>Before creating our own image, let’s understand some useful commands.</p><h3>Check the installed Docker version</h3><pre>docker --version</pre><h3>Download an image</h3><pre>docker pull redis:7</pre><h3>List available images</h3><pre>docker images</pre><h3>Start a container</h3><pre>docker run -d --name redis-demo redis:7</pre><p>Here:</p><ul><li>docker run creates and starts a container.</li><li>-d runs it in the background.</li><li>--name gives the container a name.</li><li>redis:7 identifies the image.</li></ul><h3>List running containers</h3><pre>docker ps</pre><p>To include stopped containers:</p><pre>docker ps -a</pre><h3>View container logs</h3><pre>docker logs redis-demo</pre><p>Logs help developers understand what an application is doing and identify errors.</p><h3>Stop a container</h3><pre>docker stop redis-demo</pre><h3>Remove a stopped container</h3><pre>docker rm redis-demo</pre><p>Notice that stopping a container and removing it are different operations.</p><h3>5. What Is a Dockerfile?</h3><p>A Dockerfile is a text file containing instructions for building a Docker image.</p><p>It describes the starting image, application files, working directory, and startup command.</p><p>Let’s imagine we have a Spring Boot application.</p><p>A simple Dockerfile might look like this:</p><pre>FROM eclipse-temurin:21-jre</pre><pre>WORKDIR /app</pre><pre>COPY target/app.jar app.jar</pre><pre>EXPOSE 8080</pre><pre>ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;app.jar&quot;]</pre><p>Let’s understand each instruction.</p><h3>FROM</h3><pre>FROM eclipse-temurin:21-jre</pre><p>Specifies the starting image.</p><p>Here, we use an image containing the Java 21 runtime.</p><h3>WORKDIR</h3><pre>WORKDIR /app</pre><p>Sets the working directory inside the image.</p><h3>COPY</h3><pre>COPY target/app.jar app.jar</pre><p>Copies the packaged Spring Boot application into the image.</p><h3>EXPOSE</h3><pre>EXPOSE 8080</pre><p>Documents the port that the application is expected to use.</p><p>It does not automatically publish that port to the host computer.</p><h3>ENTRYPOINT</h3><pre>ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;app.jar&quot;]</pre><p>Defines the command used to start the Spring Boot application.</p><p>When the container starts, Docker runs this command.</p><h3>6. Practical Example: Dockerizing a Spring Boot Application</h3><p>Now let’s see how these concepts work together.</p><p>We will use a simple Spring Boot application that runs on port 8080.</p><p><strong>Prerequisites</strong></p><ul><li>Docker installed and running.</li><li>Java 21.</li><li>A Maven-based Spring Boot project.</li><li>An application that already builds successfully.</li></ul><h3>Step 1 — Package the application</h3><p>Inside the project directory, run:</p><pre>mvn clean package</pre><p>Maven builds the application and creates a JAR file inside the target directory.</p><p>For example:</p><pre>target/demo-0.0.1-SNAPSHOT.jar</pre><p>A JAR file is a package containing compiled Java application code and required resources.</p><p>For this example, rename or copy the generated application JAR to:</p><pre>target/app.jar</pre><h3>Step 2 — Create the Dockerfile</h3><p>In your project root, create a file named Dockerfile.</p><pre>FROM eclipse-temurin:21-jre</pre><pre>WORKDIR /app</pre><pre>COPY target/app.jar app.jar</pre><pre>EXPOSE 8080</pre><pre>ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;app.jar&quot;]</pre><p>Make sure the Dockerfile is in the same project directory as your Maven configuration.</p><h3>Step 3 — Build the Docker image</h3><p>Run:</p><pre>docker build -t spring-demo .</pre><p>Here:</p><ul><li>docker build creates a Docker image.</li><li>-t spring-demo assigns a name to the image.</li><li>. specifies the current directory as the build context.</li></ul><p>Docker reads the Dockerfile and follows its instructions.</p><h3>Step 4 — Run the container</h3><pre>docker run -d \<br>  --name spring-app \<br>  -p 127.0.0.1:8080:8080 \<br>  spring-demo</pre><p>This creates and starts a container from our image.</p><p>The port mapping makes the application’s port available on the local machine.</p><p>Now visit:</p><p><a href="http://localhost:8080/">http://localhost:8080</a></p><p>If your application provides an endpoint at /, you should see its response. Otherwise, use an API path that exists in your application.</p><h3>Step 5 — Check container status</h3><pre>docker ps</pre><p>If the application isn’t working, inspect its logs:</p><pre>docker logs spring-app</pre><p>You can stop it with:</p><pre>docker stop spring-app</pre><p>And start it again:</p><pre>docker start spring-app</pre><p>We have now built an image and run a Java application inside a container.</p><p>This example assumes the application does not require additional external services. In a real project, we may also need to configure databases, caches, and environment variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*F2G2yZhxgqcVSY1J" /></figure><h3>7. Understanding Docker Ports</h3><p>An application running inside a container may listen on port 8080.</p><p>But how can we access it from our laptop?</p><p>Docker uses <strong>port mapping</strong>.</p><p>For example:</p><pre>docker run -p 9090:8080 spring-demo</pre><p>The format is:</p><pre>HOST_PORT:CONTAINER_PORT</pre><p>Here:</p><ul><li>9090 is the host port.</li><li>8080 is the port inside the container.</li></ul><p>You can access the application through:</p><p><a href="http://localhost:9090/">http://localhost:9090</a></p><p>The application still listens on port 8080 inside its container.</p><p>This is useful when several applications need to run on the same computer.</p><p>By default, publishing a port without specifying a host IP may expose it on more network interfaces than intended. For local development, binding it to 127.0.0.1 is a useful precaution.</p><h3>8. What Are Docker Volumes?</h3><p>Imagine running PostgreSQL inside a container.</p><p>You create tables and insert customer information.</p><p>Then the container is removed.</p><p>If the database files were stored only in the container’s writable layer, those files can be lost when the container is deleted.</p><p>Docker volumes help solve this problem.</p><p>A <strong>volume stores data separately from the container’s temporary writable layer</strong>.</p><p>For example:</p><pre>docker volume create postgres_data</pre><p>This creates a named volume.</p><p>A PostgreSQL 17 container could then use it:</p><pre>docker run -d \<br>  --name postgres-demo \<br>  -e POSTGRES_PASSWORD=local_demo_password \<br>  -v postgres_data:/var/lib/postgresql/data \<br>  postgres:17</pre><p>The volume stores the database files independently of that container.</p><p>If we recreate a compatible PostgreSQL container and attach the same volume, the existing data can remain available.</p><p>Volumes provide persistence, but they do not replace regular database backups.</p><p>The password shown here is only for local demonstration. Production credentials should be managed securely.</p><h3>9. What Is Docker Hub?</h3><p>Docker Hub is an online container registry.</p><p>A <strong>container registry</strong> stores and distributes Docker images.</p><p>GitHub is commonly used to store source code.</p><p>Docker Hub is commonly used to distribute container images.</p><p>For example, we can download existing images for:</p><ul><li>PostgreSQL.</li><li>Redis.</li><li>Nginx.</li><li>Java runtime environments.</li></ul><p>This saves developers from creating every environment from scratch.</p><p>You can explore the available images at:</p><p><a href="https://hub.docker.com/">https://hub.docker.com/</a></p><h3>10. Common Docker Mistakes Beginners Should Avoid</h3><h3>Confusing images and containers</h3><p>An image is the template. A container is an instance of that image.</p><h3>Assuming EXPOSE publishes a port</h3><p>EXPOSE documents the application port.</p><p>Use the -p option when you need to publish a port to the host.</p><h3>Storing important data only inside containers</h3><p>Use appropriate persistent storage, such as Docker volumes, for databases.</p><h3>Putting passwords inside Dockerfiles</h3><p>Avoid embedding credentials directly into images or publishing them to version control.</p><h3>Using the latest tag for everything</h3><p>Explicit version tags help make builds and deployments more predictable.</p><p>For stronger reproducibility, production images can also be pinned by digest.</p><h3>Ignoring container logs</h3><p>Logs are often the first place to investigate when an application fails.</p><h3>Assuming Docker is a complete security solution</h3><p>Containers provide isolation, but applications still need secure configurations, restricted permissions, updated dependencies, and vulnerability management.</p><h3>11. Where Does Docker Fit in a CI/CD Pipeline?</h3><p>In the previous article, we learned how CI/CD helps developers validate and deliver software.</p><p>Docker can become part of that process.</p><p>A simplified workflow might look like this:</p><p><strong>Developer writes code → Pushes to GitHub → CI runs tests → Docker image is built → Image is stored in a registry → Application is deployed</strong></p><p>For example, a GitHub Actions pipeline might:</p><ol><li>Download the source code.</li><li>Set up Java.</li><li>Build and test the Spring Boot application.</li><li>Build a Docker image.</li><li>Push the image to a container registry.</li><li>Deploy an approved image to a server.</li></ol><p>Docker helps make the packaged application more consistent across stages.</p><p>However, Docker itself is not a CI/CD tool. It works alongside tools such as GitHub Actions, Jenkins, or GitLab CI/CD.</p><h3>12. What Comes After Docker?</h3><p>So far, we’ve focused on building images and running individual containers.</p><p>But real applications usually contain multiple services.</p><p>For example:</p><ul><li>Spring Boot backend.</li><li>PostgreSQL database.</li><li>Redis cache.</li></ul><p>Starting and configuring each container separately can become difficult as an application grows.</p><p>This leads us to another important DevOps tool:</p><p><strong>Docker Compose.</strong></p><p>Docker Compose lets us define related services, networks, volumes, and configuration in a single YAML file.</p><p>Instead of running several long Docker commands, we can start the application with:</p><pre>docker compose up -d</pre><p>We’ll explore Docker Compose in the next article.</p><h3>Final Thoughts</h3><p>Docker is one of the fundamental tools used in modern software development and DevOps.</p><p>It helps developers package applications into repeatable environments, making software easier to build, test, share, and run.</p><p>The most important concepts to remember are:</p><ul><li><strong>Docker Image:</strong> A packaged template for an application.</li><li><strong>Docker Container:</strong> An instance created from an image.</li><li><strong>Dockerfile:</strong> Instructions used to build an image.</li><li><strong>Port Mapping:</strong> Connects host ports to container ports.</li><li><strong>Docker Volume:</strong> Helps preserve data independently of containers.</li><li><strong>Docker Hub:</strong> A registry for sharing Docker images.</li></ul><p>Understanding these concepts provides a strong foundation for learning Docker Compose, CI/CD image pipelines, Kubernetes, and cloud deployment.</p><h3>What’s Next?</h3><p><strong>Article 08 — Docker Compose Explained: Running Multiple Containers Together</strong></p><p>We’ll explore services, networks, volumes, environment variables, and a practical application using Spring Boot, PostgreSQL, and Redis.</p><h3>References and Further Reading</h3><ul><li><a href="https://docs.docker.com/get-started/docker-overview/">Docker Overview — Official Documentation</a></li><li><a href="https://docs.docker.com/reference/dockerfile/">Dockerfile Reference</a></li><li><a href="https://docs.docker.com/engine/storage/volumes/">Docker Volumes</a></li><li><a href="https://docs.docker.com/get-started/docker-concepts/running-containers/publishing-ports/">Docker Port Publishing</a></li><li><a href="https://hub.docker.com/">Docker Hub</a></li><li><a href="https://docs.docker.com/compose/">Docker Compose Documentation</a></li></ul><p><em>Part of the DevOps From Zero to Production series.</em></p><p><em>Written by Sajini Tharushika.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9338b6c1698" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CI/CD Explained: Continuous Integration, Continuous Delivery, and Continuous Deployment]]></title>
            <link>https://medium.com/@sajinitharushika3655/ci-cd-explained-continuous-integration-continuous-delivery-and-continuous-deployment-74a8d2c78bda?source=rss-e1a9a8dbe515------2</link>
            <guid isPermaLink="false">https://medium.com/p/74a8d2c78bda</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <dc:creator><![CDATA[Sajinitharushika]]></dc:creator>
            <pubDate>Tue, 17 Nov 2026 18:18:31 GMT</pubDate>
            <atom:updated>2026-11-17T18:18:31.355Z</atom:updated>
            <content:encoded><![CDATA[<p><em>DevOps From Zero to Production — Article 06</em></p><p><strong>Understanding CI/CD pipelines, automated testing, software releases, and how modern development teams deliver applications reliably.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*0iUWdqjxAyF-7gl0" /></figure><h3>Introduction</h3><p>Imagine working on a software project with several developers.</p><p>Every day, team members are adding features, fixing bugs, and updating existing functionality.</p><p>One developer completes a new API endpoint. Another modifies the database logic. Someone else fixes an issue in the frontend.</p><p>Now imagine that every change must be manually downloaded, built, tested, and deployed by another person.</p><p>What happens when the team starts making dozens of changes every week?</p><p>Releases become slower, mistakes become more likely, and identifying problems becomes difficult.</p><p>This is one of the problems that CI/CD aims to solve.</p><p><strong>CI/CD helps development teams integrate code changes, validate them automatically, and deliver software through a consistent process.</strong></p><p>In the previous articles of my <em>DevOps From Zero to Production</em> series, we explored DevOps, Linux, networking, Git and GitHub, and automation using Bash and Python.</p><p>Now we’re entering the next phase: <strong>CI/CD and Containerization</strong>.</p><p>In this article, we’ll understand what CI/CD means, how pipelines work, why automated testing is important, and how a simple GitHub Actions workflow can validate a project.</p><p>Let’s begin!</p><h3>1. What Is CI/CD?</h3><p>CI/CD stands for:</p><ul><li><strong>CI — Continuous Integration</strong></li><li><strong>CD — Continuous Delivery or Continuous Deployment</strong></li></ul><p>These practices help software teams reduce manual work and deliver changes more consistently.</p><p>But CI/CD isn’t simply installing an automation tool.</p><p>It combines development practices, automated checks, and repeatable release processes.</p><p>For example, a typical automated workflow might look like this:</p><p><strong>Developer → Git Commit → GitHub → Build → Test → Package → Deploy → Monitor</strong></p><p>The exact steps depend on the project.</p><p>Some pipelines only build and test code. Others also create Docker images, deploy to cloud environments, or perform security checks.</p><p>The important idea is that changes move through a defined, repeatable process.</p><p>Let’s understand each part separately.</p><h3>2. What Is Continuous Integration (CI)?</h3><p>Continuous Integration is a software development practice in which developers frequently integrate their changes into a shared codebase.</p><p>Each change is validated through automated checks, typically including builds and tests.</p><p>The purpose is to identify integration problems as early as possible.</p><h3>A Simple Example</h3><p>Imagine three developers working on a Spring Boot application.</p><p>Developer A implements authentication.</p><p>Developer B adds a new API endpoint.</p><p>Developer C improves database validation.</p><p>Each developer works on a separate branch and opens a pull request.</p><p>When a pull request is created, a CI workflow automatically:</p><ol><li>Retrieves the source code.</li><li>Sets up the required environment.</li><li>Builds the application.</li><li>Runs automated tests.</li><li>Reports the results.</li></ol><p>If the tests fail, the developer receives feedback before the changes are merged.</p><h3>Why Is Continuous Integration Important?</h3><p><strong>Early Error Detection</strong></p><p>Problems can be identified before they become part of a larger release.</p><p><strong>Faster Feedback</strong></p><p>Developers can see whether their changes pass the required checks.</p><p><strong>Better Collaboration</strong></p><p>Frequent integration reduces the amount of divergent work that must be combined later.</p><p><strong>Consistent Validation</strong></p><p>Automated checks reduce dependence on someone remembering to run tests manually.</p><p><strong>Improved Code Quality</strong></p><p>Testing and static analysis can identify certain defects and coding problems earlier.</p><p>However, passing CI checks does not guarantee that an application contains no bugs.</p><p>The pipeline can only detect problems covered by its configured checks and tests.</p><p><strong>CI answers an important question: Can this code change be integrated without failing the checks we’ve defined?</strong></p><h3>3. What Is Continuous Delivery?</h3><p>Continuous Delivery extends Continuous Integration by automating the process of preparing software for release.</p><p>The goal is to keep the application in a state where a validated version can be released reliably.</p><p>Continuous Delivery commonly includes:</p><ul><li>Building deployable artifacts.</li><li>Running additional automated tests.</li><li>Preparing release packages.</li><li>Deploying to testing or staging environments.</li><li>Validating the application before production.</li><li>Maintaining a repeatable production release process.</li></ul><h3>Example: An E-Commerce Application</h3><p>Imagine a team developing an online shopping platform.</p><p>A developer adds a new discount feature.</p><p>The CI pipeline builds the application and runs the unit tests.</p><p>After those checks pass, the delivery pipeline packages the application into a Docker image and deploys it to a staging environment.</p><p>The team performs additional validation to ensure the application behaves correctly.</p><p>Once the required checks pass, the application is ready for production.</p><p>However, the team may choose when to release it.</p><p>For example, a release manager might approve the deployment after reviewing the change.</p><p><strong>Continuous Delivery means the software is kept ready for release, not that every successful change must immediately reach users.</strong></p><p>This gives organizations control over release timing while reducing manual preparation.</p><h3>4. What Is Continuous Deployment?</h3><p>Continuous Deployment goes one step further than Continuous Delivery.</p><p>In Continuous Deployment, changes that pass the required automated checks are deployed to production automatically, without a separate manual approval for each release.</p><h3>Example</h3><p>Imagine a team operating an online service.</p><p>A developer fixes a small application bug.</p><p>The updated code is pushed to the repository.</p><p>The pipeline automatically:</p><ol><li>Builds the application.</li><li>Runs automated tests.</li><li>Performs the configured security and quality checks.</li><li>Creates a release artifact.</li><li>Deploys the validated version to production.</li><li>Performs post-deployment verification.</li></ol><p>If the required conditions are satisfied, the release happens without a separate manual production approval.</p><h3>Is Continuous Deployment Always Better?</h3><p>Not necessarily.</p><p>Automatic production deployment can be useful when organizations have strong automated testing, monitoring, recovery procedures, and confidence in their release processes.</p><p>However, some organizations require additional approvals because of operational, regulatory, or business requirements.</p><p>Both Continuous Delivery and Continuous Deployment can be appropriate.</p><p>The right approach depends on the organization’s needs.</p><h3>5. Continuous Integration vs Continuous Delivery vs Continuous Deployment</h3><p>These three concepts are closely related, but they solve different problems.</p><h3>Continuous Integration</h3><p><strong>Main purpose:</strong> Validate code changes frequently.</p><p>Typical activities:</p><ul><li>Build the application.</li><li>Run unit tests.</li><li>Execute linting and static analysis.</li><li>Report errors.</li><li>Validate pull requests.</li></ul><p><strong>Result:</strong> Code changes have passed the configured integration checks.</p><h3>Continuous Delivery</h3><p><strong>Main purpose:</strong> Keep validated software ready for production release.</p><p>Typical activities:</p><ul><li>Build and package applications.</li><li>Run additional tests.</li><li>Prepare release artifacts.</li><li>Deploy to staging.</li><li>Validate release readiness.</li><li>Support controlled production deployment.</li></ul><p><strong>Result:</strong> A validated application can be released through a reliable process.</p><h3>Continuous Deployment</h3><p><strong>Main purpose:</strong> Release validated changes to production automatically.</p><p>Typical activities:</p><ul><li>Execute the required automated checks.</li><li>Deploy approved-by-policy changes automatically.</li><li>Verify deployment health.</li><li>Monitor production behavior.</li></ul><p><strong>Result:</strong> Successful changes move into production without separate manual release approval.</p><h3>The Key Difference</h3><p>Remember these three questions:</p><p><strong>CI:</strong> Is the integrated code passing our checks?</p><p><strong>Continuous Delivery:</strong> Is the application ready to be released?</p><p><strong>Continuous Deployment:</strong> Can validated changes be released automatically?</p><p>Understanding these distinctions is important because Continuous Delivery and Continuous Deployment are often confused.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*2-tKYWzs2wRJ3kgv" /></figure><h3>6. What Is a CI/CD Pipeline?</h3><p>A CI/CD pipeline is an automated sequence of activities that validates and prepares software changes for delivery.</p><p>Each stage performs a particular operation.</p><p>A typical pipeline may include the following stages.</p><h3>Stage 1 — Source</h3><p>A developer commits code to a version control system.</p><p>An event, such as a push or pull request, can trigger the pipeline.</p><h3>Stage 2 — Build</h3><p>The pipeline compiles or packages the application.</p><p>For a Java project, this might involve Maven or Gradle.</p><p>For a frontend project, it might involve installing dependencies and creating a production build.</p><h3>Stage 3 — Test</h3><p>Automated tests check different aspects of the application.</p><p>Examples include:</p><ul><li>Unit tests</li><li>Integration tests</li><li>API tests</li><li>Static analysis</li><li>Security scans</li></ul><p>Not every project needs every category of test in every pipeline.</p><h3>Stage 4 — Package</h3><p>The validated application is packaged into a deployable artifact.</p><p>For example:</p><ul><li>A Java JAR file</li><li>A frontend build</li><li>A Docker image</li></ul><p>The artifact may be stored in a package repository or container registry.</p><h3>Stage 5 — Deploy</h3><p>The application is released to a target environment.</p><p>Examples include:</p><ul><li>A testing environment</li><li>A staging environment</li><li>A production environment</li></ul><h3>Stage 6 — Verify and Monitor</h3><p>The team checks whether the deployed application behaves correctly.</p><p>This may involve smoke tests, health checks, metrics, alerts, and application logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*g0MHO4nEYIqrt2zf" /></figure><p>A simplified pipeline looks like this:</p><p><strong>Code → Build → Test → Package → Deploy → Verify</strong></p><p>If an important stage fails, the pipeline should report the problem and prevent unsafe progression.</p><h3>7. Common CI/CD Tools</h3><p>There are several technologies used to build and manage CI/CD pipelines.</p><h3>GitHub Actions</h3><p>GitHub Actions allows developers to automate workflows associated with GitHub repositories.</p><p>Workflows can respond to events such as pushes, pull requests, or manual execution.</p><h3>Jenkins</h3><p>Jenkins is an open-source automation server frequently used to build, test, and deploy applications.</p><p>It provides extensive customization through pipelines and plugins.</p><h3>GitLab CI/CD</h3><p>GitLab CI/CD provides pipeline automation integrated with GitLab repositories and development workflows.</p><h3>Azure Pipelines</h3><p>Azure Pipelines is part of Azure DevOps and supports building, testing, and deploying applications across different platforms.</p><h3>AWS CodePipeline</h3><p>AWS CodePipeline helps orchestrate automated software delivery workflows using AWS and supported integrations.</p><p>These tools differ in configuration, hosting, features, and infrastructure requirements.</p><p>However, they share the same general purpose: helping teams automate software delivery processes.</p><p>For beginners already using GitHub, GitHub Actions is a convenient starting point.</p><h3>8. Understanding GitHub Actions</h3><p>Let’s explore GitHub Actions more closely.</p><p>GitHub Actions is an automation platform that can execute workflows associated with repository events.</p><p>These workflows are defined using YAML files.</p><p>A workflow file is normally stored in:</p><p>.github/workflows/</p><p>For example:</p><p>.github/workflows/ci.yml</p><h3>Important GitHub Actions Concepts</h3><p><strong>Workflow</strong></p><p>An automated process defined in a YAML file.</p><p><strong>Event</strong></p><p>An activity that can trigger a workflow, such as a push or pull request.</p><p><strong>Job</strong></p><p>A group of steps executed on a runner.</p><p><strong>Step</strong></p><p>An individual task within a job.</p><p><strong>Runner</strong></p><p>The machine or environment that executes a job.</p><p><strong>Action</strong></p><p>A reusable component that performs a particular task in a workflow.</p><h3>Example Workflow Structure</h3><pre>name: Example CI</pre><pre>on:<br>  push:<br>    branches: [main]<br>  pull_request:<br>    branches: [main]</pre><pre>jobs:<br>  check:<br>    runs-on: ubuntu-latest</pre><pre>    steps:<br>      - name: Display message<br>        run: echo &quot;CI workflow started&quot;</pre><p>Let’s understand this example.</p><p>name gives the workflow a descriptive name.</p><p>on defines the events that trigger it.</p><p>jobs defines the work to execute.</p><p>runs-on identifies the runner environment.</p><p>steps contains the individual operations.</p><p>In this example, the workflow runs when changes are pushed to main or when a pull request targets main.</p><p>It only displays a message.</p><p>It does not build or test an application yet.</p><p>Let’s create a more useful workflow in the practical exercise.</p><h3>9. Practical Project: Your First CI Pipeline</h3><p>Now let’s build a simple GitHub Actions pipeline for a Python project.</p><p>This exercise requires:</p><ul><li>Git</li><li>Python 3</li><li>A GitHub account</li><li>A repository where you have permission to push changes</li></ul><p>We’ll create a small calculator, write unit tests, and configure GitHub Actions to run those tests automatically.</p><h3>Step 1 — Create a Project Directory</h3><p>Open your terminal.</p><pre>mkdir devops-ci-lab<br>cd devops-ci-lab</pre><p>Initialize Git:</p><pre>git init -b main</pre><h3>Step 2 — Create a Python Application</h3><p>Create a file named:</p><p>calculator.py</p><p>Add:</p><pre>def add(a, b):<br>    return a + b<br></pre><pre>def subtract(a, b):<br>    return a - b</pre><p>This is a simple Python application containing two functions.</p><h3>Step 3 — Create Unit Tests</h3><p>Create another file:</p><p>test_calculator.py</p><p>Add:</p><pre>import unittest</pre><pre>from calculator import add, subtract<br></pre><pre>class CalculatorTests(unittest.TestCase):</pre><pre>    def test_add(self):<br>        self.assertEqual(add(2, 3), 5)</pre><pre>    def test_subtract(self):<br>        self.assertEqual(subtract(8, 3), 5)<br></pre><pre>if __name__ == &quot;__main__&quot;:<br>    unittest.main()</pre><p>These tests check whether both functions return the expected results.</p><h3>Step 4 — Run the Tests Locally</h3><p>Execute:</p><pre>python3 -m unittest discover -v</pre><p>If everything is correct, both tests should pass.</p><p>It’s important to run tests locally before committing changes.</p><p>CI should complement local development, not replace it entirely.</p><h3>Step 5 — Create the GitHub Actions Workflow</h3><p>Create the required directory:</p><pre>mkdir -p .github/workflows</pre><p>Create a file named:</p><p>.github/workflows/ci.yml</p><p>Add:</p><pre>name: Python CI</pre><pre>on:<br>  push:<br>    branches: [main]<br>  pull_request:<br>    branches: [main]</pre><pre>jobs:<br>  test:<br>    runs-on: ubuntu-latest</pre><pre>    steps:<br>      - name: Checkout repository<br>        uses: actions/checkout@v4</pre><pre>      - name: Set up Python<br>        uses: actions/setup-python@v5<br>        with:<br>          python-version: &#39;3.12&#39;</pre><pre>      - name: Run unit tests<br>        run: python -m unittest discover -v</pre><h3>Step 6 — Understand the Workflow</h3><p><strong>Checkout Repository</strong></p><p>The checkout action makes the repository’s source code available to the workflow.</p><p><strong>Set Up Python</strong></p><p>The setup-python action configures the required Python version for the job.</p><p><strong>Run Unit Tests</strong></p><p>The pipeline executes the tests using Python’s built-in unittest framework.</p><p>If a test fails, the step reports a nonzero exit status and the job is marked unsuccessful.</p><p>If the tests pass, the job succeeds.</p><p>This is a basic but functional CI pipeline.</p><h3>Step 7 — Commit Your Project</h3><p>Run:</p><pre>git add calculator.py test_calculator.py .github/workflows/ci.yml</pre><p>Then:</p><pre>git commit -m &quot;Add calculator with automated CI tests&quot;</pre><h3>Step 8 — Create a GitHub Repository</h3><p>Open:</p><p><a href="https://github.com/new">https://github.com/new</a></p><p>Create an empty repository named:</p><p>devops-ci-lab</p><p>For this exercise, don’t initialize it with a README, license, or .gitignore.</p><h3>Step 9 — Connect and Push</h3><p>Replace YOUR_USERNAME with your GitHub username.</p><pre>git remote add origin https://github.com/YOUR_USERNAME/devops-ci-lab.git</pre><p>Push your main branch:</p><pre>git push -u origin main</pre><p>Complete GitHub authentication using your configured method if required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*N8kIPUnwB9WW-xTJ" /></figure><h3>Step 10 — Check GitHub Actions</h3><p>Open your repository on GitHub.</p><p>Navigate to the <strong>Actions</strong> tab.</p><p>You should see the Python CI workflow triggered by the push to main, provided Actions is enabled and the workflow is accepted.</p><p>Open the workflow run.</p><p>You’ll be able to inspect the job, its individual steps, and the test output.</p><p>If both tests pass, the workflow run should succeed.</p><p>Congratulations! You’ve created a simple Continuous Integration pipeline.</p><h3>10. Testing the Pipeline with a Pull Request</h3><p>Now let’s see how CI helps developers validate changes before merging.</p><h3>Step 1 — Create a Feature Branch</h3><pre>git switch -c feature/calculator-update</pre><h3>Step 2 — Add a New Function</h3><p>Update calculator.py by adding:</p><pre>def multiply(a, b):<br>    return a * b</pre><p>In test_calculator.py, update the import to include multiply:</p><pre>from calculator import add, subtract, multiply</pre><p>Then add a new test method inside the existing CalculatorTests class:</p><pre>def test_multiply(self):<br>    self.assertEqual(multiply(4, 3), 12)</pre><h3>Step 3 — Run the Tests</h3><pre>python3 -m unittest discover -v</pre><p>You should now have three passing tests.</p><h3>Step 4 — Commit and Push</h3><pre>git add calculator.py test_calculator.py<br>git commit -m &quot;Add multiplication function and test&quot;<br>git push -u origin feature/calculator-update</pre><h3>Step 5 — Open a Pull Request</h3><p>Visit the repository on GitHub.</p><p>Create a pull request from:</p><p>feature/calculator-update</p><p>into:</p><p>main</p><p>Because the workflow is configured to respond to pull requests targeting main, GitHub Actions should run the tests for the proposed changes.</p><p>You can review the results before merging.</p><p>This demonstrates an important benefit of Continuous Integration:</p><p><strong>New changes can be checked automatically before they become part of the main codebase.</strong></p><h3>11. What Happens When a CI Pipeline Fails?</h3><p>Let’s intentionally introduce a test failure.</p><p>In your feature branch, change the expected result in the multiplication test:</p><pre>def test_multiply(self):<br>    self.assertEqual(multiply(4, 3), 15)</pre><p>The actual result is 12, not 15.</p><p>Run the tests locally:</p><pre>python3 -m unittest discover -v</pre><p>The multiplication test should fail.</p><p>Commit and push this change to your practice branch:</p><pre>git add test_calculator.py<br>git commit -m &quot;Demonstrate failing CI test&quot;<br>git push</pre><p>Open the GitHub Actions workflow run associated with the new commit.</p><p>You should see a failed test job.</p><p>The logs will indicate which test failed and what result was expected.</p><h3>Fixing the Failure</h3><p>Correct the test:</p><pre>def test_multiply(self):<br>    self.assertEqual(multiply(4, 3), 12)</pre><p>Run the tests again.</p><p>Then commit and push the correction:</p><pre>git add test_calculator.py<br>git commit -m &quot;Fix multiplication test expectation&quot;<br>git push</pre><p>The next workflow run should pass.</p><h3>What Did We Learn?</h3><p>A CI pipeline provides automated feedback.</p><p>When a check fails, developers can inspect the logs, investigate the cause, and correct the problem.</p><p>For a professional team, required CI checks can be enforced through repository rules so that pull requests cannot be merged until the required conditions are satisfied.</p><p>Simply creating a CI workflow does not automatically enable those merge restrictions.</p><h3>12. Understanding Build Artifacts</h3><p>A build artifact is an output produced by a build process.</p><p>Examples include:</p><ul><li>Java JAR files</li><li>Compiled application binaries</li><li>Frontend build directories</li><li>Test reports</li><li>Docker images</li></ul><p>Artifacts are important because they provide a versioned output that can be tested and released.</p><p>For example, a Spring Boot pipeline might compile the application into a JAR file.</p><p>Another step could build a Docker image containing that application.</p><p>The resulting artifact can then be stored and later deployed.</p><p>A good release process avoids rebuilding different versions of the application unnecessarily between environments.</p><p>Instead, teams often promote the same validated artifact through testing, staging, and production.</p><p>This helps reduce differences between what was tested and what was deployed.</p><h3>13. Understanding Deployment Environments</h3><p>Applications are often deployed to multiple environments.</p><h3>Development</h3><p>Used by developers to build and test features.</p><h3>Testing</h3><p>Used to execute automated or manual tests against an application.</p><h3>Staging</h3><p>A pre-production environment designed to help validate a release under conditions that resemble production.</p><h3>Production</h3><p>The live environment serving real users or business workloads.</p><h3>Example Workflow</h3><p>A company may use:</p><p><strong>GitHub → CI Tests → Build Artifact → Staging → Approval → Production</strong></p><p>This resembles a Continuous Delivery process.</p><p>If the production approval is replaced by fully automated release rules, the workflow may follow a Continuous Deployment approach.</p><p>Not every project needs all of these environments.</p><p>A small personal project may use a simpler workflow, while a larger organization may require additional controls.</p><h3>14. Deployment Strategies</h3><p>Deploying a new version can temporarily affect users if it is not managed carefully.</p><p>Several deployment strategies help teams control how applications are updated.</p><h3>Rolling Deployment</h3><p>The application is updated gradually, replacing instances in stages.</p><p>This can reduce disruption when the application has multiple running instances and sufficient capacity.</p><h3>Blue-Green Deployment</h3><p>Two environments are maintained:</p><ul><li><strong>Blue:</strong> The current version.</li><li><strong>Green:</strong> The new version.</li></ul><p>Traffic is switched to the new environment after validation.</p><p>If a problem occurs, traffic may be switched back, provided the previous environment remains compatible and available.</p><h3>Canary Deployment</h3><p>A new version is initially released to a small portion of users or traffic.</p><p>The team monitors its behavior before increasing exposure.</p><h3>Why These Strategies Matter</h3><p>Different strategies offer different trade-offs involving complexity, infrastructure cost, and risk.</p><p>For beginners, the important concept is that deployment is not always a single action that replaces an entire running application.</p><p>Later in this series, we’ll explore these strategies in more detail.</p><h3>15. Security in CI/CD Pipelines</h3><p>Automation pipelines may have access to source code, build infrastructure, deployment environments, and credentials.</p><p>This makes security an important part of CI/CD.</p><h3>Protect Secrets</h3><p>Never hardcode passwords, API keys, or deployment credentials inside workflow files.</p><p>Use appropriate secret-management mechanisms.</p><h3>Use Least Privilege</h3><p>Give workflows only the permissions required to perform their tasks.</p><h3>Review Third-Party Actions</h3><p>External actions and dependencies should come from trusted sources.</p><p>Pinning third-party actions to specific commit hashes can improve supply-chain security.</p><h3>Protect Important Branches</h3><p>Use repository rules and required checks to reduce the chance of unreviewed changes entering critical branches.</p><h3>Separate Build and Deployment Permissions</h3><p>A workflow that runs tests on untrusted contributions should not automatically receive unrestricted production deployment credentials.</p><p>Security controls must reflect the risks associated with each workflow.</p><p><strong>A reliable pipeline should be designed to protect both the application and the infrastructure used to deliver it.</strong></p><h3>16. Common CI/CD Mistakes Beginners Should Avoid</h3><h3>Assuming CI/CD Means Automatic Deployment</h3><p>CI/CD includes different practices.</p><p>A CI pipeline may only build and test an application.</p><p>Deployment requires additional configuration.</p><h3>Ignoring Failed Tests</h3><p>A failed pipeline indicates that something needs investigation.</p><p>Do not bypass failures simply to complete a merge.</p><h3>Using Only Manual Testing</h3><p>Manual testing is useful, but repeatable automated checks provide faster feedback on frequently changing code.</p><h3>Exposing Credentials in Workflow Files</h3><p>Secrets should be managed securely, with carefully limited access.</p><h3>Building Different Artifacts for Every Environment</h3><p>Unnecessary rebuilding can introduce differences between validated and released software.</p><p>Promoting the same validated artifact is often preferable.</p><h3>Deploying Without Monitoring</h3><p>A successful deployment command does not guarantee that the application is functioning correctly.</p><p>Health checks, metrics, and logs help verify the actual result.</p><h3>Overcomplicating the Pipeline</h3><p>A simple application may not need a large, multi-stage deployment platform.</p><p>Start with the necessary checks and introduce additional stages as the project’s requirements grow.</p><h3>17. Best Practices for Reliable CI/CD</h3><p>As you build more advanced workflows, keep these principles in mind.</p><p><strong>Automate Important Checks</strong></p><p>Run relevant builds and tests consistently.</p><p><strong>Keep Pipelines Fast Enough to Provide Useful Feedback</strong></p><p>Long-running pipelines can slow development and encourage teams to bypass checks.</p><p><strong>Use Small, Reviewable Changes</strong></p><p>Smaller changes are usually easier to understand and troubleshoot.</p><p><strong>Maintain Clear Pipeline Logs</strong></p><p>Failure messages should help developers identify the cause of a problem.</p><p><strong>Manage Artifacts Carefully</strong></p><p>Track which application version was built, tested, and deployed.</p><p><strong>Protect Sensitive Information</strong></p><p>Use appropriate permissions, secure credentials, and trusted dependencies.</p><p><strong>Design for Recovery</strong></p><p>Plan how to respond if a deployment introduces problems.</p><p><strong>Monitor Production</strong></p><p>Use health checks, logs, metrics, and alerts to understand system behavior.</p><p><strong>Improve Pipelines Continuously</strong></p><p>Review recurring failures, unnecessary steps, and opportunities to improve reliability.</p><p>CI/CD is not a one-time setup. It is an engineering process that should evolve with the application.</p><h3>Final Thoughts</h3><p>CI/CD is a fundamental part of modern DevOps practices.</p><p>It helps teams move software changes from development toward production through automated, repeatable, and controlled workflows.</p><p>In this article, we explored:</p><ul><li>Continuous Integration</li><li>Continuous Delivery</li><li>Continuous Deployment</li><li>CI/CD pipeline stages</li><li>Popular CI/CD tools</li><li>GitHub Actions fundamentals</li><li>Creating a practical Python CI workflow</li><li>Running tests automatically on pull requests</li><li>Investigating pipeline failures</li><li>Build artifacts and deployment environments</li><li>Deployment strategies</li><li>CI/CD security and best practices</li></ul><p>The most important lesson is:</p><p><strong>CI/CD is not about deploying code as quickly as possible. It is about creating a reliable, repeatable process for validating and delivering software changes.</strong></p><p>A well-designed pipeline helps development teams move faster without ignoring quality, security, or operational reliability.</p><h3>What’s Next?</h3><p><strong>Article 07 — GitHub Actions: Building Your First Complete CI/CD Pipeline</strong></p><p>In the next article, we’ll move beyond the basic CI workflow created here.</p><p>We’ll explore GitHub Actions in greater depth, including workflow triggers, jobs, dependencies, caching, artifacts, repository secrets, and deployment environments.</p><p>We’ll then create a more complete pipeline that builds, tests, and prepares an application for deployment.</p><p><em>Thanks for reading Article 06 of my DevOps From Zero to Production series! I’m documenting my learning journey and sharing practical examples as I explore the technologies behind modern software delivery.</em></p><p><em>If you’re also learning DevOps, feel free to share your experiences, questions, and suggestions.</em></p><h3>References and Further Reading</h3><p><strong>GitHub Docs — Continuous Integration</strong></p><p><a href="https://docs.github.com/en/actions/get-started/continuous-integration">https://docs.github.com/en/actions/get-started/continuous-integration</a></p><p><strong>GitHub Docs — Continuous Deployment</strong></p><p><a href="https://docs.github.com/en/actions/get-started/continuous-deployment">https://docs.github.com/en/actions/get-started/continuous-deployment</a></p><p><strong>GitHub Docs — GitHub Actions</strong></p><p><a href="https://docs.github.com/en/actions">https://docs.github.com/en/actions</a></p><p><strong>AWS — What Is CI/CD?</strong></p><p><a href="https://aws.amazon.com/what-is/ci-cd/">https://aws.amazon.com/what-is/ci-cd/</a></p><p><strong>AWS — What Is a CI/CD Pipeline?</strong></p><p><a href="https://aws.amazon.com/what-is/ci-cd-pipeline/">https://aws.amazon.com/what-is/ci-cd-pipeline/</a></p><p><strong>AWS — Understanding CI/CD</strong></p><p><a href="https://docs.aws.amazon.com/prescriptive-guidance/latest/strategy-cicd-litmus/understanding-cicd.html">https://docs.aws.amazon.com/prescriptive-guidance/latest/strategy-cicd-litmus/understanding-cicd.html</a></p><p><strong>Python Documentation — unittest</strong></p><p><a href="https://docs.python.org/3/library/unittest.html">https://docs.python.org/3/library/unittest.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74a8d2c78bda" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bash Scripting and Python Automation for DevOps Engineers: A Beginner’s Guide]]></title>
            <link>https://medium.com/@sajinitharushika3655/bash-scripting-and-python-automation-for-devops-engineers-a-beginners-guide-a1dbcd917e32?source=rss-e1a9a8dbe515------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1dbcd917e32</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Sajinitharushika]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 13:06:45 GMT</pubDate>
            <atom:updated>2026-11-16T13:06:45.496Z</atom:updated>
            <content:encoded><![CDATA[<p><em>DevOps From Zero to Production — Article 05</em></p><p><strong>Learn how Bash and Python simplify repetitive tasks, automate system checks, analyze logs, and support reliable software operations.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*IJ5tCm_SXGH_lnJ1" /></figure><h3>Introduction</h3><p>Imagine managing several Linux servers that run different applications.</p><p>Every morning, you need to check whether the servers have enough disk space, inspect memory usage, review application logs, and make sure essential services are working.</p><p>Performing these tasks manually might be manageable for one server.</p><p>But what happens when you’re responsible for ten, fifty, or even hundreds of servers?</p><p>Repeating the same commands every day becomes time-consuming and increases the possibility of human error.</p><p>This is where automation becomes important.</p><p>Instead of manually executing the same instructions, we can write scripts that perform those tasks consistently.</p><p>Two widely used technologies for automation are <strong>Bash and Python</strong>.</p><p>In the previous article of my <em>DevOps From Zero to Production</em> series, we explored Git and GitHub, including version control, branching, pull requests, and collaboration.</p><p>In this fifth article, we’ll learn how scripting helps DevOps engineers automate repetitive tasks, understand the differences between Bash and Python, and build practical automation scripts.</p><p>Let’s begin!</p><h3>1. What Is Automation in DevOps?</h3><p>Automation is the process of using software to perform tasks with minimal manual intervention.</p><p>In DevOps, automation helps teams reduce repetitive work and improve the consistency of software delivery and operations.</p><p>Consider a simple example.</p><p>Without automation, an engineer might manually:</p><ol><li>Connect to a server.</li><li>Check disk usage.</li><li>Check available memory.</li><li>Inspect application logs.</li><li>Record the results.</li><li>Repeat the process on another server.</li></ol><p>With automation, a script can execute the required checks and generate a report.</p><p>Automation is commonly used for:</p><ul><li>Building and testing applications</li><li>Deploying software</li><li>Checking server health</li><li>Collecting logs</li><li>Creating file backups</li><li>Managing configuration</li><li>Performing scheduled maintenance</li><li>Validating infrastructure</li></ul><p>However, automation is not simply about running commands faster.</p><p>Good automation should also be <strong>reliable, repeatable, observable, and safe</strong>.</p><p>A script that runs automatically but silently ignores failures can create more problems than it solves.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*jLUmZvibKFplAtAr" /></figure><h3>2. What Is Bash?</h3><p>Bash stands for <strong>Bourne Again Shell</strong>.</p><p>It is a command-line shell and scripting language commonly available on Linux systems.</p><p>When you enter commands in a Bash terminal, Bash interprets those commands and executes the required operations.</p><p>For example:</p><pre>pwd</pre><p>Displays the current working directory.</p><pre>ls</pre><p>Lists files and directories.</p><pre>df -h</pre><p>Displays filesystem usage.</p><p>Instead of executing these commands individually, we can place them into a script.</p><h3>What Is a Bash Script?</h3><p>A Bash script is a text file containing commands and programming constructs that Bash can execute.</p><p>Bash scripts commonly use the .sh extension.</p><p>For example:</p><p>system-check.sh</p><p>A basic script might look like this:</p><pre>#!/usr/bin/env bash</pre><pre>echo &quot;Starting system check&quot;</pre><pre>date</pre><pre>df -h</pre><pre>free -h</pre><p>The first line:</p><pre>#!/usr/bin/env bash</pre><p>is called a <strong>shebang</strong>.</p><p>It tells the system to locate Bash through the environment when the script is executed directly.</p><p>The echo command displays text.</p><p>The date command displays the current date and time.</p><p>The remaining commands inspect disk and memory information.</p><h3>Running a Bash Script</h3><p>Save the commands in a file named system-check.sh.</p><p>Then execute:</p><pre>bash system-check.sh</pre><p>Alternatively, make the script executable:</p><pre>chmod +x system-check.sh</pre><p>Then run:</p><pre>./system-check.sh</pre><p>The script executes the commands in sequence.</p><p>This is the foundation of shell scripting.</p><h3>3. Understanding Bash Variables</h3><p>Variables allow scripts to store and reuse values.</p><p>For example:</p><pre>#!/usr/bin/env bash</pre><pre>APP_NAME=&quot;DevOps Demo&quot;</pre><pre>echo &quot;Application: $APP_NAME&quot;</pre><p>Output:</p><pre>Application: DevOps Demo</pre><p>Here, APP_NAME is a variable.</p><p>The value is assigned using the = operator.</p><p>Notice that there are no spaces around the assignment operator.</p><p>Correct:</p><pre>APP_NAME=&quot;DevOps Demo&quot;</pre><p>Incorrect:</p><pre>APP_NAME = &quot;DevOps Demo&quot;</pre><h3>Using Variables with Commands</h3><p>We can also store the output of commands.</p><pre>#!/usr/bin/env bash</pre><pre>CURRENT_DATE=$(date)</pre><pre>echo &quot;System check performed at:&quot;<br>echo &quot;$CURRENT_DATE&quot;</pre><p>The syntax $(...) performs command substitution.</p><p>It executes the command and captures its standard output.</p><h3>Why Variables Matter</h3><p>Imagine using the same directory path in several places in a script.</p><p>Instead of repeatedly writing the full path, we can store it in a variable.</p><pre>BACKUP_DIR=&quot;$HOME/devops-backups&quot;</pre><pre>mkdir -p &quot;$BACKUP_DIR&quot;</pre><p>This makes the script easier to maintain.</p><p>Notice the double quotes around the variable.</p><p>Quoting variable expansions is an important practice because paths may contain spaces or other special characters.</p><h3>4. Conditional Statements in Bash</h3><p>Automation often requires making decisions.</p><p>For example:</p><ul><li>If a file exists, process it.</li><li>If a service is unavailable, report an error.</li><li>If disk usage is high, display a warning.</li></ul><p>Bash supports conditional statements using if.</p><h3>Example: Checking Whether a File Exists</h3><pre>#!/usr/bin/env bash</pre><pre>FILE=&quot;application.log&quot;</pre><pre>if [[ -f &quot;$FILE&quot; ]]; then<br>    echo &quot;Log file found&quot;<br>else<br>    echo &quot;Log file not found&quot;<br>fi</pre><p>Here:</p><ul><li>if begins the condition.</li><li>[[ -f &quot;$FILE&quot; ]] checks whether the specified path is a regular file.</li><li>then introduces commands executed when the condition is true.</li><li>else provides an alternative.</li><li>fi ends the conditional block.</li></ul><h3>Example: Checking a Directory</h3><pre>#!/usr/bin/env bash</pre><pre>DIRECTORY=&quot;$HOME/devops-lab&quot;</pre><pre>if [[ -d &quot;$DIRECTORY&quot; ]]; then<br>    echo &quot;Directory exists&quot;<br>else<br>    echo &quot;Directory does not exist&quot;<br>fi</pre><p>Conditional statements are useful when writing scripts that must respond differently depending on the system’s state.</p><h3>5. Loops in Bash</h3><p>Loops allow us to repeat commands without writing the same instructions multiple times.</p><h3>Example: A Simple for Loop</h3><pre>#!/usr/bin/env bash</pre><pre>for NUMBER in 1 2 3 4 5<br>do<br>    echo &quot;Checking server $NUMBER&quot;<br>done</pre><p>Output:</p><pre>Checking server 1<br>Checking server 2<br>Checking server 3<br>Checking server 4<br>Checking server 5</pre><h3>Example: Processing Multiple Files</h3><pre>#!/usr/bin/env bash</pre><pre>for FILE in *.log<br>do<br>    [[ -f &quot;$FILE&quot; ]] || continue<br>    echo &quot;Found log file: $FILE&quot;<br>done</pre><p>This script searches the current directory for files matching *.log.</p><p>The file check also handles the situation where no matching log files exist.</p><h3>Why Loops Matter in DevOps</h3><p>Loops can be used to:</p><ul><li>Process multiple log files.</li><li>Inspect several services.</li><li>Run checks against a list of servers.</li><li>Validate configuration files.</li><li>Perform repeated maintenance operations.</li></ul><p>For example, instead of manually reviewing five log files, a script could process them in a single execution.</p><h3>6. Functions in Bash</h3><p>As scripts grow, repeating similar code becomes difficult to maintain.</p><p>Functions allow us to group commands into reusable blocks.</p><h3>Example</h3><pre>#!/usr/bin/env bash</pre><pre>show_system_info() {<br>    echo &quot;Hostname:&quot;<br>    hostname</pre><pre>    echo &quot;Current user:&quot;<br>    whoami<br>}</pre><pre>show_system_info</pre><p>The function show_system_info contains commands that display basic system information.</p><p>Calling the function executes those commands.</p><p>Functions help organize scripts into smaller, more understandable sections.</p><p>This becomes especially useful when creating deployment scripts, environment checks, and administrative utilities.</p><h3>7. Understanding Exit Codes and Error Handling</h3><p>When a command finishes executing, it returns an exit status.</p><p>In Unix-style systems:</p><p><strong>Exit status 0</strong> normally indicates success.</p><p><strong>A nonzero exit status</strong> normally indicates failure or another condition reported by the command.</p><p>For example:</p><pre>ls /path/that/does/not/exist</pre><p>The command should fail because the path does not exist.</p><p>You can inspect the exit status of the most recent command using:</p><pre>echo $?</pre><p>The value will normally be nonzero.</p><h3>Why Exit Codes Matter</h3><p>Imagine an automated deployment script.</p><p>If the application build fails but the script continues to the deployment step, it might attempt to deploy an invalid or outdated artifact.</p><p>Scripts should detect important failures and respond appropriately.</p><h3>A Simple Error Handling Example</h3><pre>#!/usr/bin/env bash</pre><pre>if mkdir -p &quot;$HOME/devops-demo&quot;; then<br>    echo &quot;Directory is ready&quot;<br>else<br>    echo &quot;Failed to create directory&quot; &gt;&amp;2<br>    exit 1<br>fi</pre><p>The script checks whether the directory creation command succeeded.</p><p>If it fails, the script displays an error and exits with status 1.</p><p>The &gt;&amp;2 redirection sends the message to standard error.</p><h3>Understanding set -euo pipefail</h3><p>You may encounter this line in Bash scripts:</p><pre>set -euo pipefail</pre><p>It enables several shell behaviors:</p><ul><li>-e: Exits on certain unhandled command failures.</li><li>-u: Treats references to unset variables as errors.</li><li>-o pipefail: Makes a pipeline report a failure when one of its commands fails, rather than relying only on the last command.</li></ul><p>These settings can help identify errors, but they are not a complete error-handling solution.</p><p>In particular, -e has exceptions depending on how a command is used.</p><p>A reliable script should still validate inputs and explicitly handle expected failures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*3CslKg1EUnnnkCHc" /></figure><h3>8. Understanding Input and Output Redirection</h3><p>Bash provides operators to control where command output goes.</p><h3>Save Output to a File</h3><pre>date &gt; report.txt</pre><p>The &gt; operator redirects standard output to a file.</p><p>If the file already exists, its previous contents are normally replaced.</p><h3>Append Output to a File</h3><pre>date &gt;&gt; report.txt</pre><p>The &gt;&gt; operator appends output to the existing file.</p><h3>Redirect Error Messages</h3><pre>ls /missing-directory 2&gt; errors.txt</pre><p>The 2&gt; operator redirects standard error.</p><h3>Combining Commands with Pipes</h3><p>A pipe sends the standard output of one command to the standard input of another.</p><p>For example:</p><pre>printf &#39;%s\n&#39; &quot;INFO&quot; &quot;ERROR&quot; &quot;INFO&quot; | grep &quot;ERROR&quot;</pre><p>This displays the matching line.</p><p>Pipelines are useful for filtering data, processing logs, and connecting command-line tools.</p><h3>9. Practical Project 01: Automated System Health Report</h3><p>Let’s combine what we’ve learned.</p><p>We will create a Bash script that generates a basic Linux system report.</p><h3>Step 1 — Create a Practice Directory</h3><pre>mkdir -p ~/devops-automation-lab<br>cd ~/devops-automation-lab</pre><h3>Step 2 — Create the Script</h3><p>Open a new file:</p><pre>nano health-check.sh</pre><p>Add:</p><pre>#!/usr/bin/env bash</pre><pre>set -euo pipefail</pre><pre>REPORT_DIR=&quot;$HOME/devops-automation-lab/reports&quot;</pre><pre>mkdir -p &quot;$REPORT_DIR&quot;</pre><pre>REPORT_FILE=&quot;$REPORT_DIR/health-$(date +%Y%m%d-%H%M%S).txt&quot;</pre><pre>{<br>    echo &quot;=== SYSTEM HEALTH REPORT ===&quot;<br>    echo</pre><pre>    echo &quot;Date:&quot;<br>    date<br>    echo</pre><pre>    echo &quot;Hostname:&quot;<br>    hostname<br>    echo</pre><pre>    echo &quot;Current User:&quot;<br>    whoami<br>    echo</pre><pre>    echo &quot;System Uptime:&quot;<br>    uptime<br>    echo</pre><pre>    echo &quot;Memory Usage:&quot;<br>    free -h<br>    echo</pre><pre>    echo &quot;Filesystem Usage:&quot;<br>    df -h<br>    echo</pre><pre>} &gt; &quot;$REPORT_FILE&quot;</pre><pre>echo &quot;Report saved to: $REPORT_FILE&quot;</pre><h3>Step 3 — Run the Script</h3><pre>bash health-check.sh</pre><p>The script creates a timestamped report inside the reports directory.</p><h3>Step 4 — View the Reports</h3><pre>ls reports</pre><p>Open a report using:</p><pre>cat reports/health-*.txt</pre><p>If you run the script multiple times, this command may display multiple reports.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Alrun6p7NWlGeswf" /></figure><h3>What Did We Automate?</h3><p>Our script:</p><ol><li>Creates a report directory if required.</li><li>Generates a timestamped filename.</li><li>Collects system information.</li><li>Saves the results to a file.</li><li>Reports where the file was saved.</li></ol><p>This is a small example of system monitoring automation.</p><p>However, it is not a complete production monitoring solution.</p><p>It provides a snapshot of the machine rather than continuous monitoring, alerting, or long-term metrics storage.</p><p>Those capabilities will be explored in later articles.</p><h3>10. What Is Python Automation?</h3><p>Bash is useful for combining operating system commands.</p><p>But some automation tasks become easier when we use a general-purpose programming language.</p><p>Python is widely used for scripting, data processing, API communication, and automation.</p><p>Python provides libraries for working with files, directories, processes, JSON, HTTP services, and many other tasks.</p><h3>A Simple Python Script</h3><p>Create a file named hello.py.</p><pre>print(&quot;Hello from Python automation!&quot;)</pre><p>Run it using:</p><pre>python3 hello.py</pre><p>Output:</p><pre>Hello from Python automation!</pre><h3>Bash vs Python: When Should We Use Each?</h3><p>Bash is often a good choice for:</p><ul><li>Running Linux commands.</li><li>Combining command-line utilities.</li><li>Writing small system administration scripts.</li><li>Performing simple file operations.</li><li>Creating wrappers around existing tools.</li></ul><p>Python is often a good choice for:</p><ul><li>Processing structured data.</li><li>Interacting with APIs.</li><li>Creating more complex automation logic.</li><li>Analyzing logs.</li><li>Building reusable automation utilities.</li><li>Writing scripts that need more extensive testing and error handling.</li></ul><p>They are not competing technologies.</p><p>In many real projects, Bash and Python complement each other.</p><p>The best choice depends on the problem being solved.</p><h3>11. Working with Files Using Python</h3><p>Python includes a module called pathlib for working with filesystem paths.</p><h3>Example: Creating a Directory</h3><pre>from pathlib import Path</pre><pre>directory = Path.home() / &quot;devops-python-lab&quot;</pre><pre>directory.mkdir(parents=True, exist_ok=True)</pre><pre>print(&quot;Directory created:&quot;, directory)</pre><p>This script creates a practice directory inside the current user’s home directory.</p><p>The exist_ok=True argument prevents an error when the directory already exists.</p><h3>Example: Writing a File</h3><pre>from pathlib import Path</pre><pre>file = Path.home() / &quot;devops-python-lab&quot; / &quot;notes.txt&quot;</pre><pre>file.parent.mkdir(parents=True, exist_ok=True)</pre><pre>file.write_text(<br>    &quot;Learning Python automation for DevOps.\n&quot;,<br>    encoding=&quot;utf-8&quot;<br>)</pre><pre>print(&quot;File written successfully&quot;)</pre><h3>Example: Reading a File</h3><pre>from pathlib import Path</pre><pre>file = Path.home() / &quot;devops-python-lab&quot; / &quot;notes.txt&quot;</pre><pre>if file.is_file():<br>    content = file.read_text(encoding=&quot;utf-8&quot;)<br>    print(content)<br>else:<br>    print(&quot;File not found&quot;)</pre><p>These examples demonstrate how Python can manage files without calling separate shell commands.</p><h3>12. Running System Commands with Python</h3><p>Sometimes a Python script needs to execute an external program.</p><p>Python provides the subprocess module for this purpose.</p><h3>Example: Checking System Uptime</h3><pre>import subprocess</pre><pre>result = subprocess.run(<br>    [&quot;uptime&quot;],<br>    capture_output=True,<br>    text=True,<br>    check=True<br>)</pre><pre>print(result.stdout)</pre><p>The subprocess.run() function starts an external command and waits for it to finish.</p><p>In this example:</p><ul><li>[&quot;uptime&quot;] identifies the command.</li><li>capture_output=True captures its output.</li><li>text=True returns output as text.</li><li>check=True raises an exception if the command exits unsuccessfully.</li></ul><p>This example is intended for a Linux system with the uptime command available.</p><h3>Important Security Practice</h3><p>Avoid constructing shell commands by combining untrusted input into command strings.</p><p>Where possible, pass the command and its arguments as a list and avoid shell=True.</p><p>This reduces the risk of shell injection vulnerabilities.</p><p>For routine filesystem operations, prefer Python’s built-in libraries when they already provide the required functionality.</p><h3>13. Practical Project 02: Python Log Analyzer</h3><p>Application logs are important for diagnosing failures.</p><p>Let’s build a simple Python script that counts log entries containing the words ERROR and WARNING.</p><p>This exercise uses a small sample file so it can be tested safely.</p><h3>Step 1 — Create a Sample Log File</h3><p>Inside your devops-automation-lab directory, create a file called application.log.</p><p>Add:</p><pre>INFO Application started<br>INFO Database connected<br>WARNING High memory usage<br>ERROR Database connection failed<br>INFO Retrying connection<br>ERROR Request processing failed<br>WARNING Response time increased</pre><h3>Step 2 — Create the Python Script</h3><p>Create a file named:</p><p>analyze_logs.py</p><p>Add:</p><pre>from pathlib import Path</pre><pre>log_file = Path(&quot;application.log&quot;)</pre><pre>if not log_file.is_file():<br>    print(&quot;Log file not found&quot;)<br>    raise SystemExit(1)</pre><pre>error_count = 0<br>warning_count = 0</pre><pre>with log_file.open(encoding=&quot;utf-8&quot;) as file:<br>    for line in file:<br>        if &quot;ERROR&quot; in line:<br>            error_count += 1<br>        elif &quot;WARNING&quot; in line:<br>            warning_count += 1</pre><pre>print(&quot;=== LOG ANALYSIS REPORT ===&quot;)<br>print(f&quot;Errors: {error_count}&quot;)<br>print(f&quot;Warnings: {warning_count}&quot;)</pre><h3>Step 3 — Run the Script</h3><pre>python3 analyze_logs.py</pre><p>Expected output:</p><pre>=== LOG ANALYSIS REPORT ===<br>Errors: 2<br>Warnings: 2</pre><h3>How Does It Work?</h3><p>The script:</p><ol><li>Checks whether the log file exists.</li><li>Opens the file.</li><li>Reads the content line by line.</li><li>Counts lines containing ERROR or WARNING.</li><li>Displays a summary.</li></ol><p>This is a simplified log analyzer.</p><p>It assumes the log messages follow the sample format, and it is case-sensitive.</p><p>Real production systems may use structured JSON logs, multiple files, timestamps, and centralized logging platforms.</p><p>Nevertheless, this small project demonstrates an important automation concept: transforming raw operational data into useful information.</p><h3>14. Practical Project 03: Creating a Simple Backup</h3><p>Another common automation task is creating backups.</p><p>Let’s build a small Bash script that creates a compressed archive of a practice directory.</p><h3>Step 1 — Prepare a Practice Directory</h3><pre>mkdir -p ~/devops-backup-lab/data</pre><pre>echo &quot;Sample configuration&quot; &gt; ~/devops-backup-lab/data/config.txt</pre><h3>Step 2 — Create the Backup Script</h3><p>Create:</p><p>backup.sh</p><p>Add:</p><pre>#!/usr/bin/env bash</pre><pre>set -euo pipefail</pre><pre>BASE_DIR=&quot;$HOME/devops-backup-lab&quot;<br>SOURCE_DIR=&quot;$BASE_DIR/data&quot;<br>BACKUP_DIR=&quot;$BASE_DIR/backups&quot;</pre><pre>if [[ ! -d &quot;$SOURCE_DIR&quot; ]]; then<br>    echo &quot;Source directory not found&quot; &gt;&amp;2<br>    exit 1<br>fi</pre><pre>mkdir -p &quot;$BACKUP_DIR&quot;</pre><pre>BACKUP_FILE=&quot;$BACKUP_DIR/backup-$(date +%Y%m%d-%H%M%S).tar.gz&quot;</pre><pre>tar -czf &quot;$BACKUP_FILE&quot; -C &quot;$BASE_DIR&quot; data</pre><pre>echo &quot;Backup created: $BACKUP_FILE&quot;</pre><h3>Step 3 — Run the Script</h3><pre>bash backup.sh</pre><h3>Step 4 — Inspect the Backup</h3><pre>ls ~/devops-backup-lab/backups</pre><p>To list the archive’s contents:</p><pre>tar -tzf ~/devops-backup-lab/backups/backup-*.tar.gz</pre><p>If multiple backups exist, this last command may need a specific archive filename.</p><h3>What Did We Learn?</h3><p>The script:</p><ul><li>Checks whether the source directory exists.</li><li>Creates a backup directory.</li><li>Generates a timestamped archive name.</li><li>Compresses the selected practice data.</li><li>Reports the created archive’s location.</li></ul><p>An archive is not automatically a reliable disaster-recovery solution.</p><p>Production backup strategies should include independent storage, retention policies, access controls, encryption where appropriate, and regular restoration tests.</p><p>For this article, our goal is to understand the fundamentals of automating a simple file backup.</p><h3>15. Scheduling Automation with Cron</h3><p>So far, we’ve executed scripts manually.</p><p>But what if we want a script to run automatically at a particular time?</p><p>Linux systems commonly use scheduling tools such as cron or systemd timers.</p><p>Cron allows commands to execute according to a defined schedule.</p><h3>Understanding a Cron Expression</h3><p>A traditional five-field cron schedule specifies:</p><ol><li>Minute</li><li>Hour</li><li>Day of the month</li><li>Month</li><li>Day of the week</li></ol><p>For example:</p><pre>0 9 * * *</pre><p>This represents 9:00 AM every day, according to the cron daemon’s applicable time zone.</p><h3>Editing a User’s Cron Jobs</h3><pre>crontab -e</pre><p>To schedule a script, an entry might look like:</p><pre>0 9 * * * /bin/bash /home/developer/devops-automation-lab/health-check.sh</pre><p>Replace /home/developer with the correct user home directory.</p><p>This example schedules the script for 9:00 AM each day.</p><h3>Important Scheduling Considerations</h3><p>Scheduled scripts run with a particular user identity and environment.</p><p>Do not assume they use the same working directory, environment variables, or PATH as your interactive terminal.</p><p>Use appropriate absolute paths, handle failures, and arrange for logs or notifications.</p><p>For a beginner, it’s best to test a script manually before scheduling it.</p><p>Do not schedule the practice scripts until you understand where their output is stored and how failures will be reported.</p><h3>16. How Automation Connects to CI/CD</h3><p>Automation is a key part of modern CI/CD pipelines.</p><p>Consider a software engineering team developing a Spring Boot application.</p><p>A developer pushes changes to GitHub.</p><p>A configured GitHub Actions workflow starts.</p><p>The workflow might:</p><ol><li>Check out the repository.</li><li>Install the appropriate Java version.</li><li>Run automated tests.</li><li>Build an application artifact.</li><li>Perform code-quality checks.</li><li>Prepare the artifact for deployment.</li></ol><p>Some workflow steps may execute Bash scripts.</p><p>Other steps may run Python utilities for validation, generating reports, or processing configuration.</p><p>For example, a pipeline could run:</p><pre>bash scripts/validate-config.sh</pre><p>Or:</p><pre>python3 scripts/check_release.py</pre><p>The pipeline runner must have the required runtime and dependencies available.</p><p>These scripts become part of an automated software delivery process.</p><h3>Why This Matters</h3><p>Instead of relying on a developer to remember every validation step, a pipeline can execute defined checks consistently.</p><p>However, automated workflows still require maintenance, appropriate permissions, secure credential handling, and meaningful failure reporting.</p><p>Automation improves consistency when the automated process itself is designed correctly.</p><h3>17. Best Practices for DevOps Automation</h3><p>Before writing more advanced scripts, it’s useful to understand several important habits.</p><h3>Keep Scripts Small and Understandable</h3><p>A script that performs one clear task is generally easier to test and maintain.</p><h3>Validate Inputs</h3><p>Check that required directories, files, and parameters exist before performing operations.</p><h3>Handle Errors Explicitly</h3><p>Do not assume every command will succeed.</p><p>Use appropriate exit statuses, exceptions, and helpful error messages.</p><h3>Avoid Hardcoding Secrets</h3><p>Never place passwords, API tokens, or private keys directly inside scripts committed to Git.</p><p>Use appropriate secret-management mechanisms and carefully controlled runtime environments.</p><h3>Use Safe File Operations</h3><p>Be cautious with commands that delete, overwrite, or modify files.</p><p>Test potentially destructive operations using disposable data.</p><h3>Make Scripts Repeatable</h3><p>Where practical, design automation so it can be executed multiple times without causing unintended changes.</p><p>This idea is closely related to <strong>idempotency</strong>.</p><p>An idempotent operation produces the same intended state even when executed repeatedly.</p><h3>Log Important Operations</h3><p>Record enough information to understand what a script attempted and whether it succeeded.</p><p>Avoid exposing credentials or sensitive information in logs.</p><h3>Test Before Scheduling</h3><p>Always test scripts in a safe environment before using them in scheduled jobs or production pipelines.</p><h3>Store Scripts in Version Control</h3><p>Git can help teams review, maintain, and track changes to automation scripts.</p><h3>18. Common Beginner Mistakes</h3><h3>Copying Scripts Without Understanding Them</h3><p>A script might contain commands that modify or remove important files.</p><p>Read every command before running it.</p><h3>Running Scripts with Unnecessary Administrator Privileges</h3><p>Avoid using sudo unless the operation requires elevated permissions.</p><h3>Ignoring Failure Conditions</h3><p>A script that prints a success message after a failed operation can provide misleading information.</p><h3>Using Relative Paths Carelessly</h3><p>Scheduled tasks and automation runners may execute scripts from unexpected working directories.</p><p>Resolve paths explicitly when necessary.</p><h3>Overwriting Existing Data</h3><p>Operators such as &gt; replace file contents.</p><p>Use them intentionally and preserve important data.</p><h3>Assuming Automation Means Reliability</h3><p>Automation makes processes repeatable, but it can also repeat mistakes.</p><p>Testing, validation, monitoring, and recovery procedures remain essential.</p><h3>Final Thoughts</h3><p>Bash scripting and Python automation are valuable skills for DevOps engineers.</p><p>They help reduce repetitive manual work, improve consistency, and connect different tools into practical workflows.</p><p>In this article, we explored:</p><ul><li>What automation means in DevOps</li><li>Bash scripting fundamentals</li><li>Variables, conditions, loops, and functions</li><li>Exit codes and error handling</li><li>Input and output redirection</li><li>Creating automated system health reports</li><li>Python file operations and subprocess execution</li><li>Building a simple log analyzer</li><li>Creating compressed backups</li><li>Scheduling scripts using cron</li><li>Connecting automation scripts to CI/CD pipelines</li><li>Important security and reliability practices</li></ul><p>The most important lesson is:</p><p><strong>Good automation is not simply about making tasks run automatically. It is about making tasks repeatable, understandable, safe, and reliable.</strong></p><p>As we continue exploring DevOps, these scripting fundamentals will become useful when working with CI/CD pipelines, containers, cloud infrastructure, and monitoring systems.</p><h3>What’s Next?</h3><p><strong>Article 06 — CI/CD Explained: Continuous Integration, Continuous Delivery, and Continuous Deployment</strong></p><p>In the next article, we’ll explore how modern software teams automate the process of building, testing, and releasing applications.</p><p>We’ll understand the differences between CI, continuous delivery, and continuous deployment, and see how these practices connect source code with software delivery.</p><p>This will prepare us for building our first GitHub Actions pipeline in Article 07.</p><p><em>Thanks for reading Article 05 of my DevOps From Zero to Production series! I’m documenting my learning journey and sharing practical examples as I explore modern software engineering and DevOps technologies.</em></p><p><em>If you’re also learning DevOps, feel free to share your experiences, questions, and suggestions.</em></p><h3>References and Further Reading</h3><p><strong>GNU Bash Reference Manual</strong></p><p><a href="https://www.gnu.org/software/bash/manual/">https://www.gnu.org/software/bash/manual/</a></p><p><strong>Ubuntu — Bash Scripting for Beginners</strong></p><p><a href="https://wiki.ubuntu.com/Beginners/BashScripting">https://wiki.ubuntu.com/Beginners/BashScripting</a></p><p><strong>Python Documentation — The Python Tutorial</strong></p><p><a href="https://docs.python.org/3/tutorial/">https://docs.python.org/3/tutorial/</a></p><p><strong>Python Documentation — pathlib</strong></p><p><a href="https://docs.python.org/3/library/pathlib.html">https://docs.python.org/3/library/pathlib.html</a></p><p><strong>Python Documentation — subprocess</strong></p><p><a href="https://docs.python.org/3/library/subprocess.html">https://docs.python.org/3/library/subprocess.html</a></p><p><strong>Python Documentation — Logging</strong></p><p><a href="https://docs.python.org/3/library/logging.html">https://docs.python.org/3/library/logging.html</a></p><p><strong>GitHub Docs — Understanding GitHub Actions</strong></p><p><a href="https://docs.github.com/en/actions/get-started/understand-github-actions">https://docs.github.com/en/actions/get-started/understand-github-actions</a></p><p><strong>crontab Manual</strong></p><p><a href="https://man7.org/linux/man-pages/man5/crontab.5.html">https://man7.org/linux/man-pages/man5/crontab.5.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1dbcd917e32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git and GitHub for DevOps Engineers: Version Control and Collaboration]]></title>
            <link>https://medium.com/@sajinitharushika3655/git-and-github-for-devops-engineers-version-control-and-collaboration-fe340b1b4d4f?source=rss-e1a9a8dbe515------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe340b1b4d4f</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Sajinitharushika]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 12:51:34 GMT</pubDate>
            <atom:updated>2026-11-16T12:51:34.029Z</atom:updated>
            <content:encoded><![CDATA[<p><em>DevOps From Zero to Production — Article 04</em></p><p><strong>Understanding Git fundamentals, repositories, branches, commits, pull requests, and how version control supports modern software delivery.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Ao5x1Y8g53IvHmv_" /></figure><h3>Introduction</h3><p>Imagine working on a software project with five developers.</p><p>One developer is implementing authentication. Another is fixing a bug. A third is improving the user interface.</p><p>Everyone is modifying the same project.</p><p>How can the team work together without accidentally overwriting each other’s changes?</p><p>What happens if someone introduces a bug and the team needs to investigate an earlier version?</p><p>And how can a company automatically test new changes before deploying them?</p><p>This is where version control becomes essential.</p><p>Version control allows developers to track changes, collaborate safely, and maintain a history of their projects.</p><p>Two technologies commonly used for this purpose are <strong>Git and GitHub</strong>.</p><p>In the previous articles of my <em>DevOps From Zero to Production</em> series, we explored DevOps fundamentals, Linux, and networking.</p><p>In this fourth article, we’ll understand how Git and GitHub work, explore essential commands, and build a practical workflow similar to what development teams use in real projects.</p><p>Let’s get started.</p><h3>1. What Is Version Control?</h3><p>Version control is a system for recording and managing changes to files over time.</p><p>Instead of manually maintaining different copies of a project, version control provides an organized history of its development.</p><p>Without version control, a project might look like this:</p><ul><li>project-final</li><li>project-final-v2</li><li>project-final-updated</li><li>project-final-actual-final</li></ul><p>This approach quickly becomes confusing, especially when multiple people are working on the same application.</p><p>With version control, developers can maintain a project history and identify when changes were introduced.</p><p>Version control makes it possible to:</p><ul><li>Track modifications to source code.</li><li>Work on multiple features independently.</li><li>Review changes before integrating them.</li><li>Return to or recover earlier versions.</li><li>Collaborate with other developers.</li><li>Investigate when bugs were introduced.</li></ul><p>Version control is useful for application code, but it is also important for configuration files, infrastructure definitions, documentation, and automation scripts.</p><h3>2. What Is Git?</h3><p><strong>Git is a free, open-source, distributed version control system.</strong></p><p>It tracks changes to files and allows developers to maintain a history of their projects.</p><p>Git is called a distributed version control system because developers can have local repositories containing project history.</p><p>This allows many Git operations, such as creating commits, viewing history, and creating branches, to work without an internet connection.</p><h3>What Is a Repository?</h3><p>A <strong>repository</strong>, often called a <em>repo</em>, is a project managed by Git.</p><p>It contains the tracked project content and information about its history.</p><p>For example, a Spring Boot application repository might contain:</p><ul><li>Java source code</li><li>Configuration files</li><li>Automated tests</li><li>Dockerfiles</li><li>GitHub Actions workflows</li><li>Documentation</li></ul><p>Git stores its internal repository data in a hidden directory named .git.</p><p>This directory contains information used to manage commits, branches, references, and other repository data.</p><h3>Why Is Git Important in DevOps?</h3><p>In DevOps, version control is not limited to application development.</p><p>Teams also use Git to manage:</p><ul><li>CI/CD pipeline definitions</li><li>Docker configuration</li><li>Kubernetes manifests</li><li>Infrastructure as Code</li><li>Automation scripts</li><li>Deployment configurations</li></ul><p>This helps teams review infrastructure and deployment changes using similar practices to application code.</p><p><strong>Git provides the foundation for managing changes, while automation tools can use those changes to trigger build, test, and deployment workflows.</strong></p><h3>3. Git vs GitHub: What’s the Difference?</h3><p>Git and GitHub are related, but they are not the same thing.</p><h3>Git</h3><p>Git is the version control software.</p><p>It runs locally on your computer and manages your project’s history.</p><p>You can use Git without creating a GitHub account.</p><h3>GitHub</h3><p>GitHub is a cloud-based platform that hosts Git repositories and provides additional collaboration features.</p><p>For example, GitHub supports:</p><ul><li>Remote repository hosting</li><li>Pull requests</li><li>Code reviews</li><li>Issues and project discussions</li><li>Branch protection and rulesets</li><li>GitHub Actions for automation</li></ul><h3>A Simple Example</h3><p>Imagine developing an application on your laptop.</p><p>You use Git to create commits and track your changes.</p><p>You then push your commits to a repository hosted on GitHub.</p><p>Other developers can access the repository, work on their own branches, and propose changes through pull requests.</p><p><strong>Git manages the version history. GitHub provides a platform for hosting, collaboration, and automation around Git repositories.</strong></p><p>GitHub is not the only available Git hosting platform. GitLab, Bitbucket, and self-hosted Git servers are other options.</p><h3>4. Understanding the Git Workflow</h3><p>Before learning commands, it’s important to understand how Git manages changes.</p><p>A simplified Git workflow contains three main areas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/0*SaKG71eiXkAEb6VY" /></figure><h3>Working Directory</h3><p>The working directory contains the project files you are currently editing.</p><p>For example, you might modify a Java class or update a README file.</p><p>These changes are not automatically included in the next commit.</p><h3>Staging Area</h3><p>The staging area, also called the index, contains the file content selected for the next commit.</p><p>The git add command stages changes.</p><p>Staging allows developers to decide which modifications belong together in a commit.</p><h3>Local Repository</h3><p>When you create a commit, Git records a snapshot of the staged content in the repository history.</p><p>A commit represents a specific version of the tracked project content.</p><h3>The Basic Workflow</h3><p><strong>Working Directory → Staging Area → Local Repository → Remote Repository</strong></p><p>A typical sequence is:</p><ol><li>Modify project files.</li><li>Review the changes.</li><li>Stage the appropriate files.</li><li>Create a commit.</li><li>Push the commit to a remote repository, if required.</li></ol><p>One important detail: pushing is not part of creating a local commit. Your commits can exist locally without being uploaded anywhere.</p><p>Understanding this distinction prevents confusion when working with Git.</p><h3>5. Essential Git Commands</h3><p>Let’s explore the commands beginners should know.</p><p>These examples assume Git is installed on your computer.</p><h3>5.1 Check the Git Version</h3><pre>git --version</pre><p>This displays the installed Git version.</p><h3>5.2 Configure Your Identity</h3><p>Git uses a name and email address as author information for commits.</p><pre>git config --global user.name &quot;Your Name&quot;<br>git config --global user.email &quot;you@example.com&quot;</pre><p>Replace these example values with your own information.</p><p>The --global option sets these values for your user account.</p><p>If a repository requires a different identity, you can configure it locally without --global.</p><h3>5.3 Initialize a Repository</h3><pre>git init</pre><p>This initializes Git inside the current directory.</p><p>For a new repository with an explicitly named main branch, you can use:</p><pre>git init -b main</pre><p>This is useful when starting a project from scratch.</p><h3>5.4 Check Repository Status</h3><pre>git status</pre><p>This shows information about:</p><ul><li>The current branch</li><li>Modified files</li><li>Staged changes</li><li>Untracked files</li></ul><p>It is one of the most useful commands for understanding the current state of a repository.</p><h3>5.5 Stage Changes</h3><pre>git add README.md</pre><p>This stages changes to the specified file.</p><p>To stage changes throughout the current directory and its subdirectories:</p><pre>git add .</pre><p>Be careful when using git add . because it can include files you did not intend to commit.</p><p>Always review what is staged, especially before committing configuration files or potentially sensitive data.</p><h3>5.6 Commit Changes</h3><pre>git commit -m &quot;Add project documentation&quot;</pre><p>This creates a commit containing the staged changes.</p><p>A good commit message should describe the purpose of the change.</p><p>For example:</p><p><strong>Good:</strong> Fix order validation error</p><p><strong>Less useful:</strong> changes</p><p>Clear commit messages make project history easier to understand.</p><h3>5.7 View Commit History</h3><pre>git log</pre><p>This displays the commit history.</p><p>For a shorter view:</p><pre>git log --oneline</pre><p>To include a simple visual representation of branches:</p><pre>git log --oneline --graph --all</pre><h3>5.8 Inspect Changes</h3><pre>git diff</pre><p>This shows differences between the working directory and the staging area for tracked files.</p><p>To inspect staged changes:</p><pre>git diff --staged</pre><p>Reviewing differences before committing is a useful habit.</p><h3>6. Understanding Git Branches</h3><p>Branches are one of Git’s most powerful features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*6QOPZz3XceZOFmNn" /></figure><p>A branch is a movable reference to a commit.</p><p>It allows developers to maintain separate lines of development within the same repository.</p><p>Imagine developing an e-commerce application.</p><p>The main branch contains the current shared version of the project.</p><p>A developer needs to add a new shopping cart feature.</p><p>Instead of developing directly on main, they create a feature branch.</p><p>For example:</p><p>feature/shopping-cart</p><p>Changes committed on this branch do not automatically appear on main.</p><p>After development and testing, the changes can be integrated into the shared branch.</p><h3>Creating a Branch</h3><pre>git switch -c feature/shopping-cart</pre><p>This creates the branch and switches to it.</p><h3>Listing Branches</h3><pre>git branch</pre><p>The current branch is marked with an asterisk.</p><h3>Switching Branches</h3><pre>git switch main</pre><p>This switches back to the main branch.</p><h3>Deleting a Local Branch</h3><p>After safely integrating its work:</p><pre>git branch -d feature/shopping-cart</pre><p>The -d option normally prevents deleting a branch whose work has not been safely merged.</p><p>Branches are especially useful for feature development, bug fixes, experiments, and releases.</p><p><strong>A good team workflow allows developers to work independently while keeping shared branches stable.</strong></p><h3>7. What Is Git Merging?</h3><p>Merging combines changes from separate development histories.</p><p>For example, a developer completes a feature on a separate branch.</p><p>After reviewing and testing the feature, the team decides to integrate it into main.</p><p>A local merge might look like this:</p><pre>git switch main<br>git merge feature/shopping-cart</pre><p>Git attempts to integrate the feature branch into the current branch.</p><p>Depending on the commit history, the merge may produce a fast-forward or a merge commit.</p><h3>Fast-Forward Merge</h3><p>If the target branch has not diverged, Git may simply move its branch reference forward.</p><h3>Three-Way Merge</h3><p>When branches have diverged, Git can use their common ancestor and both branch tips to calculate a merge result.</p><p>If the changes are compatible, Git can merge them automatically.</p><p>However, some changes require manual conflict resolution.</p><p>We’ll explore that shortly.</p><h3>8. What Is a Merge Conflict?</h3><p>A merge conflict occurs when Git cannot automatically combine certain changes.</p><p>Imagine two developers editing the same line of a file in different branches.</p><p>One developer writes:</p><p>Application Version 1</p><p>Another developer changes the same line to:</p><p>Application Version 2</p><p>Git may not know which version should be kept.</p><p>During a conflict, Git can insert markers similar to these:</p><pre>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD<br>Application Version 1<br>=======<br>Application Version 2<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; feature/update</pre><p>These markers identify the competing changes.</p><h3>How Do You Resolve a Conflict?</h3><ol><li>Open the affected file.</li><li>Review both versions.</li><li>Decide what the final content should contain.</li><li>Remove the conflict markers.</li><li>Save the corrected file.</li><li>Stage the resolved file.</li><li>Complete the merge.</li></ol><p>For example:</p><pre>git add README.md<br>git commit</pre><p>When a merge is in progress and all conflicts have been resolved, git commit can complete the merge.</p><p>You can also use:</p><pre>git merge --continue</pre><p>A merge conflict does not necessarily mean someone made a mistake.</p><p>It often means Git needs a human decision about how to combine changes.</p><h3>9. Understanding Remote Repositories</h3><p>So far, we’ve mainly discussed Git operations on a local computer.</p><p>But how do developers share changes?</p><p>This is where remote repositories become useful.</p><p>A <strong>remote repository</strong> is another Git repository that your local repository can communicate with.</p><p>It may be hosted on GitHub, GitLab, or another server.</p><h3>Clone a Repository</h3><pre>git clone https://github.com/OWNER/REPOSITORY.git</pre><p>Cloning downloads a repository and sets up a local working copy.</p><p>Replace OWNER and REPOSITORY with the appropriate values.</p><h3>View Configured Remotes</h3><pre>git remote -v</pre><p>This displays configured remote repository names and addresses.</p><p>The name origin is a common convention for the primary remote.</p><h3>Add a Remote</h3><pre>git remote add origin https://github.com/OWNER/REPOSITORY.git</pre><p>This connects your existing local repository to a remote repository address.</p><h3>Push Changes</h3><pre>git push -u origin main</pre><p>This uploads your local main branch to the remote and configures an upstream tracking relationship.</p><p>You need appropriate repository access and authentication.</p><h3>Fetch Changes</h3><pre>git fetch origin</pre><p>This retrieves remote changes and updates remote-tracking references without automatically integrating them into your current branch.</p><h3>Pull Changes</h3><pre>git pull</pre><p>This fetches remote changes and then integrates them according to the configured pull strategy.</p><p>Depending on repository configuration and history, the integration may involve merging or rebasing.</p><p>For team projects, it’s important to understand the repository’s chosen workflow before pulling or integrating changes.</p><h3>10. What Is a Pull Request?</h3><p>A <strong>pull request</strong>, commonly called a PR, is a collaboration feature provided by GitHub and similar hosting platforms.</p><p>It allows developers to propose changes from one branch into another.</p><p>For example:</p><p>A developer completes a new feature in:</p><p>feature/login</p><p>They push the branch to GitHub and open a pull request targeting main.</p><p>Other team members can then:</p><ul><li>Review the proposed code changes.</li><li>Leave comments and suggestions.</li><li>Discuss implementation decisions.</li><li>Inspect automated test results.</li><li>Request improvements.</li><li>Approve or merge the changes when appropriate.</li></ul><h3>A Typical Pull Request Workflow</h3><p><strong>Step 1:</strong> Create a feature branch.</p><p><strong>Step 2:</strong> Implement the feature.</p><p><strong>Step 3:</strong> Run relevant tests.</p><p><strong>Step 4:</strong> Commit the changes.</p><p><strong>Step 5:</strong> Push the feature branch.</p><p><strong>Step 6:</strong> Open a pull request on GitHub.</p><p><strong>Step 7:</strong> Review the changes and automated checks.</p><p><strong>Step 8:</strong> Merge the pull request when the required conditions are satisfied.</p><p>Pull requests are important because they create an opportunity to inspect and discuss code before it becomes part of a shared branch.</p><p>In many professional development teams, changes are reviewed through pull requests rather than being committed directly to the default branch.</p><h3>11. How Git Connects to DevOps and CI/CD</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*5kjZDfBwkLoVEsjF" /></figure><p>Version control plays a central role in DevOps automation.</p><p>Imagine a development team using GitHub Actions.</p><p>A developer pushes a new commit or opens a pull request.</p><p>A configured workflow can automatically:</p><ol><li>Check out the repository.</li><li>Install dependencies.</li><li>Build the application.</li><li>Run automated tests.</li><li>Perform code-quality and security checks.</li><li>Report whether the required checks passed.</li></ol><p>After changes are reviewed and merged, a separate workflow may build a release artifact, publish a Docker image, or deploy an application.</p><p>For example:</p><p><strong>Developer → Git Commit → GitHub → GitHub Actions → Build → Test → Deployment</strong></p><p>However, deployment is not automatically triggered by every commit.</p><p>The team must explicitly configure the workflow triggers, permissions, checks, and deployment rules.</p><h3>Git and Infrastructure as Code</h3><p>Git is also useful for managing infrastructure configuration.</p><p>For example, a repository may contain Terraform files or Kubernetes manifests.</p><p>Changes to these files can be proposed through pull requests.</p><p>Reviewers can examine what infrastructure modifications are being requested before approving them.</p><p>This approach provides traceability and supports repeatable infrastructure management.</p><p>Later in this series, we’ll explore how Git-based workflows connect to CI/CD, Infrastructure as Code, and GitOps.</p><h3>12. Practical Exercise: Building a Git Workflow</h3><p>Now let’s put these concepts into practice.</p><p>In this exercise, we’ll create a small repository, add files, create a feature branch, commit changes, and merge the branch into main.</p><p>We will first work completely locally.</p><p>Afterward, we’ll optionally upload the project to GitHub and open a pull request.</p><h3>Prerequisites</h3><p>You need Git installed and a terminal.</p><p>For the optional GitHub steps, you’ll also need a GitHub account and a way to authenticate Git operations.</p><p>All commands in this exercise should be run inside a new practice directory, not an existing important project.</p><h3>Step 1 — Create a Project</h3><p>Open your terminal.</p><pre>mkdir devops-git-lab<br>cd devops-git-lab</pre><p>Initialize the repository:</p><pre>git init -b main</pre><p>If Git hasn’t been configured with your identity, set it using your own details:</p><pre>git config user.name &quot;Your Name&quot;<br>git config user.email &quot;you@example.com&quot;</pre><p>These settings apply only to this practice repository.</p><h3>Step 2 — Create Your First File</h3><p>Run:</p><pre>echo &quot;# DevOps Git Lab&quot; &gt; README.md</pre><p>Check the status:</p><pre>git status</pre><p>Git should show that README.md is currently untracked.</p><h3>Step 3 — Make Your First Commit</h3><p>Stage the README:</p><pre>git add README.md</pre><p>Create a commit:</p><pre>git commit -m &quot;Initialize DevOps Git lab&quot;</pre><p>View the history:</p><pre>git log --oneline</pre><p>You now have a repository with its first commit.</p><h3>Step 4 — Create a Feature Branch</h3><pre>git switch -c feature/add-notes</pre><p>This creates a new branch named feature/add-notes.</p><p>Check the current branch:</p><pre>git branch</pre><p>The asterisk should appear next to your feature branch.</p><h3>Step 5 — Add a New File</h3><p>Create a file containing a short explanation of Git:</p><pre>echo &quot;Git tracks changes to project files.&quot; &gt; git-notes.txt</pre><p>Stage and commit it:</p><pre>git add git-notes.txt<br>git commit -m &quot;Add introductory Git notes&quot;</pre><p>The new commit belongs to your feature branch.</p><h3>Step 6 — Switch Back to Main</h3><pre>git switch main</pre><p>List the files:</p><pre>ls</pre><p>You should see the README file, but not git-notes.txt.</p><p>Why?</p><p>Because the new file was committed on the feature branch, and its changes have not yet been merged into main.</p><h3>Step 7 — Merge the Feature Branch</h3><p>Run:</p><pre>git merge feature/add-notes</pre><p>Because main has not diverged in this exercise, Git should perform a fast-forward merge.</p><p>Now run:</p><pre>ls</pre><p>The git-notes.txt file should appear.</p><p>View the history:</p><pre>git log --oneline --graph --all</pre><p>You’ve successfully created and merged your first feature branch.</p><h3>Step 8 — Clean Up</h3><p>After confirming the changes are merged, you can delete the local feature branch:</p><pre>git branch -d feature/add-notes</pre><p>Your commits remain accessible through main.</p><h3>13. Optional Exercise: Upload the Project to GitHub</h3><p>Now let’s connect your local repository to GitHub.</p><h3>Step 1 — Create an Empty Repository on GitHub</h3><p>Open:</p><p><a href="https://github.com/new">https://github.com/new</a></p><p>Create a repository named:</p><p>devops-git-lab</p><p>For this exercise, leave the options for initializing the repository with a README, .gitignore, or license unchecked.</p><p>This avoids creating a separate initial history on GitHub.</p><h3>Step 2 — Connect Your Local Repository</h3><p>Run this inside your practice project directory:</p><pre>git remote add origin https://github.com/YOUR_USERNAME/devops-git-lab.git</pre><p>Replace YOUR_USERNAME with your GitHub username.</p><h3>Step 3 — Push Main</h3><pre>git push -u origin main</pre><p>Authenticate using GitHub’s supported authentication method when prompted.</p><p>Your project should now appear on GitHub.</p><h3>Step 4 — Create Another Feature Branch</h3><pre>git switch -c feature/update-readme</pre><p>Add a new line to the README:</p><pre>echo &quot;Learning Git and GitHub for DevOps.&quot; &gt;&gt; README.md</pre><p>Commit it:</p><pre>git add README.md<br>git commit -m &quot;Update README with learning goal&quot;</pre><h3>Step 5 — Push the Feature Branch</h3><pre>git push -u origin feature/update-readme</pre><h3>Step 6 — Open a Pull Request</h3><p>Visit your repository on GitHub.</p><p>You should be able to select the recently pushed branch and create a pull request.</p><p>Choose:</p><ul><li>Base branch: main</li><li>Compare branch: feature/update-readme</li></ul><p>Add a clear title and description.</p><p>For example:</p><p><strong>Title:</strong> Update README with DevOps learning goal</p><p><strong>Description:</strong> Adds a short description of the project’s learning purpose.</p><p>Create the pull request.</p><p>Review the changes, then merge the PR if everything looks correct.</p><h3>Step 7 — Update Your Local Main Branch</h3><p>After merging on GitHub, return to the terminal:</p><pre>git switch main<br>git pull --ff-only origin main</pre><p>The --ff-only option updates the branch only when a fast-forward is possible.</p><p>Now verify the README:</p><pre>cat README.md</pre><p>You should see the new line.</p><p>Congratulations! You’ve completed a basic feature-branch and pull-request workflow.</p><p>This is similar to the collaboration process used by many software engineering teams.</p><h3>14. Bonus Exercise: Resolve a Merge Conflict</h3><p>Let’s create a small conflict deliberately.</p><p>We’ll use the same practice repository.</p><p>First, make sure you’re on main and that your working directory is clean:</p><pre>git switch main<br>git status</pre><h3>Step 1 — Create a Sample File</h3><pre>echo &quot;Environment: Development&quot; &gt; config.txt<br>git add config.txt<br>git commit -m &quot;Add sample environment configuration&quot;</pre><h3>Step 2 — Create a Branch</h3><pre>git switch -c feature/config-update</pre><p>Modify the file:</p><pre>echo &quot;Environment: Testing&quot; &gt; config.txt<br>git add config.txt<br>git commit -m &quot;Update environment to testing&quot;</pre><h3>Step 3 — Modify Main Differently</h3><p>Switch back:</p><pre>git switch main</pre><p>Change the same line:</p><pre>echo &quot;Environment: Staging&quot; &gt; config.txt<br>git add config.txt<br>git commit -m &quot;Update environment to staging&quot;</pre><h3>Step 4 — Attempt the Merge</h3><pre>git merge feature/config-update</pre><p>Git should report a conflict because both branches changed the same line differently.</p><p>Open config.txt.</p><p>You will see conflict markers identifying the competing changes.</p><h3>Step 5 — Resolve the Conflict</h3><p>For this learning exercise, choose a final value:</p><pre>echo &quot;Environment: Staging&quot; &gt; config.txt</pre><p>Stage the resolved file:</p><pre>git add config.txt</pre><p>Complete the merge:</p><pre>git merge --continue</pre><p>Git may open a text editor so you can confirm the merge commit message.</p><p>Finally, inspect the history:</p><pre>git log --oneline --graph --all</pre><p>You’ve now practiced resolving a merge conflict.</p><p>In a real project, never choose a conflict resolution arbitrarily. Understand the intended behavior and consult relevant teammates when necessary.</p><h3>15. Common Git Mistakes Beginners Should Avoid</h3><h3>Committing Secrets</h3><p>Never intentionally commit API keys, passwords, access tokens, private keys, or sensitive environment files.</p><p>A .gitignore file helps prevent selected untracked files from being added, but it does not remove secrets already stored in Git history.</p><p>If a secret is accidentally committed, treat it as compromised and follow the appropriate credential rotation and incident response procedure.</p><h3>Working Directly on Main</h3><p>For collaborative projects, feature branches and pull requests often make changes easier to review and test.</p><p>Follow your team’s branch protection rules and development workflow.</p><h3>Using Unclear Commit Messages</h3><p>Messages such as fix, update, or final give very little context.</p><p>Prefer meaningful messages that explain the purpose of the change.</p><h3>Running Destructive Commands Without Understanding Them</h3><p>Commands such as:</p><p>git reset --hard</p><p>can discard local changes.</p><p>Similarly, force pushing can overwrite remote branch history.</p><p>Understand the consequences before using these commands, particularly in shared repositories.</p><h3>Ignoring Merge Conflicts</h3><p>Never remove conflict markers without understanding which changes should remain.</p><h3>Forgetting to Check Repository Status</h3><p>Running git status before staging, committing, switching branches, or merging can help prevent mistakes.</p><h3>Assuming a Successful Push Means the Application Works</h3><p>Git confirms that repository data was transferred successfully.</p><p>It does not confirm that the application builds, passes tests, or behaves correctly.</p><p>Automated checks and code reviews are still important.</p><h3>16. Git Best Practices for DevOps Engineers</h3><p>As you become more comfortable with Git, develop these habits:</p><p><strong>Commit Small, Logical Changes</strong></p><p>Make commits that represent understandable units of work.</p><p><strong>Write Descriptive Commit Messages</strong></p><p>Explain the purpose of the change.</p><p><strong>Review Before Committing</strong></p><p>Use git status, git diff, and git diff --staged.</p><p><strong>Use Pull Requests for Collaboration</strong></p><p>Review changes before integrating them into important shared branches.</p><p><strong>Protect Important Branches</strong></p><p>Use branch protection rules or repository rulesets where appropriate.</p><p><strong>Keep Sensitive Information Out of Repositories</strong></p><p>Use secret management solutions and avoid storing credentials in source control.</p><p><strong>Automate Validation</strong></p><p>Use CI workflows to run tests and checks on relevant commits and pull requests.</p><p><strong>Document Your Projects</strong></p><p>Include a README describing the project’s purpose, setup, and usage.</p><p>These practices make both application development and infrastructure management more reliable.</p><h3>Final Thoughts</h3><p>Git and GitHub are essential tools in modern software engineering and DevOps.</p><p>They help teams manage changes, collaborate, maintain project history, and connect source code with automated delivery workflows.</p><p>In this article, we explored:</p><ul><li>Version control fundamentals</li><li>The difference between Git and GitHub</li><li>Repositories, staging areas, and commits</li><li>Essential Git commands</li><li>Branching and merging</li><li>Merge conflicts and their resolution</li><li>Remote repositories</li><li>Pull requests and code reviews</li><li>Git’s role in CI/CD and Infrastructure as Code</li><li>A complete practical Git workflow</li></ul><p>The most important lesson is:</p><p><strong>Version control is not simply about saving code. It is about managing change in a way that supports collaboration, traceability, and reliable software delivery.</strong></p><p>Understanding Git gives us an important foundation for the automation tools we’ll explore in the coming articles.</p><h3>What’s Next?</h3><p><strong>Article 05 — Bash Scripting and Python Automation for DevOps Engineers</strong></p><p>In the next article, we’ll explore how shell scripting and Python can automate repetitive development and system administration tasks.</p><p>We’ll also create a few practical scripts for checking system information, processing files, and performing basic automated operations.</p><p><em>Thanks for reading Article 04 of my DevOps From Zero to Production series! I’m documenting my learning journey and sharing practical examples as I explore modern software engineering and DevOps technologies.</em></p><p><em>If you’re learning DevOps too, feel free to share your experiences, questions, or suggestions.</em></p><h3>References and Further Reading</h3><p><strong>Git — Official Documentation</strong></p><p><a href="https://git-scm.com/docs">https://git-scm.com/docs</a></p><p><strong>Pro Git Book — Getting Started</strong></p><p><a href="https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control">https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control</a></p><p><strong>Pro Git Book — Git Branching</strong></p><p><a href="https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell">https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell</a></p><p><strong>Pro Git Book — Basic Branching and Merging</strong></p><p><a href="https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging">https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging</a></p><p><strong>GitHub Docs — About Pull Requests</strong></p><p><a href="https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests">https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests</a></p><p><strong>GitHub Docs — Creating a Pull Request</strong></p><p><a href="https://docs.github.com/en/pull-requests/how-tos/create-pull-requests/creating-a-pull-request">https://docs.github.com/en/pull-requests/how-tos/create-pull-requests/creating-a-pull-request</a></p><p><strong>GitHub Docs — GitHub Actions</strong></p><p><a href="https://docs.github.com/en/actions">https://docs.github.com/en/actions</a></p><p><strong>GitHub Docs — Removing Sensitive Data from a Repository</strong></p><p><a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository">https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe340b1b4d4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Networking Fundamentals for DevOps Engineers: A Beginner’s Guide]]></title>
            <link>https://medium.com/@sajinitharushika3655/networking-fundamentals-for-devops-engineers-a-beginners-guide-4ff776bcbf79?source=rss-e1a9a8dbe515------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ff776bcbf79</guid>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[computer-networking]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Sajinitharushika]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 12:24:02 GMT</pubDate>
            <atom:updated>2026-11-16T12:24:02.813Z</atom:updated>
            <content:encoded><![CDATA[<p><em>DevOps From Zero to Production — Article 03</em></p><p><strong>Understanding IP addresses, DNS, ports, TCP/IP, HTTP/HTTPS, and the networking concepts behind modern applications.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*5_1KuKMixF5jo3S6" /></figure><h3>Introduction</h3><p>Imagine deploying a web application to a cloud server.</p><p>The application starts successfully. The server is running, and the application logs show no errors.</p><p>But when you try to access the website from your browser, nothing loads.</p><p>What could be wrong?</p><p>Perhaps the application is listening on the wrong port. Maybe the server’s firewall is blocking incoming connections. Or the domain name is not pointing to the correct server.</p><p>These are networking-related problems.</p><p>In DevOps, knowing how to deploy an application is important. But understanding how users, servers, databases, and services communicate is just as important.</p><p>Networking connects almost every part of modern software infrastructure, including cloud platforms, containers, microservices, and distributed systems.</p><p>In Article 02 of my <em>DevOps From Zero to Production</em> series, we explored Linux fundamentals and essential terminal commands.</p><p>In this article, we’ll explore the networking concepts that every aspiring DevOps engineer should understand.</p><p>Let’s begin with the basics.</p><h3>1. What Is Computer Networking?</h3><p>Computer networking is the process of connecting devices so they can communicate and exchange information.</p><p>These devices might include:</p><ul><li>Personal computers</li><li>Smartphones</li><li>Web servers</li><li>Database servers</li><li>Cloud virtual machines</li><li>Containers</li><li>Network routers</li></ul><p>For example, when you open an online shopping website, your browser communicates with a server over a network.</p><p>The server processes your request and sends back the information needed to display the website.</p><p>This communication happens using networking protocols.</p><p>A <strong>network protocol</strong> is a set of rules that determines how devices exchange information.</p><p>Common networking protocols include IP, TCP, UDP, DNS, HTTP, and HTTPS.</p><p>Each protocol has a specific purpose.</p><p>Understanding these protocols helps engineers identify problems and design reliable communication between systems.</p><h3>2. Understanding IP Addresses</h3><p>Every device communicating over an IP network uses an IP address.</p><p>An <strong>IP address (Internet Protocol address)</strong> is a numerical address used to identify a network interface and help route data to its destination.</p><p>Think of it like an address used to deliver a package.</p><p>Without a destination address, a delivery service would not know where to send a parcel.</p><p>Similarly, devices use IP addresses to direct network traffic.</p><p>There are two major versions of IP addresses.</p><h3>IPv4</h3><p>IPv4 addresses are 32 bits long and are commonly written as four decimal numbers separated by dots.</p><p>Example:</p><p>192.168.1.10</p><p>Each number ranges from 0 to 255.</p><p>IPv4 is widely used, but its address space is limited.</p><h3>IPv6</h3><p>IPv6 uses 128-bit addresses, providing a much larger address space.</p><p>Example:</p><p>2001:db8::1</p><p>IPv6 addresses are written using hexadecimal notation.</p><p>Both IPv4 and IPv6 are important in modern networking.</p><h3>Public vs Private IP Addresses</h3><p><strong>Public IP Address</strong></p><p>A public IP address is used for communication over the public internet and must be globally unique when publicly routed.</p><p>Cloud servers may have public IP addresses so users can access hosted services.</p><p><strong>Private IP Address</strong></p><p>A private IPv4 address is used within private networks and is not directly routed across the public internet.</p><p>Common private IPv4 ranges include:</p><ul><li>10.0.0.0/8</li><li>172.16.0.0/12</li><li>192.168.0.0/16</li></ul><p>For example, your laptop might have the private IP address 192.168.1.10 on your home Wi-Fi network.</p><p>Your router typically uses Network Address Translation (NAT) to allow devices with private IPv4 addresses to communicate with the internet.</p><h3>Why IP Addresses Matter in DevOps</h3><p>Imagine deploying a backend application to a cloud server.</p><p>If the server uses a private IP address, users on the public internet may not be able to connect to it directly.</p><p>You might need a public-facing load balancer, reverse proxy, or another properly configured network entry point.</p><p>Understanding public and private addresses is essential when working with cloud networking.</p><h3>3. What Is DNS?</h3><p>Humans remember names more easily than numbers.</p><p>For example, remembering example.com is easier than remembering an IP address.</p><p>This is where DNS becomes useful.</p><p><strong>DNS stands for Domain Name System.</strong></p><p>DNS is a distributed naming system that helps translate human-readable domain names into IP addresses and provides other information about domains.</p><h3>How DNS Works</h3><p>Imagine entering:</p><p><a href="https://example.com/">https://example.com</a></p><p>A simplified DNS lookup works as follows:</p><ol><li>Your browser or operating system checks whether it already has the required DNS information cached.</li><li>If necessary, a DNS resolver looks up the domain.</li><li>The resolver may contact other DNS servers to find the requested record.</li><li>The resolver returns the relevant DNS information.</li><li>The browser uses the result to establish a connection to the appropriate destination.</li></ol><p>DNS lookups can involve multiple servers, including root, top-level domain, and authoritative DNS servers.</p><p>Caching helps reduce unnecessary lookups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*B4OHP1caXKSjU-az" /></figure><h3>Common DNS Records</h3><p><strong>A Record</strong></p><p>Maps a domain name to an IPv4 address.</p><p><strong>AAAA Record</strong></p><p>Maps a domain name to an IPv6 address.</p><p><strong>CNAME Record</strong></p><p>Provides an alias from one domain name to another.</p><p><strong>MX Record</strong></p><p>Identifies mail servers responsible for receiving email for a domain.</p><p><strong>TXT Record</strong></p><p>Stores text-based information commonly used for domain verification and email-related security configurations.</p><h3>Why DNS Matters in DevOps</h3><p>Imagine deploying a website to a new server.</p><p>Even when the application is working correctly, users may be unable to access it if its DNS records are incorrect.</p><p>DNS configuration is also important for custom domains, load balancers, cloud services, and service discovery.</p><p><strong>A healthy application can still appear unavailable when DNS is misconfigured.</strong></p><h3>4. Understanding Ports</h3><p>An IP address helps identify the destination device or network interface.</p><p>But what happens when multiple applications are running on the same server?</p><p>For example, a server might run:</p><ul><li>A web application</li><li>An SSH service</li><li>A PostgreSQL database</li><li>A monitoring service</li></ul><p>How does the operating system know which service should receive incoming traffic?</p><p>One important part of the answer is the <strong>port number</strong>.</p><p>A port identifies a communication endpoint associated with a transport protocol such as TCP or UDP.</p><p>Port numbers range from 0 to 65535.</p><h3>Common Port Numbers</h3><p><strong>Port 22 — SSH</strong></p><p>Commonly used for secure remote administration.</p><p><strong>Port 53 — DNS</strong></p><p>Used for DNS communication over UDP and TCP.</p><p><strong>Port 80 — HTTP</strong></p><p>The conventional port for unencrypted HTTP.</p><p><strong>Port 443 — HTTPS</strong></p><p>The conventional port for secure web traffic.</p><p><strong>Port 5432 — PostgreSQL</strong></p><p>The default PostgreSQL server port.</p><p><strong>Port 3306 — MySQL</strong></p><p>The default MySQL server port.</p><p><strong>Port 8080 — Application Servers</strong></p><p>Frequently used by development servers and backend applications, including Spring Boot applications.</p><p>These are common defaults, not requirements. Services can be configured to use different ports.</p><h3>A Practical Example</h3><p>Imagine running a Spring Boot application locally.</p><p>You can access it through:</p><p><a href="http://localhost:8080/">http://localhost:8080</a></p><p>Here:</p><ul><li>localhost refers to the local machine.</li><li>8080 identifies the destination port.</li><li>http indicates the communication protocol.</li></ul><p>If the application listens on port 8080 but you send a request to port 9090, the connection may fail unless another appropriate service is listening there.</p><p>Ports are especially important when configuring Docker containers, Kubernetes Services, cloud firewalls, and application servers.</p><h3>5. Understanding TCP and UDP</h3><p>Two important transport-layer protocols are TCP and UDP.</p><p>Both allow applications to communicate over IP networks, but they provide different behavior.</p><h3>TCP — Transmission Control Protocol</h3><p>TCP is a connection-oriented transport protocol.</p><p>It provides reliable, ordered delivery of a stream of bytes between communicating endpoints.</p><p>TCP includes mechanisms for:</p><ul><li>Establishing connections</li><li>Detecting lost data</li><li>Retransmitting lost data</li><li>Delivering data in order</li><li>Managing transmission rates</li></ul><p>Common examples of TCP-based communication include SSH, many database connections, and HTTP/1.1 or HTTP/2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/0*5kuxIIMjMUp-UidG" /></figure><h3>TCP Three-Way Handshake</h3><p>Before exchanging application data over a new TCP connection, the endpoints normally establish the connection using a three-way handshake.</p><p><strong>Step 1 — SYN</strong></p><p>The client sends a SYN segment to request a connection.</p><p><strong>Step 2 — SYN-ACK</strong></p><p>The server responds with SYN-ACK to acknowledge the request and synchronize its own sequence number.</p><p><strong>Step 3 — ACK</strong></p><p>The client acknowledges the server’s response.</p><p>The TCP connection is then established.</p><p>This process helps both endpoints establish the connection state required for communication.</p><h3>UDP — User Datagram Protocol</h3><p>UDP is a connectionless transport protocol.</p><p>Unlike TCP, UDP does not itself guarantee that packets will arrive, arrive in order, or be retransmitted if lost.</p><p>Its simpler design makes it useful for applications that need low overhead or implement their own reliability mechanisms.</p><p>Common uses include:</p><ul><li>DNS queries</li><li>Real-time communication</li><li>Online gaming</li><li>Media streaming</li><li>QUIC, the transport protocol used by HTTP/3</li></ul><h3>TCP vs UDP — When Are They Used?</h3><p>TCP is useful when an application benefits from reliable, ordered byte-stream delivery.</p><p>UDP is useful when an application needs datagram-based communication or handles reliability at a higher layer.</p><p>Neither protocol is universally better.</p><p><strong>The right choice depends on the application’s requirements.</strong></p><h3>6. Understanding HTTP and HTTPS</h3><p>HTTP is one of the most important protocols in web development and DevOps.</p><p><strong>HTTP stands for Hypertext Transfer Protocol.</strong></p><p>It is an application-layer protocol used for communication between clients and servers.</p><p>When you open a website, your browser sends requests and receives responses.</p><h3>Understanding HTTP Requests</h3><p>Imagine a frontend application requesting product information from a backend API.</p><p>A request might look like:</p><pre>GET /api/products HTTP/1.1<br>Host: example.com</pre><p>The GET method requests a resource from the server.</p><p>The server processes the request and returns a response.</p><p>For example:</p><pre>HTTP/1.1 200 OK<br>Content-Type: application/json</pre><pre>{<br>  &quot;products&quot;: []<br>}</pre><p>The status code 200 indicates that the request succeeded.</p><h3>Common HTTP Methods</h3><p><strong>GET</strong></p><p>Retrieve a resource.</p><p><strong>POST</strong></p><p>Submit data, often to create a resource or initiate processing.</p><p><strong>PUT</strong></p><p>Create or replace the state of a target resource.</p><p><strong>PATCH</strong></p><p>Apply a partial modification to a resource.</p><p><strong>DELETE</strong></p><p>Request removal of a resource.</p><p>The exact behavior depends on the API’s design and implementation.</p><h3>Common HTTP Status Codes</h3><p><strong>200 — OK</strong></p><p>The request succeeded.</p><p><strong>201 — Created</strong></p><p>The request succeeded and created a resource.</p><p><strong>301 — Moved Permanently</strong></p><p>The resource has been assigned a permanent new location.</p><p><strong>400 — Bad Request</strong></p><p>The server cannot process the request because of a client-side issue with the request.</p><p><strong>401 — Unauthorized</strong></p><p>The request lacks valid authentication credentials.</p><p><strong>403 — Forbidden</strong></p><p>The server refuses to authorize the requested operation.</p><p><strong>404 — Not Found</strong></p><p>The requested resource could not be found.</p><p><strong>500 — Internal Server Error</strong></p><p>The server encountered an unexpected condition.</p><p><strong>502 — Bad Gateway</strong></p><p>A gateway or proxy received an invalid response from an upstream server.</p><p><strong>503 — Service Unavailable</strong></p><p>The server is temporarily unable to handle the request.</p><p>These status codes are especially useful when troubleshooting REST APIs and reverse proxies.</p><h3>What Is HTTPS?</h3><p>HTTPS is HTTP protected using Transport Layer Security (TLS).</p><p>TLS helps provide:</p><ul><li>Encryption of data in transit</li><li>Integrity protection against undetected modification</li><li>Authentication of the server through certificates</li></ul><p>For example:</p><p><a href="https://example.com/">https://example.com</a></p><p>HTTPS protects communications between the client and the TLS endpoint.</p><p>However, HTTPS does not automatically guarantee that a website is trustworthy or free of application vulnerabilities.</p><p>Modern web applications should use HTTPS for protecting network communication.</p><h3>7. What Happens When You Open a Website?</h3><p>Let’s connect the networking concepts we’ve learned.</p><p>Imagine entering:</p><p><a href="https://example.com/">https://example.com</a></p><p>into your browser.</p><p>A simplified sequence looks like this:</p><p><strong>Step 1 — DNS Resolution</strong></p><p>The browser obtains the information needed to locate the destination server.</p><p><strong>Step 2 — Establish a Connection</strong></p><p>The client establishes communication using an appropriate transport protocol.</p><p>For HTTP/1.1 or HTTP/2 over HTTPS, this normally involves TCP.</p><p>HTTP/3 instead uses QUIC over UDP.</p><p><strong>Step 3 — TLS Handshake</strong></p><p>For HTTPS, the client and server negotiate secure communication and authenticate the server.</p><p><strong>Step 4 — Send an HTTP Request</strong></p><p>The browser requests the webpage.</p><p><strong>Step 5 — Server Processing</strong></p><p>The server processes the request and prepares a response.</p><p><strong>Step 6 — Receive an HTTP Response</strong></p><p>The server returns a status code, headers, and possibly a response body.</p><p><strong>Step 7 — Render the Page</strong></p><p>The browser processes the response and may make additional requests for images, scripts, stylesheets, or API data.</p><p>A simple action like opening a website involves several networking layers working together.</p><p>Understanding these layers makes troubleshooting much easier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/0*5N7uZIKGC1H4JLk2" /></figure><h3>8. Understanding Firewalls</h3><p>A firewall controls network traffic according to defined security rules.</p><p>Firewalls can allow or block traffic based on factors such as IP addresses, ports, protocols, and connection state.</p><h3>Example</h3><p>Imagine deploying a backend application on a cloud virtual machine.</p><p>The application listens on port 8080.</p><p>Even if the application starts successfully, incoming connections may be blocked by:</p><ul><li>Cloud security group rules</li><li>Network firewall policies</li><li>The operating system’s firewall</li><li>Network routing configurations</li></ul><p>In a production environment, engineers normally expose only the network services that need to be accessible.</p><p>For example, a public HTTPS endpoint may be exposed through a reverse proxy while the backend application and database remain on private networks.</p><p><strong>A working application does not automatically mean its network endpoint is reachable.</strong></p><h3>9. What Is a Reverse Proxy?</h3><p>A reverse proxy is a server that receives client requests and forwards them to backend services.</p><p>A common example is Nginx.</p><p>Imagine an application running on port 8080 while users access the website through HTTPS on port 443.</p><p>A reverse proxy can accept the HTTPS connection and forward requests to the backend.</p><p>A simplified request flow is:</p><p><strong>Browser → Nginx Reverse Proxy → Spring Boot Application</strong></p><p>Reverse proxies can provide features such as:</p><ul><li>Routing requests</li><li>TLS termination</li><li>Load balancing</li><li>Request filtering</li><li>Caching</li><li>Centralized access logging</li></ul><p>In real applications, reverse proxies are useful for managing how external traffic reaches backend services.</p><h3>10. Essential Linux Networking Commands</h3><p>Now let’s explore a few practical commands.</p><p>These examples are intended for a Linux environment such as Ubuntu.</p><p>Some utilities may need to be installed separately.</p><h3>10.1 ip — Inspect IP Addresses</h3><pre>ip addr</pre><p>This displays the network interfaces and IP addresses configured on your system.</p><p>To see routing information:</p><pre>ip route</pre><p>This helps you understand how traffic is routed through the network.</p><h3>10.2 ping — Test Basic Reachability</h3><pre>ping -c 4 1.1.1.1</pre><p>This sends four ICMP echo requests to the specified destination.</p><p>It can help test basic network reachability.</p><p>However, some networks block ICMP traffic.</p><p>A failed ping does not necessarily mean the destination’s application is unavailable.</p><h3>10.3 dig — Inspect DNS Records</h3><pre>dig example.com</pre><p>This performs a DNS lookup.</p><p>To request only IPv4 address records:</p><pre>dig example.com A</pre><p>To request IPv6 address records:</p><pre>dig example.com AAAA</pre><p>The dig command is useful when troubleshooting domain resolution issues.</p><h3>10.4 curl — Test HTTP Endpoints</h3><pre>curl -I https://example.com</pre><p>This requests HTTP response headers using the HEAD method.</p><p>To retrieve a response body:</p><pre>curl https://example.com</pre><p>To display more information about connection establishment and the HTTP exchange:</p><pre>curl -v https://example.com</pre><p>This is useful when diagnosing API and web server problems.</p><h3>10.5 ss — Inspect Listening Ports</h3><pre>ss -tuln</pre><p>This displays listening TCP and UDP sockets.</p><p>The options mean:</p><ul><li>-t — TCP</li><li>-u — UDP</li><li>-l — Listening sockets</li><li>-n — Numerical addresses and port numbers</li></ul><p>This command helps identify which ports have services listening on a server.</p><h3>10.6 traceroute — Inspect the Network Path</h3><pre>traceroute example.com</pre><p>This attempts to display intermediate network hops toward a destination.</p><p>Some networks or routers may block or limit the responses required by traceroute.</p><p>The command is useful for investigating routing paths, but its results must be interpreted carefully.</p><h3>11. Practical Exercise: Troubleshooting a Local Web Server</h3><p>Let’s apply what we’ve learned using a small local HTTP server.</p><p>For this exercise, use a Linux terminal with Python 3 installed.</p><p>We will create a simple webpage, start a local server, and inspect its network behavior.</p><h3>Step 1 — Create a Practice Directory</h3><pre>mkdir -p ~/devops-network-lab<br>cd ~/devops-network-lab</pre><h3>Step 2 — Create a Webpage</h3><pre>echo &quot;&lt;h1&gt;Hello DevOps Networking!&lt;/h1&gt;&quot; &gt; index.html</pre><p>This creates a simple HTML file.</p><h3>Step 3 — Start a Local HTTP Server</h3><pre>python3 -m http.server 8000 --bind 127.0.0.1</pre><p>Python starts a basic HTTP server listening on port 8000.</p><p>The address 127.0.0.1 is a loopback address, so the server is accessible locally rather than directly from other computers.</p><p>Keep this terminal running.</p><h3>Step 4 — Open Another Terminal</h3><p>In a second terminal, run:</p><pre>curl http://127.0.0.1:8000</pre><p>You should receive the HTML content.</p><h3>Step 5 — Inspect the Listening Port</h3><pre>ss -tln</pre><p>Look for a TCP listener on port 8000.</p><p>This confirms that a process is listening on that port.</p><h3>Step 6 — Inspect the HTTP Response</h3><pre>curl -I http://127.0.0.1:8000</pre><p>You should see HTTP response headers.</p><p>The local server uses HTTP, not HTTPS.</p><p>This is acceptable for this isolated learning exercise, but production applications should use appropriate security controls.</p><h3>Step 7 — Test a Port Without a Listener</h3><p>Try:</p><pre>curl --connect-timeout 3 http://127.0.0.1:9999</pre><p>Assuming no application is listening on port 9999, you will normally receive a connection-refused error.</p><p>This illustrates how a connection can fail even when the computer itself is running normally.</p><h3>Step 8 — Stop the Server</h3><p>Return to the terminal running the Python HTTP server.</p><p>Press:</p><p>Ctrl + C</p><p>Now repeat:</p><pre>curl http://127.0.0.1:8000</pre><p>The request should fail because the local server is no longer listening.</p><h3>What Did We Learn?</h3><p>Through this small experiment, we observed:</p><ul><li>How a server listens on a port</li><li>How a client sends an HTTP request</li><li>How to inspect HTTP responses</li><li>How to inspect listening sockets</li><li>What happens when a service stops running</li></ul><p>This is a simplified version of the same reasoning used when investigating application availability problems.</p><p>The Python HTTP server in this exercise is intended for local learning, not production hosting.</p><h3>12. A Real-World DevOps Troubleshooting Scenario</h3><p>Imagine a company deploys a Spring Boot API to an Ubuntu server.</p><p>The application starts correctly, but users report that they cannot access it.</p><p>How should an engineer approach the problem?</p><h3>Step 1 — Check Whether the Application Is Running</h3><p>Inspect the service status or running processes.</p><p>If the application is stopped, investigate why it failed to start.</p><h3>Step 2 — Check the Listening Port</h3><p>Use:</p><pre>ss -tln</pre><p>Confirm that the application is listening on its configured port.</p><h3>Step 3 — Test the Application Locally</h3><p>If the application has an appropriate health endpoint, test it locally.</p><p>For example:</p><pre>curl -i http://127.0.0.1:8080/actuator/health</pre><p>This example assumes Spring Boot Actuator is configured and the endpoint is enabled.</p><p>If the request succeeds locally but fails remotely, the issue may involve the server’s network configuration or an intermediate component.</p><h3>Step 4 — Check DNS</h3><p>Use dig to inspect whether the domain resolves to the intended destination.</p><h3>Step 5 — Check Firewall and Network Rules</h3><p>Verify whether the required traffic is permitted.</p><p>Consider cloud security groups, routing rules, reverse proxies, and local firewall settings.</p><h3>Step 6 — Inspect Logs</h3><p>Review application logs and any reverse proxy or infrastructure logs.</p><p>Look for connection errors, configuration problems, or application exceptions.</p><h3>Step 7 — Fix and Verify</h3><p>Identify the actual cause, apply the appropriate change, and test the affected endpoint again.</p><p>This structured approach is much more effective than randomly changing application settings.</p><p><strong>Good troubleshooting begins by identifying where communication is failing.</strong></p><h3>13. Common Networking Mistakes Beginners Should Avoid</h3><h3>Confusing an IP Address with a Port</h3><p>An IP address identifies a destination within a network.</p><p>A port identifies a transport-level communication endpoint.</p><p>They serve different purposes.</p><h3>Assuming DNS Problems Are Application Problems</h3><p>If a domain doesn’t resolve correctly, the backend may still be running normally.</p><p>Always distinguish name resolution problems from application failures.</p><h3>Assuming a Running Application Is Publicly Reachable</h3><p>The application may be listening only on the loopback interface, or external traffic may be blocked.</p><h3>Exposing Database Ports Publicly</h3><p>Databases generally should not be exposed directly to the public internet unless there is a well-justified, securely designed requirement.</p><p>Private networking and appropriate access controls are preferable.</p><h3>Assuming Ping Tests Every Network Service</h3><p>Ping uses ICMP and does not confirm that an HTTP service or database endpoint is functioning.</p><h3>Ignoring HTTPS</h3><p>Sensitive information should not be transmitted over unprotected HTTP connections.</p><p>Use secure communication and proper certificate validation.</p><h3>Making Random Firewall Changes</h3><p>Opening ports without understanding the network architecture can introduce security risks.</p><p>Always verify which services actually need external access.</p><h3>Final Thoughts</h3><p>Networking is one of the most important foundations for DevOps engineers.</p><p>When an application fails to communicate with another service, the cause may not be a code error.</p><p>It could be related to IP addressing, DNS resolution, routing, ports, firewalls, or transport protocols.</p><p>In this article, we explored:</p><ul><li>Computer networking fundamentals</li><li>IPv4, IPv6, and private vs public IP addresses</li><li>DNS and common DNS records</li><li>Ports and their role in application communication</li><li>TCP and UDP</li><li>HTTP, HTTPS, and status codes</li><li>Firewalls and reverse proxies</li><li>Essential Linux networking commands</li><li>A practical local HTTP server exercise</li><li>A structured troubleshooting approach</li></ul><p>The most important lesson is:</p><p><strong>Before fixing a network problem, understand how the components are supposed to communicate and identify where that communication fails.</strong></p><p>With these fundamentals, we can begin exploring technologies that automate software delivery and infrastructure management.</p><h3>What’s Next?</h3><p><strong>Article 04 — Git and GitHub for DevOps Engineers</strong></p><p>In the next article, we’ll learn how Git manages source code, how teams collaborate through GitHub, and why version control is essential for CI/CD pipelines and Infrastructure as Code.</p><p>We’ll explore repositories, commits, branches, merges, pull requests, and useful Git commands through a practical exercise.</p><p><em>Thanks for reading Article 03 of my DevOps From Zero to Production series! I’m documenting my learning journey and sharing practical examples as I explore the technologies behind modern software delivery.</em></p><p><em>If you’re also learning DevOps, feel free to share your thoughts, experiences, or suggestions.</em></p><h3>References and Further Reading</h3><p><strong>Cloudflare — What Is DNS?</strong></p><p><a href="https://www.cloudflare.com/learning/dns/what-is-dns/">https://www.cloudflare.com/learning/dns/what-is-dns/</a></p><p><strong>MDN Web Docs — Overview of HTTP</strong></p><p><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Overview">https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Overview</a></p><p><strong>MDN Web Docs — Transport Layer Security (TLS)</strong></p><p><a href="https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Transport_Layer_Security">https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Transport_Layer_Security</a></p><p><strong>Ubuntu Server Documentation — Networking</strong></p><p><a href="https://ubuntu.com/server/docs/networking">https://ubuntu.com/server/docs/networking</a></p><p><strong>Linux Manual Pages — ip, ss, and Other Networking Utilities</strong></p><p><a href="https://man7.org/linux/man-pages/">https://man7.org/linux/man-pages/</a></p><p><strong>RFC 9293 — Transmission Control Protocol (TCP)</strong></p><p><a href="https://www.rfc-editor.org/rfc/rfc9293.html">https://www.rfc-editor.org/rfc/rfc9293.html</a></p><p><strong>RFC 9114 — HTTP/3</strong></p><p><a href="https://www.rfc-editor.org/rfc/rfc9114.html">https://www.rfc-editor.org/rfc/rfc9114.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ff776bcbf79" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux Fundamentals for DevOps Engineers: A Beginner’s Guide]]></title>
            <link>https://medium.com/@sajinitharushika3655/linux-fundamentals-for-devops-engineers-a-beginners-guide-060a28d39e41?source=rss-e1a9a8dbe515------2</link>
            <guid isPermaLink="false">https://medium.com/p/060a28d39e41</guid>
            <category><![CDATA[system-administration]]></category>
            <category><![CDATA[linux-commands]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Sajinitharushika]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 12:00:25 GMT</pubDate>
            <atom:updated>2026-11-16T12:00:25.634Z</atom:updated>
            <content:encoded><![CDATA[<p><em>DevOps From Zero to Production — Article 02</em></p><p><strong>Understanding Linux, essential terminal commands, file permissions, processes, and basic server management.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*jer-2A0aFiCc842P8fU1uA.jpeg" /></figure><h3>Introduction</h3><p>Imagine deploying an application to a cloud server.</p><p>The deployment appears successful, but when you try to access the application, the website doesn’t load.</p><p>How would you investigate the problem?</p><p>You might need to check whether the application is running, inspect its logs, verify network connectivity, or identify a configuration issue.</p><p>Many of these tasks are performed through the Linux command line.</p><p>Linux is an important foundation for DevOps because it is widely used in servers, cloud environments, containers, and infrastructure platforms.</p><p>In the previous article, we explored what DevOps is and how software moves from development to production.</p><p>In this second article of my <em>DevOps From Zero to Production</em> series, we’ll explore Linux fundamentals and learn some essential commands that engineers use when working with applications and servers.</p><h3>1. What Is Linux?</h3><p>Linux is technically an open-source operating system kernel.</p><p>The kernel is the central component of an operating system. It manages hardware resources such as the CPU and memory, supports processes, and allows software to interact with hardware.</p><p>A complete Linux-based operating system combines the Linux kernel with system tools, libraries, applications, and other components.</p><p>These complete systems are commonly called <strong>Linux distributions</strong>, or <em>distros</em>.</p><p>Some popular Linux distributions include:</p><ul><li><strong>Ubuntu:</strong> Widely used for desktop computers, cloud servers, and development environments.</li><li><strong>Debian:</strong> Known for its stability and strong package management ecosystem.</li><li><strong>Red Hat Enterprise Linux (RHEL):</strong> A commercial Linux distribution used in enterprise environments.</li><li><strong>Rocky Linux:</strong> A community-supported distribution designed for enterprise Linux compatibility.</li><li><strong>Alpine Linux:</strong> A lightweight distribution often used in container environments.</li></ul><p>Different distributions may use different package managers, default configurations, and administration tools.</p><p>However, many important Linux concepts and commands remain similar.</p><p>For this article, we’ll focus mainly on <strong>Ubuntu Linux</strong> and commonly available command-line utilities.</p><h3>2. Why Is Linux Important in DevOps?</h3><p>Linux plays a major role in modern software infrastructure.</p><p>Many web applications, backend services, cloud virtual machines, and containerized workloads run on Linux-based systems.</p><p>Understanding Linux helps engineers perform several important tasks.</p><h3>Managing Servers</h3><p>Engineers use Linux to configure servers, manage users, install software, and maintain applications.</p><p>For example, a Spring Boot application might run on an Ubuntu server.</p><h3>Working with Containers</h3><p>Linux provides important operating system features used by container technologies, such as namespaces and control groups.</p><p>Docker and other container technologies use these features to isolate and manage workloads on Linux hosts.</p><h3>Troubleshooting Applications</h3><p>Engineers frequently investigate issues involving CPU usage, memory consumption, logs, processes, and networking.</p><h3>Automating Tasks</h3><p>Linux provides powerful command-line tools and scripting environments that help automate repetitive operations.</p><h3>Managing Cloud Infrastructure</h3><p>Cloud platforms such as AWS, Azure, and Google Cloud support Linux virtual machines and services.</p><p>Knowing how to work with Linux is useful when deploying and maintaining applications in these environments.</p><p><strong>The key idea is simple: Linux provides the operating environment, while DevOps practices help teams deliver and operate software reliably within that environment.</strong></p><h3>3. Understanding the Linux Terminal</h3><p>A terminal allows users to interact with a computer through text commands.</p><p>Instead of clicking buttons in a graphical interface, we type instructions.</p><p>For example:</p><p>pwd</p><p>This command displays the current working directory.</p><p>Another example:</p><p>ls</p><p>This command lists files and directories in the current location.</p><h3>Terminal vs Shell</h3><p>These two terms are related, but they are not exactly the same.</p><p><strong>Terminal:</strong> An application or interface through which users enter commands and view results.</p><p><strong>Shell:</strong> A program that interprets commands and communicates with the operating system.</p><p>Bash and Zsh are common Unix-style shells.</p><p>When you open a terminal and type a command, the shell interprets your input and runs the appropriate program or built-in command.</p><p>A terminal is especially useful when working on remote servers that may not have a graphical desktop environment.</p><h3>4. Understanding the Linux Filesystem</h3><p>Linux organizes files and directories into a hierarchical structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*axxBqY63NtEszJ2W3rcnPQ.jpeg" /></figure><p>At the top of this hierarchy is the <strong>root directory</strong>, represented by:</p><p>/</p><p>All other files and directories appear beneath this root directory.</p><p>For example, a typical Linux filesystem contains directories such as:</p><p><strong>/home</strong></p><p>Contains home directories for regular users.</p><p>Example: /home/developer</p><p><strong>/etc</strong></p><p>Contains system-wide configuration files.</p><p>Example: /etc/ssh/sshd_config</p><p><strong>/var</strong></p><p>Stores variable data, including caches, logs, and other files that change while the system runs.</p><p>Example: /var/log</p><p><strong>/usr</strong></p><p>Contains many user programs, shared libraries, and supporting files.</p><p><strong>/tmp</strong></p><p>Provides a location for temporary files.</p><p><strong>/root</strong></p><p>The home directory of the root administrator account.</p><p><strong>/opt</strong></p><p>Often used for optional or third-party application software.</p><p>Understanding the filesystem helps engineers locate application files, configuration settings, and logs.</p><p>For example, if a service is not working correctly, an engineer may need to inspect its configuration in /etc or examine relevant logs.</p><p>However, exact locations can differ between distributions and applications.</p><h3>5. Essential Linux Commands</h3><p>Let’s explore some of the commands that every beginner should understand.</p><h3>5.1 pwd — Print Working Directory</h3><p>The pwd command displays your current directory.</p><pre>pwd</pre><p>Example output:</p><pre>/home/developer</pre><p>This tells us that we are currently inside the developer user&#39;s home directory.</p><h3>5.2 ls — List Files and Directories</h3><p>The ls command displays the contents of a directory.</p><pre>ls</pre><p>To see more details:</p><pre>ls -l</pre><p>To include hidden files:</p><pre>ls -a</pre><p>Hidden files in Linux commonly begin with a dot (.).</p><p>For example, .bashrc is a configuration file often found in a user&#39;s home directory.</p><h3>5.3 cd — Change Directory</h3><p>The cd command allows us to navigate between directories.</p><pre>cd Documents</pre><p>Move to the parent directory:</p><pre>cd ..</pre><p>Return to your home directory:</p><pre>cd ~</pre><p>Go directly to a specified directory:</p><pre>cd /var/log</pre><h3>5.4 mkdir — Create a Directory</h3><p>Use mkdir to create a new directory.</p><pre>mkdir devops-practice</pre><p>This creates a directory named devops-practice.</p><h3>5.5 touch — Create an Empty File</h3><pre>touch notes.txt</pre><p>If the file doesn’t exist, this command creates an empty file.</p><p>If it already exists, touch normally updates its timestamps.</p><h3>5.6 cp — Copy Files</h3><pre>cp notes.txt backup.txt</pre><p>This copies notes.txt into backup.txt.</p><h3>5.7 mv — Move or Rename Files</h3><pre>mv notes.txt linux-notes.txt</pre><p>This renames the file.</p><p>The same command can move files between directories.</p><h3>5.8 rm — Remove Files</h3><pre>rm linux-notes.txt</pre><p>This removes the specified file.</p><p>Be careful: files removed through rm are generally not placed in a desktop trash folder.</p><p>Always verify the file path before deleting anything.</p><h3>5.9 cat — Display File Contents</h3><pre>cat example.txt</pre><p>This prints the file’s contents to the terminal.</p><p>For large files, commands such as less are often easier to use.</p><h3>5.10 grep — Search Text</h3><p>The grep command searches for matching text.</p><p>For example:</p><pre>grep &quot;ERROR&quot; application.log</pre><p>This displays lines containing ERROR from the specified file.</p><p>It is especially useful when investigating logs.</p><h3>5.11 find — Search for Files</h3><pre>find . -name &quot;*.log&quot;</pre><p>This searches the current directory and its subdirectories for filenames ending in .log.</p><h3>5.12 man — Read Command Documentation</h3><pre>man ls</pre><p>This opens the manual page for the ls command, if the manual is installed.</p><p>When you’re unsure what a command does, its documentation is a good place to start.</p><h3>6. Understanding Linux File Permissions</h3><p>Linux is designed to support multiple users.</p><p>Not every user should be allowed to read, modify, or execute every file.</p><p>Linux uses file ownership and permissions to control access.</p><p>There are three basic permission types:</p><ul><li><strong>Read (r):</strong> Permission to read a file.</li><li><strong>Write (w):</strong> Permission to modify a file.</li><li><strong>Execute (x):</strong> Permission to execute a file as a program or script.</li></ul><p>These permissions are assigned to three categories:</p><ul><li><strong>Owner:</strong> The user who owns the file.</li><li><strong>Group:</strong> Users who belong to the file’s assigned group.</li><li><strong>Others:</strong> Other users.</li></ul><p>You can inspect permissions using:</p><pre>ls -l</pre><p>Example output:</p><pre>-rwxr-xr-x 1 developer developer 1200 Nov 16 10:00 deploy.sh</pre><p>The permission string -rwxr-xr-x can be understood as follows:</p><ul><li>- means this is a regular file.</li><li>rwx means the owner can read, write, and execute it.</li><li>r-x means the group can read and execute it.</li><li>r-x means others can read and execute it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mNDa7MnSRptp2OoO9XtoQw.jpeg" /></figure><h3>Changing Permissions with chmod</h3><p>The chmod command modifies file permissions.</p><p>For example:</p><pre>chmod 755 deploy.sh</pre><p>The number 755 represents:</p><ul><li><strong>7:</strong> Read + write + execute for the owner.</li><li><strong>5:</strong> Read + execute for the group.</li><li><strong>5:</strong> Read + execute for others.</li></ul><p>Another example:</p><pre>chmod 600 private.txt</pre><p>This gives the owner read and write permissions and removes all group and other permissions.</p><p>Permissions matter in DevOps because incorrect access settings can prevent applications from reading configuration files or executing scripts.</p><p>At the same time, overly permissive settings can expose sensitive information.</p><p>Avoid using chmod 777 as a quick solution to permission problems.</p><p>The safest approach is to grant only the permissions required.</p><h3>7. Understanding Processes and System Resources</h3><p>When an application runs, the operating system manages it as one or more processes.</p><p>A process is a running instance of a program.</p><p>For example, when a Spring Boot application starts, a Java process executes the application.</p><p>Linux provides several commands to inspect these processes.</p><h3>ps — View Processes</h3><pre>ps aux</pre><p>This displays information about running processes.</p><p>To look for Java processes:</p><pre>ps aux | grep java</pre><h3>top — Monitor System Activity</h3><pre>top</pre><p>The top command displays continuously updated information about processes and resource usage.</p><p>It can help identify applications consuming significant CPU or memory.</p><p>Press q to exit.</p><h3>free — Check Memory</h3><pre>free -h</pre><p>This displays memory information in a human-readable format.</p><h3>df — Check Filesystem Space</h3><pre>df -h</pre><p>This shows disk usage and available space on mounted filesystems.</p><h3>du — Check Directory Size</h3><pre>du -sh .</pre><p>This displays the approximate disk space used by the current directory.</p><p>These commands are useful when investigating resource-related problems.</p><p>For example, if a server is running out of disk space, df -h can help identify the affected filesystem.</p><h3>8. Managing Services with systemctl</h3><p>Many Linux distributions use a service manager called <strong>systemd</strong>.</p><p>On systems that use systemd, the systemctl command manages services and other system units.</p><p>For example, a web server such as Nginx may run as a background service.</p><p>To check its status:</p><pre>systemctl status nginx</pre><p>To start it:</p><pre>sudo systemctl start nginx</pre><p>To stop it:</p><pre>sudo systemctl stop nginx</pre><p>To restart it:</p><pre>sudo systemctl restart nginx</pre><p>These examples assume Nginx is installed and a corresponding systemd service exists.</p><p>The sudo command requests elevated privileges for an authorized user.</p><p><strong>Important:</strong> Restarting or stopping a service can interrupt users. Production service management should follow the organization’s operational procedures.</p><p>Not all Linux environments use systemd, and these commands may not be available inside minimal containers.</p><h3>9. Understanding Linux Logs</h3><p>Logs provide information about application activity and system events.</p><p>They are useful when investigating problems.</p><p>Imagine your application suddenly stops responding.</p><p>Instead of guessing what happened, you can inspect its logs.</p><h3>Using tail</h3><pre>tail -n 20 application.log</pre><p>This displays the last 20 lines of a log file.</p><p>To follow new log entries as they are written:</p><pre>tail -f application.log</pre><p>Press Ctrl + C to stop following the file.</p><h3>Using journalctl</h3><p>On Linux systems using systemd, journalctl can inspect journal logs.</p><p>For example:</p><pre>journalctl -u nginx</pre><p>This displays journal entries associated with the Nginx service.</p><p>To see recent entries:</p><pre>journalctl -u nginx -n 20</pre><p>To follow new entries:</p><pre>journalctl -u nginx -f</pre><p>You may need appropriate permissions to read certain system logs.</p><p>In real DevOps work, logs help engineers investigate failed deployments, application crashes, startup errors, and unexpected behavior.</p><h3>10. Basic Networking Commands</h3><p>Applications often communicate over networks, so basic networking knowledge is valuable.</p><p>Here are several commands worth understanding.</p><h3>ping — Test Network Reachability</h3><pre>ping -c 4 example.com</pre><p>This sends four ICMP echo requests to the specified host.</p><p>A response can indicate basic network reachability.</p><p>However, some servers block ICMP, so a failed ping does not always mean a website or service is unavailable.</p><h3>curl — Send HTTP Requests</h3><pre>curl -I https://example.com</pre><p>This requests HTTP response headers.</p><p>The curl tool is useful for checking API endpoints, web servers, and HTTP responses.</p><p>For example, a developer might use it to check an application’s health endpoint.</p><h3>ss — Inspect Network Sockets</h3><pre>ss -tuln</pre><p>This displays information about listening TCP and UDP sockets.</p><p>It can help determine which ports services are listening on.</p><p>These commands are useful when investigating network-related application problems.</p><h3>11. A Practical Linux Exercise</h3><p>Now let’s combine several commands into a small hands-on activity.</p><p>For this exercise, use an Ubuntu terminal or another compatible Linux environment.</p><p>We will create a simple project directory, write a shell script, execute it, and inspect its output.</p><h3>Step 1 — Create a Project Directory</h3><pre>mkdir -p ~/devops-linux-lab<br>cd ~/devops-linux-lab</pre><h3>Step 2 — Create a Shell Script</h3><p>Create a new script using:</p><pre>nano system-check.sh</pre><p>Add the following:</p><pre>#!/usr/bin/env bash</pre><pre>echo &quot;=== Basic System Check ===&quot;</pre><pre>echo &quot;Current user:&quot;<br>whoami</pre><pre>echo &quot;Current directory:&quot;<br>pwd</pre><pre>echo &quot;System information:&quot;<br>uname -s</pre><pre>echo &quot;Memory usage:&quot;<br>free -h</pre><pre>echo &quot;Disk usage:&quot;<br>df -h</pre><p>Save the file.</p><p>If you’re using Nano, press Ctrl + O, then Enter to save, and Ctrl + X to exit.</p><h3>Step 3 — Make the Script Executable</h3><pre>chmod 700 system-check.sh</pre><p>This allows the file owner to read, write, and execute the script.</p><h3>Step 4 — Run the Script</h3><pre>./system-check.sh</pre><p>The script displays basic information about your Linux environment.</p><h3>Step 5 — Save the Output</h3><pre>./system-check.sh &gt; report.txt</pre><p>This saves the script’s standard output into report.txt.</p><p>To read it:</p><pre>cat report.txt</pre><p>Congratulations! You’ve created and executed a basic Linux automation script.</p><p>Although this is a small example, the same concepts — running commands, collecting system information, and redirecting output — are useful when building more sophisticated automation.</p><p>For production systems, scripts should also handle errors and report failures appropriately.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VUnGM1Ex30zbYfC7teLiuQ.jpeg" /></figure><h3>12. Common Linux Mistakes Beginners Should Avoid</h3><p>Learning Linux involves experimentation, but some mistakes can cause unnecessary problems.</p><p><strong>Running every command with sudo</strong></p><p>Administrative privileges should only be used when necessary.</p><p><strong>Using overly permissive file permissions</strong></p><p>Avoid granting access to everyone simply to bypass a permission error.</p><p><strong>Deleting files without checking paths</strong></p><p>Commands such as rm can permanently remove important files.</p><p><strong>Ignoring command errors</strong></p><p>Read error messages instead of repeatedly running the same command.</p><p><strong>Copying commands without understanding them</strong></p><p>Review commands, especially those that download software, modify system settings, or request administrator privileges.</p><p><strong>Making changes directly on production servers</strong></p><p>Practice first in an isolated development environment or virtual machine.</p><p>Understanding these risks helps build better operational habits.</p><h3>13. How Linux Connects to DevOps</h3><p>Let’s return to the Spring Boot application discussed earlier.</p><p>Imagine a company has deployed its backend application to an Ubuntu virtual machine.</p><p>Users report that the application has become unavailable.</p><p>An engineer might investigate the issue through the following process:</p><p><strong>Step 1: Check the application process</strong></p><p>Use process inspection tools to determine whether the application is running.</p><p><strong>Step 2: Check system resources</strong></p><p>Inspect CPU, memory, and disk usage to identify possible resource constraints.</p><p><strong>Step 3: Inspect application logs</strong></p><p>Look for startup failures, exceptions, or other relevant error messages.</p><p><strong>Step 4: Check network connectivity</strong></p><p>Verify whether the application is listening on the expected port and whether the HTTP endpoint responds.</p><p><strong>Step 5: Identify the cause</strong></p><p>Determine whether the failure is related to the application, service configuration, infrastructure, or network.</p><p><strong>Step 6: Apply and verify an appropriate fix</strong></p><p>Follow the organization’s procedures to correct the issue and confirm that the application is healthy.</p><p>This example illustrates why Linux knowledge is valuable in DevOps.</p><p>Engineers need to understand not only how applications are developed, but also how those applications behave in their operating environments.</p><h3>Final Thoughts</h3><p>Linux is an important foundation for anyone interested in DevOps, cloud infrastructure, backend development, or site reliability engineering.</p><p>Learning commands is useful, but understanding <strong>why and when to use them</strong> is even more valuable.</p><p>In this article, we explored:</p><ul><li>Linux and its role in DevOps</li><li>The terminal and shell</li><li>Linux filesystem organization</li><li>Essential file and directory commands</li><li>Users and file permissions</li><li>Processes and system resources</li><li>Service management</li><li>Logs and basic networking</li><li>A practical shell scripting exercise</li></ul><p>These fundamentals provide a foundation for working with servers, investigating failures, and automating routine tasks.</p><p><strong>You don’t need to memorize every Linux command. Start with the fundamentals, practice regularly, and build confidence by solving real problems.</strong></p><h3>What’s Next?</h3><p><strong>Article 03 — Networking Fundamentals for DevOps Engineers</strong></p><p>In the next article, we’ll explore IP addresses, DNS, ports, TCP/IP, HTTP and HTTPS, and how applications communicate over networks.</p><p>We’ll also look at why networking knowledge is essential when deploying and troubleshooting services.</p><p><em>Thanks for reading Article 02 of my DevOps From Zero to Production series! I’m documenting my learning journey and sharing the concepts, practical examples, and lessons I discover along the way.</em></p><p><em>If you’re also learning DevOps, feel free to share your experiences and suggestions.</em></p><h3>References and Further Reading</h3><p><strong>Ubuntu Server Documentation — Command-Line Cheat Sheet</strong></p><p><a href="https://ubuntu.com/server/docs/reference/cli-cheatsheet/">https://ubuntu.com/server/docs/reference/cli-cheatsheet/</a></p><p><strong>Ubuntu Server Documentation — Welcome to the Terminal</strong></p><p><a href="https://ubuntu.com/server/docs/tutorial/welcome-to-the-terminal/">https://ubuntu.com/server/docs/tutorial/welcome-to-the-terminal/</a></p><p><strong>Ubuntu Server Documentation — Command Line in Depth</strong></p><p><a href="https://ubuntu.com/server/docs/tutorial/cli-in-depth/">https://ubuntu.com/server/docs/tutorial/cli-in-depth/</a></p><p><strong>Ubuntu Server Documentation — Package Management</strong></p><p><a href="https://ubuntu.com/server/docs/package-management/">https://ubuntu.com/server/docs/package-management/</a></p><p><strong>GNU Bash Reference Manual</strong></p><p><a href="https://www.gnu.org/software/bash/manual/">https://www.gnu.org/software/bash/manual/</a></p><p><strong>Linux Manual Pages</strong></p><p><a href="https://man7.org/linux/man-pages/">https://man7.org/linux/man-pages/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=060a28d39e41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding DevOps: From Code to Production]]></title>
            <link>https://medium.com/@sajinitharushika3655/understanding-devops-from-code-to-production-399dd77bc63a?source=rss-e1a9a8dbe515------2</link>
            <guid isPermaLink="false">https://medium.com/p/399dd77bc63a</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Sajinitharushika]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 11:12:06 GMT</pubDate>
            <atom:updated>2026-11-16T11:54:01.231Z</atom:updated>
            <content:encoded><![CDATA[<p><em>DevOps From Zero to Production — Article 01</em></p><p><strong>Why DevOps matters, how it works, and how it connects software development with real-world operations.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j_wGch8JYBQgpe6MRFhzeg.jpeg" /></figure><h3>Introduction</h3><p>Have you ever wondered what happens after a developer finishes writing code?</p><p>Building an application is only one part of software engineering. The application must also be tested, deployed, monitored, secured, and maintained so that real users can access it reliably.</p><p>Imagine a developer building a new feature for an online shopping application. The feature works perfectly on their laptop, but when the application is deployed to a server, something goes wrong.</p><p>Perhaps the server has a different configuration. Maybe a required dependency is missing. Or the new feature works correctly but introduces unexpected problems elsewhere.</p><p>These challenges are part of the reason why <strong>DevOps</strong> has become important in modern software engineering.</p><p>In the first article of my <em>DevOps From Zero to Production</em> series, let’s explore what DevOps actually means, why organizations adopt it, and how it helps teams deliver software reliably.</p><h3>1. What Is DevOps?</h3><p>DevOps combines two words:</p><ul><li><strong>Dev — Development:</strong> Designing, building, and testing software applications.</li><li><strong>Ops — Operations:</strong> Deploying, operating, monitoring, and maintaining applications and their infrastructure.</li></ul><p>DevOps is a combination of <strong>culture, practices, and technologies</strong> that encourages software development and IT operations teams to work together throughout the software lifecycle.</p><p>Its objective is to help organizations deliver software more frequently, reliably, and securely.</p><p>However, there is an important distinction:</p><p><strong>DevOps is not simply a tool, a job title, or a collection of automation scripts. It is an approach to how teams build, deliver, and operate software.</strong></p><p>Docker, Kubernetes, Jenkins, and GitHub Actions are technologies that can support DevOps practices, but installing these tools alone does not mean an organization has successfully adopted DevOps.</p><p>Collaboration, shared responsibility, automation, and continuous improvement are equally important.</p><h3>2. Why Do We Need DevOps?</h3><p>Traditionally, software development and IT operations often worked as separate teams.</p><p>A development team would write the application and hand it over to an operations team responsible for deployment and maintenance.</p><p>This separation could introduce several challenges:</p><p><strong>Slow releases</strong></p><p>Deployments required multiple manual steps and handovers.</p><p><strong>Environment differences</strong></p><p>Software that worked on a developer’s computer might behave differently in production.</p><p><strong>Communication gaps</strong></p><p>Development and operations teams might have different priorities.</p><p><strong>Difficult troubleshooting</strong></p><p>Finding and resolving production problems could require coordination across several teams.</p><p><strong>Repetitive tasks</strong></p><p>Manual builds, tests, and deployments consumed valuable engineering time.</p><p>DevOps helps address these challenges by promoting collaboration, automation, and shared ownership.</p><p>Instead of treating deployment and operations as the final steps, teams consider them throughout the development process.</p><p>For example, developers can create automated tests, operations engineers can help design reliable deployment processes, and both groups can use monitoring feedback to improve the application.</p><p>The result is a workflow in which software delivery becomes more consistent and easier to maintain.</p><h3>3. How Does DevOps Work?</h3><p>DevOps is often represented as a continuous lifecycle containing several connected activities.</p><p><strong>Plan → Code → Build → Test → Release → Deploy → Operate → Monitor → Feedback → Plan</strong></p><p>Let’s understand each stage.</p><h3>Plan</h3><p>Teams identify requirements, discuss user stories, and decide what needs to be developed.</p><p>Example: An online shopping application needs a new discount feature.</p><h3>Code</h3><p>Developers implement features and store their changes in a version control system such as Git.</p><h3>Build</h3><p>The source code is compiled or packaged into an executable application or another deployable artifact.</p><h3>Test</h3><p>Automated tests help identify defects before changes are released.</p><p>Tests may include unit tests, integration tests, and security checks.</p><h3>Release</h3><p>A validated version of the application is prepared and approved for deployment according to the team’s release process.</p><h3>Deploy</h3><p>The application is delivered to a target environment, such as a cloud server or container platform.</p><h3>Operate</h3><p>The deployed application and its infrastructure are managed to ensure they continue functioning.</p><h3>Monitor</h3><p>Teams observe application performance, availability, errors, logs, and infrastructure health.</p><h3>Feedback</h3><p>Monitoring results, incidents, and user feedback help teams plan future improvements.</p><p>The important idea is that the process is continuous.</p><p><strong>Software delivery doesn’t end when an application is deployed. What happens in production influences what the team improves next.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*jdxtQ6Mu-Mxxb6ABlMRSwA.jpeg" /></figure><h3>4. A Real-World Example: Deploying a Spring Boot Application</h3><p>Let’s imagine we are developing a Spring Boot REST API for an e-commerce platform.</p><p>The application uses PostgreSQL to store product and order information.</p><p>A developer creates a new endpoint that allows customers to retrieve their order history.</p><p>How could a DevOps workflow support this change?</p><h3>Step 1 — Write and Push the Code</h3><p>The developer implements the endpoint locally and pushes the changes to a GitHub repository.</p><h3>Step 2 — Run Automated Checks</h3><p>A GitHub Actions workflow starts automatically and performs several checks, such as compiling the application and running JUnit tests.</p><p>If a test fails, the pipeline reports the failure, allowing the developer to investigate before the change is released.</p><h3>Step 3 — Build an Application Artifact</h3><p>After the required checks pass and the changes are approved, the pipeline can package the application into a JAR file and build a Docker image.</p><p>A Docker image packages the application with the runtime environment and other dependencies required by its container.</p><h3>Step 4 — Deploy the Application</h3><p>An approved deployment process releases the image to a target environment.</p><p>For example, the application could run on a cloud virtual machine or in a Kubernetes cluster.</p><h3>Step 5 — Monitor the Application</h3><p>Prometheus could collect application metrics, while Grafana could display them in dashboards.</p><p>The team could monitor request rates, error rates, response times, and resource usage.</p><h3>Step 6 — Respond and Improve</h3><p>If the new endpoint causes problems, the team can investigate logs and metrics, fix the issue, or roll back to a previously working version.</p><p>This example demonstrates how development, testing, deployment, and monitoring can work together.</p><p>It is not necessary for every project to use all of these technologies. The appropriate tools depend on application requirements, team size, and infrastructure complexity.</p><h3>5. Understanding CI/CD</h3><p>One of the most important technical practices associated with DevOps is CI/CD.</p><h3>CI — Continuous Integration</h3><p>Continuous Integration is the practice of frequently integrating code changes into a shared repository and validating them through automated builds and tests.</p><p>For example:</p><p>Developer pushes code to GitHub → GitHub Actions builds the project → Automated tests run → Team receives the results.</p><p>CI helps teams detect integration problems earlier.</p><h3>CD — Continuous Delivery</h3><p>Continuous Delivery extends the workflow by ensuring that validated changes can be released to production reliably, usually with a deliberate release decision or approval.</p><h3>Continuous Deployment</h3><p>Continuous Deployment goes one step further.</p><p>Every change that successfully passes the required automated checks is deployed to production automatically, without an additional manual release decision.</p><p>These terms are related, but continuous delivery and continuous deployment are not identical.</p><p>We will explore CI/CD in more detail later in this series.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ngyHSuwM0LBqkYnXArADw.jpeg" /></figure><h3>6. Common Technologies Used in DevOps</h3><p>DevOps does not require a fixed technology stack. However, several tools are commonly used to support particular practices.</p><h3>Version Control — Git and GitHub</h3><p>Version control systems help developers track code changes, collaborate with teammates, and manage different versions of a project.</p><h3>CI/CD — GitHub Actions, Jenkins, and GitLab CI</h3><p>These tools automate software builds, testing, and deployment workflows.</p><h3>Containerization — Docker</h3><p>Docker packages applications and their dependencies into containers, helping maintain consistent runtime environments.</p><h3>Container Orchestration — Kubernetes</h3><p>Kubernetes manages containerized applications, including deployment, scaling, and recovery from certain types of failures.</p><h3>Cloud Infrastructure — AWS, Azure, and Google Cloud</h3><p>Cloud platforms provide computing resources, storage, networking, and managed services for running applications.</p><h3>Infrastructure as Code — Terraform</h3><p>Terraform allows engineers to define and provision infrastructure using configuration files instead of performing every task manually.</p><h3>Configuration Management — Ansible</h3><p>Ansible automates tasks such as server configuration, software installation, and system administration.</p><h3>Monitoring — Prometheus and Grafana</h3><p>Prometheus collects and stores metrics, while Grafana provides dashboards to visualize system and application performance.</p><h3>Logging — Loki and Elasticsearch</h3><p>Logging technologies help teams collect, search, and investigate application and infrastructure logs.</p><h3>Security — Trivy and SonarQube</h3><p>These tools support different types of security and code-quality checks within software development workflows.</p><p>Each tool addresses a different problem.</p><p>For instance, Docker and Kubernetes are related but do not perform the same function.</p><p>Docker helps package and run applications in containers, while Kubernetes manages containerized workloads across infrastructure.</p><p><strong>Understanding the purpose of each technology is more valuable than memorizing tool names.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n1RExXY4Lg4fSquWVPmmFA.jpeg" /></figure><h3>7. Key Principles of DevOps</h3><p>Regardless of the technologies being used, effective DevOps practices are built around several principles.</p><h3>Collaboration</h3><p>Development, operations, testing, and security teams communicate and share responsibility for delivering reliable software.</p><h3>Automation</h3><p>Teams automate repetitive activities such as testing, building, infrastructure provisioning, and deployment where appropriate.</p><h3>Continuous Improvement</h3><p>Teams use feedback from production, users, and engineering processes to identify opportunities for improvement.</p><h3>Monitoring and Observability</h3><p>Metrics, logs, and traces help teams understand system behavior and investigate problems.</p><h3>Reliability and Security</h3><p>Software should be delivered safely, with appropriate testing, security controls, recovery procedures, and operational practices.</p><p>These principles help organizations balance delivery speed with long-term reliability.</p><h3>8. Does DevOps Replace Software Developers?</h3><p>No.</p><p>DevOps does not eliminate software development or operations. Instead, it encourages closer collaboration and shared ownership.</p><p>Software engineers still design systems and develop application functionality.</p><p>DevOps and platform engineers may focus on CI/CD pipelines, infrastructure automation, cloud environments, deployment platforms, and observability.</p><p>Site Reliability Engineers (SREs) often focus on reliability, availability, incident response, and operational performance.</p><p>The responsibilities overlap, and the exact job titles differ between organizations.</p><p>Most importantly, DevOps is a shared organizational approach rather than something performed exclusively by a single engineer.</p><h3>9. What Should Beginners Learn First?</h3><p>If you’re beginning your DevOps journey, I recommend learning the foundations before moving directly into complex cloud infrastructure.</p><p>A practical learning path is:</p><p><strong>1. Linux Fundamentals and Basic Networking</strong></p><p>Learn Linux commands, file permissions, processes, networking fundamentals, and server management.</p><p><strong>2. Git and GitHub</strong></p><p>Understand repositories, branches, commits, merges, and pull requests.</p><p><strong>3. Bash Scripting and Automation</strong></p><p>Learn to automate repetitive tasks using shell scripts.</p><p><strong>4. CI/CD and GitHub Actions</strong></p><p>Create automated workflows for building, testing, and deploying software.</p><p><strong>5. Docker and Docker Compose</strong></p><p>Learn how to containerize applications and run multiple services together.</p><p><strong>6. Cloud Computing Fundamentals</strong></p><p>Explore cloud infrastructure using services provided by AWS, Azure, or Google Cloud.</p><p><strong>7. Kubernetes</strong></p><p>Learn to deploy, scale, and manage containerized applications.</p><p><strong>8. Infrastructure as Code</strong></p><p>Use technologies such as Terraform to define and provision infrastructure.</p><p><strong>9. Monitoring and Observability</strong></p><p>Understand application metrics, logs, traces, dashboards, and alerts.</p><p><strong>10. Security and Production Reliability</strong></p><p>Explore secure deployments, secrets management, recovery strategies, and production troubleshooting.</p><p>Try to combine theoretical understanding with small practical exercises.</p><p>For example, start by automating tests for a simple application using GitHub Actions before attempting to build a complete Kubernetes deployment pipeline.</p><p>The goal is not to learn every technology at once. It is to understand problems, learn appropriate solutions, and gradually connect the different parts of software delivery.</p><h3>Final Thoughts</h3><p>DevOps connects software development with the processes required to deliver and operate applications successfully.</p><p>It is built around collaboration, shared responsibility, automation, continuous feedback, and improvement.</p><p>The most important lesson from this introduction is simple:</p><p><strong>Writing code creates software. Delivering, operating, and improving that software reliably is an ongoing engineering responsibility.</strong></p><p>Throughout this series, I’ll explore DevOps concepts step by step, starting with the fundamentals and gradually moving toward practical production-oriented workflows.</p><h3>What’s Next?</h3><p><strong>Article 02 — Linux Fundamentals for DevOps Engineers</strong></p><p>In the next article, we’ll explore why Linux is important in DevOps, how the Linux file system works, and the basic commands used to navigate and manage a system.</p><p><em>Thanks for reading! This article is part of my DevOps From Zero to Production learning series. Feel free to share your thoughts, experiences, or suggestions as I continue exploring the world of DevOps.</em></p><h3>References and Further Reading</h3><ul><li>Microsoft Learn — What Is DevOps?<br><a href="https://learn.microsoft.com/en-us/devops/what-is-devops">https://learn.microsoft.com/en-us/devops/what-is-devops</a></li><li>AWS — What Is DevOps?<br><a href="https://aws.amazon.com/devops/what-is-devops/">https://aws.amazon.com/devops/what-is-devops/</a></li><li>GitHub Docs — Continuous Integration<br><a href="https://docs.github.com/en/actions/get-started/continuous-integration">https://docs.github.com/en/actions/get-started/continuous-integration</a></li><li>Google Cloud — DevOps Capabilities<br><a href="https://docs.cloud.google.com/architecture/devops">https://docs.cloud.google.com/architecture/devops</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=399dd77bc63a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>