<?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 Michael Mensah on Medium]]></title>
        <description><![CDATA[Stories by Michael Mensah on Medium]]></description>
        <link>https://medium.com/@m-kwasi99?source=rss-4ac62243c8f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*p3wm-rVB7A6GB7A_fNZ8mg.jpeg</url>
            <title>Stories by Michael Mensah on Medium</title>
            <link>https://medium.com/@m-kwasi99?source=rss-4ac62243c8f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 18:13:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@m-kwasi99/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[How to Setup a Jenkins Server]]></title>
            <link>https://m-kwasi99.medium.com/how-to-setup-a-jenkins-server-c5484fa623f3?source=rss-4ac62243c8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5484fa623f3</guid>
            <dc:creator><![CDATA[Michael Mensah]]></dc:creator>
            <pubDate>Fri, 12 May 2023 02:13:34 GMT</pubDate>
            <atom:updated>2023-05-12T14:07:00.106Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*8aIXk990rQlbPnqjIkcKIw.png" /></figure><p>What is Jenkins — Jenkins is an open-source automation server widely used for continuous integration and continuous delivery (CI/CD) pipelines. It allows software developers to automate various stages of the software development process, such as building, testing, and deploying applications.</p><p>In this mini project, we will explore the setup of a Jenkins server to facilitate the processes of building, testing, and deploying applications.</p><p>Frist — Launch your Jenkins server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aDlqPljD5ephI3JM_6aPew.png" /></figure><p>Second — To obtain the release, please visit the official Jenkins website and proceed with the download process.</p><pre>https://www.jenkins.io/download/<br><br># Select the Stable (LTS)<br># Click on Installing Jenkins<br>#In the user handbook select the distro, OS or the platform you want to install <br>Jenkins on.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wAYWcIddWu-yCAWdy9AJiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wzSSssA-Od54xPQ0STNZfQ.png" /></figure><p>Three — Proceed with the installation of the packages on your Jenkins servers.</p><pre>sudo wget -O /etc/yum.repos.d/jenkins.repo \<br>    https://pkg.jenkins.io/redhat-stable/jenkins.repo<br>sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key<br>sudo yum upgrade<br># Add required dependencies for the jenkins package<br>#To install Openjdk<br>If you are using Amazon AMI 2.The command is <br>Amazon-linux-extras install java-openjdk11 -y or sudo yum install java-11-openjdk<br>sudo yum install jenkins<br>sudo systemctl daemon-reload<br>Jenkins --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YfPbi8O31vkIEqIqJUIJvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xDstUPIIw93Fdf29sCkkkg.png" /></figure><p>Four — Check and status and start the Jenkins server</p><pre>#Check Jenkins status<br>sytemctl status jenkins<br><br>#Start Jenkins<br>sytemctl start jenkins</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PWSdR5nee_oBzl0_QL944A.png" /></figure><p>Five — I encountered a connectivity issue with the Jenkins server because I neglected to enable port 8080, which is the port utilized by Jenkins servers for communication and operation.</p><pre><br>Upon observation, I realized that I had neglected to open port 8080, <br>which resulted in difficulties when attempting to connect to the Jenkins server.<br><br>To resolve the issue, I accessed the security group settings and created a <br>specific Jenkins security group. Subsequently, I included port 8080 in the <br>firewall rules to allow the Jenkins server to communicate properly.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8mHU7iXY_6xYD66_fYck3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i5m83wqPYIFU3ZXrWambfw.png" /></figure><p>Six — Now that I have successfully added port 8080, I can establish a connection to the Jenkins server without any issues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xFuMhYWjDxIJKJlwBGNHoQ.png" /></figure><p>Seven —To unlock Jenkins, you can retrieve the password by copying and passing the log file to the “cat” command.</p><pre>#Copy log file and use cat command to retrieve password<br>cat /var/lib/jenkins/secrets/initialAdminPassword<br>[Password]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x64kjaabeMQ2XS8x41llTA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ac7UTFPEDnfNf5YHynIqLQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*cJeOb0x7qSfvBRu0fvTA0w.png" /></figure><p>Please choose the appropriate option based on your preference from the selection provided above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*IT6qCz1MgEI5OPdJFpTnjw.png" /></figure><p>You have the option to create your own admin account in addition to the default admin account provided by Jenkins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*Xq23B9ZsJ5vS10AOkmIIjA.png" /></figure><p>Jenkins is ready</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*i-zTp8-Lsz7A3WwHYaZYgg.png" /></figure><p>This is the primary page of the Jenkins server, where you can initiate the processes of building, testing, and deploying applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rxk0LI6pvXOBHoLaS9EV_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ScRLSExUSfZPXvvsr0N-zw.png" /></figure><p>Finally, once your project is completed, remember to terminate your instance to prevent any additional charges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ku0pqzl75guZmnBa-SHpaA.png" /></figure><p>To summarize, the following is a step-by-step process for setting up a Jenkins server to facilitate the building, testing, and deployment of applications.</p><p>Thank you for taking the time to read through my project. I appreciate your support.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5484fa623f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ansible — PLAYBOOK]]></title>
            <link>https://m-kwasi99.medium.com/ansible-playbook-84a93cfe2ca8?source=rss-4ac62243c8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/84a93cfe2ca8</guid>
            <dc:creator><![CDATA[Michael Mensah]]></dc:creator>
            <pubDate>Sat, 06 May 2023 04:46:11 GMT</pubDate>
            <atom:updated>2023-05-08T22:01:34.872Z</atom:updated>
            <content:encoded><![CDATA[<h3>ANSIBLE — PLAYBOOK</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*GeGXiwc_artI_SN4344YFA.png" /></figure><p>What is Ansible playbook — An Ansible playbook is a file that contains code written in YAML format for executing tasks using Ansible.</p><p>To get started on this project.</p><p>First — Launch your servers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fbbEMIAXHiknhTNZe5ZJLg.png" /></figure><p>Second — Login to the Ansible control Engine and download ansible.</p><pre>#Switch to root user for the download<br>sudo su -<br><br>#I want to turn on access to the Extra Packages for Enterprise Linux (EPEL) repository in an Amazon.<br>sudo amazon-linux-extras install epel -y<br><br>#Download ansible on Amazon Linux 2 AMI<br> Amazon-Linux-extras install ansible2 -y<br><br>#Check the anisble version <br>ansible --verion</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DEJltr98eKrG2BHa6h-VkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kiy3nrS0z2M2GzaYJyBanw.png" /></figure><p>Third —The IP addresses for all six servers (both Test and Prod) have been included in the Ansible host inventory file.</p><pre>#To add your servers to the hosts file<br>cd /etc/ansible/<br>vi hosts (Add your servers)<br><br>#To exit the vi editor<br>Press the ESC button shift and : on your keyboard and then select wq to exit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KWRYuBGMgN63z7uSVAcyEA.png" /></figure><p>Four — Generate a key pair and distribute the public key to the relevant servers. Once completed, use SSH to access all servers from the Ansible control engine.</p><pre>#Create a key<br>ssh-keygen -t rsa<br><br>#copy key<br> cat ~/.ssh/id_rsa.pub<br><br>#ssh into all the server to see if you they can accessed from the control engine<br> ssh IP Addres</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HENd_eWUgSgZ13hqFzFAYQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HK8ss0rxU4KADrDGAo5rgA.png" /></figure><p>Five — It is time to commence building our Ansible playbook on the servers.</p><pre>#Go to the ansible control enginer and create a yaml file to run the play<br> vi Testserver.yaml<br><br># Simple playbook for Test server (Httpd webserver)<br>---<br>- hosts: Test<br>  tasks:<br>  - name: install web server<br>    yum:<br>     name: httpd<br>     state: latest<br>  - name: starting the webserver<br>    services:<br>     name: httpd<br>     state: started<br><br>#Run the playbook<br>ansible-playbook Testserver.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UZJesq03I6z3Eg9oqXSnFA.png" /></figure><p>I encountered an error while running the playbook. I reviewed the Testserver.yaml file to verify if there were any missing indentation issues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*imt9K3kYyUo5IjsgUXxjNw.png" /></figure><p>The installation of Httpd using the Testserver.yaml playbook was successful.</p><pre>ansible-playbook Testserver.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k-4UvpBEu_K7KVrMl4oOVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JFC-2Ys1lwNlzRsEKAJHlA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6IAObEUGB4NHG76ak6Xqhg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7tmZhv80JwMMHYS5JCTYNA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9aaQA8udSO4X4xjN1XN8rA.png" /></figure><p>The installation of Nginx using the Prodserver.yaml playbook was successful.</p><pre>#Go to the ansible control enginer and create a yaml file to run the play<br> vi Prodserver.yaml<br><br># Simple playbook for Test server (Nginx webserver)<br>---<br>- hosts: Prod<br>  tasks:<br>  - name: install web server<br>    yum:<br>     name: nginx<br>     state: latest<br>  - name: starting the webserver<br>    services:<br>     name: nginx<br>     state: started<br><br><br>#Run the playbook<br>ansible-playbook Proserver.yaml<br><br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tm_6zzJoeNWRPiaJHj9rfA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zlqYXujcRuxRXt062Lclow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EVXEoPsu5tcxxmxvwBGcUA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*p-B5k_3aEG883WHxAtdOsg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*BvS3hEU4gyOrKvByAceCFQ.png" /></figure><p>Terminate instance by the project to avoid any chargers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8W_eMJyauvjcg1VvnUQBTA.png" /></figure><p>To conclude, this is a straightforward and informative method to execute an Ansible playbook on multiple servers. Thank you for your time and attention. It is much appreciated.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84a93cfe2ca8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ansible Ad-hoc Command]]></title>
            <link>https://m-kwasi99.medium.com/ansible-ad-hoc-be031093bc87?source=rss-4ac62243c8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/be031093bc87</guid>
            <dc:creator><![CDATA[Michael Mensah]]></dc:creator>
            <pubDate>Wed, 03 May 2023 02:49:52 GMT</pubDate>
            <atom:updated>2023-05-03T05:18:13.035Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*zyQKBHCJKHSesLkXLTofFg.png" /></figure><p>What is Ansible Ad-hoc command — Is a one-line commands that are used to perform quick tasks on remote hosts without the need to create a playbook or execute a script.</p><p>The purpose of the mini project is to demonstrate how to execute Ad-hoc commands in Ansible.</p><p>First — Create your ansible control engine and 3 target servers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*_5Ih3KUT-prwNZab.png" /></figure><p>Second —To configure the Ansible control engine, add the IP addresses of all three servers to the hosts directory.</p><pre>Amazon Linux 2  AMI<br>Install Ansible using command - <br>Amazon-linux-extras install ansible2 -y<br>cd /etc/ansible/<br>ls -l<br>vi hosts - (Copy and paste all your targer server IP address to the host file)<br>Shift + : on your keyboard - wq to save your entry in the vim editor</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*aVclGgPP5ak_3xI2.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*KwF-yBBlwbIrl1_3.png" /></figure><p>Third — After testing and logging in to all three target servers, you can use the Ad-hoc come to install httpd on all of target server from the Ansible control engine by executing the following command below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*QgUQsMICofrktLl9.png" /></figure><pre>(Command to install httpd)<br>ansible -m command -a &quot;yum install httpd -y&quot; dev<br><br>(Commmand to start httpd)<br>ansible -m command -a &quot;systemctl start httpd&quot; dev </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ii6hlD7ngcKz3ALCAvDaWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T6-oSEZhc4sjIo-cGMm46g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k23RITk9FytSuZ_rcu5hIw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*abQxkCaZLwfKPf5kNDGjtw.png" /></figure><p>Four —After running the installation command on the Ansible control engine on all three target servers, the output will depend on the command that was executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*iF_voNr86_-PZMdsL3ItGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dxzBIOwynRSOC0EPkoWEGQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ZkxhSL_8_zhVhpdJ9OGfA.png" /></figure><p>In conclusion, this is how to set up Ansible to manage configuration across three or more targets servers.</p><p>Thank you all for stopping by to read my Mini project with MensahCloud.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be031093bc87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ansible and Target Servers]]></title>
            <link>https://m-kwasi99.medium.com/ansible-and-target-servers-e9c57da37aef?source=rss-4ac62243c8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9c57da37aef</guid>
            <dc:creator><![CDATA[Michael Mensah]]></dc:creator>
            <pubDate>Mon, 01 May 2023 05:47:17 GMT</pubDate>
            <atom:updated>2023-05-01T06:14:20.641Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*Wkrps5Q0tSDS-lZcJTMKsg.png" /></figure><p><strong>Ansible and Target Servers</strong></p><p><strong>What is Ansible</strong> — an open-source automation tool used for configuration management, application deployment, and task automation. The ansible control engine, which operates separately, relies on three components to facilitate the process. In addition, Ansible has the capability to authenticate login on target servers using the existing SSH protocol. The three components are as follows:</p><ol><li>Control Engine — This is the Ansible software that possesses intelligence on how to configure software packages across multiple servers.</li><li>Inventory File — This file contains the IP addresses of the target servers and specifies where configuration needs to occur.</li><li>Modules — These modules assist Ansible in performing the configuration across the target servers.</li></ol><p>Let see how to implement an Ansible on 3 target servers.</p><p>First — Launch your instances</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yeweQgTIe6VwsnDS8cEmAg.png" /></figure><p>Second — Login to the Ansible control engine and Install Ansible.</p><pre>Amazon Linux 2 AMI<br>Install Ansible using command - <br>Amazon-linux-extras install ansible2 -y</pre><pre>#Check the version of Ansible with the command - <br>ansible --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*My08I9rVGPP0bIxJIww2Mw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vGTyvpbSe7WRxhkmUH1mOA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AEojrY79nL6Z1jHNkozS8w.png" /></figure><p>Second — Configure the Inventory file by going to the ansible location where the file are located.</p><pre>cd /etc/ansible/<br>ls -l<br>vi hosts (Copy and paste all your targer server IP address in the host file)<br>Shift + : on your keyboard - wq to save your entry in the vim editor</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*THsDTCrZNFBEEsA-Y3gAeA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y6JtpRc5lCB6LsjL_OC11A.png" /></figure><p>Three —</p><p>1. Configure SSH passwordless authentication on the Ansible control engine.</p><p>2. Copy the public key to the “.ssh” directory on the target servers.</p><p>3. Create a file named “authorized_keys” and copy the public key into it.</p><pre>#Create a key<br>ssh-keygen -t rsa (This generates both the priviate and public keys)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y28idXfwC0wh8pLRMwwdbQ.png" /></figure><p>Four — Copy public key from Ansible control engine to the authorize keys in the target servers.</p><pre>#Copy public to the authorize_keys in the target servers<br>cat ~/.ssh/id_rsa.pub</pre><pre>#login to one of the targer server<br>cd /root<br>ls -la<br>cd .ssh<br>#created a file called authorized_keys and copy and pay the publics from<br>Ansible control engine.<br>vi authorized_keys</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iRq-4s2jwdoTIf_n40CUqQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gg9NBbp-TTgwBgRuH3oNng.png" /></figure><p>Fifth — Test login to all 3 target servers from your Ansible control engine.</p><p>From the screenshot I am able to authenticate to all 3 servers from my ansible control engine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tlUn1T2fraOKWT4jFaI-Ww.png" /></figure><p>Note — After project kindly terminate all servers to avoid any chargers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wc-rrMSMq2KzGR_yMX-Kxg.png" /></figure><p>In conclusion, this is how to set up Ansible to manage configuration across three or more targets servers.</p><p>Thank you all for stopping by to read my Mini project with MensahCloud.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9c57da37aef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Setup a Kubernetes Cluster in AWS using KOPS.]]></title>
            <link>https://m-kwasi99.medium.com/how-to-setup-kubernetes-cluster-using-kops-af2072bd5a04?source=rss-4ac62243c8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/af2072bd5a04</guid>
            <dc:creator><![CDATA[Michael Mensah]]></dc:creator>
            <pubDate>Sun, 10 Apr 2022 03:54:06 GMT</pubDate>
            <atom:updated>2022-11-13T22:07:35.512Z</atom:updated>
            <content:encoded><![CDATA[<p>The purpose of todays Mini Project with Mensah is to setup a Kubernetes cluster using the Kops method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*0huVZlWYv6fyHIunaaEXuA.png" /></figure><p>KOPS, also know as Kubernetes Operations, is an open-source project which helps you create, destroy, upgrade and maintain production-grade, highly available, Kubernetes cluster and is also used to provision cloud infrastructure. Please visit website to read more — <a href="https://kops.sigs.k8s.io/">https://kops.sigs.k8s.io/</a></p><ol><li>The first step in the process in setting up a cluster using the KOPS method is to create a <strong>Bootstrap Server</strong>. Bootstrap server can be your local system or an EC2 instance created in AWS. Bootstrap server is only needed to setup the K8s cluster by running the kops commands to initialize the cluster.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FpVY0uzrHP_Y-Yusfqy97w.png" /></figure><p>2. <strong>Install Kubectl with the command</strong> —</p><ul><li>curl -LO “https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl”</li><li>chmod +x kubectl</li><li>mv kubectl /usr/local/bin/kubectl</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VQgm5hJYdhmzklcX-g9qaA.png" /></figure><p>3. <strong>Install Kops</strong></p><ul><li>curl -Lo kops <a href="https://github.com/kubernetes/kops/releases/download/$(curl">https://github.com/kubernetes/kops/releases/download/$(curl</a> -s <a href="https://api.github.com/repos/kubernetes/kops/releases/latest">https://api.github.com/repos/kubernetes/kops/releases/latest</a> | grep tag_name | cut -d ‘”‘ -f 4)/kops-linux-amd64</li><li>chmod +x kops</li><li>sudo mv kops /usr/local/bin/kops</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jYOvxSIVyPstrz-G-0yKhg.png" /></figure><p>4. Create an IAM Role and attach the role to the K8 bootstrap server. This is because the Kops will need access to the cloud environment and resources and permissions to be able to create the cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a9Es_quOwthHYAwE7DUnsA.png" /></figure><p>Attached the IAM Role created to the EC2 K8 bootstrap server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RlPwWW90gyrTgWiRx1y6PA.png" /></figure><p>5. Configure Route53</p><p>Custom domain is required to setup Kubernetes cluster using Kops, so that Kops can create required resource records in that domain in Route 53. example — “mensahdev.com”</p><p>Gossip is an alternate option if you want to deploy a cluster without custom domain in Route 53. To use gossip-based DNS, configure the cluster domain name to end with <strong>.k8s.local</strong>. example — “<strong>mensahcloud.k8s.local</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TTcLSZ6cWdJP0w0k_9coHw.png" /></figure><p>6. <strong>Create Cluster State Storage (S3 Bucket)</strong></p><p>To store the state of your cluster, and the representation of your cluster, we need to create a dedicated S3 bucket for kops to use. This bucket will become the source of truth for our cluster configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Yr5RkD37Caa-mNOqKKpFQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*muFfXeBAf6sxFTaeLWOipw.png" /></figure><p>7. <strong>Setup SSH Keys</strong> — SSH keys will be used by Kops to setup the Kubernetes cluster to have a custom authentication token to be generated between master and client.</p><p>Create SSH Keys by running “<strong>ssh-keygen -t rsa</strong>”, which creates keys in default location $HOME/.ssh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y-ZmLqHluMbwKgZPbwNd-A.png" /></figure><p>8. <strong>Create cluster configuration</strong></p><p>Congratulations!! You have setup all prerequisites on the bootstrap server.</p><p>We’re ready to start creating our k8s cluster! setup below environment variables to start creating cluster configuration.</p><p><strong>Custom Domain</strong></p><ol><li>export NAME= Your domain name</li><li>export KOPS_STATE_STORE=s3://you bucket name</li></ol><p><strong>Gossip Domain — Am using the gossip domain because I don’t have a custom domain yet</strong></p><ol><li>export NAME=mensahcloud.k8s.local</li><li>export KOPS_STATE_STORE=s3://mybucketmensahcloud</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nktVbNOo0UCrffRfzY8qoA.png" /></figure><p>9. <strong>Create a cluster</strong> —</p><p><strong>kops create cluster — — zones=us-east-1a,us-east-1b ${NAME}</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I4FW5u_DEu1ruluHD5Ksrg.png" /></figure><p>10. <strong>Update the cluster with the command</strong> —</p><p><strong>kops update cluster — — name mensahdev.k8s.local — — yes — — admin</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kaXK3QGP-yHMFix1oBGO4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UHEfid9pjlb4bSpogtI0zQ.png" /></figure><p>11. Nodes have been created. You have your Master and 2 worker nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t2SBbIEfKJfBlr1-BU0pZA.png" /></figure><p><strong>Kubectl get nodes — Master and 2 worker nodes</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jBsR7M5O2HX_P9hjiuBmMA.png" /></figure><p>Kops also setup Auto Scaling groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*trzt9JhcBLq9Jd7E83bMQA.png" /></figure><p>12. <strong>Delete cluster.</strong></p><p><strong>kops delete cluster — — name=mensahcloud.k8s.local — — yes</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B39V9XPf2MHJwNus6Mm7aQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*234hIjRZaK57ToQ_VZIjvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rY9fZhdiho40bzeXcL-nqA.png" /></figure><p>Thank you for stopping by page. Much love and much appreciation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af2072bd5a04" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a Java Web Application in Apache Tomcat App Server.]]></title>
            <link>https://m-kwasi99.medium.com/deploying-a-java-web-application-in-apache-tomcat-app-server-adf65471c4be?source=rss-4ac62243c8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/adf65471c4be</guid>
            <dc:creator><![CDATA[Michael Mensah]]></dc:creator>
            <pubDate>Wed, 16 Mar 2022 07:13:40 GMT</pubDate>
            <atom:updated>2022-03-18T03:35:14.840Z</atom:updated>
            <content:encoded><![CDATA[<p>This project is to copy a .war file from JFrog Artifactory to an app server (Tomcat) to serve content to users. Tomcat is the application server to host java application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/0*ifUpEvkJ6frZGc9m.jpeg" /></figure><h3>Pre-Requisites</h3><ol><li>You must have an <a href="https://aws.amazon.com/">AWS account</a> to create infrastructure resources on AWS cloud.</li><li>GitHub or Bitbucket to clone your code for the build process.</li><li>JFrog Antifactory account to store artifacts files.</li></ol><p>Lets begin the process — Head over to your JFrog Artifactory account to check where your artifact was saved. Below is the screenshot. In the screenshot my .war file is saved under the name projectdevcloud</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k2AaTRbEEKTk6SZ-.png" /></figure><p>The next step is to create a Tomcat server to host the code from JFrog. Login to the server and change user to root user with the command <strong>sudo su -</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V_C4wYrKIHw4koio.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L8_tguYS2C8iXyKq.png" /></figure><p>Head over to the Tomcat website — <a href="https://tomcat.apache.org/download-80.cgi"><strong>https://tomcat.apache.org/download-80.cgi</strong></a> to download the version of Tomcat specified by the developer. In my case the developer requires I download Tomcat 8 version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zphf5gwTMtfg_O27.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*l3oOhQVm8E5Nf4zR.png" /></figure><p>Right click on the link and go to your application server and download Tomcat in the /opt location with the command <strong>wget </strong><a href="https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.76/bin/apache-tomcat-8.5.76.zip"><strong>https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.76/bin/apache-tomcat-8.5.76.zip</strong></a><strong>. </strong>After the download unzip the file with the command<strong> unzip apach-tomcat-8.5.76 .zip. </strong>Screenshot blow</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nxh8gPcEBYhwQkxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5feuRf5mXlRSmPSe.png" /></figure><p>After Tomcat is unzip. change directory to apache-tomcat-8.5.76 with the command <strong>cd apache-tomcat-8.5.76/</strong> and with another command <strong>ls -la</strong> which gives you the files in the home directory call <strong>Catalina home directory </strong>which<strong> </strong>is the directory where the application will be hosted under the folder <strong>Webapps</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7j9m7Gl9n-JGo5a8.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Rr8qw5n8pujzf2tx.png" /></figure><p>In the Catalina home directory you will see a folder call bin. Change directory to the bin folder with the command <strong>cd bin/</strong> and then <strong>ls -la</strong> to see what is inside of the bin folder to configure some settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5oINh9Xwbbw75M4H.png" /></figure><p>In the bin folder we realize all the scripts don’t have the execution permission so we need to change the permission with the command <strong>Chmod +x ./*</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FCIYIYsSEWTBzF-e.png" /></figure><p>After enabling the permission look for a script name <strong>startup.sh</strong>. Tomcat needs to be started with the command <strong>./startup.sh </strong>to<strong> </strong>start the Tomcat application. Once you run the scripts Tomcat should start. The server didn’t start because we haven’t installed Java JDK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Zvhfg7GFKR9smbvB.png" /></figure><p>Install Java JDK with the command the command<strong> amazon-linux-extras install java OpenJDK </strong>if you are downloading<strong> JDK 11 or yum install OpenJDK if you downloading OpenJDK 1.8.0 version. </strong>Check the version of Java install with the command <strong>Java -version</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AqY7A0bAikAtfu7V.png" /></figure><p>After installing Java. Head over to the Catalina home directory with the command <strong>cd bin/</strong> and start the Tomcat app server with the command <strong>./startup.sh</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dLGaEXXhwlmjMVYF.png" /></figure><p>Use <strong>netstate -tupln</strong> to check if tomcat port 8080 is open and listen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HbGFp4Qc5q157KuU.png" /></figure><p>After head over to the AWS management console and copy the IP Address to the web browser to see if Tomcat server landing page is running <strong>44.202.35.41:8080</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qEUsq-WwWlYkuYad.png" /></figure><p>After seeing that the landing page is working. The <strong>.war files </strong>saved in the JFrog will need to be copied to the Catalina home directory insider the folder called <strong>Webapps </strong>with the command <strong>cd webapps/ </strong>and the command<strong> ls -la </strong>to see what is inside the webapps folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ysf5IcY1lZ8JErLs.png" /></figure><p>Head over to your JFrog account and copy the URL to your app server and use the <strong>wget command and authenticate with a username and password</strong> to download</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H4aXKFKC_-SOOyyv.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h9XPvqUgGnN8NvLM.png" /></figure><p>Check your <strong>Webapps folder</strong> to see if Code is copied to the webapps folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iTyoxurTzgZ5WSSy.png" /></figure><p>Check your web browser to with the with link to see if java code is successfully deployed to Tomcat and is in a working state — <a href="http://44.202.35.41:8080/dptweb-1.0/login"><strong>http://44.202.35.41:8080/dptweb-1.0/login</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*vY0h6NgUmVhPD8vM.png" /></figure><p>In conclusion — This is a simple step by step tutorial on how to successfully deploy a Java Web Application in Apache Tomcat App Server. Thank you so much for stopping by my page to read my mini project with mensahcloud. A very grateful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=adf65471c4be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nginx Reverse Proxy]]></title>
            <link>https://m-kwasi99.medium.com/nginx-reverse-proxy-588cc31f4df?source=rss-4ac62243c8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/588cc31f4df</guid>
            <dc:creator><![CDATA[Michael Mensah]]></dc:creator>
            <pubDate>Wed, 16 Mar 2022 07:02:35 GMT</pubDate>
            <atom:updated>2022-03-21T23:07:37.772Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>NGINX</strong> is open source software for web serving, reverse proxying, caching, load balancing, media streaming, and more. It started out as a web server designed for maximum performance and stability. In addition to its HTTP server capabilities, NGINX can also function as a proxy server for email (IMAP, POP3, and SMTP) and a reverse proxy and load balancer for HTTP, TCP, and UDP servers.</p><p>Source —<strong> </strong><a href="https://www.nginx.com/resources/glossary/nginx/"><strong>https://www.nginx.com/resources/glossary/nginx/</strong></a></p><p>The purpose of this project is to use Nginx as a load balance to route traffic to the app server where the java web application content is been hosted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*FcyXEsAsdJrKkyAESAvj0Q.png" /></figure><p>Launch your instances to begin the process. Name one of the server Nginx Server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*loIJBl3dN5WIdJgJ2Os4Pw.png" /></figure><p>Configure your Tomcat server to serve your Java Web Application. Please see the screenshots below. Go to Tomcat website and copy the version of the application suggested by your developer. <a href="https://tomcat.apache.org/download-80.cgi"><strong>https://tomcat.apache.org/download-80.cgi</strong></a></p><p>Login into your Tomcat server and copy the linked from the website with the command to download the file. — <strong>Wget </strong><a href="https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.77/bin/apache-tomcat-8.5.77.zip"><strong>https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.77/bin/apache-tomcat-8.5.77.zip</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oo9n8lOw7C2eOHxyNjNTxw.png" /></figure><p>Use the command <strong>ls -la </strong>to<strong> </strong>see the content in the<strong> /opt </strong>folder and the command <strong>unzip apache-tomcat-8.5.77.zip to unzip </strong>the file and the <strong>cd </strong>command<strong> cd apache-tomcat-8.5.77/ </strong>to change directory<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tZToh80IVp1AfM4uOIYFcQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RVG9RjbIKVlehD8cRzJYhw.png" /></figure><p>Change directory to the bin folder to start server the Tomcat server with the command <strong>Chmod +x ./*</strong> to change permission of the scripts and then start server with the command <strong>./startup .sh</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8LfV7y1yTZtplQpQDSCyRg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SaZkDFLwCGCAspm7pmMd_A.png" /></figure><p>Install OpenJDK with the command <strong>amazon-linux-extras java-openjdk11. </strong>Now that OpenJDK is installed we can now start our Tomcat server. Change directory to the bin folder and start Tomcat serer with the command <strong>./startup.sh</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IBvH-ylFmhyRqfks3zPFSg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZWnkEf852m555SBKcFYhUg.png" /></figure><p>Once you see the Tomcat browser started then this means your server has started successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BYSug2GQ5hpL0qqw814CzQ.png" /></figure><p>In the home directory of <strong>/opt/apache-tomcat-8.5.77</strong> look for a folder call <strong>Webapps </strong>and change dir<strong> with </strong>the<strong> command cd webapps </strong>which<strong> </strong>is where the Java Web Application will be copied to from<strong> JFrog Artifactory.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZKYVGvmA4Ji_chBIXL1leA.png" /></figure><p>Download the build application that was save in JFrog Artifactory to your <strong>webapps</strong> with the command wget and the URL from the JFrog account <strong>wget — — user= — — password= the URL copied from JFrog Artifactory</strong></p><p>Press the ENTER key on your keyboard and yes the build Java web application is download to your tomcat server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wV4hTYNWke06hpU3bBJ6Bw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LL4ufa63OPeeySi4VliQjQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JRsmJeEjcGnKlKzXXoHXfg.png" /></figure><p>After the Java Web Application is deployed to the app server. The next step is to launch an <strong>NGINX server</strong> configure it and route traffic to the app server. Nginx can be install with the command <strong>amazon-linux-extras install nginx1 -y</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gVWus6503WOYHFvevilW4Q.png" /></figure><p>After Nginx is install the configuration files will be stored in the <strong>etc </strong>location with the command cd to change directory <strong>cd /etc/nginx/</strong> Start your Nginx server with the command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fv83kbBX3uvyIJ0hFJpV6w.png" /></figure><p>Start the Nginx server with the command <strong>service Nginx start</strong> and check the status with command <strong>service Nginx status. </strong>Check the browser to see if Nginx is working.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JrtKj97Ek_UwieG7fNcKew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7vuoXycBNuErl5BZ1hcfpw.png" /></figure><p>Since am using Nginx server reserve proxy to help route traffic to the Java Web Application hosted in Tomcat to serve content to users. <strong>Nginx.conf</strong> is the location to go to make the necessary configuration changes to make your server as a reverse proxy. Use the command <strong>vi nginx.conf</strong> to make the changes in the configuration files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1r4MNkjKA3v3uHFwupV9Aw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bj-v966fuMZsN0KrmmEtvw.png" /></figure><p>To make the necessary changes on how to add a reserve proxy to the Nginx serve to route traffic to the backend Tomcat server. Type in Nginx Reverse Proxy pass documentation and go to the website and see how Nginx shows you how to add a request to an HTTP proxied served.</p><p>link — <a href="https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/">https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B9lKRCckMw7IasZ03cJPAA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EfqMHA7o9f7Pvyn_II-JLw.png" /></figure><p>To pass a request to an HTTP proxied server, the <a href="https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass">proxy pass</a> directive is specified inside a <a href="https://nginx.org/en/docs/http/ngx_http_core_module.html#location">location</a>. For example: Make the necessary config changes by looking the steps below so that Nginx can revere proxy your traffic to the backend app service.</p><pre>location /some/path/ {<br>    proxy_pass http://www.example.com/link/;<br>}</pre><pre>location / {<br>    proxy_pass http:<a href="http://3.88.158.15:8080/dptweb-1.0/">//3.88.158.15:8080/dptweb-1.0/</a>;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PSO9w2fI7Pf6iLTAiU6y8A.png" /></figure><p>After configuration have been completed stop your Nginx with the command<strong> Service Nginx stop and </strong>restart the Nginx back again with the command <strong>Service Nginx start. </strong>Now my Nginx serve is routing traffic from it server to Tomcat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jcRqJMlyc2V9njPQdk4XqQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BKbVkajfpngMVB09JeVB1Q.png" /></figure><p>Conclusion — Now that my IP address and artifact is live in the <strong>Nginx confi</strong> folder content can now be served to users.. I can now add the Nginx IP as an A record or CNAME in the hosted zone in Route 53.</p><p>Thank you for stopping by to read my mini project with mensahCloud</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=588cc31f4df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JFrog Integration with Maven]]></title>
            <link>https://m-kwasi99.medium.com/jfrog-integration-with-maven-2304f31cb207?source=rss-4ac62243c8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2304f31cb207</guid>
            <dc:creator><![CDATA[Michael Mensah]]></dc:creator>
            <pubDate>Tue, 15 Mar 2022 03:56:24 GMT</pubDate>
            <atom:updated>2022-03-15T14:05:13.736Z</atom:updated>
            <content:encoded><![CDATA[<p>The purpose of this project is to move the artifact after the build process is successful to a virtual repository call JFrog Artifactory to store the artifact file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*d24Pghh8etZPL22eUWqe0g.png" /></figure><h4>Pre-Requisites</h4><ol><li>You must have an <a href="https://aws.amazon.com/">AWS account</a> to create infrastructure resources on AWS cloud.</li><li>GitHub or Bitbucket to clone your code for the build</li><li>JFrog Antifactory account to store artifacts files</li></ol><p>Lets begin the process — Launch your instance to begin the build process. My instance name is <strong>Maven Build</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MSo-eYsmIR9VN6OtBwWF3g.png" /></figure><p>After instance is launched login to the server and change the user to Root with the command —<strong> sudo su -</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8JE6Dz2fh_Aa0j0Mck-Emw.png" /></figure><p>Download Maven from the the Maven website site. Copy and paste the link to your server to begin the download with the command <strong>wget apache-maven-3.8.5-bin.zip. </strong>Screenshot below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nuIc7PBbVERKxJKJGv6Jgw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PTmVj2_L6Y-AOJQi4jQotA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M6GiVuKQTO23iDLxXviYmQ.png" /></figure><p>Once the link is downloaded the next step is to unzip the file with command unzip <strong>apache -maven-3.8.4-bin.zip</strong>. Use the<strong> Cd</strong> command to change directory to the file <strong>apache-maven-3.8.4</strong> and the <strong>ls -la</strong> command to see all the config files in your maven file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ZazoTuIbBdcC7v1OlMnpw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IyYoLPdb8qWho3TpkzRxng.png" /></figure><p>The next step is to install a few application to help with the build process. We will install <strong>Java OpenJDK</strong> with the<strong> command yum install java-1.8.0-openjdk-devel -y.</strong> Once Java is install the next application to install is <strong>GIT</strong> with the command <strong>yum git install -y</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rrTNogMBFhCv8I4CaILn_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qu7_v87grnAYLsAtr5uyFg.png" /></figure><p>Once the Java and GIT application are both installed. The next process is to GIT pull the code from a remote repo from <strong>GitHub</strong> or <strong>Bitbucket</strong> to the server to store the code for the build process. Copy and paste your <strong>clone link</strong> to the server press ENTER on the keyboard to clone code to server. Once that is done you will see your code (<strong>java login — app</strong>)on the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C7c9eQ8nvGS9GTopmT_9ag.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GkPB3GPn9ZHre1mSrp-iGw.png" /></figure><p>The next step is to begin the build process. To begin the build process you have to change directory to where the <strong>pom.xml</strong> file is with the command <strong>cd java-login-app/</strong> and then <strong>ls -la</strong> to see the files in the entire code file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*chOh9y6B6zI8eaqs9GsNbg.png" /></figure><p>In the pom.xml present working directory is where the build process will take place with the command <strong>/opt/apache-maven-3.8.5/bin/mvn package</strong>. Once build is completed the output of the build will read as <strong>BUILD SUCCESS. </strong>Screenshot below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ajD6w6riwqYnNlcpXpQrlw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OCvsgSj_RlX3b2RKyyi4hA.png" /></figure><p>Once the build is successful you will see a directory call t<strong>arget</strong> which wasn’t there formally, but after the build the target directory is there. and inside the target directory is where our code will be package nicely to be moved to the Jfrog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UpD_PfD5Xg9gdST6OyS3NQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GSKtggAbY3MDVNdUuiQCDQ.png" /></figure><p>The next step is to head over to the JFrog website. Create an account and login. After a creating an account. Open the home page and click on <strong>Quickset up, which s</strong>how you the list of application that can save their artifacts in this remote repo (JFrog).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CHWPTf_640tUyICiEhopdA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q-Z-g6XrtcP60m9pYK8D4w.png" /></figure><p>Create a repo for Maven by selecting <strong>Default-maven-local</strong> and create a new repository and assign a name to your new repositories by adding a meaningful prefix identifier. Screenshot below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1v6dvFy53vqTgrzvfYsMLw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tjSrgZiH4XY1DIF_7olyQw.png" /></figure><p>After you create the repo. Click “Generated setting” below to configure and copy and paste this settings to maven repository call <strong>.m2.</strong> Copy the setting to Vscode to make the changes. Changes will include adding your username and password to make it easy for maven to authenticate when pushing code after the build process to JFrog successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9dfo42ReVmh96TtSqzqQbA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R5XEP8242NdV0kUD1n0SRQ.png" /></figure><p>In the setting files you have to define the credentials by putting in your username and password so maven an authenticate and push code to JFrog. Afterward, define that the artifact has to be resolvable by which virtual repo by default. In this case the default is — <strong>Default -maven-virtual</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EZumRR5Qw_gT3W_8AOAi-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KLR4Acu1OtY88DwKpv4cBQ.png" /></figure><p>After the setting files have been configured. Click on the <strong>Set me up</strong> to define which repository you want to move your artifact to in my my case I will move it to <strong>projectdevcloud-libs-release-local. </strong>Afterward, below Set Me Up click on the <strong>Deploy </strong>to generate the code which the plugins on where the java source code will be save in JFrog by add the code to the <strong>pom.xml file.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I49KsThfFO2EWC0QaE4UyQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yJmxnvFVX6dIhnq8fyv5Dg.png" /></figure><p>After this is done. Head over to your Maven server to complete the process by configuring the setting in a way that it will be able to push code to the JFrog artifact. Use the command <strong>cd /root</strong> — then the command <strong>cd .m2</strong> which is the local repository in the maven server where I will be copying and pasting the dependency. Use the command <strong>vi settings.xml </strong>then copy and paste the dependency code generated from JFrog. .<strong>m2</strong> is local repo folder which supplies the required configuration details to your build process</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b5qaWGHPO9jk4VV5AficEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gGJEi14l2rFPXsjUj9i_bQ.png" /></figure><p>The next step is to add the distribution setting code to your <strong>pom.xml</strong> file to tell maven which repository location to post the artifact to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b4ZFCPdJ_kcFu7CVMsZhgA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XFxWnuBGlRVp4evgOx4uhg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c1OPHIvqw_sgPiLajVhncg.png" /></figure><p>After the distribution is added to the pom.xml. Run the <strong>mvn package</strong> command to build and prepare the artifact to push to JFrog. Run another command <strong>mvn deploy</strong> to push your artifact to your JFrog artifactory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lp_LIYKh2UQXOxdcfvc7Lw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eb5AxhJkwEGr7gRX1fs4Cw.png" /></figure><p>Refresh your JFrog webpage to see if your artifact was successfully deployed to the local antifactory location I specified. Yes artifact was SUCCESSFULLY deployed to the right location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5hUsuo_Dk1Xd6dWytNe2kw.png" /></figure><p>Conclusion — You have seen the step by step tutorial how to push an artifact to an antifactory account to store codes after is been compile, built and packaged to be deployed to an app server (Tomcat) to serve users.</p><p>Much you for stopping by as usual to ready my block post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2304f31cb207" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sonar Cloud Integration with Maven for Continuous Code Quality & Code Security.]]></title>
            <link>https://m-kwasi99.medium.com/sonar-cloud-integration-with-maven-ee61ca52d2b?source=rss-4ac62243c8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee61ca52d2b</guid>
            <dc:creator><![CDATA[Michael Mensah]]></dc:creator>
            <pubDate>Tue, 01 Mar 2022 06:18:17 GMT</pubDate>
            <atom:updated>2022-03-02T00:56:59.519Z</atom:updated>
            <content:encoded><![CDATA[<p>This project will focus on Sonar Cloud as a Code Quality Assurance tool that collects and analyzes source code, and provide report on the code quality of the project. This process is achieved by integrating sonar cloud plugins into pom.xml and running the mvn package command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wbEzqZMNa2MWvM6qys_h3g.jpeg" /></figure><p>Launch an EC2 instance name — Maven Build Server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i2lC6QVkDZ01GoYxFBslNw.png" /></figure><p>Download Maven from the website. Using the command <strong>wget </strong><a href="https://dlcdn.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.zip"><strong>https://dlcdn.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.zip</strong></a><strong>. </strong>After which you unzip the file using the command<strong> unzip apache-maven-3.8.4-bin.zip. </strong>Once you are done head to the apache-maven-3.8.4 dir using the command<strong> — cd apache-maven-3.8.4/. </strong>When you are in the folder go to bin dir with the command<strong> cd bin/. </strong>In the bin dir is where you will see <strong>mvn</strong> dir which will be use for the build process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_mP-tGgyIUVxdMChchA7OQ.png" /></figure><p>Before we move on with the build process the JDK application have to be download and installed with the command <strong>yum search Java. </strong>Once the search is done look for<strong> Java-1.8.0-openjdk-devel </strong>for the implementation of the java platform and install application with the command <strong>yum install java-1.8.0-openjdk-devel.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AwDIDq886yL5Y6-yzkjMZw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bN6ciOCEvFxJcBOI2Vu5Zg.png" /></figure><p>After the Java installation is done verify with the command <strong>java — — version </strong>to check for the JDK version which will be used for the project and also using the command <strong>./mvn — — version</strong> to check for the maven version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lb0XjkJxN0IBwqmXIvCf2w.png" /></figure><p>Now that we have that out of the way. We will move on to GIT as a version control for Pulling and Pushing codes to remote repo and into our local repo. We will install Git with the command <strong>yum install git -y. </strong>After which I will pull the code from bitbucket by cloning the java source code from the remote repo. In my case the remote repo I will be pulling my java source code from is Bitbucket with the command<strong> git clone + URL of the remote report</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R-T3p5jU2TS1C1mbNTIQBQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uoSbLLWdYQgHR-1x3nXI6Q.png" /></figure><p>After the java source code have been pulled from the remote repo. The next step is to initiate the build process with the command <strong>/opt/apache-maven-3.8.4/bin/mvn package. </strong>My build failed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hqruB5mRohJffNOFPPhKAQ.png" /></figure><p>My build failed because the build process has to be initiated in the java source code dir where pom.xml file is using the command <strong>/opt/apache-maven-3.8.4/bin/mvn package.</strong> After running running the build in the java dir the<strong> Build was SUCCESSFULL.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mv10YntxoiMx_LhWfkr6rg.png" /></figure><p>Once the build process is done. You can now see in the target folder the artifact type <strong>.jar</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5_7HIsT3R6oyM7RnsolIYA.png" /></figure><p>After the build process is done and build is <strong>SUCCESSFUL</strong>. The next step is to launch Sonar cloud for continuous code quality and code security. Go to the website — <a href="https://sonarcloud.io/">https://sonarcloud.io/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z6dJxNPsqTdqx2MKf5IEqw.png" /></figure><p>When you login to the Sonar Cloud — Create an <strong>organization manually</strong>. An organization is a space where team or a whole company can collaborate across many project. My organization is <strong>mensahcloudproject</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WuQfXBZSTPD3bUwjTF8Xug.png" /></figure><p>After creating an organization. Go ahead and create a project that will analyze your code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1PHkLcMnwFucceVGc3e1Jw.png" /></figure><p>After the project is done. Select the <strong>analysis method</strong> for the build. In my case is Maven.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sVo6MWGqEfv8lqYVtnR0vA.png" /></figure><p>After letting Maven as analysis method for the build. The next is Sonar Cloud shows you the configure plugins and steps on how to integrate the plugins into pom.xml.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TDjhHSrdvkuQYjp-JeGFOQ.png" /></figure><p>First we will use the command <strong>export </strong>for<strong> </strong>Configuring the <strong>SONAR_TOKEN</strong> environment variable and add the environment value and press ENTER.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eXYbyq7iXH4gojvAFhQGAg.png" /></figure><p>Update pom.xml file with the following <strong>Environment values plugins</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7WMe-hjU62qiDwJgtNoOwg.png" /></figure><p>After adding the plugins to the properties section in the pom.xml file with the Vim editior with command <strong>vi pom.xml</strong>. Run the command in the project folder in the terminal with the command <strong>/opt/apache.-maven-3.8.4/bin/mvn mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=mensahcloudprojectmaven</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FwiZCOJZ5anprKeGTTeDXQ.png" /></figure><p>The Build process FAILED after integrating Sonar Cloud environment values to running for code quality. The build failed because the version of the Java Run time only recognizes class file versions mean that Sonar Cloud is not compatible with JDK 1.8.0 is compatible with JDK 11</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9tgEIvMyV_rpjnXMhV5QNw.png" /></figure><p>Removing Java JDK with command <strong>yum remove Java-1.8.0 openjdk* </strong>and install the JDK 11<strong> </strong>Using the command a<strong>mazon-linux-extras install java-openjdk11 </strong>and looking the JDK 11</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TzViZgmkSbM5VLg2VjREkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FLohqutXklKrjEXBm8wVww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UQrdDpKk42tia2Ca42Vb1g.png" /></figure><p>After JDK 11 is install. We run the sonar cloud integration again. Build process integrated was SUCCESSFULL</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v2m-VWaJvzWeVFl0s1CatA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ceapt2ycS7AcLOhNKI3FHA.png" /></figure><p>After integrating Sonar Cloud into pom.mxl and the build process been successful. I will head over to my Sonar Cloud console to check and review the analysis base on the code check and code quality As you can see in the report with a green A meaning the code has no bug, code smells, no vulnerabilities etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5fAv9QNR5lKuHjNTGaKAwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MxJ9cCInuggkCBLknoitSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LkHmnyz6MWwmJvzGhg-Ueg.png" /></figure><p>Conclusion — Sonar Cloud is a good tool to use for continuous checking for code quality and code security.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee61ca52d2b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTML based static web application on AWS EC2.]]></title>
            <link>https://m-kwasi99.medium.com/html-based-static-web-application-on-aws-ec2-2a76e93404cf?source=rss-4ac62243c8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a76e93404cf</guid>
            <dc:creator><![CDATA[Michael Mensah]]></dc:creator>
            <pubDate>Sun, 27 Feb 2022 05:49:32 GMT</pubDate>
            <atom:updated>2022-02-27T06:08:28.066Z</atom:updated>
            <content:encoded><![CDATA[<p>The goal of this project is to launch an Ec2 sever, configure the server into a webserver. Git pull html code from remote rep into your webserver and bam!! refresh browser to see website which is what you see on the right.</p><p>Step by step process below.</p><h4>Pre-Deployment</h4><p>Customize the application dependencies mentioned below on AWS EC2 instance and create the Golden AMI.</p><ol><li>AWS CLI</li><li>Install Apache Web Server</li><li>Install Git</li><li>Configure Apache to start automatically after the instance reboot.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/0*AijVeNoWsIMt1ZKq" /></figure><p>One — Launch an Ec2 instance.<br>Two — Configure instance into a webserver with command — yum install httpd -y<br>Three — Enable or start httpd with command — service httpd start<br>Four — Once the Apache httpd web page is up. copy the path /var/www/html/ to the root<br>Five — Install git with the command yum install git -y. Then git clone (PULL) your code from remote repo either BitBucket or GitHub to your webserver.<br>Six — Open the folder where the html path or pwd is and cp all the codes from code folder to the working dir location /var/www/html/ with the command cp -R ./* /var/www/html/<br>Seven — Bam!! refresh your httpd web page to see the website showing.</p><p>This ends my mini Saturday project with MensahCloud. Any tip or critique is welcome.</p><p>Honestly, I want to sincerely say thank you to everyone who stop by my page to read my mini projects. Am grateful and honored to share my post and your support. 🙏🏿</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a76e93404cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>