<?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 Durrell Gemuh on Medium]]></title>
        <description><![CDATA[Stories by Durrell Gemuh on Medium]]></description>
        <link>https://medium.com/@durrello?source=rss-4c1f6e425d1a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NzhgUbPmqwUaMDYDLR2szw.jpeg</url>
            <title>Stories by Durrell Gemuh on Medium</title>
            <link>https://medium.com/@durrello?source=rss-4c1f6e425d1a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 05:52:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@durrello/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[A Step-by-Step Guide to Proxying Traffic through Apache]]></title>
            <link>https://durrello.medium.com/a-step-by-step-guide-to-proxying-traffic-through-apache-305884736f02?source=rss-4c1f6e425d1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/305884736f02</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[apache]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[proxy-server]]></category>
            <dc:creator><![CDATA[Durrell Gemuh]]></dc:creator>
            <pubDate>Thu, 03 Oct 2024 11:05:13 GMT</pubDate>
            <atom:updated>2024-10-03T11:08:48.710Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gpwhdr34X-zZdjx63hjeMw.jpeg" /></figure><p>Quick documentation on how to use Apache to proxy traffic from a specific port (e.g., 8080) to the default Apache port (80/443). This allows you to expose services running on internal ports, such as application servers or services, while making them accessible via standard HTTP or HTTPS.</p><h4>Prerequisites</h4><ol><li>Apache Web Server: Make sure you have Apache installed. You can install it using:</li></ol><pre>sudo apt update<br>sudo apt install apache2</pre><p>2. SSL Certificate (for HTTPS): If you want to proxy traffic over HTTPS (port 443), you should have a valid SSL certificate installed on your Apache server. You can obtain one via <a href="https://letsencrypt.org/getting-started/">Let’s Encrypt</a> or from another CA.</p><p>3. Enable Necessary Apache Modules: Apache requires certain modules to handle proxying and SSL. Enable the required modules:</p><pre>sudo a2enmod proxy proxy_http ssl headers rewrite</pre><p>4. Firewall Configuration: Ensure that your firewall allows traffic on ports 80 (HTTP) and 443 (HTTPS):</p><pre>sudo ufw allow 80/tcp<br>sudo ufw allow 443/tcp</pre><h4>Step 1: Set Up a Virtual Host for HTTP (Port 80)</h4><p>We will start by creating a virtual host to proxy requests from the default port 80 to your application running on another port (e.g., 8080).</p><ol><li>Create a New Virtual Host File: Create a virtual host file for your domain or IP address.</li></ol><pre>sudo nano /etc/apache2/sites-available/yourdomain.conf</pre><p>2. Add the Virtual Host Configuration: Add the following content to proxy traffic from port 80 to port 8080.</p><pre>&lt;VirtualHost *:80&gt;<br>     ServerName yourdomain.com<br>     ServerAlias www.yourdomain.com<br>     # Proxy Settings<br>     ProxyPass / http://127.0.0.1:8080/<br>     ProxyPassReverse / http://127.0.0.1:8080/<br>     # Optional Logging<br>     ErrorLog ${APACHE_LOG_DIR}/yourdomain_error.log<br>     CustomLog ${APACHE_LOG_DIR}/yourdomain_access.log combined<br>&lt;/VirtualHost&gt;</pre><p>Replace yourdomain.com with your actual domain name and ensure that the ProxyPass and ProxyPassReverse URLs are correct for your service.</p><p>3. Enable the Site: Enable the new site configuration.</p><pre>sudo a2ensite yourdomain.conf</pre><p>4. Reload Apache: Reload Apache to apply the changes.</p><pre>sudo systemctl reload apache2</pre><p>Now, Apache will forward traffic from http://yourdomain.com (port 80) to http://127.0.0.1:8080</p><h4>Step 2: Set Up a Virtual Host for HTTPS (Port 443)</h4><p>For HTTPS, you will need a valid SSL certificate. You can either use a certificate from Let’s Encrypt or a custom certificate.</p><ol><li>Create a New Virtual Host File for HTTPS:</li></ol><pre>sudo nano /etc/apache2/sites-available/yourdomain-ssl.conf</pre><p>2. Add the Virtual Host Configuration for HTTPS:</p><pre>&lt;VirtualHost *:443&gt;<br>   ServerName yourdomain.com<br>   ServerAlias www.yourdomain.com<br>   SSLEngine on<br>   SSLCertificateFile /etc/ssl/certs/yourdomain.crt<br>   SSLCertificateKeyFile /etc/ssl/private/yourdomain.key<br>   SSLCertificateChainFile /etc/ssl/certs/chain.pem<br>   # Proxy Settings<br>   ProxyPass / http://127.0.0.1:8080/<br>   ProxyPassReverse / http://127.0.0.1:8080/<br>   # Security Headers<br>   Header always set Strict-Transport-Security &quot;max-age=31536000; includeSubDomains&quot;<br>   # Optional Logging<br>   ErrorLog ${APACHE_LOG_DIR}/yourdomain_ssl_error.log<br>   CustomLog ${APACHE_LOG_DIR}/yourdomain_ssl_access.log combined<br>&lt;/VirtualHost&gt;</pre><p>- Replace the SSLCertificateFile, SSLCertificateKeyFile, and SSLCertificateChainFile paths with the actual locations of your SSL certificate files.<br> — Make sure the ProxyPass and ProxyPassReverse directives point to the correct internal service port (e.g., 8080).</p><p>3. Enable the HTTPS Site:</p><pre>sudo a2ensite yourdomain-ssl.conf</pre><p>4. Reload Apache:</p><pre>sudo systemctl reload apache2</pre><p>At this point, Apache will forward traffic from https://yourdomain.com (port 443) to http://127.0.0.1:8080</p><h4>Step 3: Configure SSL with Let’s Encrypt (Optional)</h4><p>If you don’t have an SSL certificate, you can obtain one for free from Let’s Encrypt.</p><ol><li>Install Certbot:</li></ol><pre>sudo apt install certbot python3-certbot-apache</pre><p>2. Obtain SSL Certificate:</p><pre>sudo certbot - apache -d yourdomain.com -d www.yourdomain.com</pre><p>3. Automatic Renewal: Certbot automatically configures a cron job for renewing your certificate. You can test the renewal process with:</p><pre>sudo certbot renew - dry-run</pre><h4>Step 4: Restart Apache and Verify</h4><p>After configuring the virtual hosts, restart Apache:</p><pre>sudo systemctl restart apache2</pre><p>Verify the setup by accessing your domain via HTTP and HTTPS:</p><p>- HTTP: http://yourdomain.com<br>- HTTPS: https://yourdomain.com</p><p>You can also check if Apache is listening on the correct ports:</p><pre>sudo netstat -tuln | grep &#39;:80\|:443&#39;</pre><h4>Troubleshooting</h4><p>- ERR_SSL_PROTOCOL_ERROR: Ensure that your SSL certificate is correctly installed and that Apache is configured to serve HTTPS on port 443.<br>- 503 Service Unavailable: This could happen if Apache can’t reach the service running on the internal port (e.g., 8080). Verify the internal service is running and accessible.</p><ul><li>Logs: Check the Apache logs for errors or warnings:</li></ul><pre>tail -f /var/log/apache2/error.log</pre><h4>Summary</h4><p>This documentation outlines how to set up Apache as a reverse proxy to expose an internal service running on a non-standard port (e.g., 8080) through the default Apache ports (80 for HTTP and 443 for HTTPS). By following these steps, you can serve your application securely and make it publicly accessible while retaining the flexibility of running services on different internal ports.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=305884736f02" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Master Your Workflow with GitFlow: A Branching Strategy for Seamless Development]]></title>
            <link>https://blog.devops.dev/master-your-workflow-with-gitflow-a-branching-strategy-for-seamless-development-935705ebafbb?source=rss-4c1f6e425d1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/935705ebafbb</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[branching-strategy]]></category>
            <dc:creator><![CDATA[Durrell Gemuh]]></dc:creator>
            <pubDate>Wed, 25 Sep 2024 11:22:23 GMT</pubDate>
            <atom:updated>2024-09-26T17:21:29.864Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mHhux7Swl_qOUZ9zYjgRnQ.jpeg" /></figure><p>GitFlow is a branching model for Git that helps manage the development, release, and maintenance of your codebase. It introduces two main branches develop and masteralong with additional branches for features, releases, and hotfixes. This model allows you to separate the code for development, staging, and production, making it easier to manage releases and bug fixes.</p><h3>Branching Strategy</h3><ol><li>Master/Main Branch: This branch represents the production-ready state of your code. All commits to this branch are considered releases.</li><li>Develop Branch: This branch serves as the integration branch for features. It contains the latest development changes and is used to prepare for the next release.</li><li>Feature Branches: Branches created from develop for developing new features. These are merged back into develop once complete.</li><li>Release Branches: Branches created from develop when preparing for a release. These branches allow for final testing and bug fixes before merging into master.</li><li>Hotfix Branches: Branches created from master for urgent fixes that need to go into production immediately. Once fixed, these are merged back into both master and develop.</li></ol><h3>Branching and Merging Workflow</h3><h4>1. Starting Development</h4><p><strong>Create a Feature Branch</strong>:</p><ul><li>Branch off from develop.</li><li>Naming convention: feature/feature-name</li><li>Example command:</li></ul><pre>git checkout -b feature/add-login-page develop</pre><p><strong>Work on the Feature</strong>: Commit changes to your feature branch.</p><p><strong>Merge Feature Branch into Develop</strong>:</p><ul><li>When the feature is complete and tested, merge it back into develop.</li><li>Example command:</li></ul><pre>git checkout develop &amp;&amp; git merge feature/add-login-page</pre><ul><li>Delete the feature branch if no longer needed:</li></ul><pre>git branch -d feature/add-login-page</pre><h4>2. Preparing for a Release</h4><p><strong>Create a Release Branch</strong>:</p><ul><li>Branch off from develop.</li><li>Naming convention: release/version-number</li><li>Example command:</li></ul><pre>git checkout -b release/1.0.0 develop</pre><p><strong>Finalize the Release</strong>:</p><ul><li>Perform final testing and make necessary adjustments.</li><li>Commit changes to the release branch.</li></ul><p><strong>Merge Release Branch into Master and Develop</strong>:</p><ul><li>Merge the release branch into master to finalize the release.</li><li>Example command:</li></ul><pre>git checkout master &amp;&amp; git merge release/1.0.0</pre><ul><li>Tag the release:</li></ul><pre>git tag -a v1.0.0 -m &quot;Release version 1.0.0&quot;</pre><ul><li>Merge the release branch back into develop to incorporate any fixes.</li><li>Example command:</li></ul><pre>git checkout develop &amp;&amp; git merge release/1.0.0</pre><ul><li>Delete the release branch if no longer needed:</li></ul><pre>git branch -d release/1.0.0</pre><h4>3. Hotfixes</h4><p><strong>Create a Hotfix Branch</strong>:</p><ul><li>Branch off from master.</li><li>Naming convention: hotfix/issue-description</li><li>Example command:</li></ul><pre>git checkout -b hotfix/critical-bug master</pre><p><strong>Apply the Hotfix</strong>:</p><ul><li>Make the necessary fixes and commit changes to the hotfix branch.</li></ul><p><strong>Merge Hotfix Branch into Master and Develop</strong>:</p><ul><li>Merge the hotfix branch into master to deploy the fix immediately.</li><li>Example command:</li></ul><pre>git checkout master &amp;&amp; git merge hotfix/critical-bug</pre><ul><li>Tag the hotfix:</li></ul><pre>git tag -a v1.0.1 -m &quot;Hotfix version 1.0.1&quot;</pre><ul><li>Merge the hotfix branch back into develop to ensure that the fix is included in future releases.</li><li>Example command:</li></ul><pre>git checkout develop &amp;&amp; git merge hotfix/critical-bug</pre><ul><li>Delete the hotfix branch if no longer needed:</li></ul><pre>git branch -d hotfix/critical-bug</pre><h3>Example Workflow</h3><p><strong>Creating and Merging a Feature</strong></p><pre># Start a new feature <br>git checkout develop <br>git checkout -b feature/new-dashboard <br><br># Work on the feature, then commit <br>git add . <br>git commit -m &quot;Add new dashboard feature&quot; <br><br># Merge feature into develop <br>git checkout develop <br>git merge feature/new-dashboard <br><br># Delete the feature branch git branch -d feature/new-dashboard</pre><p><strong>Preparing and Releasing</strong></p><pre># Start a release <br>git checkout develop <br>git checkout -b release/1.0.0 <br><br># Finalize the release, then commit <br>git add . <br>git commit -m &quot;Prepare release 1.0.0&quot; <br><br># Merge release into master <br>git checkout master <br>git merge release/1.0.0 <br>git tag -a v1.0.0 -m &quot;Release version 1.0.0&quot; <br><br># Merge release into develop <br>git checkout develop <br>git merge release/1.0.0 <br><br># Delete the release branch <br>git branch -d release/1.0.0</pre><p><strong>Handling a Hotfix</strong></p><pre># Start a hotfix <br>git checkout master <br>git checkout -b hotfix/critical-bug <br><br># Apply the hotfix, then commit <br>git add . <br>git commit -m &quot;Fix critical bug&quot; <br><br># Merge hotfix into master <br>git checkout master <br>git merge hotfix/critical-bug <br>git tag -a v1.0.1 -m &quot;Hotfix version 1.0.1&quot; <br><br># Merge hotfix into develop <br>git checkout develop <br>git merge hotfix/critical-bug <br><br># Delete the hotfix branch <br>git branch -d hotfix/critical-bug</pre><h3>Best Practices</h3><ul><li><strong>Regularly Pull Changes</strong>: Regularly pull from develop and master to keep your branches up-to-date.</li><li><strong>Use Pull Requests</strong>: Use pull requests for merging branches to ensure code reviews and discussions.</li><li><strong>Keep Commits Small</strong>: Make small, incremental commits with descriptive messages.</li><li><strong>Tag Releases</strong>: Tag releases in master to keep track of versions and facilitate rollbacks if necessary.</li></ul><h3>Summary</h3><p>Transitioning to a GitFlow approach with develop and master branches will improve your development workflow by clearly separating the stages of development, release, and hotfix management. By following this branching strategy, you can manage features, releases, and urgent fixes in a structured and efficient manner</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=935705ebafbb" width="1" height="1" alt=""><hr><p><a href="https://blog.devops.dev/master-your-workflow-with-gitflow-a-branching-strategy-for-seamless-development-935705ebafbb">Master Your Workflow with GitFlow: A Branching Strategy for Seamless Development</a> was originally published in <a href="https://blog.devops.dev/">DevOps.dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting Up a DevOps Playground Server with Vagrant and VirtualBox]]></title>
            <link>https://durrello.medium.com/setting-up-a-devops-playground-server-with-vagrant-and-virtualbox-6b94796366c7?source=rss-4c1f6e425d1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b94796366c7</guid>
            <category><![CDATA[vagrant]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[virtualbox]]></category>
            <dc:creator><![CDATA[Durrell Gemuh]]></dc:creator>
            <pubDate>Wed, 25 Sep 2024 10:31:19 GMT</pubDate>
            <atom:updated>2024-09-25T10:31:19.684Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h5ocVCaHebO1E84Qkin2Ig.jpeg" /></figure><p>In today’s cloud-centric world, setting up servers across various platforms is easier than ever. Cloud providers such as AWS, GCP, Linode, and DigitalOcean etc offer powerful infrastructure suitable for production environments and large-scale applications. However, for local development and experimentation in a DevOps context, Vagrant provides a simple, free, and open-source tool for creating and managing virtual machines on your own system. In this guide, we’ll focus on setting up a DevOps playground ubuntu server using Vagrant and VirtualBox, ideal for learning and testing DevOps tools and methodologies.</p><h3><strong>Vagrant boxes</strong></h3><p>Vagrant boxes are pre-packaged, reusable base images that define the operating system and environment for your Vagrant virtual machines. They serve as the foundation for your development environment, allowing you to quickly spin up instances with consistent configurations. Vagrant boxes can be customized further through the Vagrantfile, where you can specify software installations, network settings, and other configurations.</p><p>Vagrant boxes are stored and shared on platforms like <a href="https://app.vagrantup.com/">Vagrant Cloud</a>, where you can find a variety of images for different operating systems and use cases.</p><h4>Choosing a Vagrant Box</h4><p>For this DevOps playground setup, we recommend using the Ubuntu 20.04 LTS (Focal Fossa) box, known for its stability and wide community support. Alternatively, you can use Ubuntu 18.04 (Bionic Beaver) if preferred. Both versions are available on Vagrant Cloud.</p><ul><li><strong>Box Name</strong>: ubuntu/bionic64</li><li><strong>Provider</strong>: VirtualBox (can be used with other providers as well)</li></ul><h3>Setting Up a Local Server on Windows with Vagrant and VirtualBox</h3><h4>Step 1: Install Prerequisites</h4><ul><li><strong>Install VirtualBox</strong>: Download and install <a href="https://www.virtualbox.org/">VirtualBox</a>.</li><li><strong>Install Vagrant</strong>: Download and install <a href="https://www.vagrantup.com/">Vagrant</a>.</li></ul><h4>Step 2: Initialize a Vagrant Project</h4><p>Create a New Directory: This is where your Vagrant configuration and files will reside.</p><pre>mkdir devops-playground &amp;&amp; cd devops-playground</pre><p>Initialize Vagrant: This creates a Vagrantfile in your project directory, specifying the base box and settings for your virtual machine.</p><pre>vagrant init ubuntu/bionic64</pre><p><strong>Start Your VM</strong>: Launch your VM with:</p><pre>vagrant up</pre><p><strong>SSH into Your VM</strong>: Connect to your virtual machine using:</p><pre>vagrant ssh</pre><p>Install any additional tools as needed for your DevOps tasks</p><p>Once your VM is running, you can install DevOps tools such as Docker, Ansible, or any other software relevant to your environment.</p><h4>Conclusion</h4><p>You have now completed the setup for a DevOps playground server, either using AWS for cloud-based services or Vagrant and VirtualBox for a local environment. Both setups provide a flexible and powerful platform for exploring DevOps tools and methodologies.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b94796366c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to safely pull and push terraform remote Statefile on windows]]></title>
            <link>https://durrello.medium.com/how-to-safely-pull-and-push-terraform-remote-statefile-on-windows-b097ffd361bd?source=rss-4c1f6e425d1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b097ffd361bd</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Durrell Gemuh]]></dc:creator>
            <pubDate>Tue, 20 Aug 2024 09:14:47 GMT</pubDate>
            <atom:updated>2024-08-20T09:14:47.194Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NqJ3drOUzssXrrBXCBlf3w.jpeg" /></figure><p>While working with Terraform on Windows, I encountered a strange issue when trying to update my remote state file. The error messages were confusing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*QmB4KM4-xLhcoX7mcufAIg.png" /></figure><p>This problem arose because I was trying to manually edit my Terraform state file to remove an unsupported attribute.</p><h3>How I got the issue resolved!</h3><p>When working with Terraform on Windows, you may encounter issues with the direct output redirection approach for state files. Here’s a step-by-step guide to handle this correctly</p><p><strong>Important:</strong> <strong>Always ensure you take a backup of your state file before making any manual changes.</strong> Modifying the state file directly can lead to unforeseen issues, so having a backup ensures you can restore the original state if needed.</p><p><strong>Pull the State File:</strong> Instead of using terraform state pull &gt; terraform.tfstate, which can lead to formatting issues on Windows, use the following command to pull the state file and save it as tfstate.json</p><pre>terraform state pull | sc tfstate.json</pre><p>The Set-Content cmdlet (sc) ensures that the file is correctly encoded, avoiding JSON parsing errors.</p><p><strong>Edit the State File:</strong> Open the tfstate.json file in your text editor and locate the &quot;serial&quot; attribute at the top of the file. Increment this number by 1 to reflect the manual changes you’ll make. For example, if the current &quot;serial&quot; attribute is:</p><pre>&quot;serial&quot;: 197</pre><p>Change it to:</p><pre>&quot;serial&quot;: 198</pre><p>This increment is necessary to maintain the state file’s integrity after manual edits.</p><p>Then you can continue with changes you wish to make on the file, add, remove edit resources.</p><p><strong>Push the Updated State File:</strong> Once you’ve made the necessary edits, push the updated state file back to your remote backend using:</p><pre>terraform state push tfstate.json</pre><p>This command will upload the modified state file and apply your changes.</p><p>By following these steps, you ensure that the state file is correctly formatted and that your changes are properly recorded.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b097ffd361bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cloud Notifications: Automating Email Alerts for Deployments with Google Cloud Build and msmtp in…]]></title>
            <link>https://durrello.medium.com/cloud-notifications-automating-email-alerts-for-deployments-with-google-cloud-build-and-msmtp-in-a49f5feebc78?source=rss-4c1f6e425d1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a49f5feebc78</guid>
            <category><![CDATA[email]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[gcp]]></category>
            <dc:creator><![CDATA[Durrell Gemuh]]></dc:creator>
            <pubDate>Tue, 06 Aug 2024 09:55:58 GMT</pubDate>
            <atom:updated>2024-08-06T09:55:58.778Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cloud Notifications: Automating Email Alerts for Deployments with Google Cloud Build and msmtp in GCP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b9Mpy9Mz4wXcuwj1-dClhg.jpeg" /></figure><h3>Overview of Messaging in the Cloud</h3><p>Cloud messaging involves sending notifications, alerts, or emails from cloud-based applications or services. This is essential for DevOps processes, alerting teams of deployments, errors, or other significant events.</p><h3>Different Messaging Options</h3><p>There are various messaging options available in the cloud:</p><p><strong>SMTP</strong>: Simple Mail Transfer Protocol, used for sending emails.</p><p><strong>SMS</strong>: Short Message Service, used for sending text messages.</p><p><strong>Push Notifications</strong>: Used for sending notifications to mobile and web applications.</p><p><strong>In-App Messaging</strong>: Used for sending messages within an application.</p><h3>Our Choice: msmtp</h3><p>For our cloud build notifications, we use <strong>msmtp</strong>, a lightweight SMTP client that allows sending emails using an external SMTP server.</p><h3>Components and Explanations</h3><p><strong>Alpine Linux</strong> is a security-oriented, lightweight Linux distribution, which makes it an excellent choice for Docker images. The packages we use are:</p><ul><li><strong>msmtp</strong>: A command-line SMTP client.</li></ul><p><strong>Dockerfile: </strong>Our Dockerfile sets up the environment for sending emails using msmtp.</p><pre>FROM alpine:latest<br><br># Install necessary packages<br>RUN apk add --no-cache mutt msmtp busybox-extras<br><br># Add msmtp configuration file<br>ADD msmtprc /etc/msmtprc<br><br># Ensure msmtp is used as sendmail<br>RUN ln -sf /usr/bin/msmtp /usr/sbin/sendmail<br><br># Set up a directory for logs (optional)<br>RUN mkdir -p /var/log/msmtp</pre><p><strong>msmtprc Configuration</strong>: The msmtprc file contains the configuration for the msmtp client, specifying the SMTP server details and authentication.</p><pre># msmtprc<br>account default<br>host smtp.office365.com # For outlook<br>port 587<br>tls on<br>tls_starttls on<br>tls_trust_file /etc/ssl/certs/ca-certificates.crt<br>tls_certcheck on<br>auth on<br>user example@example.com<br>passwordeval &quot;echo $MSMTP_PASSWORD&quot;<br>from example@example.com<br>logfile /var/log/msmtp/msmtp.log</pre><h3>Creating the Secret for Password</h3><p>To securely store your SMTP password, use Google Secret Manager:</p><pre>echo -n &#39;password&#39; | gcloud secrets create msmtp_password --data-file=-</pre><p>This command creates a secret named msmtp_password with the specified password.</p><h3>Building and Push the Docker Image</h3><p>To build and submit the custom Cloud Builder Docker image to GCP, have the Dockerfile and the msmtprcin folder then use the following command:</p><pre>gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/IMAGE_NAME</pre><h3>Using the Custom Cloud Builder in Cloud Build</h3><p>Now that the custom <a href="https://cloud.google.com/build/docs/configuring-builds/use-community-and-custom-builders">Cloud Builder</a> is built and pushed to Google Container Registry, it can be integrated into the Cloud Build pipeline. Here is an example of how to use this custom builder in a cloudbuild.yaml file:</p><pre>steps:<br>  - name: &#39;gcr.io/YOUR_PROJECT_ID/IMAGE_NAME&#39;<br>    entrypoint: &#39;/bin/sh&#39;<br>    args:<br>      - &#39;-c&#39;<br>      - |<br>        echo $$MSMTP_PASSWORD &gt; /dev/null<br>        {<br>          echo &quot;To: example@example.com, example@example.com&quot;;<br>          echo &quot;Subject: Deployment Notification&quot;;<br>          echo;<br>          echo &quot;Dear Team,&quot;;<br>          echo;<br>          echo &quot;A new deployment has been successfully completed. Here are the details of the deployment:&quot;;<br>          echo;<br>          echo &quot;- Deployment Time: $(date)&quot;;<br>          echo &quot;- GitHub Branch: $_BRANCH_NAME&quot;;<br>          echo;<br>          echo &quot;Everything is up and running. Please let us know if you encounter any issues.&quot;;<br>          echo;<br>          echo &quot;Thank you,&quot;;<br>          echo &quot;The DevOps Team&quot;;<br>        } | msmtp -a default -t<br>    secretEnv: [MSMTP_PASSWORD]<br>availableSecrets:<br>  secretManager:<br>    - versionName: projects/YOUR_PROJECT_ID/secrets/msmtp_password/versions/latest<br>      env: MSMTP_PASSWORD</pre><h3>Sample Email</h3><p>Once configured, the pipeline will send an email notification upon successful build completion. The email will contain deployment details, ensuring the team is promptly informed about the latest deployment status.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a49f5feebc78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Simple CI/CD Pipeline with GitHub and Cloudflare Pages]]></title>
            <link>https://durrello.medium.com/building-a-simple-ci-cd-pipeline-with-github-and-cloudflare-pages-a01280913549?source=rss-4c1f6e425d1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a01280913549</guid>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[cloudflare]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[deployment]]></category>
            <dc:creator><![CDATA[Durrell Gemuh]]></dc:creator>
            <pubDate>Sun, 19 May 2024 19:07:31 GMT</pubDate>
            <atom:updated>2024-05-19T19:07:31.136Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Simple CI/CD Pipeline with GitHub and Cloudflare Pages.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j-tugQdfHtlqMbCN9ycTmQ.jpeg" /></figure><p><strong>Introduction</strong><br>Are you the kind of engineer who loves to make things simple yet highly effective? 🛠️✨ Then you’ve come to the right place! In this article, we will guide you through setting up a simple CI/CD pipeline. We will use GitHub as our version control system and Cloudflare Pages for continuous deployment. By the end of this guide, you will have your project automatically deployed to end-users through Cloudflare. 🚀</p><p><strong>Requirements</strong><br>- A project hosted on <a href="https://github.com/">GitHub</a><br>- A <a href="https://dash.cloudflare.com/login">Cloudflare account</a> <br>- An application to deploy, such as a portfolio project built with HTML, CSS, and JavaScript</p><p><strong>Bonus</strong><br>How to download a template for free from ThemeForest (for educational purposes)</p><p><strong>Definitions</strong><br><strong>CI (Continuous Integration)</strong>: A development practice where developers regularly merge their code changes into a central repository, followed by automated builds and tests. This process helps in identifying integration issues early.</p><p><strong>CD (Continuous Deployment):</strong> An extension of continuous integration where the code changes are automatically deployed to a production environment after passing the necessary tests. This ensures that the software is always in a releasable state.</p><p><strong>Why Cloudflare Pages?</strong><br><strong>Cloudflare Pages</strong> is a JAMstack platform for frontend developers to collaborate and deploy websites. It is optimized for static sites, providing fast and secure content delivery. Projects built with HTML, CSS, JavaScript, and frameworks like React can be easily deployed using Cloudflare Pages.</p><p><strong>Steps to Deploy a Simple Portfolio</strong></p><p><strong>Step 1: Set Up Your Cloudflare Account</strong><br>First, log in to your Cloudflare account. If you do not have an account, you can create one <a href="https://dash.cloudflare.com/sign-up">here</a>. Once logged in, access the Cloudflare Workers from the dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E7Bq20gmE7vdfjrltB1oQA.png" /></figure><p><strong>Step 2: Access Cloudflare Pages Dashboard and Configure Git</strong><br>Navigate to the Cloudflare Pages dashboard. Here, you will need to configure your Git settings to connect your GitHub repositories with Cloudflare Pages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0hTaeSw4-qHhGcgzyZhS3Q.png" /></figure><p>1. <strong>Link Your GitHub Account:</strong> Click on the “Connect to Git” button and authorize Cloudflare to access your GitHub repositories.<br>2. <strong>Select Repositories:</strong> You can choose to give access to all repositories or select specific ones that you want to deploy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FyOyaflMs1SjREA2m8MvHQ.png" /></figure><p>Make sure the project you want to deploy is available on GitHub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eK3_rRporryq3Kwhi9r9KQ.png" /></figure><p><strong>Step 3: Deploy Your Site</strong><br>Once your GitHub account is linked, select the repository containing your project. Cloudflare Pages will automatically detect the build settings. For a project built with HTML, CSS, and JavaScript, the default settings will typically suffice.</p><ol><li><strong>Select the Repository:</strong> Choose your portfolio project repository</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*09sITNOew9CulJPn6GqNTQ.png" /></figure><p><strong>2. Configure Build Settings:</strong> Ensure the build command and output directory are correctly set. For static sites, the default should be appropriate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*aE-NiubEjTlw48ArPe-50Q.png" /></figure><p>3. Deploy: Click on “Save and Deploy” to initiate the deployment process.</p><p>Cloudflare Pages will now build and deploy your site. You can monitor the deployment status from the dashboard. Once the deployment is complete, your site will be live and accessible via a Cloudflare-provided URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*fcoJn_WZptbm-m4aeUPmhg.png" /></figure><p>Conclusion<br>By following these steps, you can set up a CI/CD pipeline using GitHub and Cloudflare Pages. This setup ensures that your changes are automatically deployed, providing a seamless and efficient development workflow. Whether you are deploying a simple HTML, CSS, and JavaScript portfolio or a complex React application, Cloudflare Pages offers a robust solution for your deployment needs.</p><p>Bonus: Downloading a Template from <a href="https://themeforest.net/">ThemeForest</a><br>For educational purposes, you can download a free template from ThemeForest. Here’s how:</p><p>1. <strong>Visit ThemeForest</strong>: Go to <a href="https://themeforest.net/">ThemeForest</a>.<br>2. <strong>Search for Free Templates</strong>: Use the search bar to find free HTML templates. <br>3. <strong>Download</strong>: Select a template you like and download it. Ensure you adhere to the licensing terms provided.</p><p>By utilizing free resources, you can enhance your learning experience and build a more polished portfolio. 🎨📚</p><p>— -</p><p>With this guide, you’re now equipped to deploy your projects seamlessly using modern CI/CD practices. Happy coding! 😄👩‍💻</p><p>Link to GitHub project <a href="https://github.com/durrello/portfolio.">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a01280913549" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>