<?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 Ahmed Hosny on Medium]]></title>
        <description><![CDATA[Stories by Ahmed Hosny on Medium]]></description>
        <link>https://medium.com/@ahmed.hosny?source=rss-842c923d4543------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cgrx1-XE_PLoLXw34OHXCw@2x.jpeg</url>
            <title>Stories by Ahmed Hosny on Medium</title>
            <link>https://medium.com/@ahmed.hosny?source=rss-842c923d4543------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 03:16:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ahmed.hosny/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[Building a Software Development Home-Based Lab: A DevOps Automation Platform (Part-3: Integrate…]]></title>
            <link>https://medium.com/@ahmed.hosny/building-a-software-development-home-based-lab-a-devops-automation-platform-part-3-integrate-e4721e6892c3?source=rss-842c923d4543------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4721e6892c3</guid>
            <category><![CDATA[homelab]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[cicd]]></category>
            <dc:creator><![CDATA[Ahmed Hosny]]></dc:creator>
            <pubDate>Sun, 30 Jul 2023 15:51:58 GMT</pubDate>
            <atom:updated>2023-07-30T15:51:58.006Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Software Development Home-Based Lab: A DevOps Automation Platform (Part-3: Integrate Jenkins &amp; Other Tools)</h3><h4>Part-3: Configure Jenkins &amp; Integrate with Other Tools</h4><p>In this guide, we will go through the following items:</p><ul><li>Jenkins General Configurations</li><li>Setup Gerrit Users in OpenLDAP</li><li>Jenkins and Gerrit Integration</li><li>Jenkins and SonarQube Integration</li><li>Jenkins and JFrog Artifactory Integration</li></ul><h4><strong>1. Jenkins General Configurations:</strong></h4><ul><li>Upgrade Jenkins to the latest version and restart:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OHTg_tRV0YA6o9ZSsMNK9Q.png" /><figcaption>SW-Lab Jenkins Home Page</figcaption></figure><ul><li>Configure Jenkins:</li></ul><p>— Click “Dashboard -&gt; Manage Jenkins -&gt; System”.</p><p>— Set System Admin e-mail address and save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fGLYNmBjmib57Qt6LHA1NA.png" /><figcaption>SW-Lab Jenkins System Admin Email</figcaption></figure><p>- Update Jenkins Admin User Details.</p><p>- Click “Dashboard -&gt; People -&gt; admin -&gt; Configure”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4XQDLx2V7PxsEd1C3ySaZQ.png" /><figcaption>SW-Lab Jenkins Admin Configurations</figcaption></figure><ul><li>Setup Email Notification Plugins and Configurations:</li></ul><p>— Install Mailer Plugins — “Dashboard -&gt; Manage Jenkins -&gt; Plugins”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*olPT-718OUQ9LNp2pi3I8w.png" /><figcaption>SW-Lab Jenkins Email Plugins</figcaption></figure><p>— Configure Email Notification — “Dashboard -&gt; Manage Jenkins -&gt; System”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RaU-TL0M2SmKG-05FN7rcg.png" /><figcaption>SW-Lab Jenkins Email Notifications</figcaption></figure><p>— Verify Test configuration by sending test email.</p><p>— Login into Mailcow Web using Test email recipient and verify email has been sent/received by Jenkins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZD_lc6A0aHmlKT0CegZ63g.png" /><figcaption>SW-Lab Jenkins: Verify Test Email</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y2bUEM_glQGs20LrI-jixw.png" /><figcaption>SW-Lab Jenkins: Test Email</figcaption></figure><ul><li>Configure Git &amp; Maven Tools:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*arkNABq37Okuhsq5H2DBeA.png" /><figcaption>SW-Lab Jenkins: Configure Git</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V6t6v9AiQ7z6gMRhjLxyvw.png" /><figcaption>SW-Lab Jenkins: Configure Maven</figcaption></figure><h4><strong>2. Setup Gerrit Users in OpenLDAP:</strong></h4><ol><li>Configure Gerrit Users in OpenLDAP:</li></ol><ul><li>Open OpenLDAP Web <a href="http://ldapweb.swlab.local/">http://ldapweb.swlab.local/</a></li><li>Click “login” and enter “cn=admin,dc=example,dc=org” for the “Login DN” and then “ldappassword” password as set in docker-compose file for admin user.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jm2LjWcm6yx1pbNI4cURKw.jpeg" /><figcaption>SW-Lab OpenLDAP Login Page</figcaption></figure><ul><li>Click the domain from left side tree and then create child entry.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o19SYVgppBxdFPjQjuUxDw.jpeg" /><figcaption>SW-Lab OpenLDAP: Courier Mail Account</figcaption></figure><ul><li>Select “Courier Mail: Account” template to create user and enter user details.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IfsAYhUrOQp5WFBb2i8xkA.jpeg" /><figcaption>SW-Lab OpenLDAP: User Account Details</figcaption></figure><ul><li>Commit to save the new created user.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NiO6z4Pwe8gU_4sukodaUg.jpeg" /><figcaption>SW-Lab OpenLDAP: Save User</figcaption></figure><ul><li>Repeat the steps above to create the following users and make sure to create corresponding user emails in Mailcow:</li></ul><p>— Gerrit Admin User “gerrit.admin@swlab.local”</p><p>— Jenkins Gerrit User “jenkins.gerrit@swlab.local”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ku4S0zvBH7xi92wyfi_DiA.png" /><figcaption>SW-Lab OpenLDAP: Add Jenkins &amp; Gerrit Users</figcaption></figure><ul><li>Now, let’s try login to Gerrit <a href="http://gerrit.swlab.local/">http://gerrit.swlab.local/</a> using admin user “gerrit.admin” or “admin” has been created in OpenLDAP as Gerrit will set the first login user as the system admin that is very important to consider.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KFe_4R9eR8_f16rpPkhORQ.jpeg" /><figcaption>SW-Lab Gerrit Login Page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aiIF-6JqqsYHEiVv8ZbLtQ.png" /><figcaption>SW-Lab Gerrit Admin User Settings</figcaption></figure><p>2. Verify “ahosny” user created in OpenLDAP and test repository access:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5fCE-3FKpyzHCq1B4HbqQA.jpeg" /><figcaption>SW-Lab Gerrit Login Page “user:ahosny”</figcaption></figure><ul><li>After successful login using “ahosny” user, click on the user avatar on the right side of the page and select Settings to see user’s details.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aOAY8C2un310YN2DRl5TKg.jpeg" /><figcaption>SW-Lab Gerrit Home Page</figcaption></figure><ul><li>User settings page in Gerrit showing user’s details from OpenLDAP.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gpxxZs0BiI7LPn20yceWzQ.jpeg" /><figcaption>SW-Lab Gerrit “ahosny” User Settings</figcaption></figure><ul><li>Configure Git and generate ssh key for your development environment.</li></ul><pre># Configure Git<br>$ git config - global user.email &quot;ahmed.hosny@swlab.local&quot;<br>$ git config - global user.name &quot;ahosny&quot;<br># Generate ssh key<br>$ ssh-keygen -t rsa -C &quot;ahmed.hosny@swlab.local&quot;<br># Copy the ssh public key and save it in Gerrit for your user<br>$ cat ~/.ssh/id_rsa.pub</pre><ul><li>Save your public key in Gerrit “User -&gt; Settings -&gt; SSH Keys”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gs74u_b3Q_Cioi5b3vPVHw.png" /><figcaption>SW-Lab Gerrit: Add SSH Key</figcaption></figure><ul><li>Check and test clone repository for “ALL-Projects” repository: “$git clone “http://ahosny@gerrit.swlab.local/a/All-Projects&quot;.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HmZPM_22Xr9lSD7SyWNHXQ.jpeg" /><figcaption>SW-Lab Gerrit: Clone All-Projects</figcaption></figure><h4><strong>3. Jenkins and Gerrit Integration</strong></h4><p>1. Install Gerrit Plugins (Gerrit Trigger and Sonar Gerrit Plugin):</p><ul><li>Click “Dashboard -&gt; Manage Jenkins -&gt; Plugins” and enter “Gerrit”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1g8cm1NSoaczcTN9K9k39Q.png" /><figcaption>SW-Lab Jenkins Gerrit Plugins</figcaption></figure><ul><li>Verify Gerrit Trigger plugin installed under “Dashboard -&gt; Manage Jenkins”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dxkQtYhjR7odLKc5tbLdDA.png" /><figcaption>SW-Lab Jenkins Gerrit Trigger</figcaption></figure><p>2. Configure Gerrit Trigger Plugin:</p><ul><li>Click “Dashboard -&gt; Manage Jenkins -&gt; Gerrit Trigger”.</li><li>Click “Add New Server i.e., gerrit-server” and select “Gerrit Server with Default Configuration” option then continue.</li><li>Enter following “Gerrit Connection Setting” fields:</li></ul><p>— Name: gerrit-server</p><p>— Hostname: gerrit.swlab.local</p><p>— Frontend URL: <a href="http://gerrit.swlab.local/">http://gerrit.swlab.local/</a></p><p>— SSH Port: 29418</p><p>— Username: jenkins.gerrit</p><p>— E-mail: jenkins.gerrit@swlab.local</p><p>— SSH Keyfile: /root/.ssh/id_rsa</p><p>— Click “Advanced -&gt; REST API -&gt;</p><p>— Check “Use REST API”</p><p>— Enter “jenkins.gerrit” for Gerrit HTTP Username”</p><p>— Test REST Connection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eBHSeZyAtw5c0FS_LagVnw.png" /><figcaption>SW-Lab Jenkins Gerrit Trigger: Add Gerrit Connection</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fkKs-Avf7ukFebql6Xc2Qw.png" /><figcaption>SW-Lab Jenkins Gerrit Trigger: Gerrit Server Test Connection</figcaption></figure><ul><li>Note: SSH Keyfile is the ssh private key of Jenkins that you need to generate it inside the container as the root user.</li><li>Save the changes and will be directed to “Dashboard -&gt; Gerrit Trigger” and you will find your “gerrit-server” is listed under “Gerrit Servers”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gCedqAtTqXawVr14c50Ojg.png" /><figcaption>SW-Lab Jenkins Gerrit Trigger: Gerrit Server</figcaption></figure><p>3. Test Gerrit Server Connection</p><ul><li>Click “Dashboard -&gt; Trigger a Gerrit event manually -&gt; Select Gerrit Server and Search”.</li><li>If you have Pachset available in Gerrit, then it will be returned in the search table with Patchset details.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PyCnkSVbkjql8AVrQYba7A.png" /><figcaption>SW-Lab Jenkins Gerrit Trigger: Gerrit Server Changes</figcaption></figure><h4><strong>4. Jenkins and SonarQube Integration</strong></h4><p>1- Install SonarQube and Sonar Scanner Plugins:</p><p>— Install SonarQube Plugins — “Dashboard -&gt; Manage Jenkins -&gt; Plugins”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wtFO2rb7ZwkAaeYkUBihug.png" /><figcaption>SW-Lab Jenkins SonarQube Plugins</figcaption></figure><p>2. Add SonarQube Scanner “Dashboard -&gt; Manage Jenkins -&gt; Tools”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UEl9kr7mtMOXXJrybhTufw.png" /><figcaption>SW-Lab Jenkins SonarQube: Add SonarQube Scanner</figcaption></figure><p>3. Create an access token for Jenkins in SonarQube.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jyNXQ-PpcWdT4f-ncttrLg.png" /><figcaption>SW-Lab SonarQube: Generate Access Token</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-sbM66LaS2y-Aa7cs6wByQ.png" /><figcaption>SW-Lab SonarQube: Access Token</figcaption></figure><p>4. Create credentials for SonarQube access token in Jenkins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f6IdrtM5uDBxQMSlZfugBQ.png" /><figcaption>SW-Lab Jenkins Credentials</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r8eXsK9GrMKx-Ec8Jzx0Dw.png" /><figcaption>SW-Lab Jenkins Credentials: Global credentials</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rW2XfCng-AAxvmCE9wjU4g.png" /><figcaption>SW-Lab Jenkins Credentials: SonarQube new credentials</figcaption></figure><p>5. Add SonarQube Server in Jenkins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zgJXBcMp4Rw75JWH8AgvjQ.png" /><figcaption>SW-Lab Jenkins SonarQube: Add SonarQube Server</figcaption></figure><h4><strong>5. Jenkins and JFrog Artifactory Integration</strong></h4><ol><li>Create an access token for Jenkins in JFrog Artifactory.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZHj49oGim0pXfKvdo6-7cw.png" /><figcaption>SW-Lab Jenkins JFrog Artifactory: Generate Access Token</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6WS4Xx6L3f-oHe1bRpT47g.png" /><figcaption>SW-Lab Jenkins JFrog Artifactory: Generate Access Token Details</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ypwXnwRctyEBYC38DACOcA.png" /><figcaption>SW-Lab Jenkins JFrog Artifactory: Access Token</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mm-GZu8pKjDhxh6ulQNaEg.png" /><figcaption>SW-Lab Jenkins JFrog Artifactory: Access Tokens</figcaption></figure><p>2. Create credentials for JFrog Artifactory access token in Jenkins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U3Ijmm5ip4qrJCsgsPYV-Q.png" /><figcaption>SW-Lab Jenkins Credentials: JFrog Artifactory new credentials</figcaption></figure><p>3. Configure JFrog Platform Instance in Jenkins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u3AtaeDQwupiuI_SYXxeTw.png" /><figcaption>SW-Lab Jenkins JFrog Artifactory: Add JFrog Platform</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xFxyy7Gf6RHGANMRALoxTQ.png" /><figcaption>SW-Lab Jenkins JFrog Artifactory: JFrog Platform Advanced Configurations</figcaption></figure><p>4. Test Connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nG_sEiQTpBktB-sqM_oPOw.png" /><figcaption>SW-Lab Jenkins JFrog Artifactory: JFrog Platform Test Connection</figcaption></figure><h4>End of Part-3 and SW-Lab Configuration Completed.</h4><p>Congratulations! By reaching this section, it means we have successfully completed all the necessary lab configurations, and our SW-Lab environment is now ready for service.</p><blockquote>Next, Part-4: SW-Lab Recap and Highlights</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4721e6892c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Software Development Home-Based Lab: A DevOps Automation Platform (Part-2: Setup Gerrit…]]></title>
            <link>https://medium.com/@ahmed.hosny/building-a-software-development-home-based-lab-a-devops-automation-platform-part-2-setup-gerrit-7a46b569b29?source=rss-842c923d4543------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a46b569b29</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[gerrit]]></category>
            <category><![CDATA[cicd-pipeline]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[homelab]]></category>
            <dc:creator><![CDATA[Ahmed Hosny]]></dc:creator>
            <pubDate>Wed, 26 Jul 2023 19:57:00 GMT</pubDate>
            <atom:updated>2023-07-26T19:57:00.731Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Software Development Home-Based Lab: A DevOps Automation Platform (Part-2: Setup Gerrit, Jenkins, SonarQube &amp; JFrog Artifactory)</h3><h4><strong>Part-2: Setup and configure software development tools.</strong></h4><p>In this guide, we will go through the following items:</p><ul><li>Setup Gerrit with MySQL and OpenLDAP using Docker Compose.</li><li>Setup Jenkins and SonarQube using Docker Compose</li><li>Setup JFrog Artifactory using Docker.</li></ul><h4><strong>1. Setup Gerrit with MySQL and OpenLDAP using Docker Compose:</strong></h4><p>1. Login into “scms.swlab.local”:</p><pre># Login using docker user<br>$ ssh docker@192.168.1.24</pre><p>2. Create the required mount directories for the docker containers:</p><pre># Create a base directory for persisting containers data<br>$ sudo mkdir /data/<br># Create directory(s) for docker-compose.yaml file<br>$ sudo mkdir -p /data/docker/scms.swlab.local<br># Create docker-compose.yaml file<br>$ sudo touch /data/docker/scms.swlab.local/docker-compose.yaml</pre><p>3. Copy docker-compose contents below to the docker-compose.yaml file:</p><pre>version: &#39;3&#39;<br>services:<br>  gerrit-db-svc:<br>    image: &#39;mysql:5.7&#39;<br>    hostname: gerritdb<br>    container_name: gerritdb-container<br>    networks:<br>      default:<br>         aliases:<br>           - gerritdb<br>           - gerritdb.swlab<br>           - gerritdb.swlab.local<br>    ports:<br>      - &#39;3306:3306&#39;<br>    restart: unless-stopped<br>    volumes:<br>      - /data/gerritdb/mysql:/var/lib/mysql<br>    environment:<br>     - MYSQL_ROOT_PASSWORD=dbrootpassword<br>  ldap-svc:<br>    image: osixia/openldap<br>    hostname: ldap<br>    container_name: ldap-container<br>    networks:<br>      default:<br>        aliases:<br>          - ldap<br>          - ldap.swlab<br>          - ldap.swlab.local<br>    ports:<br>      - &#39;389:389&#39;<br>      - &#39;636:636&#39;<br>    restart: unless-stopped<br>    environment:<br>      - LDAP_ADMIN_PASSWORD=ldappassword<br>    volumes:<br>      - /data/ldap/var:/var/lib/ldap<br>      - /data/ldap/etc:/etc/ldap/slapd.d<br>  ldap-web-svc:<br>    image: osixia/phpldapadmin<br>    hostname: ldapweb<br>    container_name: ldapweb-container<br>    networks:<br>      default:<br>        aliases:<br>          - ldapweb<br>          - ldapweb.swlab<br>          - ldapweb.swlab.local<br>    ports:<br>      - &#39;8082:80&#39;<br>    restart: unless-stopped<br>    environment:<br>      - PHPLDAPADMIN_LDAP_HOSTS=ldap<br>      - PHPLDAPADMIN_HTTPS=false<br>  gerrit-svc:<br>    depends_on:<br>      - ldap-svc<br>      - gerrit-db-svc<br>    image: gerritcodereview/gerrit<br>    hostname: gerrit<br>    container_name: gerrit-container<br>    networks:<br>      default:<br>        aliases:<br>          - gerrit<br>          - gerrit.swlab<br>          - gerrit.swlab.local<br>    links:<br>      - gerrit-db-svc<br>    ports:<br>      - &#39;29418:29418&#39;<br>      - &#39;8080:8080&#39;<br>    restart: unless-stopped<br>    user: root<br>    volumes:<br>      - /data/gerrit/etc:/var/gerrit/etc<br>      - /data/gerrit/git:/var/gerrit/git<br>      - /data/gerrit/index:/var/gerrit/index<br>      - /data/gerrit/cache:/var/gerrit/cache<br>    environment:<br>      - DATABASE_TYPE=mysql<br>      - DATABASE_HOSTNAME=gerritdb<br>      - DATABASE_PORT=3306<br>      - DATABASE_DATABASE=gerrit<br>      - DATABASE_USERNAME=gerrit<br>      - DATABASE_PASSWORD=ggrrit<br>      - CANONICAL_WEB_URL=http://gerrit.swlab.local/</pre><p>4. Setup Gerrit Database (MySQL).</p><pre># Start mysql database service first<br>$ docker-compose up -d gerrit-db-svc<br># Login to gerritdb-container by container name<br># &#39;docker container ls&#39; will show all running containers<br>$ docker exec -it gerritdb-container /bin/bash<br># Enter mysql console with root user<br>$ mysql -u root -p<br># Create gerrit database user<br>$ mysql&gt; CREATE database gerrit DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;<br># Grante all privilege to gerrit database user<br>$ mysql&gt; grant all privileges on gerrit.* to gerrit@&#39;%&#39; identified by &#39;gerrit&#39;;<br># Flush privileges<br>$ mysql&gt; flush privileges;<br># Adjust mysql timestamp<br>$ mysql&gt; set global explicit_defaults_for_timestamp=1;<br># List databases<br>$ mysql&gt; show databases;<br># Exist mysql and the container bash<br>$ mysql&gt; exit</pre><p>5. Start Gerrit.</p><pre># Start remaining docker-compose services in daemon mode<br>$ docker-compose up -d<br># Check docker containers are up and running<br>$ docker container ls<br># Check gerrit container logs<br>$ docker logs -f gerrit-container<br># Logs should indicate gerrit started successfully<br>-&gt; &quot;Gerrit Code Review 3.5.0.1 ready&quot;<br># Now you should have gerrit directories and files mounted to the docker host virtual machine<br># Directories should be located under &quot;/data/gerrit/…&quot; as defined in the docker-compose file</pre><p>6. Configure Gerrit.</p><pre># Edit gerrit.config file<br>$ sudo vi /data/gerrit/etc/gerrit.config<br># We will add/update following sections:<br>1- update [auth] to make gerrit use ldap for authontication<br>2- update [httpd] to listen on traffic on http://*:8080<br>2- add [ldap] ldap server configuration details<br>3- add [database] to make gerrit use mysql database<br>4- add [email] configuration section<br>################################################################<br>[auth]<br>type = ldap<br>gitBasicAuth = true<br>[ldap]<br>server = ldap://ldap<br>username=cn=admin,dc=example,dc=org<br>accountBase = dc=example,dc=org<br>accountPattern = (&amp;(objectClass=person)(uid=${username}))<br>accountFullName = displayName<br>accountEmailAddress = mail<br>[database]<br>type = mysql<br>port = 3306<br>hostname = gerritdb<br>database = gerrit<br>username = gerrit<br>[httpd]<br>listenUrl = http://*:8080/<br>################################################################<br># Edit secure.config file to add ldap and mysql user password<br>$ sudo vi /data/gerrit/etc/secure.config<br># Add following lines to the file<br>################################################################<br>[ldap]<br>password = ldappassword<br>[database]<br>password = gerrit<br>################################################################<br># Stop and start services<br>$ docker-compose down<br>$ docker-compose up -d</pre><p>7. Test Gerrit <a href="http://gerrit.swlab.local/">http://gerrit.swlab.local/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8tAMdEzCF4cqG5EWf_SgXQ.jpeg" /></figure><ul><li>Click “Sign in” on the right side of the Gerrit home page to login.</li><li>You will be redirected to “Sign in” page that is actually using OpenLDAP for user’s authentication.</li><li>If you can see “Sign in” page below, then Gerrit is configured successfully to use OpenLDAP as authentication provider.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KFe_4R9eR8_f16rpPkhORQ.jpeg" /></figure><ul><li>Now, Gerrit and OpenLDAP are all set. Congratulations!</li></ul><h4><strong>2. Setup Jenkins and SonarQube using Docker Compose:</strong></h4><ol><li>Login into “cicd.swlab.local”.</li></ol><pre># Login using docker user<br>$ ssh docker@192.168.1.26</pre><p>2. Create the required directories for the docker containers.</p><pre># Create a base directory for persisting containers data<br>$ sudo mkdir /data/<br>$ sudo mkdir -p /data/sonarqube/{conf,logs,data,extensions}<br>$ sudo chmod 777 -R /data/sonarqube/<br># Create directory(s) for docker-compose.yaml file<br>$ sudo mkdir -p /data/docker/cicd.swlab.local<br># Create docker-compose.yaml file<br>$ sudo touch /data/docker/cicd.swlab.local/docker-compose.yaml</pre><p>3. Setup Postgres:9.5 for SonarQube.</p><pre># Create a base directory for persisting postgresql data<br>$ mkdir -p /data/sonarqube/postgresql/{data,logs,conf}<br>$ chmod 777 -R /data/sonarqube/postgresql/<br># Set &quot;vm.max_map_count&quot; parameter for SonarQube<br>$ echo &quot;vm.max_map_count=262144&quot; &gt; /etc/sysctl.conf<br>$ sysctl -p<br># Do below steps for troubleshooting<br>$ docker run -d - name sonarqube-container -p 9000:9000 sonarqube:7.4-community<br>$ sudo docker cp sonarqube-container:/opt/sonarqube/conf /data/sonarqube<br>$ sudo docker cp sonarqube-container:/opt/sonarqube/data /data/sonarqube<br>$ sudo docker cp sonarqube-container:/opt/sonarqube/logs /data/sonarqube<br>$ sudo docker cp sonarqube-container:/opt/sonarqube/extensions /data/sonarqube<br>$ sudo docker rm -f sonarqube-container</pre><p>4. Copy docker-compose contents below to docker-compose.yaml file for installing Jenkins and SonarQube.</p><pre>version: &#39;3&#39;<br>services:<br>  jenkins-svc:<br>    image: &#39;jenkins/jenkins:latest&#39;<br>    hostname: jenkins<br>    container_name: jenkins-container<br>    user: root<br>    networks:<br>      default:<br>         aliases:<br>           - jenkins<br>           - jenkins.swlab<br>           - jenkins.swlab.local<br>    ports:<br>      - &#39;8080:8080&#39;<br>      - &#39;50000:50000&#39;<br>    restart: unless-stopped<br>    volumes:<br>      - /data/jenkins_home:/var/jenkins_home<br>    environment:<br>     - JAVA_OPTS=-Dhudson.remoting.ClassFilter=com.google.gerrit.extensions.common.AvatarInfo,com.google.gerrit.extensions.common.ReviewerUpdateInfo<br>  sonarqube-svc:<br>    image: sonarqube:community<br>    hostname: sonarqube<br>    container_name: sonarqube-container<br>    networks:<br>      default:<br>         aliases:<br>           - sonarqube<br>           - sonarqube.swlab<br>           - sonarqube.swlab.local<br>    depends_on:<br>      - sonarqube-db-svc<br>    ports:<br>      - &#39;9000:9000&#39;<br>    restart: unless-stopped<br>    environment:<br>      SONAR_JDBC_URL: jdbc:postgresql://sonarqubedb:5432/sonar<br>      SONAR_JDBC_USERNAME: sonar<br>      SONAR_JDBC_PASSWORD: sonar<br>    volumes:<br>      - /data/sonarqube/data:/opt/sonarqube/data<br>      - /data/sonarqube/extensions:/opt/sonarqube/extensions<br>      - /data/sonarqube/logs:/opt/sonarqube/logs<br>  sonarqube-db-svc:<br>    image: postgres:12<br>    hostname: sonarqubedb<br>    container_name: sonarqubedb-container<br>    networks:<br>      default:<br>         aliases:<br>           - sonarqubedb<br>           - sonarqubedb.swlab<br>           - sonarqubedb.swlab.local<br>    restart: unless-stopped<br>    environment:<br>      POSTGRES_USER: sonar<br>      POSTGRES_PASSWORD: sonar<br>    volumes:<br>      - /data/sonarqube/postgresql:/var/lib/postgresql<br>      - /data/sonarqube/postgresql_data:/var/lib/postgresql/data</pre><p>5. Test and verify Jenkins installation.</p><ul><li>Open Jenkins <a href="http://jenkins.swlab.local/">http://jenkins.swlab.local/</a></li><li>You will be asked to unlock Jenkins by providing the initial admin password.</li><li>Run following command to get the password from Jenkins docker container.</li></ul><pre>$ docker exec -it jenkins-container cat /var/jenkins_home/secrets/initialAdminPassword</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aJvgph5SIoR9Cktap2GI2w.jpeg" /></figure><ul><li>Customize Jenkins configurations.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pg2nDnzz9Y2cx7-lZD08EQ.jpeg" /></figure><ul><li>Select “Install suggested plugins”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fJplUWiRKPdT6H9l7G1xEQ.jpeg" /></figure><ul><li>Create admin user.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u4v_eUhIyYyD7Cd3P8nMaA.jpeg" /></figure><ul><li>Configure Jenkins URL.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J-n8IsjAcLZ-zGYTN37iuA.jpeg" /></figure><ul><li>Jenkins home page.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EmuVGt4mrw6H62P5LYr0yA.jpeg" /></figure><ul><li>After installations you may be asked to upgrade Jenkins to latest version.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*amodepEMJtb02RiZPbZyiw.jpeg" /></figure><p>6. Test and verify SonarQube installation.</p><ul><li>Open SonarQube <a href="http://sonarqube.swlab.local/">http://sonarqube.swlab.local/</a></li><li>Enter the default username and password “admin/admin”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2A0mzBl0SsfHMbEaOXra9w.jpeg" /></figure><ul><li>SonarQube home page.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4vRvlthPNpwDYWvWGI-XtQ.jpeg" /></figure><h4>1. Setup JFrog Artifactory using Docker:</h4><pre># Using the root user<br># Set the JFrog Home environment variable<br>$ export JFROG_HOME=/data/jfrog_home<br># Create JFrog directories<br>$ mkdir -p $JFROG_HOME/artifactory/var/etc/<br>$ cd $JFROG_HOME/artifactory/var/etc/<br>$ touch ./system.yaml<br>$ chown -R 1030:1030 $JFROG_HOME/artifactory/var<br>$ chmod -R 777 $JFROG_HOME/artifactory/var<br># Create jfrog artifactory docker container using docker user<br>$ docker run - name artifactory -v $JFROG_HOME/artifactory/var/:/var/opt/jfrog/artifactory -d - restart unless-stopped -p 8081:8081 -p 8082:8082 releases-docker.jfrog.io/jfrog/artifactory-oss:latest</pre><p>— Test and verify JFrog Artifactory installation.</p><ul><li>Open JFrog Artifactory <a href="http://artifactory.swlab.local/">http://artifactory.swlab.local/</a></li><li>You will be asked to update default password “admin/password”.</li><li>Update the default password and save.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k0UFNgulWxzmYNcmlBWHIQ.jpeg" /></figure><ul><li>JFrog Artifactory welcome page</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Eo4E2HT9k5MUGN7GwIKXnA.jpeg" /></figure><ul><li>JFrog Artifactory Base URL.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lKoO6D6xghcLKLInqn88TQ.jpeg" /></figure><ul><li>Skip default proxy configuration.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1rhmHUq2r8MvkXxhTvzMQw.jpeg" /></figure><ul><li>Finish configuration.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_XtzQfeypk-1NI6YmftqBQ.jpeg" /></figure><ul><li>JFrog Artifactory home page.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Y7CZalOrCq0OGPkJIXzVg.jpeg" /></figure><ul><li>Now, Jenkins, SonarQube and JFrog Artifactory are all set. Congratulations!</li></ul><blockquote>Next, Part-3: Integrate Jenkins &amp; DevOps (CI/CD) tools.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a46b569b29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Software Development Home-Based Lab: A DevOps Automation Platform (Part-1: Setup VMs, OS…]]></title>
            <link>https://medium.com/@ahmed.hosny/building-a-software-development-home-based-lab-a-devops-automation-platform-part-1-setup-vms-os-ae49b2b02475?source=rss-842c923d4543------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae49b2b02475</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cicd-tools]]></category>
            <category><![CDATA[gerrit]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[homelab]]></category>
            <dc:creator><![CDATA[Ahmed Hosny]]></dc:creator>
            <pubDate>Sun, 23 Jul 2023 15:54:22 GMT</pubDate>
            <atom:updated>2023-07-23T15:54:22.904Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Software Development Home-Based Lab: A DevOps Automation Platform (Part-1: Setup VMs, OS and Infrastructure Software)</h3><h4>Part-1: Setup VMs, OS and Infrastructure Software</h4><p>In this guide, we will go through the following items:</p><ul><li>Setup Environments (VMs)</li><li>Setup DNS Server (Bind9)</li><li>Setup Containers Platform</li><li>Setup Mail Server (Mailcow)</li><li>Setup Reverse Proxy Server (Nginx)</li><li>Setup Containers Management and Monitoring (Portainer)</li></ul><h3><strong>1. Setup Environments (VMs)</strong></h3><ul><li>Download and install [Oracle VirtualBox] (https://www.virtualbox.org/)</li><li>Download Linux distribution [CentOS Stream] (https://www.centos.org/)</li></ul><h4>— Virtual machines sample configurations:</h4><ul><li>Processor: 1 or 2</li><li>Memory: 2 to &lt; 6 GB</li><li>Network: Bridged Adaptor</li><li>Storage: Dynamically Allocated</li><li>Operating System: CentOS Stream</li></ul><blockquote><strong><em>Note: About CentOS</em></strong></blockquote><blockquote>I am currently utilizing CentOS Stream version 8.x obtained from osboxes.org, which provides pre-configured Linux/Unix virtual machines (VDIs) for Oracle VirtualBox. These virtual images are readily available for download and can be easily attached to a virtual machine. Alternatively, you can visit the official Linux (CentOS) distribution website to obtain the CentOS image in various formats and set it up according to your preference. Please refer also to [CentOS Stream] (https://www.centos.org/centos-stream/) for converting from CentOS Linux 8 to CentOS Stream 8. CentOS Linux 8 reached its End of Life (EOL) on December 31st, 2021, and has been replaced by the new CentOS Stream.</blockquote><h4>— Set static IPs for the virtual machines:</h4><p><strong><em>Method#1:</em></strong> Modifying the interface configuration file manually:</p><ul><li>For each network interface created and managed by NetworkManager, a configuration file is created inside “/etc/sysconfig/network-scripts” directory, the name of the file should start with ifcfg- then the network interface name for example ‘enp0s3’. Login as the root user and modify the interface configuration file as following by setting your IP Address, Prefix, Gateway and DNS configurations:</li></ul><pre>$ vi /etc/sysconfig/network-scripts/ifcfg-enp0s3<br>##################UPDATE########################<br>BOOTPROTO=none<br>IPADDR=192.168.1.X<br>PREFIX=24_**<br>GATEWAY=192.168.1.1<br>DNS1=192.168.1.36 // Local DNS Server IP<br>DNS2=X.X.X.X // Home network DNS Server IP</pre><ul><li>Save the changes and restart NetworkManager.</li></ul><pre>$ systemctl restart NetworkManager</pre><p><strong><em>Method#2:</em></strong> Using NetworkManager user interface to edit the connection:</p><ol><li>Login as the root user.</li><li>Run the command <strong><em>“$ nmtui”.</em></strong></li><li>NetworkManager TUI -&gt; Edit a connection.</li><li>Ethernet -&gt; Select Interface i.e., enp0s3 -&gt; Then Edit.</li><li>Set IP Address, Gateway and DNS servers as below screenshot.</li><li>Save changes and restart NetworkManager:</li></ol><pre>$ systemctl restart NetworkManager</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*wcb-G8lcPH4S8e8-a8fM_g.jpeg" /><figcaption>SW-Lab Edit Network Connection</figcaption></figure><h3>2. Setup <strong>DNS Server (Bind9)</strong></h3><ol><li>Install Bind DNS Server</li></ol><pre># Login as the root user<br>$ ssh root@192.168.1.36<br><br># Set the hostname for the DNS server<br>$ hostnamectl set-hostname dns.swlab.local<br><br># Update OS software packages<br>$ yum update -y<br><br># Install bind and configure named service<br>$ yum install bind bind-utils -y<br>$ systemctl start named<br>$ systemctl enable named<br>$ systemctl status named</pre><p>2. Configure DNS manually (<strong>Option#1</strong>)</p><ul><li>Configure name services:</li></ul><pre># Edit named.conf and do the following configuration<br># Change or Add lines between dotted-lines below - - in the named.conf file<br>$ vi /etc/named.conf<br># Configure bind to listen to server IP (dns.swlab.local:192.168.1.36); by default BIND listens to (localhost:127.0.0.1) only<br># Configure bind to allow to all IP addresses or hosts in the network to query DNS server for IP to name translation<br> - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br>listen-on port 53 { 127.0.0.1;192.168.1.36; };<br>allow-query { localhost;192.168.1.1/24; };<br> - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br># Create Forward zone &quot;swlab.local&quot;<br> - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br>zone &quot;swlab.local&quot; IN { // Domain name<br>type master; // Primary DNS<br>file &quot;/var/named/forward.swlab.local&quot;; // Forward lookup file<br>allow-update { none; }; // allow-update - Since this is the primary DNS, it should be none<br>};<br> - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br># Create Reverse Zone &quot;1.168.192.in-addr.arpa&quot;<br> - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br>zone &quot;1.168.192.in-addr.arpa&quot; IN { // 1.168.192.in-addr.arpa - Reverse lookup name<br>type master; // master - Primary DNS<br>file &quot;/var/named/reverse.swlab.local&quot;; // Reverse lookup file<br>allow-update { none; }; // Since this is the primary DNS, it should be none<br>};<br> - - - - - - - - - - - - - - - - - - - - - - - - - - - -</pre><ul><li>Create file Foward “forward.swlab.local”:</li></ul><pre>$ vi /var/named/forward.swlab.local<br>​ - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br>@ IN SOA dns.swlab.local dns.swlab.local. (<br>1033<br>3H<br>15M<br>1W<br>1D )<br>;Name Server Information<br>@ IN NS dns.swlab.local. ; NS : Name Server<br>dns.swlab.local. IN A 192.168.1.36 ; Pointer 192.168.1.36 to dns.swlab.local<br>scms.swlab.local. IN A 192.168.1.24 ; A - A Record ( SCMS Server )<br>cidcd.swlab.local. IN A 192.168.1.26 ; A - A Record ( CICD Server )<br>mail.swlab.local. IN A 192.168.1.20<br>swlab.local. IN MX 1 mail.swlab.local. ; MX - Mail for Exchange<br>ftp IN CNAME www.swlab.local. ; CNAME - Canonical Name<br>gerrit.swlab.local. IN A 192.168.1.24<br>ldapweb.swlab.local. IN A 192.168.1.24<br>ldap.swlab.local. IN A 192.168.1.24<br>jenkins.swlab.local. IN A 192.168.1.26<br>artifactory.swlab.local. IN A 192.168.1.26<br>sonarqube.swlab.local. IN A 192.168.1.26<br>proxy.swlab.local. IN A 192.168.1.32<br>util.swlab.local. IN A 192.168.1.28<br> - - - - - - - - - - - - - - - - - - - - - - - - - - - -</pre><ul><li>Create file Reverser “reverse.swlab.local”:</li></ul><pre>$ vi /var/named/reverse.swlab.local<br> - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br>@ IN SOA dns.swlab.local. root.swlab.local. (<br>1029<br>3H<br>15M<br>1W<br>1D )<br>;Name Server Information<br>1.168.192.in-addr.arpa. IN NS dns.swlab.local.<br>;PTR Record IP address to Hostname<br>36.1.168.192.in-addr.arpa. IN PTR dns.swlab.local.<br>24.1.168.192.in-addr.arpa. IN PTR scms.swlab.local.<br>26.1.168.192.in-addr.arpa. IN PTR cicd.swlab.local.<br>20.1.168.192.in-addr.arpa. IN PTR mail.swlab.local.<br>24.1.168.192.in-addr.arpa. IN PTR gerrit.swlab.local.<br>24.1.168.192.in-addr.arpa. IN PTR ldapweb.swlab.local.<br>24.1.168.192.in-addr.arpa. IN PTR ldap.swlab.local.<br>26.1.168.192.in-addr.arpa. IN PTR jenkins.swlab.local.<br>26.1.168.192.in-addr.arpa. IN PTR artifactory.swlab.local.<br>26.1.168.192.in-addr.arpa. IN PTR sonarqube.swlab.local.<br>32.1.168.192.in-addr.arpa. IN PTR proxy.swlab.local.<br>28.1.168.192.in-addr.arpa. IN PTR util.swlab.local.<br> - - - - - - - - - - - - - - - - - - - - - - - - - - - -</pre><p>3. Configure DNS using Webmin UI Tool (<strong>Option#2</strong>)</p><pre># Download webmin rpm<br>$ wget http://prdownloads.sourceforge.net/webadmin/webmin-1.984-1.noarch.rpm<br><br># Install optional dependencies<br>$ yum -y install perl perl-Net-SSLeay openssl perl-Encode-Detect<br><br># Install webmin rpm<br>$ rpm -U webmin-1.984–1.noarch.rpm<br><br># Open firewall for webmin service port 10000<br>$ firewall-cmd - add-port=10000/tcp - zone=public - permanent<br>$ firewall-cmd - add-port=53/tcp - zone=public - permanent<br>$ firewall-cmd - add-port=53/udp - zone=public - permanent<br>$ firewall-cmd - reload<br><br># Edit webmin configuration and disable ssl for https and set entry to &quot;0&quot; so it will be &quot;ssl=0&quot;<br>$ vi /etc/webmin/miniserv.conf<br><br># Start and enable webmin service<br>$ systemctl start webmin<br>$ systemctl enable webmin<br>$ systemctl status webmin<br># Test webmin tool using the root user login credentials -&gt; http://dns.swlab.local:10000/<br># Configure bind DNS Server from Servers menu</pre><ul><li>DNS domain entries in Webmin UI Tool:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hyXaizUuPsmxzC9xTslzrg.png" /><figcaption>SW-Lab Webmin UI Tool — Login Page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N8pSeDE9lRSmPZxWCidtyA.png" /><figcaption>SW-Lab Webmin UI Tool — Home Page</figcaption></figure><ul><li>Forward “forward.swlab.local” domain entries:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z9DUPxJ8pJo0qqAgXw65PA.png" /><figcaption>SW-Lab Forward Domain Entries</figcaption></figure><ul><li>Reverser “reverse.swlab.local” domain entries:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cVoonY-dWaWQooMZmpMn-w.png" /><figcaption>SW-Lab Reverser Domain Entries</figcaption></figure><blockquote><strong><em>Note: About Bind9 DNS</em></strong></blockquote><blockquote>— Webmin is a web control panel that allows you to administer Linux servers like DNS, SSH …etc. through a simple interface so instead of creating and configuring dns domain names manually you can simply use Webmin to create master/forward/reverser zone and configure name entries.</blockquote><blockquote>— You will need also to edit “hosts” file in Windows (host operating system) located under the path “C:\Windows\System32\drivers\etc” to add the name entries in order to be able to access the lab services from Windows (Host OS).</blockquote><h3>3. Setup <strong>Containers Platform</strong></h3><p>In this step, we will set up Docker as an infrastructure and containerization software for our lab. Docker allows us to package our applications and their dependencies into lightweight, portable containers, making it easier to deploy and manage them across different environments.</p><p>To begin, follow these steps to set up Docker for each environment that will host our containerized services:</p><ul><li>Mail Server (mail.swlab.local)</li><li>CI/CD Automation Server &amp; Tools (cicd.swlab.local)</li><li>Source Code Management Server (scms.swlab.local)</li><li>Utilities and Containers Monitoring Server (util.swlab.local)</li></ul><pre># For each environment i.e. scms.swlab.local<br># Login as the root user<br>$ ssh root@192.168.1.24<br><br># Set the hostname for each VM server<br>$ hostnamectl set-hostname i.e. scms.swlab.local<br><br># Check hostname updated successfully<br>$ hostnamectl status<br><br># Update software packages<br>$ yum update -y<br><br># Create docker user &#39;docker&#39;<br>$ useradd docker<br><br># Set a password for the docker user<br>$ passwd docker<br><br># Add docker user to sudoers<br>$ usermod -aG wheel docker<br><br># Switch to docker user to install docker<br>$ su docker<br><br># Install docker<br># Remove following docker packages / dependencies; if exists<br>$ sudo yum remove docker \<br>docker-client \<br>docker-client-latest \<br>docker-common \<br>docker-latest \<br>docker-latest-logrotate \<br>docker-logrotate \<br>docker-engine<br><br># Install yum-utils to be able to add docker repo<br>$ sudo yum install -y yum-utils<br>$ sudo yum-config-manager - add-repo https://download.docker.com/linux/centos/docker-ce.repo<br><br># Install docker engine and related packages<br>$ sudo yum install docker-ce docker-ce-cli containerd.io<br><br># Install and add docker to docker group so you can run docker command with no need for sudo &lt;&lt;you will need to logout and login again or restart the virtual machine so that your group membership is re-evaluated&gt;&gt;<br>$ sudo groupadd docker<br>$ sudo usermod -aG docker docker<br><br># Start and enable docker services<br>$ sudo systemctl start docker<br>$ sudo systemctl enable docker.service<br>$ sudo systemctl enable containerd.service<br><br># Test docker installation<br>$ docker run hello-world<br><br># Install docker-compose<br># Download the current stable release of docker compose<br>$ sudo curl -L &quot;https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)&quot; -o /usr/local/bin/docker-compose<br># Give executable permissions to the binary<br>$ sudo chmod +x /usr/local/bin/docker-compose<br># Check installed docker-compose version<br>$ docker-compose - version<br># If docker-compose command does not work after installation, then you may need to create a symbolic link to /usr/bin<br>$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose</pre><blockquote><strong><em>Note: About Docker Installation</em></strong></blockquote><blockquote>— You may need to remove existing container packages that pre-installed with CentOS distribution we are using that are conflicting with docker packages like podman, buildah …etc., run “sudo yum remove podman” and “sudo yum remove buildah” to be able to install docker binaries successfully.</blockquote><blockquote>— Another option is to add “--allowerasing” to docker install command that will check the conflicting packages and recommend actions accordingly “$ sudo yum install — allowerasing docker-ce docker-ce-cli containerd.io”.</blockquote><h3>4. Setup Mail Server (Mailcow)</h3><ul><li>Install Mailcow using docker-compose:</li></ul><pre>1. Login into &quot;mail.swlab.local&quot; as the root user<br>$ ssh root@192.168.1.20<br><br>2. Clone mailcow docker-compose file from mailcow github repo<br># Install git first<br>$ yum install -y git<br># Navigate to /opt directory to clone the repo as per the mailcow guide<br>$ cd /opt<br># Clone mailcow repo from github to /opt directory<br>$ clone https://github.com/mailcow/mailcow-dockerized.git<br># Change directory to the cloned mailcow-dockerized repository<br>$ cd mailcow-dockerized<br># Generate mailcow configurations<br># Set hostname to &quot;mail.swlab.local&quot; and timezone when prompt<br>$ ./generate_config.sh<br><br>3. Edit mailcow configurations<br># Skip SSL certificate validation by skiping lets encrypt option in the mailcow.conf file &quot;no https&quot;<br># Edit mailcow.conf file and set the skip lets encrypt entry to yes -&gt; &quot;SKIP_LETS_ENCRYPT=y&quot;<br>$ vi /opt/mailcow-dockerized/mailcow.conf<br># Change posftfix configurations to make Jenkins access mailcow on tcp port 25<br># Change following entries under the &quot;# inter-mx with postscreen on 25/tcp&quot; section in the master.cf file by:<br>1- Updating existing entry and set to blank: -&gt; &quot;-o smtpd_helo_restrictions=&quot;<br>2- Adding new entry by inserting a new line after the above entry: -&gt; &quot;-o smtpd_helo_required=no&quot;<br><br>$ cd /opt/mailcow-dockerized/data/conf/postfix<br>$ vi master.cf<br><br>4. Start mailcow server using docker-compose<br># Switch to docker user<br>$ su docker<br>$ cd /opt/mailcow-dockerized<br># Start mailcow docker-compose<br>$ sudo docker-compose up -d</pre><ul><li>Open Mailcow <a href="http://mail.swlab.local/">http://mail.swlab.local/</a></li><li>Login using default admin username and password.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MZtGADsKcaIDK-tEnFVtxw.png" /><figcaption>SW-Lab Mailcow Mail Server — Login Page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7MCqM1zObJagXCkg_-LvBA.png" /><figcaption>SW-Lab Mailcow Mail Server — Home Page</figcaption></figure><ul><li>Create &quot;swlab.local&quot; domain and required mailboxes &quot;emails&quot;.</li></ul><p>— From &quot;Configurations&quot; menu on the top from the home page, click &quot;Mail Setup&quot;.</p><p>— Then click &quot;+ Add domain&quot; button to create new domain &quot;swlab.local&quot; for our lab.</p><p>— Enter &quot;swlab.local&quot; in the &quot;Domain&quot; field and leave other fields with the default values.</p><p>— Finally, click button &quot;Add domain and restart SOGo&quot; and wait for the domain to be created.</p><p>— Now, our domain is added successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YjyzwOB5OOilUgohrzvoGA.png" /><figcaption>SW-Lab Mailcow Mail Server — Domain “swlab.local”</figcaption></figure><ul><li>Create mailboxes &quot;emails&quot; for our software lab.</li></ul><p>— From &quot;Configurations&quot; menu on the top from the home page, click &quot;Mail Setup&quot;.</p><p>— Then select &quot;Mailboxes&quot; tab and start adding mailboxes by clicking &quot;+ Add mailbox&quot;.</p><p>— Add &quot;gerrit&quot; and &quot;jenkins&quot; mailboxes to our domain &quot;swlab.local&quot;.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BLHbMlo3h_0fSTvh-gYizQ.png" /><figcaption>SW-Lab Mailcow Mail Server — Mailboxes</figcaption></figure><ul><li>Login to Webmail <a href="http://mail.swlab.local/SOGo/">http://mail.swlab.local/SOGo/</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QVU_ya1nNIpP4y-K14muvw.jpeg" /><figcaption>SW-Lab Mailcow Mail Server — WebMail SOGo Login</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3reQyXo3vRPwfwsl-IFSyQ.jpeg" /><figcaption>SW-Lab Mailcow Mail Server — WebMail SOGo: Gerrit User Mailbox</figcaption></figure><blockquote><strong><em>Note: About Mailcow</em></strong></blockquote><blockquote>- To access the Mailcow server, use &quot;admin&quot; as the username and &quot;moohoo&quot; as the default admin password. You can also refer to the documentation for the default admin password on GitHub -&gt; https://github.com/mailcow/mailcow-dockerized</blockquote><blockquote>- Upon your first login to the Mailcow server, you may be prompted to change the default admin password.</blockquote><h3><strong>5. Setup Reverse Proxy Server (Nginx)</strong></h3><ol><li>Install Nginx Server:</li></ol><pre># Login as the root user<br>$ ssh root@192.168.1.32<br><br># Set the hostname for the server<br>$ hostnamectl set-hostname proxy.swlab.local<br><br># Check hostname updated successfully<br>$ hostnamectl status<br><br># Update software packages<br>$ yum update -y<br><br># Create nginx user<br>$ useradd nginx<br># Set user password<br>$ passwd nginx<br># Add nginx user to sudoers<br>$ usermod -aG wheel nginx<br><br># Switch to nginx user to install nginx server<br>$ su nginx<br># Install nginx<br>$ sudo yum install nginx<br><br># Open http and https firewall ports<br>$ sudo firewall-cmd --permanent --zone=public --add-service=https --add-service=http<br>$ sudo firewall-cmd --reload<br><br># Enable and start nginx service<br>$ sudo systemctl enable nginx<br>$ sudo systemctl start nginx<br><br># Check server status should be active and running<br>$ sudo systemctl status nginx</pre><p>2. Configure Nginx Server:</p><ul><li>Default nginx configuration and log format.</li><li>Webmin UI, Portainer UI, Mailcow Web and Open DAP Web UI Config.</li></ul><pre># Create a new configuration file under &quot;/etc/nginx/conf.d/&quot; directory.<br>$ vi /etc/nginx/conf.d/default.conf<br>1. Add custom log format in the first line of the file<br>#-------------------LOG FORMAT-----------------------<br>log_format custom_log &#39;&quot;Request: $request\n Status: $status\n Request_URI: $request_uri\n Host: $host\n Client_IP: $remote_addr\n Proxy_IP(s): $proxy_add_x_forwarded_for\n Proxy_Hostname: $proxy_host\n Real_IP: $http_x_real_ip\n User_Client: $http_user_agent&quot;&#39;;<br>2. Add following configurations to the file<br>#-------------------WEBMIN--------------------------<br>server {<br>listen       80;<br>server_name  dns.swlab.local;<br>access_log /var/log/nginx/dns-access-logs.log custom_log;<br>error_log /var/log/nginx/dns-error-logs.log;<br>proxy_set_header Host $host;<br>proxy_set_header X-Real-IP $remote_addr;<br>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>location / {<br>proxy_pass http://192.168.1.36:10000;<br>}<br>}<br>#-------------------PORTAINER-----------------------<br>server {<br>listen       80;<br>server_name  portainer.swlab.local;<br>access_log /var/log/nginx/portainer-access-logs.log custom_log;<br>error_log /var/log/nginx/portainer-error-logs.log;<br>proxy_set_header Host $host;<br>proxy_set_header X-Real-IP $remote_addr;<br>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>location / {<br>proxy_pass http://192.168.1.28:9000;<br>}<br>}<br>#---------------------MAILCOW-----------------------<br>server {<br>listen       80;<br>server_name  mail.swlab.local;<br>access_log /var/log/nginx/mail-access-logs.log custom_log;<br>error_log /var/log/nginx/mail-error-logs.log;<br>proxy_set_header Host $host;<br>proxy_set_header X-Real-IP $remote_addr;<br>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>location / {<br>proxy_pass http://192.168.1.20:80;<br>}<br>}<br>#---------------------OPENLDAPWEB--------------------<br>server {<br>listen       80;<br>server_name  ldapweb.swlab.local;<br>access_log /var/log/nginx/ldapweb-access-logs.log custom_log;<br>error_log /var/log/nginx/ldapweb-error-logs.log;<br>proxy_set_header Host $host;<br>proxy_set_header X-Real-IP $remote_addr;<br>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>location / {<br>proxy_pass http://192.168.1.24:8082;<br>}<br>}</pre><p>3. Nginx Reverse Proxy for Jenkins:</p><ul><li>Please refer to <a href="https://www.jenkins.io/doc/book/system-administration/reverse-proxy-configuration-nginx/">https://www.jenkins.io/doc/book/system-administration/reverse-proxy-configuration-nginx/</a></li></ul><pre>upstream jenkins {<br>  keepalive 32; # keepalive connections<br>  server 192.168.1.26:8080; # jenkins ip and port<br>}<br><br># Required for Jenkins websocket agents<br>map $http_upgrade $connection_upgrade {<br>  default upgrade;<br>  &#39;&#39; close;<br>}<br><br>server {<br>  listen          80;       # Listen on port 80 for IPv4 requests<br><br>  server_name     jenkins.swlab.local;  # replace &#39;jenkins.example.com&#39; with your server domain name<br><br>  # this is the jenkins web root directory<br>  # (mentioned in the output of &quot;systemctl cat jenkins&quot;)<br>  root            /var/run/jenkins/war/;<br><br>  access_log      /var/log/nginx/jenkins.access.log;<br>  error_log       /var/log/nginx/jenkins.error.log;<br><br>  # pass through headers from Jenkins that Nginx considers invalid<br>  ignore_invalid_headers off;<br><br>  location ~ &quot;^/static/[0-9a-fA-F]{8}\/(.*)$&quot; {<br>    # rewrite all static files into requests to the root<br>    # E.g /static/12345678/css/something.css will become /css/something.css<br>    rewrite &quot;^/static/[0-9a-fA-F]{8}\/(.*)&quot; /$1 last;<br>  }<br><br>  location /userContent {<br>    # have nginx handle all the static requests to userContent folder<br>    # note : This is the $JENKINS_HOME dir<br>    root /var/lib/jenkins/;<br>    if (!-f $request_filename){<br>      # this file does not exist, might be a directory or a /**view** url<br>      rewrite (.*) /$1 last;<br>      break;<br>    }<br>    sendfile on;<br>  }<br><br>  location / {<br>      sendfile off;<br>      proxy_pass         http://jenkins;<br>      proxy_redirect     default;<br>      proxy_http_version 1.1;<br><br>      # Required for Jenkins websocket agents<br>      proxy_set_header   Connection        $connection_upgrade;<br>      proxy_set_header   Upgrade           $http_upgrade;<br><br>      proxy_set_header   Host              $host;<br>      proxy_set_header   X-Real-IP         $remote_addr;<br>      proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;<br>      proxy_set_header   X-Forwarded-Proto $scheme;<br>      proxy_max_temp_file_size 0;<br><br>      #this is the maximum upload size<br>      client_max_body_size       10m;<br>      client_body_buffer_size    128k;<br><br>      proxy_connect_timeout      90;<br>      proxy_send_timeout         90;<br>      proxy_read_timeout         90;<br>      proxy_buffering            off;<br>      proxy_request_buffering    off; # Required for HTTP CLI commands<br>      proxy_set_header Connection &quot;&quot;; # Clear for keepalive<br>  }<br><br>}</pre><p>4. Nginx Reverse Proxy for Gerrit:</p><ul><li>Please refer to <a href="https://gerrit-review.googlesource.com/Documentation/config-reverseproxy.html">https://gerrit-review.googlesource.com/Documentation/config-reverseproxy.html</a></li></ul><pre># Create a new configuration file for gerrit<br>$ vi /etc/nginx/conf.d/gerrit.conf<br># Add following configurations to the file<br>#---------------------GERRIT-----------------------<br>server {<br>listen 80;<br>server_name gerrit.swlab.local;<br>access_log      /var/log/nginx/gerrit.access.log;<br>error_log       /var/log/nginx/gerrit.error.log;<br>proxy_set_header Host $host;<br>proxy_set_header X-Real-IP $remote_addr;<br>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>location / {<br>proxy_pass        http://192.168.1.24:8080;<br>}<br>}</pre><p>5. Nginx Reverse Proxy for JFrog Artifactory:</p><ul><li>Please refer to <a href="https://www.jfrog.com/confluence/display/JFROG/HTTP+Settings#:~:text=To%20configure%20a%20reverse%20proxy,Using%20NGINX%3F">https://www.jfrog.com/confluence/display/JFROG/HTTP+Settings#:~:text=To%20configure%20a%20reverse%20proxy,Using%20NGINX%3F</a></li></ul><pre># Create a new configuration file for artifactory<br>$ vi /etc/nginx/conf.d/artifactory.conf<br># Add following configurations to the file<br>#------------------ARTIFACTORY-------------------<br>server {<br>listen 80;<br>server_name artifactory.swlab.local;<br>access_log      /var/log/nginx/artifactory.access.log;<br>error_log       /var/log/nginx/artifactory.error.log;<br>proxy_set_header Host $host;<br>proxy_set_header X-Real-IP $remote_addr;<br>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>location / {<br>proxy_pass        http://192.168.1.26:8082;<br>}<br>}</pre><p>6. Nginx Reverse Proxy for SonarQube:</p><ul><li>Please refer to <a href="https://docs.sonarqube.org/7.2/SecuringtheServerBehindaProxy.html#src-11639522_SecuringtheServerBehindaProxy-UsingNginx">https://docs.sonarqube.org/7.2/SecuringtheServerBehindaProxy.html#src-11639522_SecuringtheServerBehindaProxy-UsingNginx</a></li></ul><pre># Create a new configuration file for sonarqube<br>$ vi /etc/nginx/conf.d/sonarqube.conf<br># Add following configurations to the file<br>#------------------SONARQUBE-------------------<br>server {<br>listen 80;<br>server_name sonarqube.swlab.local;<br>access_log      /var/log/nginx/sonarqube.access.log;<br>error_log       /var/log/nginx/sonarqube.error.log;<br>proxy_set_header Host $host;<br>proxy_set_header X-Real-IP $remote_addr;<br>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>location / {<br>proxy_pass        http://192.168.1.26:9000;<br>}<br>}</pre><blockquote><strong><em>Note: About Nginx</em></strong></blockquote><blockquote>In this lab, we are using HTTP for the services and software tools for simplicity. However, in a real production environment, it is recommended to secure your service access using HTTPS/SSL connections. This involves opening port 443 for HTTPS and configuring NGINX to support SSL certificates for secure communication.</blockquote><h3>6. Setup <strong>Containers Management (Portainer)</strong></h3><ol><li>Login into &quot;util.swlab.local&quot; as the root user.</li></ol><pre>$ ssh root@192.168.1.28</pre><p>2. Copy docker-compose contents below to docker-compose.yaml file.</p><pre>version: &#39;3&#39;<br>services:<br>portainer-svc:<br>image: portainer/portainer-ce:latest<br>hostname: portainer<br>container_name: portainer<br>networks:<br>default:<br>aliases:<br>- portainer<br>- portainer.swlab<br>- portainer.swlab.local<br>ports:<br>- 9000:9000<br>- 8000:8000<br>restart: unless-stopped<br>volumes:<br>- /etc/localtime:/etc/localtime:ro<br>- /var/run/docker.sock:/var/run/docker.sock:ro<br>- /data/portainer-data:/data portainer/portainer-ce</pre><p>3. Start Portainer docker container</p><pre># Switch to docker user<br>$ su docker<br># Start Portainer<br>$ docker-compose up -d</pre><p>4. Test and verify Portainer installation.</p><ul><li>Open Portainer <a href="http://portainer.swlab.local/">http://portainer.swlab.local/</a></li><li>Create username and password to login to Portainer.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hOvUu4tIw7vtM2_oLVCyRQ.png" /><figcaption>SW-Lab Portainer Container Management — Login Page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IdcOKQ7FO-N4jJE1XWOTmg.png" /><figcaption>SW-Lab Portainer Container Management — Home Page</figcaption></figure><ul><li>Add environment to Portainer:</li></ul><p>— Click on Environments menu.</p><p>— Select &quot;Agent Portainer Agent&quot; and &quot;Docker Swarm&quot;.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A3cU_On4ZvLzgyOwhHf15A.png" /><figcaption>SW-Lab Portainer Container Management — Add Environment</figcaption></figure><p>— And “Start Wizard”.</p><p>— Enter environment details (Name and Environment URL).</p><p>— Copy the command and execute in the target environment i.e., “mail.swlab.local” virtual server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4QnX0msJxJiuQh1QtwxSIA.png" /><figcaption>SW-Lab Portainer Container Management — Add Environment Details</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IY2yTXkivhXCZf3SbrVbfw.png" /><figcaption>SW-Lab Portainer Container Management — Environment Details</figcaption></figure><p>— Repeat the above steps to add the other environments.</p><ul><li>Show environment dashboard.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qWn9yfUYxzgvEet61QY1gA.png" /><figcaption>SW-Lab Portainer Container Management — Environment Dashboard</figcaption></figure><ul><li>Show containers list.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*564tGf8DtNC9QR69K2DNxw.png" /><figcaption>SW-Lab Portainer Container Management — Environment Container List</figcaption></figure><blockquote>Next, Part-2: Install and configure software development tools for DevOps (CI/CD).</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae49b2b02475" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Software Development Home-Based Lab: A DevOps Automation Platform (Introduction)]]></title>
            <link>https://medium.com/@ahmed.hosny/building-a-software-development-home-based-lab-a-devops-automation-platform-introduction-cbbf3de7ac59?source=rss-842c923d4543------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbbf3de7ac59</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cicd-tools]]></category>
            <category><![CDATA[cicd-pipeline]]></category>
            <dc:creator><![CDATA[Ahmed Hosny]]></dc:creator>
            <pubDate>Sat, 22 Jul 2023 14:41:41 GMT</pubDate>
            <atom:updated>2023-07-22T14:41:41.771Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s fast-paced software development platforms landscape, creating a dedicated environment for experimentation, testing, and collaboration is essential for individuals who want to gain a deeper understanding of how various technologies integrate, operate and work together. By setting up such an environment, you can explore new tools, frameworks, and apply modernized software development processes and DevOps principles utilizing a wide variety of open-source software tools, That’s where a home-based software development lab comes into play.</p><p>In this comprehensive guide, I will share my knowledge and walk through the procedure of building a home-based software development lab. With just a laptop or workstation computer and a reliable internet connection, so you can create an integrated tailored platform for exploring and practicing DevOps (CI/CD) automation using simplified process.</p><p><strong>Note:</strong> This guide is designed for individuals who may not have a background in DevOps engineering and/or systems administration but are eager to have their hands dirty building own software development lab at home for learning and practicing purposes. So, I will provide step-by-step instructions and explanations to help you understand the process that I followed to setup my lab and also to overcome any challenges that may arise and for sure you will have the flexibility to adjust the lab, resources, virtual machines, configurations and/or tools as per your convenience and needs.</p><h3><strong>Objectives:</strong></h3><p>Throughout this guide, we will strive to achieve the following objectives:</p><ol><li>Set up a local software development lab using a laptop or workstation as our foundation.</li><li>Create infrastructure virtual machines using Oracle VirtualBox and Linux (CentOS Stream).</li><li>Install and configure a powerful stack of containerized open-source software tools, tailored for seamless integration in the software development lab.</li><li>Establish an environment and workflow process that fosters team collaboration and enables efficient source code review using Gerrit with automated review and feedback capabilities.</li><li>Develop pipelines to facilitate continuous integration and continuous delivery for a simple containerized application, transforming your lab into a full-fledged DevOps automation platform.</li></ol><h3>Series Overview:</h3><p>To ensure a comprehensive understanding, this guide is divided into the following parts:</p><ol><li>Introduction: Overview, Software Stack, Architecture, Process and Services.</li><li>Part 1: Setup virtual machines, operating systems, and essential infrastructure software:</li></ol><ul><li>Setup Environments (VMs)</li><li>Setup DNS Server (BIND9)</li><li>Setup Containers Platform</li><li>Setup Mail Server (Mailcow)</li><li>Setup Reverse Proxy Server (Nginx)</li><li>Setup Containers Management and Monitoring (Portainer)</li></ul><p>3. Part 2: Install and configure software development tools:</p><ul><li>Setup Gerrit with MySQL and OpenLDAP</li><li>Setup Jenkins, SonarQube and JFrog Artifactory</li></ul><p>4. Part 3: Configure and Integrate software development tools:</p><ul><li>Jenkins General Configurations</li><li>Configuring Gerrit Users in OpenLDAP</li><li>Configure Jenkins and Gerrit Integration</li><li>Configure Jenkins and SonarQube Integration</li><li>Configure Jenkins and JFrog Artifactory Integration</li></ul><p>5. Part 4: Build CI/CD pipelines and validate the entire software development cycle within the newly established lab.</p><p>6. Part 5: Expanding the Software Lab: Enhancing and Extending Cloud-Based DevOps (CI/CD) Automation Practices.</p><h3>Software Stack:</h3><blockquote>Docker, Docker-Compose, Bind9, Nginx, Mailcow, Git, Gerrit, OpenLDAP, Jenkins, MySQL, SonarQube, JFrog Artifactory.</blockquote><p>The software development lab will leverage an array of powerful open-source tools, empowering you to achieve robust and efficient development processes. The key components of our software stack include:</p><ul><li><strong>Git:</strong> A distributed version control system that enhances collaboration and version management.</li><li><strong>Gerrit:</strong> A self-hosted code review and team collaboration tool, streamlining the review process and fostering collaboration.</li><li><strong>Jenkins:</strong> An automation server that facilitates code building, testing, and deployment, ensuring smooth and reliable integration.</li><li><strong>OpenLDAP: </strong>An open-source implementation of LDAP (Lightweight Directory Access Protocol), enabling centralized user management.</li><li><strong>SonarQube:</strong> A code quality and continuous inspection tool that automates code analysis and maintains high-quality standards.</li><li><strong>JFrog Artifactory: </strong>A repository and binaries manager that simplifies artifact management for your software projects.</li><li><strong>Infrastructure Software:</strong></li></ul><p><strong>— BIND9:</strong> A DNS server responsible for domain name resolution within your lab environment.</p><p><strong>— Mailcow:</strong> A mail server that facilitates email communication within your lab ecosystem.</p><p><strong>— Nginx:</strong> A robust reverse proxy server that handles traffic routing and load balancing.</p><p><strong>— Portainer:</strong> A user-friendly container management tool that simplifies the administration of your Docker containers.</p><p><strong>— Webmin UI (Admin Tool):</strong> A web-based Linux administration tool that provides an intuitive interface for system management.</p><p><strong>— Docker &amp; Docker-Compose:</strong> Containerization technologies that enable efficient deployment and management of software applications.</p><h3><strong>System Architecture:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*0RlLl7KI-cq1C_BCD2n8eA.jpeg" /><figcaption>SW-Lab System Architecture</figcaption></figure><ul><li>Bind9: Manages domain name resolution and facilitates communication between services, in the lab environment — we will use “<em>swlab.local</em>” as a domain name.</li><li>Nginx: Acts as an intermediary between clients and backend servers as a reverse proxy.</li><li>Mailcow: Handles email communication for users and services.</li><li>OpenLDAP: Manages user authentication and access to Gerrit.</li><li>Development Environment: Acts as a workspace for the development tools that developers use to develop and interact with the lab services.</li><li>Containers: Lab services (Gerrit, MySQL, OpenLDAP, Jenkins, SonarQube, JFrog Artifactory, Maincow and Portainer) will be deployed as containers inside the virtual machines.</li><li>Containers Management: Manages and monitors container instances hosted on the virtual machines.</li><li>Operating System: CentOS Stream (Linux) will be installed into the virtual machines to host the containers and the other lab services, and Ubuntu will be used for the development environment.</li><li>VirtualBox: Creates, manages virtual machines that will host the containerized services and provides network capabilities for the lab services communication.</li><li>Windows (Host): Hosts the VirtualBox installation and configurations.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*rbzJ1B1pk4-grLVkQfrbXw.jpeg" /><figcaption>SW-Lab Infrastructure Landscape</figcaption></figure><blockquote>Note: In my setup, I created several virtual machines to achieve a degree of isolation between different services and to demonstrate various configurations and communications. However, it’s worth noting that you have the option to consolidate all containers into a single container platform and adjust the exposed ports to avoid any conflict.</blockquote><h3><strong>Software Development Process (CI/CD):</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bysgJwXW55lbGpljjdggmA.jpeg" /><figcaption>Software Development Process (CI/CD)</figcaption></figure><h3>High Level Process:</h3><ol><li>Developer pushes code changes to Gerrit code repository.</li><li>Gerrit triggers a Jenkins job:</li></ol><ul><li>Gerrit is configured to trigger a Jenkins job whenever new code changes are pushed.</li><li>Gerrit sends a notification to Jenkins, providing details about the code changes to trigger the pre-configured job for the change.</li></ul><p>3. Jenkins job starts and performs the following tasks:</p><ul><li>Fetches the latest code changes from the Gerrit repository.</li><li>Builds the code (Cleans, Compiles the code and Runs unit tests)</li><li>Performs code quality checks with SonarQube:</li><li>Sends code analysis results to SonarQube for evaluation.</li><li>SonarQube analyzes the code for code smells, bugs, vulnerabilities, and other code quality metrics.</li><li>SonarQube generates reports and metrics related to code quality.</li><li>Publishes the build artifacts (Creates deployable artifacts or packages)</li></ul><p>4. Jenkins updates Gerrit with the build and SonarQube analysis results:</p><ul><li>Jenkins posts the build status and SonarQube analysis results back to the Gerrit code review.</li><li>Developers can review the build status and code quality metrics directly within Gerrit.</li></ul><p>5. Developers review and address feedback:</p><ul><li>Developers review the build status, test results, and SonarQube analysis reports.</li><li>If necessary, they address any issues or make improvements based on the feedback.</li></ul><p>6. If the code is reviewed and approved i.e., getting (+2 Votes), he will be able to integrate and merge the code into master that may trigger another Jenkin job or pipeline for code delivery and deployment.</p><ul><li>Developer will be always notified through emails.</li><li>Developer will be able to monitor the job executions via visualized user interface in Jenkins.</li></ul><h3>Introducing Lab Services:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*s5CNl6m5dG7BNvWvFMubOQ.jpeg" /></figure><blockquote>Note: In my lab environment, I have manually selected and assigned specific static IP addresses to assign to each virtual machine so you will need to replace those IP addresses with the appropriate ones from your home network to ensure proper configuration and communication between the lab services.</blockquote><blockquote><em>Next, Part-1: Setup virtual machines, operating systems and infrastructure software.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbbf3de7ac59" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>