<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: joy</title>
    <description>The latest articles on DEV Community by joy (@joykingoo).</description>
    <link>https://dev.to/joykingoo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1252498%2Fdf573075-4cf6-41f7-ac29-971fd5968334.jpeg</url>
      <title>DEV Community: joy</title>
      <link>https://dev.to/joykingoo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joykingoo"/>
    <language>en</language>
    <item>
      <title>Creating Parametrized builds using Jenkins</title>
      <dc:creator>joy</dc:creator>
      <pubDate>Tue, 09 Dec 2025 10:56:14 +0000</pubDate>
      <link>https://dev.to/joykingoo/creating-parametrized-builds-using-jenkins-g44</link>
      <guid>https://dev.to/joykingoo/creating-parametrized-builds-using-jenkins-g44</guid>
      <description>&lt;h4&gt;
  
  
  Introduction
&lt;/h4&gt;

&lt;p&gt;Jenkins is a tool that makes life easier by automating the tasks we repeat over and over, whether it’s building code, running tests, or deploying an application. It is platform and environment agnostic, giving teams the freedom to integrate with almost any tool or technology. Acting as a centralized automation hub, Jenkins can be customized and extended through its extensive plugin ecosystem to fit nearly any workflow.&lt;/p&gt;

&lt;p&gt;One feature that really brings out its flexibility is parameterized builds. Instead of creating a new job every time you want to deploy to a different environment or use a different version, you can simply add the options you want when starting the build. This enables a user to save on time, and allows a single job to run in multiple ways depending on your needs.&lt;/p&gt;

&lt;p&gt;This article will show how Jenkins is able to use parameterized builds, that allow you to customize a job based on the inputs you provide before it runs. The steps below walk through how to set them up.&lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;p&gt;1.&lt;a href="https://www.jenkins.io/download/" rel="noopener noreferrer"&gt;Jenkins installed on your device.&lt;/a&gt;&lt;br&gt;
2.Basic understanding of your project; Know what inputs you want to provide for example if it's environment, version or module.&lt;br&gt;
3.A web browser to interact with Jenkins.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: Once Jenkins is installed, open it in a web browser using &lt;a href="http://localhost:8080" rel="noopener noreferrer"&gt;http://localhost:8080&lt;/a&gt; and log in with the admin password.
&lt;/h4&gt;

&lt;h4&gt;
  
  
  Step 2: In the Jenkins dashboard, click Create Job, enter a name for your job, and select the Freestyle project option.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe4wwp0gohihfpevaxnlw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe4wwp0gohihfpevaxnlw.png" alt="Creating a new project " width="800" height="647"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3: After naming the job, go to the Configure tab to set up the parameterized build. Jenkins offers eight types of parameters, but for this tutorial, we’ll focus on String and Choice parameters. Start by creating a String parameter named Stage with a default value of Build.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdqksrceld4zgknme3iqs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdqksrceld4zgknme3iqs.png" alt="Creating a String Parameter" width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 4 : Next, add a Choice parameter named Env with three values: Development, Staging, and Production.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbxew5rg5cj8e2hto43d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbxew5rg5cj8e2hto43d.png" alt="Adding the Choice Parameter with Development, Staging and Production options" width="800" height="628"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 5: After adding the parameters, navigate to the Build section and click Add build step.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc1vvgnfi8ed8twzq5q2d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc1vvgnfi8ed8twzq5q2d.png" alt="Build Steps added with the env commands" width="800" height="638"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 6: Select Execute shell and enter commands that reference the Stage and Env parameters. For example we are using this in the build as shown in the previous:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "Current Stage: $Stage"
echo "Deploying to Environment: $Env"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running these commands shows the parameter values you entered for the job, confirming they’re applied correctly and highlighting how they guide the job’s execution.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 7: Once done, save the job. You will be redirected to the job homepage. Click Build with Parameters to see the input fields and run the build.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvnj2yulpng9jvsli4joc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvnj2yulpng9jvsli4joc.png" alt="Build trigger created by env" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 8: Select a value for Env (Development, Staging, or Production) as displayed above and trigger the build. After the build completes, click the build number to see the results. Select Console Output to view detailed information about the build execution as shown below.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F506nwh1zza8fvg0pjyoz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F506nwh1zza8fvg0pjyoz.png" alt="Console Output displayed" width="800" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The console output will show the messages from your shell commands, confirming which stage and environment were used for that run&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;In conclusion, we were able create parameterized builds using Jenkins which makes creating jobs much more flexible. We used inputs like environment or version before running the job, therefore enabling it's reuse for different situations. Parameterized builds therefore saves time, and makes automation smoother and easier to manage.&lt;/p&gt;

</description>
      <category>jenkins</category>
      <category>automation</category>
      <category>devops</category>
    </item>
    <item>
      <title>Load balancing with Docker Swarm &amp; Nginx</title>
      <dc:creator>joy</dc:creator>
      <pubDate>Sun, 21 Apr 2024 12:48:10 +0000</pubDate>
      <link>https://dev.to/joykingoo/load-balancing-with-docker-swarm-nginx-ef5</link>
      <guid>https://dev.to/joykingoo/load-balancing-with-docker-swarm-nginx-ef5</guid>
      <description>&lt;p&gt;&lt;a href="https://www.techtarget.com/searchitoperations/definition/Docker-Swarm#:~:text=Docker%20Swarm%20is%20a%20container,virtual%20machines%20into%20a%20cluster." rel="noopener noreferrer"&gt;Docker Swarm&lt;/a&gt; is a platform that enables deployment and hosting of clusters of docker hosts. &lt;a href="https://kinsta.com/knowledgebase/what-is-nginx/" rel="noopener noreferrer"&gt;Nginx&lt;/a&gt; is a web server that offers different services such as HTTP caching, load balancing, reverse proxying as well as mail proxying.&lt;br&gt;
&lt;a href="https://www.cloudflare.com/learning/performance/what-is-load-balancing/" rel="noopener noreferrer"&gt;Load balancing&lt;/a&gt; is the distribution of equal resources across different servers to improve the performance of an application. &lt;/p&gt;

&lt;p&gt;Let's say you're a teacher with a classroom full of students who all need your help at the same time. You have a big stack of papers to grade, questions to answer, and projects to review. If every student lines up in front of your desk to ask for help or submit their work, it's going to be chaotic and slow. Some students might have to wait a long time before they get the attention they need.&lt;br&gt;
Load balancing in this scenario would be like having teaching assistants or group leaders who can help manage the workload. Each assistant can take a group of students and handle their questions, grade their papers, and provide feedback. This way, the workload is distributed among multiple helpers, making sure that everyone gets the support they need promptly without overwhelming you, the teacher.&lt;/p&gt;

&lt;p&gt;This article will explore how to achieve load balancing with Nginx and Docker Swarm. &lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Docker &amp;amp; Docker swarm installed.&lt;/li&gt;
&lt;li&gt;Nginx installed.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Step 1: Start with creating a folder where your application will run and initialize Docker swarm. &lt;code&gt;docker swarm init&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0og0mi0g64b02vska0fj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0og0mi0g64b02vska0fj.png" alt="Docker swarm initialized"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2: Create a Docker service with the name of your application, replicas needed ports, and image needed. We will use alpine as the choice of image. &lt;code&gt;docker service create --name yourappname --replicas 2 -p 8080:80 httpd:alpine&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;`&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8tnrximicsokfuo9qz6s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8tnrximicsokfuo9qz6s.png" alt="Docker service added"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3:  Configure nginx at the ‘’/etc/nginx/sites-available/default’’ file location with the following variables.
&lt;/h4&gt;




&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
server {&lt;br&gt;
    listen 80;&lt;br&gt;
    server_name localhost;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;location / {
    proxy_pass http://localhost:8080;  
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 4: Save the configurations and restart the Nginx service.&lt;code&gt;sudo systemctl restart nginx&lt;/code&gt;
&lt;/h4&gt;

&lt;h4&gt;
  
  
  Step 5: Go to the load balancing service using &lt;a href="http://localhost" rel="noopener noreferrer"&gt;http://localhost&lt;/a&gt; or the IP address of your device. The screenshot displays that the site is actively working.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2lw6qkfhxh9yfdi4hwp5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2lw6qkfhxh9yfdi4hwp5.png" alt="Localhost shows up"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nginx acts as the load balancer for the Docker swarm. It forwards traffic to the Docker swarm services running at port 8080&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;In conclusion, we were able to create a Docker swarm service that used Nginx to forward packets and offer load balancing to the traffic in the application. Docker swarm offers a versatile tool for clustering and orchestration of Docker containers.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>nginx</category>
      <category>loadbalancing</category>
      <category>devops</category>
    </item>
    <item>
      <title>Set up an Automation script with Ansible</title>
      <dc:creator>joy</dc:creator>
      <pubDate>Sun, 21 Apr 2024 10:53:30 +0000</pubDate>
      <link>https://dev.to/joykingoo/set-up-an-automation-script-with-ansible-2g4h</link>
      <guid>https://dev.to/joykingoo/set-up-an-automation-script-with-ansible-2g4h</guid>
      <description>&lt;p&gt;&lt;a href="https://www.ansible.com/" rel="noopener noreferrer"&gt;Ansible&lt;/a&gt; is a tool used to help manage software automation processes, configuration management across machines, deployment as well as remote execution of commands and scripts. In sports, Ansible operates as the coach of your team by providing strategies (playbooks), and actions, and ensuring the smooth execution of tasks across your infrastructure, just like a coach guides and directs players (Servers)during a game.&lt;/p&gt;

&lt;p&gt;In Ansible, a playbook is a file containing a series of instructions that specify the tasks to be performed on remote systems. These tasks are typically related to configuration management, application deployment, system orchestration, and other automation processes. Playbooks are written in YAML format.&lt;/p&gt;

&lt;p&gt;In Ansible, a server is a remote computer system that Ansible manages and interacts with using SSH (Secure Shell) or other connection methods. The servers can be virtual machines or cloud instances accessible within a network.&lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Ansible is installed on your device.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Step 1: After installing Ansible, we create a directory where we store all the files needed.
&lt;/h4&gt;

&lt;h4&gt;
  
  
  Step 2: Create an inventory file (inventory.ini)in the directory and define our service. We add localhost as the testing environment.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffdhgye4oav2tgak7uj7c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffdhgye4oav2tgak7uj7c.png" alt="Inventory file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3: Create an Ansible playbook which is a yaml file. The Yaml file will define the tasks you would like to automate. In this scenario, we install and start an Apache Web server to localhost.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F638psw88w10uru6zxb96.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F638psw88w10uru6zxb96.png" alt="Yaml file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 4: We run the playbook using the ansible-playbook -i (inventory file)  nameofyourplaybook.yaml.
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;Note : make sure to have enabled &lt;u&gt;execute&lt;/u&gt; privileges in the playbook. I.e chmod +x [yourplaybook.yaml].&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 5:Your playbook should run successfully with the following output.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnpto6c5dt82reis8akx4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnpto6c5dt82reis8akx4.png" alt="Output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;In conclusion, we were able to create an automation script for installing Apache locally using Ansible. Although we explored on how to achieve load balancing with Ansible, there are other benefits and services Ansible offers like Infrastructure automation, configuration management, and deployment of applications across different servers.&lt;/p&gt;

</description>
      <category>ansible</category>
      <category>linux</category>
      <category>devops</category>
    </item>
    <item>
      <title>Send notifications to Slack using Jenkins</title>
      <dc:creator>joy</dc:creator>
      <pubDate>Mon, 26 Feb 2024 09:06:30 +0000</pubDate>
      <link>https://dev.to/joykingoo/send-notifications-to-slack-using-jenkins-d1g</link>
      <guid>https://dev.to/joykingoo/send-notifications-to-slack-using-jenkins-d1g</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.jenkins.io/" rel="noopener noreferrer"&gt;Jenkins&lt;/a&gt; is a tool used by software engineers to  automate  builds, test, and deploy software by providing a centralized platform for managing workflows. &lt;/p&gt;

&lt;p&gt;Imagine you're running a bakery, and you have a team of bakers who work together to bake different types of cakes. Each cake requires several steps, like mixing ingredients, baking, decorating, and packaging.&lt;/p&gt;

&lt;p&gt;Now, Jenkins workflows are like having a super efficient system in your bakery that automates and manages all these steps seamlessly.Jenkins workflows streamline the entire process of developing and delivering software, just like your bakery's system ensures that each cake is made to perfection and delivered to the customer with care and efficiency.&lt;/p&gt;

&lt;p&gt;This article will explore how Jenkins enables such efficiency by demonstrating how it allows this by sending notifications to Slack by using the Jenkins pipeline and a Slack bot.&lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;p&gt;To follow along easily with this tutorial, you should have the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.jenkins.io/doc/book/installing/linux/" rel="noopener noreferrer"&gt;Jenkins installed on your device.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt; &lt;a href="https://slack.com/get-started#/createnew" rel="noopener noreferrer"&gt;A Slack workspace.&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://api.slack.com/apps" rel="noopener noreferrer"&gt;Slack bot application created from scratch within your Slack workspace.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Jenkins pipeline created.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Step1 : We start by installing Jenkins and Java from the Jenkins official website.
&lt;/h4&gt;

&lt;p&gt;Once done installing, we configure the admin credentials. We then go to the Jenkins dashboard and click on manage Jenkins.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; &lt;br&gt;
We would recommend following the Jenkins documentation &lt;a href="https://www.jenkins.io/doc/book/installing/linux/" rel="noopener noreferrer"&gt;installation guide&lt;/a&gt; to have the best installation without having any blunders with Jenkins keyrings. We used the long term support release installation.Make sure to start the Jenkins application with &lt;code&gt;systemctl start jenkins&lt;/code&gt; after installing. We  access Jenkins on the localhost:8080 port.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw5k7ik67wrmu91tlitps.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw5k7ik67wrmu91tlitps.png" alt="Jenkins dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2: Go to the &lt;a href="https://plugins.jenkins.io/slack/" rel="noopener noreferrer"&gt;plugins section&lt;/a&gt; and click on available plugins. Install Slack notifications and restart Jenkins once done with installation.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq6s33gx46mbv0ts6nny3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq6s33gx46mbv0ts6nny3.png" alt="Jenkins plugin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3: Go to &lt;a href="https://api.slack.com/" rel="noopener noreferrer"&gt;https://api.slack.com&lt;/a&gt;create an (slackbot)application from scratch and add your workspace.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvtg1di80gbi300nfgsvw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvtg1di80gbi300nfgsvw.png" alt="Slack API"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(Attached is a screenshot of my app name and slack workspace. You can name the application whatever you like. We created a slack workspace for testing the application.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ocr709hu5tincajdm3k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ocr709hu5tincajdm3k.png" alt="App name and workspace"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 4: Once the app is created, we click on OAuth and permissions and add go to the bot token scopes.
&lt;/h4&gt;

&lt;p&gt;We add the chat: write, files:write, chat:write.customize, reactions:write, users:read, users:read.email &lt;strong&gt;scopes&lt;/strong&gt;.&lt;br&gt;
Once done adding the scopes, we click install workspace which adds Jenkins to the slack workspace.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ior3y3gt2l5lci0kq0g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ior3y3gt2l5lci0kq0g.png" alt="Bot scopes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 5: Go to the Jenkins Dashboard and click on manage Jenkins + credentials.Click on the global domains where we add your Slack credentials.
&lt;/h4&gt;

&lt;p&gt;Choose the secret text option; the scope option should be global.&lt;br&gt;
The value of the secret is the OAuth token created in Slack. The ID and description can be anything we wish to add.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faogxhqgunoocknmeum0t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faogxhqgunoocknmeum0t.png" alt="Secret text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmk19h341u35y9bl7ivcc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmk19h341u35y9bl7ivcc.png" alt="Secret text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 6: Click on manage Jenkins then configure systems. Scroll to the bottom where Slack exists and add the Slack workspace name and Slackbot credentials created.
&lt;/h4&gt;

&lt;p&gt;Add your &lt;strong&gt;default channel&lt;/strong&gt;. We chose to use random as our default slack channel but you can choose any. Make sure to tick the box with the custom Slack bot user. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffvj8xw0wnzu0f6p9af4i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffvj8xw0wnzu0f6p9af4i.png" alt="Adding slack configs to jenkins"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: If we encounter a &lt;strong&gt;crumb error/403 error&lt;/strong&gt;, make sure to &lt;strong&gt;enable proxy compatibility&lt;/strong&gt; in the Jenkins security tab.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Step 7: Once the values are added, apply and save the changes and test the connection for the Slack bot.
&lt;/h4&gt;

&lt;p&gt;If successful we get a success and confirmation message on the selected (random)channel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03c4am3gtx76gxlyf47l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03c4am3gtx76gxlyf47l.png" alt="Connection set to slack"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 8: Go to the Jenkins dashboard and click on a new item; name it what you wish and click the pipeline option.
&lt;/h4&gt;

&lt;p&gt;With that you have created the Jenkins pipeline.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5kob7ux55z6agn7dz4cz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5kob7ux55z6agn7dz4cz.png" alt="New pipeline"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 9: Go to the advanced project options; add a pipeline script. You can modify the text message in the &lt;a href="https://gist.github.com/darinpope/7300c9a1b893221f859f2abccc24a0dc" rel="noopener noreferrer"&gt;slackSend&lt;/a&gt; value.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhn6vxw5xh139e0ainpyd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhn6vxw5xh139e0ainpyd.png" alt="Pipeline script"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 10: Save and apply the changes. Once done, you customize and build the pipeline message and it shows up in your selected Slack channel.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm5eh145qq3icnkyed6za.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm5eh145qq3icnkyed6za.png" alt="Testing connection"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion.
&lt;/h4&gt;

&lt;p&gt;In conclusion, we were able to create and send Slack notifications using Jenkins. We were able to achieve this using the Jenkins pipeline and the use of a slackbot. &lt;/p&gt;

</description>
      <category>jenkins</category>
      <category>jenkinspipeline</category>
      <category>slack</category>
      <category>devops</category>
    </item>
    <item>
      <title>Deploying flask app to Kubernetes using Minikube</title>
      <dc:creator>joy</dc:creator>
      <pubDate>Wed, 31 Jan 2024 17:04:20 +0000</pubDate>
      <link>https://dev.to/joykingoo/deploying-flask-app-to-kubernetes-using-minikube-6jl</link>
      <guid>https://dev.to/joykingoo/deploying-flask-app-to-kubernetes-using-minikube-6jl</guid>
      <description>&lt;h4&gt;
  
  
  Introduction
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://kubernetes.io/" rel="noopener noreferrer"&gt;Kubernetes&lt;/a&gt; manages the deployment, scaling, and operation of containerized applications across a cluster of machines. Kubernetes relies on tools such as container runtimes like Docker, to run the containers.&lt;/p&gt;

&lt;p&gt;Before deploying the application with Kubernetes, you need to containerize the application using docker. This article shows how to deploy a Flask application on Ubuntu 22.04 using Minikube; a Kubernetes tool for local deployment for testing and free offering. Alternatively, you can deploy your container apps using Cloud providers such as &lt;a href="https://cloud.google.com/gcp?utm_source=google&amp;amp;utm_medium=cpc&amp;amp;utm_campaign=emea-emea-all-en-bkws-all-all-trial-e-gcp-1707574&amp;amp;utm_content=text-ad-none-any-DEV_c-CRE_500236788675-ADGP_Hybrid+%7C+BKWS+-+EXA+%7C+Txt+~+GCP+~+General%23v3-KWID_43700060393213451-aud-606988878614:kwd-87853815-userloc_1009824&amp;amp;utm_term=KW_gcp-NET_g-PLAC_&amp;amp;&amp;amp;gad_source=1&amp;amp;gclid=EAIaIQobChMIgufY2OGHhAMVP6aDBx2xBwwaEAAYASAAEgKx_vD_BwE&amp;amp;gclsrc=aw.ds" rel="noopener noreferrer"&gt;GCP&lt;/a&gt;(Google Cloud), &lt;a href="https://azure.microsoft.com/en-us" rel="noopener noreferrer"&gt;Azure&lt;/a&gt;(Microsoft) or &lt;a href="https://aws.amazon.com/free/?gclid=EAIaIQobChMI9NPy_-GHhAMVM5GDBx1Acw8kEAAYASAAEgKRhfD_BwE&amp;amp;trk=2d3e6bee-b4a1-42e0-8600-6f2bb4fcb10c&amp;amp;sc_channel=ps&amp;amp;ef_id=EAIaIQobChMI9NPy_-GHhAMVM5GDBx1Acw8kEAAYASAAEgKRhfD_BwE:G:s&amp;amp;s_kwcid=AL!4422!3!645125273261!e!!g!!aws!19574556887!145779846712" rel="noopener noreferrer"&gt;AWS&lt;/a&gt;(Amazon).&lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;p&gt;1.&lt;a href="https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository" rel="noopener noreferrer"&gt;Docker installed on your device.&lt;/a&gt;.&lt;strong&gt;NOTE: Make sure your docker version is below 25; to prevent errors associated with compatibility. We will be using Docker version 24.0.7.)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;2.&lt;a href="https://www.linuxbuzz.com/install-minikube-on-ubuntu/" rel="noopener noreferrer"&gt;Minikube installed on your Device&lt;/a&gt;.&lt;br&gt;
3.&lt;a href="https://github.com/" rel="noopener noreferrer"&gt;A Github repository to save your project files&lt;/a&gt;.&lt;br&gt;
4.&lt;a href="https://tecadmin.net/how-to-install-flask-on-ubuntu/" rel="noopener noreferrer"&gt;Flask installed in your device&lt;/a&gt;.&lt;br&gt;
5.A Dockerfile.&lt;br&gt;
6.Docker-compose yaml file.&lt;br&gt;
7.Deployment and Service yaml files.&lt;br&gt;
8.A requirement.txt file for flask dependencies.&lt;/p&gt;
&lt;h4&gt;
  
  
  Step 1:Creating a  Dockerfile with the following:
&lt;/h4&gt;

&lt;p&gt;In the file structure of the Dockerfile, we copy the requirements.txt before the files because of easier caching when modifications are done,and you can have an easier build with Docker.&lt;/p&gt;

&lt;p&gt;(Ensure you add Flask and werkzeug with their consecutive versions in the requirements.txt file.)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Use an official Python runtime as a parent image
FROM python:3.10.12

# Install python3-venv
RUN apt-get update &amp;amp;&amp;amp; \
    apt-get install -y python3-venv
# Set the working directory to the name of the application
WORKDIR /app

# Copy the requirements file into the container at the application 
COPY requirements.txt /app/

# Create a virtual environment in /opt/env
RUN python3 -m venv /opt/env

# Install any needed packages specified in requirements.txt
RUN /opt/env/bin/pip install --no-cache-dir -r requirements.txt

# Copy the current directory contents into the container at the application
COPY . /app/

# Set environment variables
ENV PATH="/app/venv/bin:$PATH"

# Make port 5000 available to the world outside this container
EXPOSE 5000

# Run flask application when the container launches
CMD ["/opt/env/bin/python", "-m","flask", "run","--host=0.0.0.0"]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 2:Creating a docker-compose yaml file with the following:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: '3'

services:
  web:
    build: .
    ports:
      - "5000:5000"
    environment:
      - DATABASE_URL=sqlite:////data/mydatabase.db  # Set the desired database file path
    volumes:
      - ./:/data # Set the desired file path

  sqlite3:
    image: nouchka/sqlite3:latest
    stdin_open: true
    tty: true
    volumes:
      - ./:/data # Set the desired file path

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 3: Run Docker Compose Commands.
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;docker-compose build&lt;/code&gt;&lt;br&gt;
&lt;code&gt;docker-compose up&lt;/code&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Step 4: Load the Docker Image to Minikube.
&lt;/h4&gt;

&lt;p&gt;Minikube is best suited for local development and testing, but it doesn't provide the same features and scalability as a full-scale production Kubernetes cluster.&lt;br&gt;
Once installed, make sure to load the image name that you created with docker using this command &lt;br&gt;
&lt;code&gt;minikube image load your-image-name:tag&lt;/code&gt;.We used this for the app:&lt;code&gt;minikube image load flask_web:latest&lt;/code&gt;. Run&lt;code&gt;minikube image list&lt;/code&gt;to check if the image exists.&lt;/p&gt;
&lt;h4&gt;
  
  
  Step 5: Create a Kubernetes Deployments file.
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Note: Make sure to add the image pull policy line as &lt;code&gt;IfNotPresent&lt;/code&gt;to mitigate pull errors from images you have.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: apps/v1
kind: Deployment
metadata:
  name: your-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: your-app
  template:
    metadata:
      labels:
        app: your-app
    spec:
      containers:
      - name: your-container
        image: your-image-name:tag
        ports:
        - containerPort: 80
        imagePullPolicy: IfNotPresent

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 6: Apply the deployment file to Minikube.
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;kubectl apply -f deployment.yaml&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 7: Create a service file that exposes the flask application.
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
  name: your-service
spec:
  selector:
    app: your-app
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
  type: LoadBalancer

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 8: Apply the service in minikube.
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;kubectl apply -f service.yaml&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 9: Access the service.
&lt;/h4&gt;

&lt;p&gt;To access the service, run the following command: &lt;br&gt;
&lt;code&gt;minikube service your-service&lt;/code&gt; If successful, it will launch in your browser. &lt;/p&gt;

&lt;h4&gt;
  
  
  Step 10: Stopping and deleting the Minikube cluster.
&lt;/h4&gt;

&lt;p&gt;Once done, make sure you stop and delete the minikube cluster using the following commands:&lt;br&gt;
&lt;code&gt;minikube stop&lt;br&gt;
minikube delete&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;In conclusion, we were able to deploy a container application in Kubernetes using Minikube as a testing tool which offered the best local testing environment. Kubernetes is the best tool for container orchestration, deployment, and scaling at the high end, while Docker complements Kubernetes by containerizing its applications.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>deployment</category>
      <category>devops</category>
    </item>
    <item>
      <title>Containerizing your Go application using Docker</title>
      <dc:creator>joy</dc:creator>
      <pubDate>Tue, 16 Jan 2024 09:52:11 +0000</pubDate>
      <link>https://dev.to/joykingoo/containerizing-your-go-application-by-using-docker-4bp2</link>
      <guid>https://dev.to/joykingoo/containerizing-your-go-application-by-using-docker-4bp2</guid>
      <description>&lt;h4&gt;
  
  
  Introduction
&lt;/h4&gt;

&lt;p&gt;This article will explore how to containerize a simple golang web server application using Docker . You can use any Operating system to run your application,We use Ubuntu to build this application. In this article we use Docker commands as opposed to using a Dockerfile.&lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;p&gt;1.&lt;a href="https://docs.docker.com/desktop/install/ubuntu/" rel="noopener noreferrer"&gt;Docker installed on your device.&lt;/a&gt;&lt;br&gt;
2.&lt;a href="https://github.com/" rel="noopener noreferrer"&gt;A Github repository to save your project files&lt;/a&gt;&lt;br&gt;
3.&lt;a href="https://itslinuxfoss.com/install-go-on-ubuntu-22-04/#google_vignette" rel="noopener noreferrer"&gt;Golang installed in your device&lt;/a&gt;&lt;br&gt;
4.&lt;a href="https://code.visualstudio.com/docs/setup/linux#_installation" rel="noopener noreferrer"&gt;VsCode Editor&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  What is Docker?
&lt;/h4&gt;

&lt;p&gt;Docker is a framework used by developers to containerize software applications. Containerizing an application is when a bunch of code and all its components, like libraries and files, are executed within a hosted environment.&lt;/p&gt;

&lt;p&gt;When a person dockerizes their application, they can access and run it on any platform supporting docker. The application run usually has many components like files and libraries; which get stored in a compressed file called a docker image.&lt;/p&gt;

&lt;p&gt;The following steps are used to containerize an application using Docker.&lt;br&gt;
&lt;strong&gt;Note:&lt;/strong&gt; We will not be using a Dockerfile for this article.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1:Cd into the directory that contains your code and libraries.
&lt;/h4&gt;

&lt;p&gt;You will then run the following command in your terminal while in your project directory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6qtwa2dz6d04rnup7ajt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6qtwa2dz6d04rnup7ajt.png" alt="Docker command for building image " width="800" height="87"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We used alpine as the base image for docker because of its minimal size and we wanted a small image for the application. But if someone wants a larger image of better performance,We would suggest using NGINX as an image base.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2:Install the necessary build tools.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmqsn53jwskib35qyhorn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmqsn53jwskib35qyhorn.png" alt="Download of build tools." width="800" height="627"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3: Copy and install go dependencies for your application.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjoggchtu5vfrp1314h9n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjoggchtu5vfrp1314h9n.png" alt="Download of Go dependencies." width="800" height="95"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 4 : Run and build the Go application using docker build -o name-of-your-application.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnnrcl03dqqo3m74fk6u4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnnrcl03dqqo3m74fk6u4.png" alt="Go build Docker command" width="800" height="24"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 5: After building the application, you exit the container.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhx4jhu3rdgj7qw5taqjn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhx4jhu3rdgj7qw5taqjn.png" alt="Exit" width="110" height="28"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 6: Commit your changes to a new image.
&lt;/h4&gt;

&lt;p&gt;You can use the container ID or name of the application to commit the changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucfmrcjexf7eoeropa95.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucfmrcjexf7eoeropa95.png" alt="Docker commit changes" width="800" height="37"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 7: Finally run your custom image with the following command.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbuccpjrph474eaczzjre.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbuccpjrph474eaczzjre.png" alt="Docker run" width="381" height="22"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: As much as this is an interactive way of containerizing an application. It is highly recommended to use a Dockerfile to containerize an application.&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;In conclusion, we were able to containerize the Go application using Docker. Docker is an amazing tool for containerizing applications such that you can access your application anywhere as long as you have the images stored in a container registry reachable when run with Docker. If you plan on seeking to explore how to do this using a Dockerfile, I would suggest following &lt;a href="https://kodekloud.com/blog/how-to-build-a-docker-image/" rel="noopener noreferrer"&gt;this&lt;/a&gt; article.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>containerapps</category>
      <category>go</category>
    </item>
    <item>
      <title>Containerizing your Go application by using Docker</title>
      <dc:creator>joy</dc:creator>
      <pubDate>Tue, 16 Jan 2024 09:52:11 +0000</pubDate>
      <link>https://dev.to/joykingoo/containerizing-your-go-application-by-using-docker-5ffo</link>
      <guid>https://dev.to/joykingoo/containerizing-your-go-application-by-using-docker-5ffo</guid>
      <description>&lt;h4&gt;
  
  
  Introduction
&lt;/h4&gt;

&lt;p&gt;This article will explore how to containerize a simple golang web server application using Docker . You can use any Operating system to run your application,We use Ubuntu to build this application. In this article we use Docker commands as opposed to using a Dockerfile.&lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;p&gt;1.&lt;a href="https://docs.docker.com/desktop/install/ubuntu/" rel="noopener noreferrer"&gt;Docker installed on your device.&lt;/a&gt;&lt;br&gt;
2.&lt;a href="https://github.com/" rel="noopener noreferrer"&gt;A Github repository to save your project files&lt;/a&gt;&lt;br&gt;
3.&lt;a href="https://itslinuxfoss.com/install-go-on-ubuntu-22-04/#google_vignette" rel="noopener noreferrer"&gt;Golang installed in your device&lt;/a&gt;&lt;br&gt;
4.&lt;a href="https://code.visualstudio.com/docs/setup/linux#_installation" rel="noopener noreferrer"&gt;VsCode Editor&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  What is Docker?
&lt;/h4&gt;

&lt;p&gt;Docker is a framework used by developers to containerize software applications. Containerizing an application is when a bunch of code and all its components, like libraries and files, are executed within a hosted environment.&lt;/p&gt;

&lt;p&gt;When a person dockerizes their application, they can access and run it on any platform supporting docker. The application run usually has many components like files and libraries; which get stored in a compressed file called a docker image.&lt;/p&gt;

&lt;p&gt;The following steps are used to containerize an application using Docker.&lt;br&gt;
&lt;strong&gt;Note:&lt;/strong&gt; We will not be using a Dockerfile for this article.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1:Cd into the directory that contains your code and libraries.
&lt;/h4&gt;

&lt;p&gt;You will then run the following command in your terminal while in your project directory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6qtwa2dz6d04rnup7ajt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6qtwa2dz6d04rnup7ajt.png" alt="Docker command for building image " width="800" height="87"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We used alpine as the base image for docker because of its minimal size and we wanted a small image for the application. But if someone wants a larger image of better performance,We would suggest using NGINX as an image base.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2:Install the necessary build tools.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmqsn53jwskib35qyhorn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmqsn53jwskib35qyhorn.png" alt="Download of build tools." width="800" height="627"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3: Copy and install go dependencies for your application.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjoggchtu5vfrp1314h9n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjoggchtu5vfrp1314h9n.png" alt="Download of Go dependencies." width="800" height="95"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 4 : Run and build the Go application using docker build -o name-of-your-application.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnnrcl03dqqo3m74fk6u4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnnrcl03dqqo3m74fk6u4.png" alt="Go build Docker command" width="800" height="24"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 5: After building the application, you exit the container.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhx4jhu3rdgj7qw5taqjn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhx4jhu3rdgj7qw5taqjn.png" alt="Exit" width="110" height="28"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 6: Commit your changes to a new image.
&lt;/h4&gt;

&lt;p&gt;You can use the container ID or name of the application to commit the changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucfmrcjexf7eoeropa95.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucfmrcjexf7eoeropa95.png" alt="Docker commit changes" width="800" height="37"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 7: Finally run your custom image with the following command.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbuccpjrph474eaczzjre.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbuccpjrph474eaczzjre.png" alt="Docker run" width="381" height="22"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;_&lt;strong&gt;Note&lt;/strong&gt;: As much as this is an interactive way of containerizing an application. It is highly recommended to use a Dockerfile to containerize an application.&lt;br&gt;
_&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;In conclusion, we were able to containerize the Go application using Docker. Docker is an amazing tool for containerizing applications such that you can access your application anywhere as long as you have the images stored in a container registry reachable when run with Docker. If you plan on seeking to explore how to do this using a Dockerfile, I would suggest following &lt;a href="https://kodekloud.com/blog/how-to-build-a-docker-image/" rel="noopener noreferrer"&gt;this&lt;/a&gt; article.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>containerapps</category>
      <category>go</category>
    </item>
  </channel>
</rss>
