<?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 Divine Anthony on Medium]]></title>
        <description><![CDATA[Stories by Divine Anthony on Medium]]></description>
        <link>https://medium.com/@divineanthony?source=rss-e8c3350f2493------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7StiuI5UiV2tLpEQ6Mru_g.jpeg</url>
            <title>Stories by Divine Anthony on Medium</title>
            <link>https://medium.com/@divineanthony?source=rss-e8c3350f2493------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:03:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@divineanthony/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 Web Application to GKE (Autopilot) using Docker, Helm Charts, ArgoCD, and GitHub…]]></title>
            <link>https://medium.com/@divineanthony/deploying-a-web-application-to-gke-autopilot-using-docker-helm-charts-argocd-and-github-b5cd2d10b31e?source=rss-e8c3350f2493------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5cd2d10b31e</guid>
            <dc:creator><![CDATA[Divine Anthony]]></dc:creator>
            <pubDate>Wed, 20 Mar 2024 21:59:49 GMT</pubDate>
            <atom:updated>2024-03-20T21:59:49.951Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deploying a Web Application to GKE (Autopilot) using Docker, Helm Charts, ArgoCD, and GitHub Actions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VarLEKR1Mbu8SGN7" /></figure><h4><strong>Introduction</strong></h4><p>Recently, I undertook a project to deploy a web application to Google Kubernetes Engine (GKE) using GitHub Actions, Helm charts, and ArgoCD. In this blog post, I’ll delve into the technical aspects of this deployment journey, focusing on the methodologies and tools employed.</p><p><strong>Prerequisites</strong></p><ul><li>Create a GKE autopilot cluster on google cloud</li><li>Install Helm and Argocd in the cluster</li><li>Dockerise your application and test locally</li></ul><p><strong>OVERVIEW</strong></p><h4>Dockerizing the Application:</h4><ul><li>Wrote a Dockerfile for the application, to containerise it, ensured the Dockerfile copies necessary application files, installs dependencies, and exposes the required ports.</li></ul><p><em>Note: it is advisable to test your docker file locally, you can do that by running the below docker command . — mapping port 5000 on your host to port 5000 inside the container</em></p><pre>docker build -t &lt;your-image-name&gt;. <br>docker run -d -p 5000:5000 &lt;your-image-name&gt;</pre><h4>Continuous Integration (CI/CD) with GitHub Actions and Argocd:</h4><p>GitHub Actions played a pretty good role in automating the CI/CD pipeline. Implemented a github workflow to manage the build process of the Docker image. The automated pipeline included 2 jobs, <strong>build and deploy</strong>. Each build was tagged with a unique identifier for version control, (in this case it was the github actions Run number) and then pushed the tagged image to the public docker registry.</p><p>The Deploy part CD job of my workflow logs into my Argocd-manifest repository using the credentials supplied and then runs a find and replace script on the image tag in my manifests file, Argocd then picks up this latest change and deploys the new image to my gke cluster. systematic process ensured a smooth transition to the latest application version with zero downtime.</p><h4>Configuring Argocd:</h4><p>I installed Argocd in my cluster, set it up using an ApplicationSet, which is a higher-level abstraction that allows users to define a set of applications based on templated parameters, enabling the bulk management of multiple similar applications. This is particularly useful for managing multiple environments or clusters with similar configurations. I also configured a Project , it serves as an organisational unit to group and manage multiple applications, Together, these components streamline the management of complex deployments by allowing users to define and organize their applications efficiently while maintaining control and security measures across their infrastructure.</p><p><em>Note: (the appset &amp; proj file was included in the argocd repo. but first, install argocd</em></p><pre>kubectl apply -k https://github.com/argoproj/argo-cd/manifests/crds\?ref\=stable</pre><pre>kubectl apply -f appsetfile.yaml -n argocd<br>kubectl apply -f projfile.yaml -n argocd</pre><p>In the appset I configured Argocd to sync with the application repository and the Kubernetes cluster. Argocd basically watches my source code repository for changes and my K8s cluster to make sure its on the same deployment revision.</p><h4>Helm Charts:</h4><p>Helm charts made defining Kubernetes resources easier. For deployment, ingress, services, and horizontal pod autoscaler, I made reusable templates. These charts provided flexibility for deployment across various environments. Subsequently, the Helm charts were applied to the GKE cluster, optimising the deployment process.</p><p>Setting up Helm chart on Github was a bit tricky however I included a step by step process in the <em>readme</em> file of the helm repository.</p><p><strong>If you’d like to recreate this project;</strong> I included the Github repositories used:</p><ol><li>Application Source Code Repository <a href="https://github.com/daviinaa/main-src.git">https://github.com/daviinaa/main-src.git</a></li><li>ArgoCD Manifests Repository <a href="https://github.com/daviinaa/argocd-manifests.git">https://github.com/daviinaa/argocd-manifests.git</a></li><li>Helm Chart Repository <a href="https://github.com/daviinaa/helm-chart">https://github.com/daviinaa/helm-chart</a></li></ol><p>If you were able to recreate the project, you should see your application running in Argocd</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Kq2GwH3R6bjkvJc8" /><figcaption>deployed application running in Argocd UI</figcaption></figure><p><strong>Conclusion</strong>:</p><p>This is a high-level overview of the project, I have shared the Github repositories which really contains the juicy details of it all, and honestly if you have some knowledge of Kubernetes and CICD this should not be a difficult task to recreate.<br>However, by leveraging these tools and methodologies, I achieved a refined deployment pipeline that prioritised efficiency and reliability. Moving forward, I remain committed to refining and optimising deployment processes to meet evolving demands in the world of DevOps.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5cd2d10b31e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Tips for Beginners inTerraform]]></title>
            <link>https://medium.com/@divineanthony/5-tips-for-beginners-interraform-cddc5bee3394?source=rss-e8c3350f2493------2</link>
            <guid isPermaLink="false">https://medium.com/p/cddc5bee3394</guid>
            <dc:creator><![CDATA[Divine Anthony]]></dc:creator>
            <pubDate>Thu, 08 Feb 2024 09:26:21 GMT</pubDate>
            <atom:updated>2024-02-08T09:26:21.918Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XrXy7ya8mOAqyQhSPjLsCw.png" /></figure><p><strong>Overview</strong><br>Introducing Terraform, a powerful Infrastructure as Code (IaC) tool that lets you declaratively define and provision infrastructure. This guide is intended for those who are new to Terraform and are thinking about building their own modules. Let us first define Terraform before delving into the technical details.</p><p><strong>Terraform: What is it?</strong><br><a href="https://www.terraform.io/">Terraform</a> is an open-source IaC tool developed by HashiCorp. With it, users are able to utilise a declarative configuration language to define and provision infrastructure. Infrastructure resource creation, modification, and deletion can be efficiently and consistently managed with Terraform. That being said, lets run through 5 tips that would help kickstart your skills in terraform.</p><h4>Tip 1: Understand the “Click-Click” Setup</h4><p>Before you start creating Terraform modules for a specific service, take some time to understand the manual setup of that service using the cloud provider’s portal. This click-click setup will give you insights into the configurations and dependencies of the service, especially if it’s unfamiliar to you.</p><p>For example; If you are working with an AWS S3 bucket, go through the steps of creating one manually in the AWS Management Console. This will help you understand the necessary configurations like bucket name, access permissions, and versioning.</p><h4>Tip 2: Avoid Hard Coding — Leverage Variables</h4><p>Hard coding values in your main.tf Terraform code can lead to inflexible and error-prone configurations. Embrace the use of variables to make your code more reusable and maintainable.</p><p>For example; for the provisioning of your S3 bucket on aws, you should have a variable.tf file that properly outlines the data type, description and the default value of each variable. Heres a code snippet below.</p><pre>variable &quot;region&quot; {<br>  description = &quot;The AWS region&quot;<br>  type        = string<br>  default     = &quot;us-west-2&quot;<br>}<br><br>variable &quot;bucket_name&quot; {<br>  description = &quot;The name of the S3 bucket&quot;<br>  type        = string<br>  default     = &quot;my_s3_bucket&quot;<br>}</pre><p>And then, in your main.tf you can call those variables;</p><pre>resource &quot;aws_s3_bucket&quot; &quot;my_bucket&quot; {<br>  bucket = var.bucket_name<br>  region = var.region<br>}</pre><h4>Tip 3: Modularise Your Code</h4><p>Break down your Terraform code into reusable modules. Think of a module as a folder of reusable and self-contained unit of Terraform configuration. Modules are helpful to create consistent and repeatable deployments.</p><p>we have a example module structure for an S3 bucket:</p><pre>modules/<br>  └── s3/<br>      ├── main.tf<br>      ├── variables.tf<br>      └── outputs.tf</pre><p>use the module in your main configuration;</p><pre>module &quot;my_s3_bucket&quot; {<br>  source      = &quot;./modules/s3&quot;<br>  bucket_name = &quot;my-s3-bucket&quot;<br>  region      = &quot;us-east-1&quot;<br>}</pre><h4>Tip 4. Test Your Modules</h4><p>Always test your Terraform modules before deploying them. Use Terraform commands like terraform init, terraform plan, before terraform apply to ensure your code behaves as expected.</p><h4>Tip 5: Document Your Code</h4><p>Good documentation is crucial for understanding, maintaining, and sharing your Terraform code. Always ask your self, if someone reads my terraform code, would it be easy to understand? It is helpful to explain the purpose, inputs, and outputs of your modules.</p><p>you can have something like this in your readme file</p><pre># AWS EC2 Module<br><br>This module creates an EC2 instance with configurable options.<br><br>## Inputs<br><br>- `instance_type`: The type of EC2 instance (e.g., t2.micro, m5.large).<br>- `ami`: The ID of the Amazon Machine Image (AMI) for the instance.<br><br>## Outputs<br><br>- `public_ip`: The public IP address of the created EC2 instance.<br>- `private_ip`: The private IP address of the created EC2 instance.</pre><h4>Conclusion</h4><p>Congratulations on taking the first steps into the world of Terraform! By following these five essential tips, you’ll be on your way to creating modular, reusable, and well-documented infrastructure code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cddc5bee3394" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installing Datadog Agent on Multiple EC2 Servers Using Ansible.]]></title>
            <link>https://medium.com/@divineanthony/installing-datadog-agent-on-multiple-ec2-servers-using-ansible-c056ef53aa5e?source=rss-e8c3350f2493------2</link>
            <guid isPermaLink="false">https://medium.com/p/c056ef53aa5e</guid>
            <dc:creator><![CDATA[Divine Anthony]]></dc:creator>
            <pubDate>Sat, 04 Mar 2023 02:01:13 GMT</pubDate>
            <atom:updated>2023-03-04T02:01:13.831Z</atom:updated>
            <content:encoded><![CDATA[<h3>Installing Datadog Agent on Multiple EC2 Servers Using Ansible</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*n72heyK9oK0TWeEQ140k3w.png" /></figure><p><strong>Ansible</strong> is an open-source automation tool that allows you to manage and configure servers, applications, and systems. its a great tool to automate repetitive tasks, reduce errors, and speed up deployment. It uses a YAML to define the tasks and configurations needed to manage your infrastructure.</p><p><strong>Datadog</strong>, on the other hand, is a cloud monitoring platform that allows you to monitor your infrastructure, applications, and logs in real-time. Datadog provides a unified view of your systems and applications, making it easy to identify and troubleshoot issues.</p><p><em>Side Note: If you’re about to attempt this, I am going to assume you are familiar with Ansible and have carried out configurations with it prior to this.</em></p><p><em>For this Tutorial we are going to be writing the Datadog main.yaml from scratch, working with an Apache server.</em></p><p><strong>Now let’s get to it.</strong></p><h4>Prerequisites</h4><ul><li>An EC2 instance running a Linux distribution (e.g. Amazon Linux 2, Ubuntu 20.04 LTS)</li><li>Ansible installed on your local machine</li><li>A Datadog account (sign up at <a href="https://www.datadoghq.com/">https://www.datadoghq.com/</a>)</li></ul><h4>Step 1: Create your Datadog Ansible role</h4><p>Create a working directory where you would create your ansible role, playbook and inventory file.</p><p>Start by running this Ansible command in your working directory. which allows you create a role, in this case we are creating a role for Datadog (the role can be named anything you choose).</p><pre>ansible-galaxy init datadog</pre><p>A role called datadog should be created, navigate to the <strong>datadog/tasks/main.yaml</strong> file and app the following lines of command to it</p><pre><br>- name: Download and run Datadog Agent installation script<br>  get_url:<br>    url: &quot;https://s3.amazonaws.com/dd-agent/scripts/install_script_agent7.sh&quot;<br>    dest: &quot;/tmp/install_script_agent7.sh&quot;<br>    mode: &#39;0755&#39;<br>- name: Install Datadog Agent<br>  shell: &quot;DD_API_KEY={{ datadog_api_key }} DD_SITE={{ datadog_site }} bash /tmp/install_script_agent7.sh&quot;<br><br><br>- name: Install Datadog Agent<br>  apt:<br>    name: datadog-agent<br>    state: present<br><br>- name: Edit Datadog Agent configuration file<br>  lineinfile:<br>    path: /etc/datadog-agent/datadog.yaml<br>    regexp: &#39;^# log_enabled: false&#39;<br>    line: &#39;log_enabled: true&#39;<br>    backup: yes<br><br>- name: Restart Datadog Agent<br>  systemd:<br>    name: datadog-agent<br>    state: restarted<br><br>- name: Rename Datadog Apache configuration file<br>  command: sudo mv /etc/datadog-agent/conf.d/apache.d/conf.yaml.example /etc/datadog-agent/conf.d/apache.d/conf.yaml<br><br>- name: Edit Datadog Apache configuration file<br>  blockinfile:<br>    path: /etc/datadog-agent/conf.d/apache.d/conf.yaml<br>    block: |<br>      logs:<br>        # - type : (mandatory) type of log input source (tcp / udp / file)<br>        #   port / path : (mandatory) Set port if type is tcp or udp. Set path if type is file<br>        #   service : (mandatory) name of the service owning the log<br>        #   source : (mandatory) attribute that defines which integration is sending the log<br>        #   sourcecategory : (optional) Multiple value attribute. Can be used to refine the source attribute<br>        #   tags: (optional) add tags to each log collected<br>        - type: file<br>          path: /var/log/apache2/access.log<br>          source: apache<br>          sourcecategory: http_web_access<br>          service: apache-access<br>        - type: file<br>          path: /var/log/apache2/error.log<br>          source: apache<br>          sourcecategory: http_web_access<br>          service: apache-error<br><br>- name: Restart Datadog Agent<br>  systemd:<br>    name: datadog-agent<br>    state: restarted<br><br>- name: Restart Apache2<br>  systemd:<br>    name: apache2<br>    state: restarted</pre><p><strong>This above tasks does the following </strong>: The first task downloads the Datadog Agent installation script from Amazon S3 and saves it to the “/tmp/” directory on your EC2 instance. The second task executes the installation script and installs the Datadog Agent. The third task uses the Ansible “apt” module to install the Datadog Agent on Debian/Ubuntu-based systems. This step is optional and only necessary if your EC2 instance is running a Debian/Ubuntu-based operating system. The fourth task edits the Datadog Agent configuration file to enable logging. The fifth task restarts the Datadog Agent to apply the changes made in the previous step. The sixth and seventh tasks configure the Datadog Agent to collect Apache logs. The sixth task renames the default Apache configuration file to enable it, and the seventh task creates a new configuration block that specifies the location of the Apache logs and how to collect them. The eighth and final task restarts the Datadog Agent and Apache2 service to apply the configuration changes made in the previous steps.</p><h4>Step 2: Creating and Defining Ansible Playbook</h4><p>Create a file called playbook.yaml this is where the plays for your Ansible configurations would be defined.</p><pre>touch playbook.yaml </pre><pre>nano playbook.yaml</pre><p>nano into your playbook.yaml and add these lines</p><pre>- name: Install Datadog Agent on servers<br>  hosts: all # or ec2<br>  become: yes<br>  roles:<br>    - datadog<br>  vars:<br>    datadog_api_key: &quot;&lt;YOUR_DATADOG_API_KEY&gt;&quot;<br>    datadog_site: &quot;us5.datadoghq.com&quot;</pre><p><em>Remember to replace with your own Datadog api key</em></p><h4>Step 3: Create an Inventory File</h4><p>To do this, you’ll need to create an inventory file that contains the IP address or hostname of your EC2 instance, Assuming you have the key pair file of the instances on your local machine, change the permission by running</p><p>Here’s an example of what the <strong>inventory.yaml</strong> might look like</p><pre>chmod 400 keypair1.pem</pre><pre>[all]<br>your-ec2-instance1 ansible_host=&lt;your-ec2-instance1-ip&gt; ansible_user=&lt;your-ssh-username&gt; ansible_ssh_private_key_file=&lt;your-keypair1.pem-file&gt;<br>your-ec2-instance2 ansible_host=&lt;your-ec2-instance2-ip&gt; ansible_user=&lt;your-ssh-username&gt; ansible_ssh_private_key_file=&lt;your-keypair2.pem-file&gt;<br>your-ec2-instance3 ansible_host=&lt;your-ec2-instance3-ip&gt; ansible_user=&lt;your-ssh-username&gt; ansible_ssh_private_key_file=&lt;your-keypair3.pem-file&gt;</pre><p>Remember to change “your-ec2-instance1&quot; and “keypair1.pem” to the actually name of your instance and keypair file respectively.</p><p>Step 4: Run your playbook</p><p>first of all we would like to be sure that Ansible can reach and talk to the servers, to do this run this command.</p><pre>ansible -m ping all -i inventory.yml </pre><p>If it returns this;</p><pre>&lt;yourserver-name&gt; | SUCCESS =&gt; {<br> &quot;ansible_facts&quot;: {<br> &quot;discovered_interpreter_python&quot;: &quot;/usr/bin/python3&quot;<br> },<br> &quot;changed&quot;: false,<br> &quot;ping&quot;: &quot;pong&quot;</pre><p>Then you’re good to go, if not you may want to confirm if theres an Ansible user on your server.</p><p>Time to run the playbook and configure Datadog on your server! to run your playbook, type this Ansible command</p><pre>ansible-playbook -i inventory.yml playbook.yaml</pre><p>Congratulations, you have just installed the Datadog Agent on your server using Ansible!!</p><h4>Summary</h4><p>In this blog post, we saw how to install Datadog on your EC2 instances using Ansible. Datadog is a popular monitoring and analytics platform that can help you gain visibility into your infrastructure and applications. With Ansible, you can easily automate the process of installing and configuring Datadog on your EC2 instances, which can save you time and effort. I provided a step-by-step guide and explanation of each command used in the Ansible playbook.</p><h4>Conclusions</h4><p>In today’s fast-paced and constantly evolving tech landscape, it’s important to have tools and solutions that can help you stay ahead of the curve. Datadog is one such solution that can provide you with the visibility and insights you need to monitor and optimize your infrastructure and applications. By using Ansible to automate the installation and configuration process, you can save time and focus on more important tasks. I hope this blog post has helped you get started with Datadog and Ansible, and encourage you to continue exploring new tools and technologies that can help you level up your tech game.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c056ef53aa5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>