<?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 Olushola Ayoade on Medium]]></title>
        <description><![CDATA[Stories by Olushola Ayoade on Medium]]></description>
        <link>https://medium.com/@olusholaayoade?source=rss-22139136ab66------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_M_Q60eGPwpXGmSa.</url>
            <title>Stories by Olushola Ayoade on Medium</title>
            <link>https://medium.com/@olusholaayoade?source=rss-22139136ab66------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 07:44:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@olusholaayoade/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[Docker + Amazon ECR, ECS Project]]></title>
            <link>https://medium.com/@olusholaayoade/docker-amazon-ecr-ecs-project-1bb387b1b737?source=rss-22139136ab66------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bb387b1b737</guid>
            <dc:creator><![CDATA[Olushola Ayoade]]></dc:creator>
            <pubDate>Fri, 09 Aug 2024 09:48:06 GMT</pubDate>
            <atom:updated>2024-08-09T09:48:06.882Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey reader and DevOps enthusiast, this would be my second medium post and it is a guide for a project to familiarize with the basics of Docker, Amazon Elastic Container Registry (ECR), and Amazon Elastic Container Service (ECS). I found this project on <a href="https://www.youtube.com/watch?v=6Hj-stf51Bc&amp;list=PLqoUmUbJ_zDHPwK-ZWATXiYrUXwWkLY65&amp;index=1">YouTube</a>.</p><p>Documenting is a necessary practice, especially if you are on a ‘self-paced’ DevOps learning journey. It helps me not just to implement these projects, but fully understand every step involved and consolidate the knowledge I acquired while doing the project.</p><p>You can find the files used in this project here: <a href="https://github.com/oayoade/Docker-ECR-ECS">oayoade/Docker-ECR-ECS (github.com)</a></p><p>Let’s get into it.. starting with a brief outline of the project</p><ol><li>Build a Docker image on Amazon EC2</li><li>Containerize and run the image using Docker.</li><li>Push the image to ECR programmatically</li><li>Create a cluster on ECS to house the Container/run the same image.</li></ol><p>You should already have an EC2 running, create a new directory from the home directory:</p><p>$ mkdir Docker</p><p>Then, we need to create a ‘Docker file’ — this file contains the configuration/blueprint for the image we’re trying to containerize.</p><p>$ vim dockerfile</p><p>Then paste the contents of the ‘Dockerfile’ from my repo into your file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*cYQpWjrq7zTPqhvtz2-uLA.png" /></figure><p>Note that my EC2 runs on Amazon Linux 2023, so if you have a different OS, you would need to reference a different image.</p><p>e.g CentOS 7, you would use this :</p><p>FROM centos:centos7</p><p>Next, create your index.html file the same way.</p><p>Now, it’s time to install Docker on your EC2 and build the Docker Image. All the commands you’ll find in this guide are for Amazon Linux so you can modify them accordingly if you have a different Linux distro — You can check the <a href="https://docs.docker.com/engine/">Docker website</a> for installation instructions</p><pre>sudo yum update<br>sudo yum install docker</pre><p>Confirm complete installation by running:</p><p>$ docker --version</p><p>Go into your project directory and run:</p><p>$ docker build -t project-image</p><p>The -t flag is used to tag the created image, and by default, the image you just created should be tagged as ‘latest’</p><p>The image should now be built, then to view the list of images, you can run:</p><p>$ docker images</p><p>Then, proceed to containerize/run the ‘project-image’ with the following command:</p><p>$ docker run -d -p 80:80 --name project-container project-image</p><p>‘-d’ flag is for <strong>detached </strong>mode, meaning the process runs in the background and you are returned to your terminal</p><p>‘-p’ flag is used to <strong>publish</strong> or map a container’s port(s) to the host machine’s port(s).</p><p>‘80:80’ means you are mapping the host machine’s port 80 to the container’s port 80 — in that order.</p><p>At this point, you should see a webpage when you visit the IP of your EC2 instance. Ensure to have allowed HTTP traffic on your security group.</p><p>Now, let us use Amazon ECS to launch the same image. Start by pushing the image to ECR.</p><p>First, navigate to Amazon ECR service in the AWS console and create a new private repository — give it any name. When it is successfully created, you will see an option to ‘View push commands’:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*b2N5yW_NxQ4nRcxahzAhbg.png" /></figure><p>We will need the first, second and 4th commands from that page, copy and save them. (please read the info under each command to understand what they do — pretty easy)</p><p>If you have connected to your EC2 via SSH from a local machine, then you need to obtain your ‘Access Keys’ from IAM, see this screenshot to guide you:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Il1DYiO8lVvYysjx74QMaw.png" /></figure><p>And in your terminal, run this command to authenticate your user:</p><p>$ aws configure</p><p>Follow the prompts and use the Access key you have generated. When that is successful, you are ready to push the image into ECR using the commands you copied earlier.</p><p>The first command authenticates you, third command tags the image, ensure to replace the part before “:latest” with your image name. In my case it was:</p><p>$ docker tag <strong>project-image</strong>:latest .....</p><p>run the last command —</p><p>$ docker push ...</p><p>You should now find the image in your ECR repo!</p><p>Next, let’s create an Application Load Balancer that would help split traffic across the ECS cluster we will still create.</p><p>So, go ahead into the AWS EC2 dashboard → Load Balancers → Create an ‘Application Load Balancer’, use the default settings but you can choose the first 3 AZs, and ensure to select the Security Group where your instance is.</p><p>You will need to create a new Target Group — you can see <a href="https://www.youtube.com/watch?v=fMzbUXCxdGU&amp;list=PLqoUmUbJ_zDHPwK-ZWATXiYrUXwWkLY65&amp;index=7">this video</a> if you are stuck anywhere in this step.</p><p>sigh.. the rest of the steps to create a Cluster and Task Definition are better followed from <a href="https://www.youtube.com/watch?v=fMzbUXCxdGU&amp;list=PLqoUmUbJ_zDHPwK-ZWATXiYrUXwWkLY65&amp;index=7">the video</a>.</p><p>The important things to note are:</p><ul><li>we are deploying the task on Fargate, which is a serverless feature- meaning you do not need to worry about the infrastructure, AWS takes care of that</li><li>The website is going to be accessible from the DNS hostname of the ECS Service you created.</li></ul><p>Will update this post if necessary. See ya in my next post! 👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bb387b1b737" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Github Actions CI with Ansible “Basic” Project]]></title>
            <link>https://medium.com/@olusholaayoade/github-actions-ci-with-ansible-basic-project-4c30db1f8b94?source=rss-22139136ab66------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c30db1f8b94</guid>
            <dc:creator><![CDATA[Olushola Ayoade]]></dc:creator>
            <pubDate>Sun, 04 Aug 2024 10:08:22 GMT</pubDate>
            <atom:updated>2024-08-04T10:08:22.611Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey you cloud/DevOps enthusiast, I wanted to start documenting my journey into DevOps so I thought this would make a good first-ever post on Medium.</p><p>At the time I completed this task that I got from my DevOps mentor, I already had my AWS Solutions Architect, both Associate and Professional certifications, and was a few days away from attempting the DevOps Engineer — Professional cert. This is not a requirement to be able to do this project, I just wanted to brag a little</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*0ZrhLLtOG70GGOrMRYIx0w.gif" /></figure><p>Alright, let’s get into it.</p><p>This task/project was basically an introduction to Continuous Integration(CI) with <a href="https://github.com/features/actions"><strong>Github Actions</strong></a>, but also to get some not-so-beginner level ideas of using Ansible — oh I suffered 🥲before I could perfect the playbook and master the SSH parts but troubleshooting is an important skill in DevOps so it was sweet pain.</p><p>The goal of the project is to trigger a Github actions workflow anytime there is a “push” commit to the <em>master </em>branch of a Github repository. There are several other triggers but we’ll be using the ‘push’ trigger for this task. I will not be doing a deep dive into each of the tools used; I will just look at the relevant details needed for this task.</p><p>Just for the sake of this project, our workflow would only be to install Git, Python, and configure Nginx with a basic HTML webpage on an AWS EC2 Amazon Linux server, so we have to create all these tasks in the Ansible playbook.</p><p>Step 1: Choose your repository or create a new one, navigate to ‘<em>Actions</em>’ and for this project, we will not be using a template, so ‘<em>set up a workflow yourself</em>’:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U86UZLR0Jc9vYqqof0FaOA.png" /></figure><p>Immediately you do this, you will be redirected to a blank text file named <em>main.yml — </em>this is your actions workflow file.</p><p>Paste in this string:</p><pre>name: CI<br># Controls when the workflow will run<br>on:<br> # Triggers the workflow on push or pull request events but only for the &quot;master&quot; branch<br> push:<br> branches: [ &quot;master&quot; ]<br># Allows you to run this workflow manually from the Actions tab<br> workflow_dispatch:<br> <br># A workflow run is made up of one or more jobs that can run sequentially or in parallel<br>jobs:<br> run-playbooks:<br> runs-on: ubuntu-latest<br> steps: <br> - uses: actions/checkout@v3<br> with:<br> submodules: true<br> <br> - name: Setup SSH <br> shell: bash<br> run: |<br> eval `ssh-agent -s`<br> mkdir -p /home/runner/.ssh/<br> touch /home/runner/.ssh/id_rsa<br> echo -e &quot;${{secrets.SSH_KEY}}&quot; &gt; /home/runner/.ssh/id_rsa<br> chmod 700 /home/runner/.ssh/id_rsa<br> echo &quot;${{secrets.SSH_KNOWN_HOSTS}}&quot; &gt;&gt; /home/runner/.ssh/known_hosts<br> <br> - name: Run ansible script<br> shell: bash <br> run: |<br> service ssh status<br> ansible-playbook -i hosts.yml ansible-pb.yml</pre><p>You can check out <a href="http://linux - How to run ansible playbook from github actions - without using external action - Stack Overflow">this post</a> for the full explanation of the workflow.</p><p>Notice the two ‘variables’ in the yaml string — “${{secrets.SSH_KEY}} and {{secrets.SSH_KNOWN_HOSTS}}”</p><p>These are ‘action secrets’ that you need to create in the “Settings” section:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p1fomReGZ-UQvOL5h9MLPQ.png" /></figure><p>To get the SSH Key variable, you need to have launched an EC2 instance and saved the private key (the .pem file in my case). You can then paste the entire content into the ‘actions secret’</p><p>For the ‘ssh_known_hosts’ value, you need to run this command on your EC2:</p><pre>ssh-keyscan -t rsa,dsa,ecdsa,ed25519 &lt;&lt;EC2-public-IP&gt;&gt;</pre><p>Copy the entire output and save it into the ‘ssh_known_hosts’ action secret.</p><p>Next, the Ansible playbook file should also be in the root of your repository. Because it had to contain an HTML webpage, the file is too long to paste so check it out in my repository:</p><p><a href="https://github.com/oayoade/actions-demo/blob/main/ansible-pb.yml">actions-demo/ansible-pb.yml at main · oayoade/actions-demo (github.com)</a></p><p>You will find the <a href="https://github.com/oayoade/actions-demo/blob/main/hosts.yml">Ansible hosts</a> file in there as well. Of course you need to edit the public IP.</p><p>At this stage, you are good to go and any changes to your <em>main </em>branch should:</p><ol><li>Install Git</li><li>Install Python</li><li>Install and configure Nginx</li><li>Deploy a webpage on that EC2’s IP address (ensure you have allowed HTTP traffic on your EC2’s security group)</li></ol><p>Here is the webpage that was deployed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*qDhTtwjFvbs1dTGboYfdkQ.jpeg" /></figure><p>‘Franklin Okpako’ is my DevOps mentor who inspired this project so I teased him with the text.</p><p>That’s it!</p><p>See you in my next project. Adios👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c30db1f8b94" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>