<?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 Ukpono Obott on Medium]]></title>
        <description><![CDATA[Stories by Ukpono Obott on Medium]]></description>
        <link>https://medium.com/@ukponoobott?source=rss-7cfa343784a6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*H8gdHLfLfy6t789aTZc_PQ@2x.jpeg</url>
            <title>Stories by Ukpono Obott on Medium</title>
            <link>https://medium.com/@ukponoobott?source=rss-7cfa343784a6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 02:00:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ukponoobott/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[Effortless Deployments with CI/CD Pipelines]]></title>
            <link>https://ukponoobott.medium.com/effortless-deployments-with-ci-cd-pipelines-ae479d22291e?source=rss-7cfa343784a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae479d22291e</guid>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[devops-practice]]></category>
            <category><![CDATA[workflow-automation]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Ukpono Obott]]></dc:creator>
            <pubDate>Mon, 09 Dec 2024 14:41:45 GMT</pubDate>
            <atom:updated>2024-12-09T14:41:45.613Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How Automation Reduces Complexity and Drives a Strong DevOps Culture</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Eynr5wEkZAcreeoy1-zH4w.png" /><figcaption>CICD</figcaption></figure><p>Managing deployments in distributed teams can be complex, especially when workflows lack proper structure and enforcement. CI/CD (Continuous Integration and Continuous Deployment/Delivery) pipelines play a significant role in simplifying this process by creating standardized, automated workflows for releasing infrastructure and applications.</p><p>At its core, a CI/CD pipeline automates key stages of development — building, testing, and deploying code — minimizing human intervention and reducing the risk of errors. By streamlining these processes, CI/CD pipelines enable organizations to accelerate the transition from development to production, maintain consistent quality, and allow teams to focus on innovation rather than spending time on manual deployment challenges. This approach is essential for fostering a productive, scalable, and collaborative development environment.</p><p><strong>Key Components of CI/CD Pipelines</strong></p><p>1. <strong>Continuous Integration (CI): </strong>Automates the integration of code changes from multiple contributors, ensuring new additions are verified through builds and tests. This fosters collaboration, reduces integration risks, and encourages smaller, incremental updates.</p><p>2. <strong>Continuous Delivery (CD): </strong>Extends CI by automating artifact preparation and validating the codebase for deployment, ensuring it is always production-ready. This allows teams to push updates confidently without last-minute issues.</p><p>3. <strong>Continuous Deployment (CD): </strong>Goes beyond Continuous Delivery by automating the release of validated changes directly to production or staging environments, ensuring faster releases and building trust in the pipeline’s quality assurance.</p><p><strong>Essential Stages of the CI/CD Workflow</strong></p><p>1. <strong>Source Control: </strong>Manages<strong> </strong>and tracks code changes in a repository, enabling version control, collaboration, and a history of contributions.</p><p>2. <strong>Build Automation: </strong>Automates the process of compiling source code and packaging it into deployable artifacts, ensuring consistency and reliability across builds.</p><p>3. <strong>Testing: </strong>Ensures code quality and functionality by running automated tests such as unit, integration, and end-to-end tests, catching potential issues early in the development process.</p><p>4. <strong>Artifact Storage: </strong>Securely stores build outputs, such as binaries, Docker images, or other deployable files, for easy reuse, versioning, and traceability during deployments.</p><p>5. <strong>Deployment: </strong>Automates the release of applications to different environments, such as development, staging or production, ensuring speed, reliability, and reduced manual effort.</p><p>6. <strong>Feedback Mechanism: </strong>Provides real-time notifications to team members about pipeline execution results, successful completion or errors, facilitating faster troubleshooting and continuous improvement.</p><p><strong>Brief Overview of GitHub Actions</strong></p><p><a href="https://docs.github.com/en/actions">GitHub Actions</a> is a CI/CD platform built into GitHub, designed to help developers automate workflows and streamline processes directly from their repositories. It allows teams to define workflows as YAML files, specifying tasks that should run in response to repository events such as code pushes, pull requests, or scheduled triggers.</p><p>The platform supports building, testing, and deploying applications across various environments with minimal setup. Developers can define workflows with jobs that run sequentially or in parallel, customize environments, and integrate with third-party tools through an extensive library of pre-built actions.</p><p>Example: This GitHub Actions workflow below triggers whenever there is a push to the main branch. The hello_world job runs on a Linux VM (ubuntu), using Bash as the default shell, and includes a single step to print “Hello World!” to the console.</p><pre>on:<br>  push:<br>    branches:<br>      - main<br><br>permissions:<br>  contents: read<br><br>jobs:<br>  hello_world:<br>    runs-on: ubuntu-latest<br>    defaults:<br>      run:<br>        shell: bash<br>    steps:<br>      - name: Print Hello World!<br>        run: echo &quot;Hello World!&quot;</pre><p>Key features of GitHub Actions include;</p><ul><li><a href="https://docs.github.com/en/actions/about-github-actions/understanding-github-actions#events"><strong>Event-Driven Workflows</strong></a><strong>:</strong> Automate tasks based on repository activities like commits, pull requests, or scheduled events.</li><li><a href="https://docs.github.com/en/actions/about-github-actions/understanding-github-actions#runners"><strong>Custom Runners</strong></a><strong>:</strong> Use GitHub-hosted runners for convenience or self-hosted runners for custom environments.</li><li><a href="https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow#about-matrix-strategies"><strong>Environment Matrix</strong></a><strong>:</strong> Test across multiple operating systems, languages, or dependency versions in a single workflow.</li><li><a href="https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#about-secrets"><strong>Secrets Management</strong></a><strong>:</strong> Securely handle credentials and sensitive data through encrypted secrets.</li><li><a href="https://docs.github.com/en/actions/sharing-automations/reusing-workflows"><strong>Reusable Workflows</strong></a><strong>:</strong> Simplify complex workflows by creating reusable components or templates.</li></ul><p>In this example, we are implementing a deployment workflow for managing both infrastructure and application releases, guided by a clearly defined branching strategy outlined below:</p><p><strong>Branching Strategy</strong></p><ul><li><strong>infra_features</strong>: For infrastructure-related feature development.</li><li><strong>infra_main</strong>: Main branch for managing stable infrastructure configurations.</li><li><strong>integration</strong>: For integrating frontend and backend application changes.</li><li><strong>deployment</strong>: Dedicated branch for application deployment.</li></ul><p><strong>Deployment Workflow</strong></p><ol><li><strong>Infrastructure Workflow</strong></li></ol><p><strong>Push to infra_features</strong>:</p><ul><li>This event triggers a terraform validate job to confirm the configuration is syntactically correct.</li></ul><pre>name: &#39;Terraform Validate&#39;<br><br>on:<br>  push:<br>    branches:<br>      - infra_features<br>      <br>jobs:<br>  terrform-validate:<br>    name: Terraform Validate<br>    runs-on: ubuntu-latest<br>    steps:<br>    ...<br>      - name: Terraform Validate<br>        id: tf-validate<br>        working-directory: ./infrastructure<br>        run: |<br>          terraform validate -no-color</pre><p><strong>PR to infra_main</strong>:</p><ul><li>Initiates a <em>terraform plan</em> job to display the expected infrastructure changes and calculate cost estimates.</li><li>Cost changes are added as comments in the PR using <a href="https://dashboard.infracost.io/"><strong>Infracost</strong></a> for visibility.</li></ul><pre>name: &#39;Terraform Plan&#39;<br><br>on:<br>  pull_request:<br>    branches:<br>      - infra_main<br><br>permissions:<br>  id-token: write<br>  contents: write<br>  pull-requests: write<br>      <br>jobs:<br>  terrform-plan:<br>    name: Terraform Plan<br>    runs-on: ubuntu-latest<br>    steps:<br>      ...<br>      - name: Terraform Plan<br>        ...<br>      - name: Setup Infracost<br>        uses: infracost/actions/setup@v3<br>        with:<br>          api-key: ${{ secrets.INFRACOST_API_KEY }}<br>      - name: Generate Infracost cost estimate baseline<br>        run: |<br>          infracost breakdown --path=./infrastructure --format=json --out-file=/tmp/infracost.json<br>      - name: Post Infracost comment<br>        run: |<br>            infracost comment github --path=/tmp/infracost.json --repo=$GITHUB_REPOSITORY --github-token=${{ github.token }} --pull-request=${{ github.event.pull_request.number }} --behavior=new --show-all-projects</pre><p><strong>Push to infra_main</strong>:</p><ul><li>Executes <em>terraform apply</em> job to deploy the infrastructure changes and runs ansible playbookto configure the infrastructure, such as installing Docker and setting up monitoring tools.</li></ul><p>2. <strong>Application Workflow</strong></p><p><strong>Push to integration</strong>: Changes in the frontend or backend trigger a build pipeline to:</p><ul><li>Build Docker images for the updated application, tag and push the images to docker hub.</li><li>User yq to update the image tag in docker-compose.yaml file to the build tag and push changes to GitHub.</li></ul><pre>name: &#39;Backend Build&#39;<br><br>on:<br>  push:<br>    branches:<br>      - integration<br>    paths:<br>      - &#39;backend/**&#39;<br><br>permissions:<br>  id-token: write<br>  contents: write<br>      <br>jobs:<br>  backend-build:<br>    name: Build and Push Backend Docker Image<br>    runs-on: ubuntu-latest<br>    steps:<br>      ...<br>      - name: Build Tag and push<br>        ...<br>      - name: &#39;Install yq&#39;<br>        ...<br>      - name: Update Image Tag<br>        run: |<br>          yq -e -i &#39;.services.backend.image = &quot;${{ secrets.DOCKERHUB_USERNAME }}/challenge-backend:build-${{ github.run_number }}&quot;&#39; -i docker-compose.yaml<br>    <br>      - name: &#39;Git Update Repo&#39;<br>        id: git<br>        run: |<br>          git config --global user.email &quot;xyz@mail.com&quot;<br>          git config --global user.name &quot;CI Bot<br>          git commit --no-verify -am &#39;[skip-ci-actions] Updated image for backend to challenge-backend:build-${{ github.run_number }}&#39;<br>          git push</pre><p><strong>Push to deployment:</strong></p><ul><li>SSH into the VM, clone the repo, and run the docker-compose up -d command to deploy the applications.</li></ul><pre>name: Deploy Applications<br><br>on:<br>  push:<br>    branches:<br>      - deployment<br><br>permissions:<br>  id-token: write<br>  contents: read<br><br>jobs:<br>  deployment:<br>    name: Deploy Applications<br>    runs-on: ubuntu-latest<br><br>    steps:<br>      - name: Checkout Repo<br>        uses: actions/checkout@v4<br>        with:<br>          ref: infra_main<br>      - name: Parse Public IP from Inventory<br>        id: parse_ip<br>        run: |<br>          export INVENTORY_FILE=./infrastructure/inventory.ini<br>          PUBLIC_IP=$(grep &quot;ansible_host&quot; $INVENTORY_FILE | head -n 1 | awk -F &#39;ansible_host=&#39; &#39;{print $2}&#39; | awk &#39;{print $1}&#39; | xargs)<br>          echo &quot;public_ip=$PUBLIC_IP&quot; &gt;&gt; $GITHUB_OUTPUT<br>      - name: Get Repo details<br>        id: repo<br>        run: |<br>          DIR_NAME=$(basename &quot;${{ github.repository }}&quot;)<br>          REPO_NAME=${{ github.repository }}<br>          echo &quot;dir_name=$DIR_NAME&quot; &gt;&gt; $GITHUB_OUTPUT<br>          echo &quot;repo_name=$REPO_NAME&quot; &gt;&gt; $GITHUB_OUTPUT<br>      - name: Start SSH Agent<br>        uses: webfactory/ssh-agent@v0.5.3<br>        with:<br>          ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}<br>      <br>      - name: SSH into VM and Deploy using Docker Compose<br>        run: |<br>          ssh -o StrictHostKeyChecking=no ${{ secrets.VM_USERNAME }}@${{ steps.parse_ip.outputs.public_ip }} &lt;&lt; &#39;EOF&#39;<br>            sudo apt update &amp;&amp; sudo apt install -y git<br>            git config --global url.&quot;https://oauth2:${{ secrets.ACCESS_GITHUB_TOKEN }}@github.com&quot;.insteadOf https://github.com<br>            git config --global user.name &quot;CI Bot&quot;<br>            git config --global user.email &quot;xyz@mail.com&quot;<br>            if [ ! -d &quot;${{ steps.repo.outputs.dir_name }}&quot; ]; then<br>              echo &quot;Directory ${{ steps.repo.outputs.dir_name }} does not exist. Cloning repository...&quot;<br>              git clone https://github.com/${{ steps.repo.outputs.repo_name }}.git<br>            else<br>              echo &quot;Directory ${{ steps.repo.outputs.dir_name }} already exists. Skipping clone.&quot;<br>            fi<br>            cd ${{ steps.repo.outputs.dir_name}}<br>            docker-compose up -d<br>            docker ps<br>          EOF    </pre><p><strong>Best Practices for CI/CD Pipelines</strong></p><p>1. <strong>Branch Protection Rules</strong></p><ul><li>Require PRs before merging to critical branches.</li><li>Restrict direct commits to protected branches.</li></ul><p>2. <strong>Pipeline Security:</strong></p><ul><li>Store secrets securely (e.g., in GitHub Actions secrets manager).</li></ul><p>3. <strong>Versioning and Artifacts:</strong></p><ul><li>Use semantic versioning for builds and tags.</li><li>Store build artifacts for debugging and reuse.</li></ul><p>4. <strong>Environment Management:</strong></p><ul><li>Use isolated environments for dev, test, and prod.</li><li>Automate environment setup for consistency.</li></ul><p><strong>Conclusion</strong></p><p>This article demonstrates how CI/CD pipelines simplify and enhance the deployment process for both infrastructure and applications. By structuring workflows for infrastructure changes using Terraform and Ansible, and automating application deployments with Docker Compose, teams can achieve reliable, repeatable, and efficient delivery cycles.</p><p>The integration of branching strategies ensures a clear and traceable flow of changes, while automation reduces manual effort and eliminates room for errors. By implementing these concepts, you can gain a deeper understanding of how to build and maintain efficient pipelines, ultimately driving higher quality and faster releases.</p><p>PS: The workflow code above has been shortened to focus on important steps, please see the full code in the repository <a href="https://github.com/ukponoobott/infra-app-deploy">here</a>.</p><p>If you have questions, please post them in the comments and don’t forget to give us a start on GitHub.</p><p>Adiós!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae479d22291e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streamlining Complex Deployments with Code]]></title>
            <link>https://ukponoobott.medium.com/streamlining-complex-deployments-with-code-8dd8a393fe5a?source=rss-7cfa343784a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8dd8a393fe5a</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Ukpono Obott]]></dc:creator>
            <pubDate>Mon, 02 Dec 2024 22:23:20 GMT</pubDate>
            <atom:updated>2024-12-02T22:23:20.433Z</atom:updated>
            <content:encoded><![CDATA[<p>An End-to-End Guide to Automation Using Terraform and Ansible</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*h0HbTD-t3Ui5moroL8rPIg.png" /></figure><p>As cloud infrastructure grows, so does its complexity. Managing configurations across multiple environments, ensuring reliability, and maintaining scalability become significant challenges. When a project is small, manually deploying infrastructure and configuring systems might seem manageable. However, as it scales, this approach becomes unsustainable. Manual processes are prone to errors, lack flexibility, and can create bottlenecks that slow down a team&#39;s ability to deliver and innovate. To tackle these challenges, modern DevOps practices emphasize the use of <strong>Infrastructure as Code (IaC)</strong> and <strong>Configuration Management</strong>, which bring automation, consistency, and repeatability to infrastructure and application deployment workflows.</p><p><strong>IaC tools like Terraform</strong> help define and provision infrastructure consistently across environments, while <strong>Ansible</strong> automates post-deployment tasks such as system configuration and application deployments. Together, these tools streamline the process — from spinning up infrastructure to configuring applications — while reducing human error and boosting efficiency.</p><p>In a previous <a href="https://ukponoobott.medium.com/deploying-containerized-applications-387875a8a2d2">article</a>, we deployed applications using Docker Compose. This time, we will take it a step further by automating the deployment with Terraform and Ansible. We will set up a compute infrastructure in Azure to host dockerized applications, including a FastAPI backend, a React frontend, and a PostgreSQL database. Additionally, we’ll configure monitoring and use Traefik as a reverse proxy. By leveraging these tools, you’ll learn how to create a scalable, reliable, and fully automated deployment pipeline for modern cloud applications.</p><p>This implementation is divided into two key parts</p><ul><li><strong>Infrastructure Provisioning with Terraform</strong></li><li><strong>Infrastructure Configuration and Application Deployment with Ansible</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Vte5wZjyMcRO4VGSKD4OA.png" /><figcaption>Architecture</figcaption></figure><p><strong>Infrastructure Provisioning with Terraform</strong></p><p>Terraform is at the core of our Infrastructure as Code approach, enabling us to define and provision cloud resources declaratively. For this implementation, we leverage the <strong>Azurerm provider</strong> from Terraform’s registry to provision the necessary Azure resources, including:</p><ul><li>Azure Resource Group</li><li>Virtual Network (VNet) and Subnet</li><li>Network Security Group (NSG)</li><li>Public IP</li><li>Azure Virtual Machines</li></ul><p>After provisioning the required infrastructure, terraform handles the post-deployment tasks below;</p><ul><li><strong>Dynamic Inventory Generation</strong>: With Terraform’s template_file function, we dynamically generate an Ansible inventory file that includes essential details like VM names, IP addresses, SSH usernames, and private keys. This ensures that the inventory is always up to date with the current infrastructure. The generated content is saved to a file using the local_file resource, specified by the ansible_inventory_file variable. This approach keeps the inventory in sync with the provisioned resources, eliminating the need for manual updates and reducing potential errors. It’s a straightforward and efficient way to ensure Ansible has the correct data to work with.</li></ul><pre>locals {<br>  ansible_inventory = templatefile(&quot;${path.module}/ansible_inventory.tpl&quot;, {<br>    vm_name         = azurerm_linux_virtual_machine.this.name<br>    ip_address      = azurerm_public_ip.this.ip_address<br>    ansible_user    = var.admin_username<br>    ssh_private_key = var.ssh_private_key<br>  })<br>}<br><br>resource &quot;local_file&quot; &quot;ansible_inventory&quot; {<br>  filename = var.ansible_inventory_file<br>  content  = local.ansible_inventory<br>}</pre><ul><li><strong>Triggering Ansible Playbooks</strong>: Once the infrastructure is provisioned, a null_resource in Terraform, combined with a local-exec provisioner, is used to trigger the Ansible playbooks. This ensures that Ansible runs immediately after Terraform completes its tasks. The playbooks use the dynamically generated inventory file, allowing Ansible to handle configuration and application deployment without requiring manual intervention. This creates a smooth and automated workflow, bridging infrastructure provisioning and application setup seamlessly.</li></ul><pre>resource &quot;null_resource&quot; &quot;ansible&quot; {<br>  depends_on = [<br>    azurerm_public_ip.this,<br>    azurerm_linux_virtual_machine.this,<br>    time_sleep.wait_2_minutes<br>  ]<br>  triggers = {<br>    always_run = &quot;${timestamp()}&quot;<br>  }<br><br>  provisioner &quot;local-exec&quot; {<br>    command = &quot;ansible-playbook -i inventory playbook.yaml&quot;<br>  }<br>}</pre><p><strong>Infrastructure Configuration and Application Deployment with Ansible</strong></p><p>Once the infrastructure is provisioned, terraform triggers Ansible to take over the configuration and application deployment processes. Ansible’s <strong>role-based approach</strong> makes it a powerful tool for managing complex deployments in a repeatable and modular way.</p><p><strong>What is an Ansible Role?</strong></p><p>An Ansible <a href="https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html">role</a> organizes playbooks and their files into reusable, structured units. This approach reduces redundancy, simplifies complex workflows, and ensures configuration tasks are self-contained and reusable across projects. Here is a short <a href="https://www.geeksforgeeks.org/ansible-roles/">guide</a> on Ansible roles by geekforgeeks.</p><p>For this setup, we created <strong>two roles — configuration, and deployment role.</strong></p><ul><li><strong>Configuration Role</strong>: This role configures the provisioned virtual machines to host Dockerized applications by installing essential system dependencies like apt-transport-https, ca-certificates, and curl. It adds Docker’s official GPG key, configures the stable Docker repository, and installs Docker Community Edition (CE). The role also ensures that the Docker service is enabled and running, and grants the user permissions to manage Docker containers by adding them to the Docker group. This setup ensures that the VMs are fully prepared to support containerized workloads with Docker, adhering to best practices for reliability and consistency.</li></ul><pre>---<br>- name: Install prerequisites<br>  apt:<br>    name:<br>      - apt-transport-https<br>      - ca-certificates<br>      - curl<br>      - software-properties-common<br>    state: present<br><br>- name: Add Docker’s official GPG key<br>  apt_key:<br>    url: https://download.docker.com/linux/ubuntu/gpg<br>    state: present<br><br>- name: Set up the stable repository<br>  apt_repository:<br>    repo: &quot;deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable&quot;<br>    state: present<br><br>- name: Install Docker CE<br>  apt:<br>    name: docker-ce<br>    state: present<br>    update_cache: yes<br><br>- name: Start and enable Docker service<br>  systemd:<br>    name: docker<br>    enabled: yes<br>    state: started<br><br>- name: Add user to Docker group<br>  user:<br>    name: &quot;{{ ansible_user }}&quot;<br>    groups: docker<br>    append: yes</pre><ul><li><strong>Application Deployment Role</strong>: This role is responsible for deploying all system components, including the application stack (FastAPI backend, React frontend, and PostgreSQL database), monitoring tools, and Traefik as the reverse proxy. It creates Docker volumes for storage and sets up networks to allow containers to communicate with each other. Configuration files are copied to the virtual machines, and environment variables are loaded from a YAML file. The role then deploys the containers, setting up the required ports, volumes, and networks to ensure everything works together. This role ensures that all system components—applications, database, monitoring, and reverse proxy—are deployed properly and function smoothly in the environment.</li></ul><pre>---<br>- name: Create Docker volumes<br>  docker_volume:<br>    name: &quot;{{ volume.split(&#39;:&#39;)[0] }}&quot;<br>    driver: local<br>    state: present<br>  with_items: &gt;-<br>    {{ containers<br>    | selectattr(&#39;volumes&#39;, &#39;defined&#39;)<br>    | map(attribute=&#39;volumes&#39;)<br>    | flatten<br>    | select(&#39;search&#39;, &#39;^[^./].*&#39;)<br>    | unique }}<br>  loop_control:<br>    loop_var: volume<br><br>- name: Create Docker networks<br>  docker_network:<br>    name: &quot;{{ network }}&quot;<br>    driver: bridge<br>    state: present<br>  with_items: &quot;{{ containers | selectattr(&#39;networks&#39;, &#39;defined&#39;) | map(attribute=&#39;networks&#39;) | flatten | map(attribute=&#39;name&#39;) | unique }}&quot;<br>  loop_control:<br>    loop_var: network<br><br>- name: Copy config files<br>  ansible.builtin.copy:<br>    src: &quot;./config&quot;<br>    dest: &quot;/home/{{ ansible_user }}/config&quot;<br>    owner: &quot;{{ ansible_user }}&quot;<br>    group: docker<br>    mode: &#39;0644&#39;<br>    remote_src: no<br><br>- name: Load environment variables<br>  include_vars:<br>    file: env.yaml<br>    name: env_vars<br><br>- name: Deploy docker images<br>  docker_container:<br>    name: &quot;{{ item.name }}&quot;<br>    image: &quot;{{ item.image }}&quot;<br>    ports: &quot;{{ item.ports | default([]) }}&quot;<br>    env: &quot;{{ env_vars.container_envs[item.name] | default({}) }}&quot;<br>    volumes: &quot;{{ item.volumes | default([]) }}&quot;<br>    command: &quot;{{ item.command | default(&#39;&#39;) }}&quot;<br>    labels: &quot;{{ item.labels | default({}) }}&quot;<br>    networks: &quot;{{ item.networks | default([{&#39;name&#39;: &#39;default_network&#39;}]) }}&quot;<br>    log_driver: &quot;json-file&quot;<br>    log_options:<br>      max-size: &quot;1m&quot;<br>      max-file: &quot;1&quot;<br>  loop: &quot;{{ containers }}&quot;</pre><p>By organizing tasks into roles, the playbook achieves a clear separation of responsibilities, making it both efficient and maintainable. The install_docker role focuses on preparing the system by installing Docker and ensuring it is properly configured and running. Meanwhile, the run_containers role handles the deployment of application containers using definitions specified in the containers.yml file. This approach provides a simple and modular structure, making the setup easier to troubleshoot, adapt to changes, and scale across multiple environments.</p><pre>---<br>- name: Install Docker and Run Containers<br>  hosts: all<br>  become: yes<br><br>  vars_files:<br>    - containers.yml<br><br>  roles:<br>    - role: install_docker<br>    - role: run_containers</pre><p><strong>Conclusion</strong></p><p>By combining Terraform for infrastructure provisioning and Ansible for configuration and application deployment, this workflow simplifies complex environments into a seamless, automated process. With a single `<em>terraform apply</em>` command, Terraform provisions the infrastructure, generates the Ansible inventory, and triggers playbooks to handle system setup and application deployments.</p><p>This approach ensures consistency, reduces errors, and enables effortless scaling across environments. It’s a reliable, efficient solution that aligns with modern DevOps practices, saving time and empowering teams to focus on delivering value.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8dd8a393fe5a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a Full-Stack Application with React, FastAPI, and PostgreSQL Using Docker Compose]]></title>
            <link>https://ukponoobott.medium.com/deploying-containerized-applications-387875a8a2d2?source=rss-7cfa343784a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/387875a8a2d2</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Ukpono Obott]]></dc:creator>
            <pubDate>Sat, 23 Nov 2024 20:16:19 GMT</pubDate>
            <atom:updated>2024-12-02T00:16:24.858Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Building and Deploying Scalable Web Applications with Ease</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uPjc5_cJuJlD9TbR1VYNyQ.jpeg" /><figcaption>Docker Compose</figcaption></figure><p>Over the last few years, there has been a buzz around cloud-native applications, containers, Docker, and Kubernetes, influencing how organizations and developers manage application deployments. From a high-level point of view, these technologies can seem complicated, but they are not when approached from a bottom-up perspective.</p><p>In this article, I will demonstrate how I dockerized and deployed a three-tier application using Docker Compose on a virtual machine. This method helps you understand the basics of containerization without the complexity of managing a Kubernetes cluster (not a k8s slander here — I promise). By the end, you’ll see how simple containerized application deployment can be with Docker Compose.</p><blockquote>This guide is tailored primarily for beginners to help them get comfortable working with containers and the cloud-native model. It serves as a stepping stone before taking a higher leap into container orchestration using Kubernetes or other advanced tools.</blockquote><p>The 3-tier setup consists of a React frontend, FastAPI backend, and a PostgreSQL database to create a complete end-to-end system using Docker Compose.</p><p>To achieve operational excellence, we have a logging/monitoring stack that includes cAdvisor, Promtail, Loki, Grafana, and Prometheus. This setup will allow us to monitor the deployed applications to gather insights on their performance for continuous improvements. Additionally, we will use Adminer for database administration.</p><p>The system will be deployed behind a reverse proxy — Traefik, exposing the services using path-based routing as shown below.</p><pre>/             -   Frontend                <br>/api          -   API                     <br>/dos          -   API Swagger Docs           <br>/db           -   Adminer UI              <br>/grafana      -   Grafana UI Dashboard<br>/prometheus   -   Prometheus Logs Query UI</pre><p><strong>Architecture</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GktlIMtrZjtkSY2iL1sAVw.png" /><figcaption>3 tier application with logging architecture</figcaption></figure><p><strong>Implementation Overview</strong></p><ul><li><strong>Dockerize the Frontend and Backend Applications</strong>: I wrote Dockerfiles for both the React frontend and Python backend to package the applications into Docker images. For the React frontend, I used a multi-stage build to optimize the image by including only the production-ready files, reducing image size and improving performance. The Python backend Dockerfile installs all required dependencies and sets up the environment for efficient execution. These Dockerfiles ensure the applications are portable and consistent across environments, simplifying deployment and management.</li></ul><p>ReactJS Dockerfile</p><pre>FROM node:18-alpine AS builder<br>WORKDIR /app<br>COPY package*.json ./<br>RUN npm install<br>COPY . .<br>RUN npm run build<br>FROM nginx:alpine AS production<br>COPY --from=builder /app/dist /usr/share/nginx/html<br>EXPOSE 80<br>CMD [&quot;nginx&quot;, &quot;-g&quot;, &quot;daemon off;&quot;]</pre><p>FastAPI Dockerfile</p><pre>FROM python:3.10-slim<br>WORKDIR /backend<br>RUN apt-get update &amp;&amp; apt-get install -y \<br>    curl \<br>    bash \<br>    libpq-dev \<br>    &amp;&amp; rm -rf /var/lib/apt/lists/*<br>RUN curl -sSL https://install.python-poetry.org | python3 - \<br>    &amp;&amp; export PATH=&quot;/root/.local/bin:$PATH&quot;<br>ENV PATH=&quot;/root/.local/bin:$PATH&quot;<br>ENV PYTHONUNBUFFERED=1 \<br>    POETRY_VIRTUALENVS_IN_PROJECT=true \<br>    PYTHONPATH=&quot;/backend/app&quot; \<br>    ENV_FILE_LOCATION=&quot;/app/.env&quot;<br>COPY . /backend<br>RUN poetry install --no-dev<br>EXPOSE 8000<br>CMD [&quot;poetry&quot;, &quot;run&quot;, &quot;uvicorn&quot;, &quot;app.main:app&quot;, &quot;--host&quot;, &quot;0.0.0.0&quot;, &quot;--port&quot;, &quot;8000&quot;]</pre><ul><li><strong>Docker Compose</strong>: I created two Docker Compose configuration files: one for the application stack and another for the logging stack, including add-ons like Adminer for database management. Using YAML files, I defined services like the React frontend, Python backend, and database for the application stack, while the logging stack includes tools like Prometheus and Grafana. Docker Compose simplifies running multi-container applications by orchestrating services, networks, and configurations in an easy-to-manage format.</li></ul><p>Side Note: I modified the run commands for the backend service, this was a blocker earlier as the image build failed because the build required the database connection.</p><pre>backend:<br>  build:<br>  ...<br>  command: &gt;<br>    /bin/sh -c &quot;<br>    chmod +x /backend/prestart.sh &amp;&amp;<br>    poetry run bash /backend/prestart.sh &amp;&amp;<br>    poetry run uvicorn app.main:app --reload --host 0.0.0.0<br>    &quot;<br></pre><ul><li><strong>Docker Network</strong>: Since all the services will be communicating, creating a shared network made sense for seamless communication between each service. I created a network and referenced it in all services.</li><li><strong>Serial Deployment Flow</strong>: In an actual sense, the database service is created first before the backend service followed by the frontend which depends on the former. In this case, I used the <em>depends_on</em> parameter to manage this flow across allow services specifying the dependencies as needed.</li></ul><pre>services:<br>  traefik:<br>  ...<br>postgres:<br>  image: postgres:14<br>  ...<br>backend:<br>  build:<br>  ...<br>  depends_on:<br>    - postgres<br>frontend:<br>  build:<br>  ...<br>  depends_on:<br>    - backend<br>adminer:<br>  image: adminer<br>  ...<br>  depends_on:<br>    - postgres</pre><ul><li><strong>Logging</strong>: We use <strong>cAdvisor</strong> to monitor container health and performance metrics. Application and container logs are collected with <strong>Promtail</strong> and sent to <strong>Loki</strong>, which aggregates the logs for better organization. These logs and metrics are then visualized in <strong>Grafana</strong> for easy analysis. Additionally, <strong>Prometheus</strong> handles metric collection and visualization, creating a comprehensive setup for monitoring and logging across the system. This approach ensures we have clear insights into container performance and application logs in one unified dashboard.</li></ul><pre>#Prometheus Targets Config<br>global:<br>  scrape_interval: 15s<br><br>scrape_configs:<br>  - job_name: &quot;cadvisor&quot;<br>    static_configs:<br>      - targets: <br>          - &quot;cadvisor:8080&quot;<br><br>  - job_name: &quot;prometheus&quot;<br>    static_configs:<br>      - targets: <br>          - &quot;prometheus:9090&quot;<br><br>  - job_name: &quot;loki&quot;<br>    static_configs:<br>      - targets: <br>          - &quot;loki:3100&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fAEjPE0pT6xGr7cMtbRbwQ.png" /><figcaption>Metrics</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6aBxz0kXZ6-Vs5Vi4JbMNA.png" /><figcaption>Logs</figcaption></figure><ul><li><strong>Reverse Proxy</strong>: I used Traefik as a reverse proxy to manage traffic routing based on URL paths. For instance, requests to /prometheus were routed to the Prometheus service, and /grafana directed users to the Grafana dashboard. This path-based routing keeps services organized and accessible without exposing them directly. Traefik&#39;s dynamic configuration with Docker labels allows quick updates or additions of services, streamlining traffic management for multiple services behind a single entry point. See an example configuration for the backend service below.</li></ul><pre>backend:<br>  build:<br>  labels:<br>    - &quot;traefik.enable=true&quot;<br>    # Router for API endpoints<br>    - &quot;traefik.http.routers.backend.rule=Host(`app.example.com`) &amp;&amp; (PathPrefix(`/api`) || PathPrefix(`/docs`))&quot;<br>    - &quot;traefik.http.routers.backend.entrypoints=websecure&quot;<br>    - &quot;traefik.http.routers.backend.tls.certresolver=myresolver&quot;<br>    - &quot;traefik.http.routers.backend.tls=true&quot;<br>    - &quot;traefik.http.services.backend.loadbalancer.server.port=8000&quot;</pre><blockquote>Key Takeaways for routing with Traefik</blockquote><ul><li>Let Traefik handle the path prefixes whenever possible</li><li>Configure the application’s base path/route settings appropriately</li><li>Use the strip prefix middleware when needed</li><li>Avoid double-prefix handling between Traefik and the application</li><li>Use an appropriate <a href="https://doc.traefik.io/traefik/middlewares/overview/">middleware</a> where applicable</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mcVbfZuNx8-UFYd0gySzoQ.png" /><figcaption>Traefik Dashboard</figcaption></figure><ul><li><strong>Custom Domain:</strong> I used Cloudflare to manage DNS records, adding an A record for the subdomain to the IP address of the Virtual Machine.</li><li><strong>Certificate Management</strong>: LetsEncrypt integration with Traefik makes it easy to manage certificate issuance and ensure HTTPS connections. The information below shows how to do so. Ensure that `/letsencrypt/acme.json` has <em>chmod 600</em> permissions on the host machine.</li></ul><pre>traefik:<br>    image: traefik:v2.10<br>    container_name: traefik<br>    command:<br>      - &quot;--providers.docker=true&quot;<br>      - &quot;--entrypoints.web.address=:80&quot;<br>      - &quot;--providers.docker.exposedbydefault=false&quot;<br>      - &quot;--entrypoints.websecure.address=:443&quot;<br>      - &quot;--certificatesresolvers.myresolver.acme.tlschallenge=true&quot;<br>      - &quot;--certificatesresolvers.myresolver.acme.email=xyz@mail.com&quot;<br>      - &quot;--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json&quot;<br>    volumes:<br>      - &quot;/var/run/docker.sock:/var/run/docker.sock:ro&quot;<br>      - &quot;./letsencrypt:/letsencrypt&quot;</pre><p>Improvements:</p><ul><li>One key improvement is to use an <strong>external database</strong> instead of running it as a container. Externalizing the database isolates the data layer from the application layer, improving efficiency and reliability. Unlike containerized databases, which are ephemeral and prone to data loss if the container fails, an external database ensures persistent storage and better scalability. This approach also simplifies backups and maintenance, making it more suitable for production environments.</li></ul><p>In conclusion, Docker Compose offers a straightforward and effective way to manage containerized applications, especially for those just starting out. By following this implementation, you’ve learned how to deploy a three-tier application on a virtual machine without the complexities of Kubernetes. This approach helps you understand the fundamentals of containerization and sets a solid foundation for more advanced topics in the future.</p><p>Remember, the key to mastering these technologies is to start simple and gradually build your knowledge. Docker Compose provides a perfect entry point, allowing you to focus on learning and experimenting without getting overwhelmed.</p><p>Link to the code <a href="https://github.com/ukponoobott/docker-compose-3-tier">repository</a></p><p>Merci!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=387875a8a2d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevOps: A Clear Picture (what, how, and why?)]]></title>
            <link>https://ukponoobott.medium.com/devops-a-clear-picture-what-how-and-why-6a433c7e2cb9?source=rss-7cfa343784a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a433c7e2cb9</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[devops-practice]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Ukpono Obott]]></dc:creator>
            <pubDate>Tue, 03 May 2022 21:01:52 GMT</pubDate>
            <atom:updated>2022-05-03T21:01:52.343Z</atom:updated>
            <content:encoded><![CDATA[<p>In recent times, DevOps has become a buzzword in the tech ecosystem mostly because of the huge role it plays in the product development lifecycle. But, What is DevOps?</p><blockquote>“DevOps is a set of <a href="https://www.atlassian.com/devops/what-is-devops/devops-best-practices">practices</a>, <a href="https://www.atlassian.com/devops/devops-tools/choose-devops-tools">tools</a>, and a <a href="https://www.atlassian.com/devops/what-is-devops/devops-culture">cultural philosophy</a> that automate and integrate the processes between software development and IT teams. It emphasizes team empowerment, cross-team communication and collaboration, and technology automation.”</blockquote><h4>Is DevOps the same as Agile?</h4><p>Not exactly, DevOps uses Agile methodologies, while Agile is a delivery approach that relates to lean manufacturing. The fundamentals of agile centre around creating a working prototype or building amidst the realities of changing needs and requirements. Bridging the gap between the development team and the end-user, adaptability is a core attribute of agile, giving precedence to the needs of users and stakeholders over rigid plans.</p><h4>More on DevOps…</h4><p>DevOps is a software development practice that brings people, processes, and technology together to deliver continuous value. The approach is divided into planning and tracking, development, build and test, delivery, and monitoring and operations. DevOps is unique in that development, IT operations, quality engineering, and security teams work together to create efficiency across all tasks involved in launching a new product, release, or update.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*NDYvnAS88vLaQyouLQYTiA.png" /></figure><h4>Product Development Lifecycle</h4><ul><li>Plan: DevOps teams should adopt agile practices to improve speed and quality. Agile is an iterative approach to project management and software development that helps teams break work into smaller pieces to deliver incremental value.</li><li>Code: After planning with the product owner, stakeholders and developers. The project requirements need to be converted to code. You may or may not be involved a whole lot with this one of the places you may get involved with it, is whenever they’re writing code you can help them better understand the infrastructure so if they know what services are available and how to best talk with those services so they’re going to do that and then once they’re done they’ll merge that code into the repository</li><li>Build: Git is a free and open-source version control system. It offers excellent support for branching, merging, and rewriting repository history, which has led to many innovative and powerful workflows and tools for the development build process.</li><li>Test: At this stage, we have our requirements and we have our application being developed, the QA can test for bugs, and check new features to meet the requirements. The ability to automate this phase allows engineers to focus on something else within the stack to ensure you are moving faster and developing more functionality vs testing bugs.</li><li>Release: CI/CD allows teams to release quality products frequently and predictably, from source code repository to production with automated workflows. Teams can merge code changes frequently, deploy feature flags, and incorporate end-to-end testing</li><li>Deploy: After the product is built and tested against the requirements of our end user and we now need to go ahead and deploy this application into production for our end users to consume. This is the stage where the code is deployed to the production servers, now this is where things get extremely interesting and it is where the rest of our 86 days dives deeper into these areas. Because different applications require different possibly hardware or configurations. This is where <strong>Application Configuration Management</strong> and <strong>Infrastructure as Code</strong> could play a key part in your DevOps lifecycle. It might be that your application is <strong>Containerised</strong> but also available to run on a virtual machine. This then also leads us onto platforms like <strong>Kubernetes</strong> which would be orchestrating those containers and making sure you have the desired state available to your end-users.</li><li>Operate: Manage the end-to-end delivery of IT services to customers. This includes the practices involved in the design, implementation, configuration, deployment, and maintenance of all IT infrastructure that supports an organization’s services.</li><li>Monitor: All of the above parts lead to the final step because you need to have monitoring, especially around operational issues auto-scaling troubleshooting like you don’t know there’s a problem if you don’t have monitoring in place to tell you that there’s a problem so some of the things you might build monitoring for are memory utilization CPU utilization disk space, api endpoint, response time, how quickly that endpoint is responding and a big part of that as well is logs. Logs give developers the ability to see what is happening without having to access production systems.</li></ul><h4>Why DevOps?</h4><p>The main focus and aim of DevOps is to shorten the development lifecycle while delivering features, fixes and functionality frequently in close alignment with business objectives.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a433c7e2cb9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Infrastructure as Code: Is it so hard?]]></title>
            <link>https://ukponoobott.medium.com/infrastructure-as-code-is-it-so-hard-ff39d3add3c7?source=rss-7cfa343784a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff39d3add3c7</guid>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Ukpono Obott]]></dc:creator>
            <pubDate>Wed, 05 Jan 2022 21:42:13 GMT</pubDate>
            <atom:updated>2022-01-06T04:13:58.379Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn how to manage infrastructure using a declarative approach, benefits, and how to get started.</h4><p>Traditionally, managing infrastructure is difficult especially when there is an increasing demand to provision and/or de-provision resources at regular intervals. Keeping track of this can be overwhelming, risky, and time-consuming which often leads to reduced efficiency due to errors that can affect uptime and disrupt service delivery.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*gI7nYpjtjhiGChbOwuxZVA.png" /><figcaption>Infrastructure as Code</figcaption></figure><p>As you may already know, the major advantage of cloud solutions is availability and scalability which depends solely on the ability to modify resources quickly without having to disrupt the architecture. Infrastructure as code(IaC) concept evolved to solve the problem of environment drift in the release pipeline. Without IaC, teams must maintain the settings of individual deployment environments which causes inconsistency among environments and leads to issues during deployments</p><h4>1. Overview</h4><p>Infrastructure as Code (IaC) is the management of infrastructure (networks, virtual machines, load balancers, and connection topology) in a descriptive model, using the same versioning as the DevOps team uses for source code. Like the principle that the same source code generates the same binary, an IaC model generates the same environment every time it is applied.</p><h4>2. Benefits of Infrastructure as Code</h4><ol><li>Speed and simplicity: You can do this quickly and easily for development, staging, and production environments, which can make your software development process much more efficient</li><li>Configuration consistency: Human error will always rear its ugly head, which may leave you with subtle differences in configurations that may be difficult to debug. IaC completely standardizes the setup of infrastructure so there is a reduced possibility of any errors or deviations which will decrease the chances of any incompatibility issues with your infrastructure and help your applications run more smoothly.</li><li>Minimization of risk: Imagine having a team where only one engineer knows the full details of your infrastructure setup. What happens if the engineer leaves your team or is in a state where he/she cannot be reached. What would you do then? There’d be a bunch of questions, some fear and panic, and many attempts at reverse engineering.</li><li>Increased efficiency in software development: Developer productivity drastically increases with the use of IaC. Cloud architectures can be easily deployed in multiple stages to make the software development life cycle much more efficient.</li><li>Cost savings: IaC script can automatically spin down environments when they’re not in use, which will further save on cloud computing costs.</li></ol><h4>3. Getting started with IaC using Terraform</h4><p><a href="https://www.terraform.io/">Terraform</a> is the most popular infrastructure provisioning tool created by Hashicorp. It allows you to describe your infrastructure as code, creates “execution plans” that outline exactly what will happen when you run your code, builds a graph of your resources, and automates changes with minimal human interaction.</p><p>Terraform uses its own domain-specific language (DSL) called Hashicorp Configuration Language (HCL). HCL is JSON-compatible and is used to create these configuration files that describe the infrastructure resources to be deployed.</p><p>There are other tools like AWS CloudFormation, Azure Resource Manager, and Google Cloud Deployment Manager.</p><h4>4. How to Install Terraform</h4><h4>4.1 Windows:</h4><p>&gt;&gt;&gt; choco install terraform</p><h4>4.2 Linux:</h4><ol><li>&gt;&gt;&gt; curl -fsSL <a href="https://apt.releases.hashicorp.com/gpg">https://apt.releases.hashicorp.com/gpg</a> | sudo apt-key add -.</li><li>&gt;&gt;&gt; sudo apt-add-repository “deb [arch=amd64] <a href="https://apt.releases.hashicorp.com/">https://apt.releases.hashicorp.com</a> $(lsb_release -cs) main”</li><li>&gt;&gt;&gt; sudo apt-get update &amp;&amp; sudo apt-get install terraform</li></ol><h4>4.3 MacOS:</h4><ol><li>&gt;&gt;&gt; brew tap hashicorp/tap</li><li>&gt;&gt;&gt; brew install hashicorp/tap/terraform</li><li>&gt;&gt;&gt; brew update</li><li>&gt;&gt;&gt; brew upgrade hashicorp/tap/terraform</li></ol><h4>4.4 Verify the installation</h4><p>&gt;&gt;&gt; terraform -help or terraform -help plan</p><h4>5. Sample Terraform Configuration</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*O98RKXMB_1EL_r6UDiClTA.png" /><figcaption>Sample Terraform Config</figcaption></figure><p><strong>5.1 Terraform Block: </strong>The terraform {} block contains Terraform settings, including the required providers Terraform will use to provision your infrastructure. For each provider, the source attribute defines an optional hostname, a namespace, and the provider type. Terraform installs providers from the <a href="https://registry.terraform.io/">Terraform Registry</a> by default. In this example configuration, the azurerm provider’s source is defined as hashicorp/azurerm, which is shorthand for registry.terraform.io/hashicorp/azurerm.</p><p><strong>5.2 Providers: </strong>The provider block configures the specified provider, in this case, azurerm. A provider is a plugin that Terraform uses to create and manage your resources. You can define multiple provider blocks in a Terraform configuration to manage resources from different providers.</p><p><strong>5.3 Resource: </strong>Resource blocks define components of your infrastructure. A resource might be a physical component such as a server, or it can be a logical resource such as a Heroku application. Resource blocks have two strings before the block: the resource type and the resource name. In this example, the resource type is azurerm_resource_group and the name is rg. The prefix of the type maps to the name of the provider. Resource blocks contain arguments which you use to configure the resource. The <a href="https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs">Azure provider documentation</a> provides a list of supported resources and their configuration options, including <a href="https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group">azurerm_resource_group</a> and its supported arguments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aVjFjnESnhQe-bnE_Ti0cA.png" /><figcaption>Terraform Cycle</figcaption></figure><h4><strong>6. Initialize your Terraform configuration</strong></h4><p>Initialize your directory in your terminal. The terraform commands will work with any operating system.</p><p>&gt;&gt;&gt; terraform init</p><p><strong>6.2 Format and validate the configuration</strong></p><p>I recommend using consistent formatting in all of your configuration files. The<em> terraform fmt</em> command automatically updates configurations in the current directory for readability and consistency.</p><p>&gt;&gt;&gt; terraform fmt</p><p>You can also make sure your configuration is syntactically valid and internally consistent by using the terraform validate command.</p><p>&gt;&gt;&gt; terraform validate</p><p><strong>6.3 Plan your Terraform Configuration</strong></p><p>To be certain of your configuration outcome, run a <em>terraform plan </em>to create a deployment plan, this interacts with your state and now shows the changes the new configuration will make to your infrastructure.</p><p>&gt;&gt;&gt; terraform plan</p><p>or</p><p>&gt;&gt;&gt; terraform plan --out main.tfplan # optionally specify a filename to save your plan details</p><p><strong>6.4 Apply your Terraform Configuration</strong></p><p>Run the terraform apply the command to apply your configuration.</p><p>&gt;&gt;&gt; terraform apply</p><p>or</p><p>&gt;&gt;&gt; terraform apply “main.tfplan” #specify a plan file to apply in case you have multiple plans.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*ltROL_SGHXiMLJGqNP7qNA.png" /><figcaption>Terraform Apply Command</figcaption></figure><p><strong>6.5 Destroy</strong></p><p>This terminates resources managed by your Terraform project. This command is the inverse of <em>terraform apply </em>in that it terminates all the resources specified in your Terraform state. It does <em>not</em> destroy resources running elsewhere that are not managed by the current Terraform project.</p><p>Destroy the resources you created.</p><p>&gt;&gt;&gt; terraform destroy</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*GxcLIvKaxoISCZLeyYS9ZQ.png" /><figcaption>Terraform Destroy Command</figcaption></figure><p>The - prefix in the output indicates that the instance will be destroyed. As with apply, Terraform shows its execution plan and waits for approval before making any changes.</p><p>For more detail on the concepts used in this tutorial:</p><ul><li>Read about the Terraform configuration language in the <a href="https://www.terraform.io/docs/language/index.html">Terraform documentation</a>.</li><li>Learn more about Terraform <a href="https://www.terraform.io/docs/providers/index.html">providers</a>.</li></ul><h4>7.0 Next Steps:</h4><p>Learn more about Infrastructure as Code using the links below to help you get started and create a simple deployment using IaC <a href="https://learn.hashicorp.com/tutorials/">https://learn.hashicorp.com/tutorials/</a></p><p><a href="https://docs.microsoft.com/en-us/devops/deliver/what-is-infrastructure-as-code">https://docs.microsoft.com/en-us/devops/deliver/what-is-infrastructure-as-code</a></p><h4>8.0 Conclusion</h4><p>Infrastructure as Code can simplify and accelerate your infrastructure provisioning process, help you avoid mistakes and comply with policies, keep your environments consistent, and save your company a lot of time and money.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff39d3add3c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure Virtual Machines: Running a compute infrastructure in the cloud]]></title>
            <link>https://ukponoobott.medium.com/azure-virtual-machines-running-a-compute-infrastructure-in-the-cloud-2d85f4ee7aa7?source=rss-7cfa343784a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d85f4ee7aa7</guid>
            <category><![CDATA[microsoft-azure]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[cloud-infrastructure]]></category>
            <category><![CDATA[virtual-machine]]></category>
            <dc:creator><![CDATA[Ukpono Obott]]></dc:creator>
            <pubDate>Thu, 30 Dec 2021 20:38:07 GMT</pubDate>
            <atom:updated>2021-12-30T20:38:07.807Z</atom:updated>
            <content:encoded><![CDATA[<p>A virtual machine is an on-demand, scalable computer resource that is generally used to host applications when the customer requires more control over the computing environment using the Infrastructure as a Service model. This compute resource is available in Azure, it is quick and easy to set up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*o47uIk4glC7nQ3nNEyGjFQ.png" /><figcaption>Microsoft Azure VM</figcaption></figure><p>An Azure VM gives you the flexibility of virtualization without having to buy and maintain the physical hardware that runs it. However, you still need to maintain the VM by performing tasks, such as configuring, patching, and installing the software that runs on it.</p><p>Azure virtual machines can be used in various ways. Some examples are:</p><ul><li>Development and test — Azure VMs offer a quick and easy way to create a computer with specific configurations required to code and test an application.</li><li>Applications in the cloud — Because demand for your application can fluctuate, it might make economic sense to run it on a VM in Azure. You pay for extra VMs when you need them and shut them down when you don’t.</li><li>Extended datacenter — Virtual machines in an Azure virtual network can easily be connected to your organization’s network.</li></ul><p>The number of VMs that your application uses can scale up and out to whatever is required to meet your needs.</p><p>Azure offers different sizes of VM’s tailored to meet your workload needs, follow this link to find out more about VM sizes in Azure <a href="https://docs.microsoft.com/en-us/azure/virtual-machines/sizes">https://docs.microsoft.com/en-us/azure/virtual-machines/sizes</a></p><ol><li>How to Create a Linux VM using Azure Portal</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3SRz4CxstjWAN3dppSdpJA.png" /><figcaption>Azure Portal</figcaption></figure><p>Step 1: Open the Azure portal and get the page shown on the image above, you can search for virtual machines from the search bar or click the CREATE RESOURCE panel and select Virtual Machines and in some cases, the Virtual machine icon may be already present for you to click on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qPIwOgdCNgs7MFuD_Vn3mw.png" /></figure><p>Step 2: Click on Create button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*oO8sjeNDkluZ1GnFbe4PrA.png" /></figure><p>Step 3: Select your Subscription, Resource group, type a VM name, select Location, Security and Image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*-mnnfC7T5lOLbriA3GQkNQ.png" /></figure><p>Step 4: Select VM size, set preferred authentication type, and optionally select inbound port rules(if necessary). Click on NEXT</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*pZQ0CFUwQStFjS9fTMKRgA.png" /></figure><p>Step 5: Select Disk Size, Disk Type, and other properties, Click on NEXT</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*VSnezQCMUdQclwXctYOzZg.png" /></figure><p>Step 7: Select a Virtual Network or Create New, select and manage subnet, setup NIC, configure NSG inbound ports. Click NEXT</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*2qUBYq6IBvY6ZmGTQNINlA.png" /></figure><p>Step 8: Make necessary management configs and click ADVANCED</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*VcbA30dnCz3yfZdl9jVXCg.png" /></figure><p>Step 9: Edit Advanced configuration (if applicable) and click NEXT</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*LS8zK0nGlCZtGQ7rDuXoTg.png" /></figure><p>Step 10: Add tags to VM so it can help while querying. Tags like Owner, Creation date, and Env can help group certain resources when needed. Click on REVIEW and CREATE</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*9jw1bnsUDCZiwWmoPq8FNQ.png" /></figure><p>Step 11: Once Validation is passed, click on Create and wait for your VM to be created.</p><p>You can now log in to you VM using Putty for Linux VMs or Remote Desktop Connection for Windows VMs using the Public IP address, you may want to modify the NSG rules to allow inbound traffic from the internet.</p><p>For more information on Azure Virtual Machines, take a look at the official guide from Microsoft here <a href="https://docs.microsoft.com/en-us/azure/virtual-machines/linux/overview">https://docs.microsoft.com/en-us/azure/virtual-machines/</a></p><p>Happy learning…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d85f4ee7aa7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hello Azure: An Introduction to Cloud Computing]]></title>
            <link>https://ukponoobott.medium.com/hello-azure-an-introduction-to-cloud-computing-f2d211171435?source=rss-7cfa343784a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2d211171435</guid>
            <category><![CDATA[microsoft-azure]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Ukpono Obott]]></dc:creator>
            <pubDate>Wed, 29 Dec 2021 00:31:48 GMT</pubDate>
            <atom:updated>2023-11-05T10:25:31.361Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometime in January 2020, just before the covid19 pandemic I was inspired by some social media posts to learn about Cloud Computing. I was not so sure of how beneficial it is to my career as a software engineer, I needed to understand its relevance and application to I did a quick Google search and got a bit comfortable with it after hours of research.</p><p>I took an Introductory cloud course on <a href="http://www.simplilearn.com/">Simplilearn </a>and in a matter of weeks, I completed the course and I sought to get better. I was able to clearly explain Cloud computing and I had a nice understanding of core concepts a beginner should know.</p><h3><strong>Here is a short summary of what I learned</strong></h3><h4><strong>1. What is Cloud Computing?</strong></h4><p><em>Cloud computing is the delivery of computing services — including servers, storage, databases, networking, software, analytics, and intelligence — over the Internet (“the cloud”) to offer faster innovation, flexible resources, and economies of scale. You typically pay only for cloud services you use, helping you lower your operating costs, run your infrastructure more efficiently, and scale as your business needs change.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*zHMo_r58os9Ds1eo4j2P4A.png" /><figcaption>Cloud Computing</figcaption></figure><h4>2. Benefits of Cloud</h4><p>Cloud offers the following benefits as they are the main driving force for the adoption of cloud technologies by businesses seeking to scale faster;</p><ol><li>Optimized cost</li><li>Scalability</li><li>Speed</li><li>Performance</li><li>Security</li><li>Reliability</li></ol><h4><strong>3. Types of Cloud</strong></h4><p>Cloud Services come in different forms giving you the freedom to adopt the best model that suits your business needs;</p><ol><li>Public Cloud: These are owned by 3rd party cloud service providers which own and deliver their resources over the internet e.g. Microsoft Azure, AWS, Google Cloud Platform, etc.</li><li>Private Cloud: A private cloud refers to computing resources exclusively owned and used by an organization either physically as an on-site datacenter and the infrastructure is maintained over a private network.</li><li>Hybrid Cloud: This is a combination of both public and private clouds using a technology that allows data to be shared between them. This can be done to promote flexibility, security, and compliance.</li></ol><h4>4. Types of Cloud Services</h4><ol><li>Infrastructure as a Service (IaaS): This is a cloud delivery model that allows you to rent IT infrastructure in the form of virtual machines, storage, networks, operating systems from a cloud provider on an operational payment basis (pay as you go basis).</li><li>Platform as a Service (PaaS): This model provides an on-demand environment for developing, testing I’m managing software applications. It helped developers to quickly create and deploy applications without worrying about the underlying infrastructure needed and it cuts down development time.</li><li>Software as a Service (SaaS): This is a model of delivering on-demand software applications over the Internet. Here the cloud provider hosts and manage the software application, infrastructure, maintenance, and upgrades, you just need to access the product over the internet.</li></ol><p>Source: <a href="https://azure.microsoft.com/en-us/overview/what-is-cloud-computing/#benefits">https://azure.microsoft.com/en-us/overview/what-is-cloud-computing/#benefits</a></p><p>After research and advice from my mentor, I opted for the Azure as the Cloud Platform I would learn and started studying for the Azure Fundamentals Certification. I combined this with Linux skills using the free guide I found on GitHub <a href="https://www.github.com/madebygps">https://www.github.com/madebygps</a> — this contains free resources and guides for anyone seeking to start a career in cloud computing.</p><p>While studying for the Azure Fundamentals Certification, I was able to scale through the initial modules because I had prior knowledge of the basics. I soon got introduced to the Azure platform and clear examples of the cloud delivery models I learned about earlier, some of which are;</p><ol><li>Virtual Machines</li><li>SQL server</li><li>App service</li><li>Logics apps</li><li>Azure functions</li><li>Etc</li></ol><p>The first milestone was passing my Azure fundamentals certification exams, this opened my eyes to endless possibilities in the cloud space, and yeah I am still pushing to do better.</p><p><a href="https://www.credly.com/earner/earned/badge/aeaf83b0-fb99-47dd-8a9b-6c852d671ebc">https://www.credly.com/earner/earned/badge/aeaf83b0-fb99-47dd-8a9b-6c852d671ebc</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2d211171435" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>