<?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>Forem: adhanaAshu </title>
    <description>The latest articles on Forem by adhanaAshu  (@ashkamrip).</description>
    <link>https://forem.com/ashkamrip</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%2F966271%2F79c1e9a9-51e4-4e49-a160-1bf2729d1720.png</url>
      <title>Forem: adhanaAshu </title>
      <link>https://forem.com/ashkamrip</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ashkamrip"/>
    <language>en</language>
    <item>
      <title>Nginx Basics</title>
      <dc:creator>adhanaAshu </dc:creator>
      <pubDate>Sat, 14 Jan 2023 09:48:37 +0000</pubDate>
      <link>https://forem.com/ashkamrip/nginx-basics-4la</link>
      <guid>https://forem.com/ashkamrip/nginx-basics-4la</guid>
      <description>&lt;h3&gt;
  
  
  what is Nginx?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;primarily one of the fastest web servers but can also be used as a proxy, reverse proxy, API Gateway, content cache and load balancer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Its usage as a &lt;strong&gt;&lt;em&gt;reverse proxy&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;load balancer&lt;/em&gt;&lt;/strong&gt; is what makes it stand out.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NGINX efficiently handles tasks that might slow down your web server, such as negotiating SSL/TLS or compressing and caching content to improve performance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Elements of Nginx configuration file
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Nginx is very simple to install and once installed you can start by editing the config file which will usually exist in &lt;strong&gt;/etc/nginx&lt;/strong&gt; or &lt;strong&gt;/usr/local/etc/nginx&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;nginx.conf is the text-based configuration file for Nginx.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;It contains elements called &lt;em&gt;Directives &lt;/em&gt; and &lt;em&gt;Contexts.&lt;/em&gt; Directives are written like key-value pairs on each line ending with semicolons(;) Context on the other hand are top-level directives that apply to different kinds of incoming traffic.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://nginx.org/en/docs/ngx_core_module.html#events"&gt;events&lt;/a&gt; – General connection processing&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nginx.org/en/docs/http/ngx_http_core_module.html#http"&gt;http&lt;/a&gt; – HTTP traffic&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nginx.org/en/docs/mail/ngx_mail_core_module.html#mail"&gt;mail&lt;/a&gt; – Mail traffic&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nginx.org/en/docs/stream/ngx_stream_core_module.html#stream"&gt;stream&lt;/a&gt; – TCP and UDP traffic&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Some directives use { } to group directives together these are called &lt;em&gt;blocks.&lt;/em&gt; One of such important directives is the &lt;code&gt;Location [modifier] [URI]{ ... }&lt;/code&gt; this directive is used to route the incoming traffic to various file systems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Examples of a few directives are given below.&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="c1"&gt;# These are directives key value; like pairs&lt;/span&gt;
&lt;span class="k"&gt;user&lt;/span&gt;             &lt;span class="s"&gt;nobody&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;error_log&lt;/span&gt;        &lt;span class="nc"&gt;logs/error&lt;/span&gt;&lt;span class="s"&gt;.log&lt;/span&gt; &lt;span class="s"&gt;notice&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;worker_processes&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Every time you make any changes to the nginx.conf , the nginx must be reloaded to take effect. you can use the command &lt;strong&gt;nginx -s reload&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Few important directives to discuss
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;include directive&lt;/strong&gt;: This directive includes another file inside the config file. include mime.types is one of the popular usages, a web server needs to know what kind of data is incoming, and this data is embedded into the headers of the incoming requests. nginx, suggest using this directive to break down your config files into simpler manageable files.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="k"&gt;http&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
&lt;span class="kn"&gt;include&lt;/span&gt; &lt;span class="s"&gt;mime.types&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 

    &lt;span class="kn"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kn"&gt;.&lt;/span&gt; &lt;span class="s"&gt;.&lt;/span&gt; &lt;span class="s"&gt;.&lt;/span&gt;
    &lt;span class="err"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;location block&lt;/strong&gt;:This directive routes the requests to the correct location within the file system by matching the URI against the parameter . It is one of the most important directives to learn. each URL is matched against the location block to determine what content it will serve.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="c1"&gt;# the uri : / is the parameter to the location block.&lt;/span&gt;
&lt;span class="c1"&gt;# users visiting localhost:8080/ would be served content from this block&lt;/span&gt;
&lt;span class="k"&gt;http&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
            &lt;span class="kn"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kn"&gt;...&lt;/span&gt;
            &lt;span class="err"&gt;}&lt;/span&gt;    
            &lt;span class="s"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;.&lt;/span&gt;
    &lt;span class="err"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;root directive&lt;/strong&gt;: The parameter &lt;code&gt;/draft&lt;/code&gt; gets appended to the root location folder.&lt;/p&gt;

&lt;p&gt;URL gets matched against &lt;code&gt;/draft&lt;/code&gt; here and then nginx serves content from the location &lt;code&gt;/users/rocky/site/draft/&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="c1"&gt;# users visiting localhost:8080/draft would be served content from this block&lt;/span&gt;
&lt;span class="k"&gt;http&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
            &lt;span class="kn"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/draft&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kn"&gt;root&lt;/span&gt; &lt;span class="n"&gt;/users/rocky/site&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
            &lt;span class="p"&gt;}&lt;/span&gt;     
            &lt;span class="kn"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;.&lt;/span&gt;
    &lt;span class="err"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;alias directive&lt;/strong&gt;: The parameter &lt;code&gt;/test&lt;/code&gt; gets dropped and the nginx serves content from &lt;code&gt;/users/rocky/site/draft&lt;/code&gt; . It allows us to remap URLs to a different directory completely other than the root location. It is useful for serving static files from a different directory&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt; &lt;span class="c1"&gt;# users visiting localhost:8080/test would be served content from this block&lt;/span&gt;
&lt;span class="k"&gt;http&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
            &lt;span class="kn"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/test&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kn"&gt;alias&lt;/span&gt; &lt;span class="n"&gt;/users/rocky/site/draft&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
            &lt;span class="p"&gt;}&lt;/span&gt;    
            &lt;span class="kn"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;.&lt;/span&gt;
    &lt;span class="err"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;try_files directive:&lt;/strong&gt; This directive recursively search for files in a specific order and serves the file located first. we've mentioned here &lt;code&gt;=404&lt;/code&gt; meaning we don't let it run forever, if the server doesn't find the index.html in a single pass, it would throw the error 404.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="c1"&gt;# users visiting localhost:8080/draft would be served content from this block&lt;/span&gt;
&lt;span class="k"&gt;http&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
            &lt;span class="kn"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/draft&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kn"&gt;try_files&lt;/span&gt; &lt;span class="n"&gt;/drafts/index.html&lt;/span&gt; &lt;span class="n"&gt;/default/index.html&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;  
            &lt;span class="kn"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;.&lt;/span&gt;
    &lt;span class="err"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;redirect and rewrite directives&lt;/strong&gt;: if a user wants to go to &lt;code&gt;/final&lt;/code&gt; but we want the page to redirect to &lt;code&gt;/draft&lt;/code&gt; it is very simple to do. Look at the below example to achieve this.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="k"&gt;http&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
            &lt;span class="kn"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/final&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="c1"&gt;# 307 is a http redirect code &lt;/span&gt;
                &lt;span class="c1"&gt;# we are redirecting from final to draft&lt;/span&gt;
                &lt;span class="c1"&gt;# users visting localhost:8080/final &lt;/span&gt;
                &lt;span class="c1"&gt;# would be redirected to localhost:8080/draft&lt;/span&gt;
                &lt;span class="kn"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;307&lt;/span&gt;  &lt;span class="n"&gt;/draft&lt;/span&gt;
            &lt;span class="err"&gt;}&lt;/span&gt;  
            &lt;span class="s"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;.&lt;/span&gt;
    &lt;span class="err"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;In the previous example if you observe the URL changes from &lt;code&gt;/final&lt;/code&gt; to &lt;code&gt;/draft&lt;/code&gt; but what if we don't want the URL to change, this kind of behaviour is where we can make use of the &lt;code&gt;rewrite&lt;/code&gt; directive. Look at the below example to achieve this&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="k"&gt;http&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
            &lt;span class="kn"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;.&lt;/span&gt;
            &lt;span class="c1"&gt;# anybody visiting localhost:8080/final &lt;/span&gt;
            &lt;span class="c1"&gt;# will be redirected to /draft &lt;/span&gt;
            &lt;span class="c1"&gt;# but the url will remain the same i.e. localhost:8080/final&lt;/span&gt;
            &lt;span class="s"&gt;rewrite&lt;/span&gt; &lt;span class="s"&gt;^/final?&lt;/span&gt; &lt;span class="n"&gt;/draft&lt;/span&gt; &lt;span class="s"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
            &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/draft&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kn"&gt;...&lt;/span&gt;
            &lt;span class="err"&gt;}&lt;/span&gt;  
            &lt;span class="s"&gt;.&lt;/span&gt;
            &lt;span class="s"&gt;.&lt;/span&gt;
    &lt;span class="err"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are just a few of the directives to get you a bit familiar with nginx. Users can go through the nginx docs to learn in-depth about the intricacies of the nginx &lt;a href="http://docs.nginx.com"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=7VAI73roXaY&amp;amp;list=RDCMUCyLNhHSiEVkVwPSFKxJAfSA&amp;amp;index=1"&gt;Laith Academy at youtube&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>kubernetes</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>devops</category>
    </item>
    <item>
      <title>Helm and Helm Charts</title>
      <dc:creator>adhanaAshu </dc:creator>
      <pubDate>Tue, 20 Dec 2022 08:16:30 +0000</pubDate>
      <link>https://forem.com/ashkamrip/helm-and-helm-charts-557l</link>
      <guid>https://forem.com/ashkamrip/helm-and-helm-charts-557l</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;what is Helm? It is a package Manager for Kubernetes, just like apt is for ubuntu.&lt;/p&gt;

&lt;p&gt;Let's say we have an application running on the Kubernetes cluster, to setup &lt;code&gt;Logging&lt;/code&gt; using say, Elastic Stack, we need to create &lt;code&gt;Stateful set&lt;/code&gt; for database, &lt;code&gt;ConfigMap&lt;/code&gt; for external configuration, &lt;code&gt;Secret&lt;/code&gt; for storing secrets, &lt;code&gt;Services&lt;/code&gt; for the dashboard and finally a user with permissions. The amount of work required for the standard setup of a logging service is huge and it is pretty much the same for everyone out there. Why not just bundle up all the YAML files and made them available to other users? Helm calls this bundle of YAML files &lt;code&gt;Helm Charts&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Helm Charts
&lt;/h3&gt;

&lt;p&gt;Helm Charts are just Bundles of the YAML Files, which can be shared with users through Registries like Helm Hub. Users can create their own Helm Charts with Helm, this would also allow them to package the deployment in the dev environment and use the same in the prod environment or vice versa. Or you can also download and use the existing Helm charts, cutting down your deployment time.&lt;/p&gt;

&lt;p&gt;Helm is also a Templating Engine, in deployments where multiple microservices exist, there would be multiple yaml files for each microservice, Using helm we can replace multiple similar YAML files with a single template file kind of like a blueprint, which takes values from &lt;code&gt;values.yaml&lt;/code&gt; see the below example&lt;/p&gt;

&lt;p&gt;Example Template file&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FWyS58hb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t9rzixvmztxki8fib5ta.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FWyS58hb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t9rzixvmztxki8fib5ta.png" alt="Template file" width="434" height="279"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The values are coming from the value.yaml file below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--82vRewVh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/08omngi32hegeamjwfod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--82vRewVh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/08omngi32hegeamjwfod.png" alt="values.yaml" width="362" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next up, we can see the structure of a Helm Chart&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_chart/
 Chart.yaml
 values.yaml
 charts/
 templates/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;my_chart&lt;/code&gt; is the name of the chart.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Chart.yaml&lt;/code&gt; contains metadata information&lt;/p&gt;

&lt;p&gt;&lt;code&gt;values.yaml&lt;/code&gt; contains the values for the template files&lt;/p&gt;

&lt;p&gt;&lt;code&gt;charts&lt;/code&gt; contains the chart dependencies&lt;/p&gt;

&lt;p&gt;&lt;code&gt;templates&lt;/code&gt; contains the template files&lt;/p&gt;

&lt;p&gt;&lt;code&gt;helm install &amp;lt;chartname&amp;gt;&lt;/code&gt; injects the values from values.yaml into the template files and creates the Kubernetes manifests to be deployed.&lt;/p&gt;

&lt;p&gt;Let's Assume that we are using the helm templates but the values inside the yaml file are something that we would like to change, in that case, we can define our own &lt;code&gt;.YAML&lt;/code&gt; file and pass it while installing the helm chart as below&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;helm install --values=my-values.yaml &amp;lt;chartname&amp;gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Release Management
&lt;/h2&gt;

&lt;p&gt;Helm version 2 comes in the form of a client i.e. helm CLI and a server component i.e. Tiller. It runs inside the Kubernetes cluster and deploys the components inside the cluster. It also keeps a history of chart executions, each time a new chart is Installed or upgraded, providing the rollback feature in case of deployment failure However this makes Tiller a big security concern, Hence in Helm version 3, Tiller was removed. So the Release Management feature although available in version 2 is not available in the latest releases.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=-ykwb1d0DXU"&gt;What is Helm in Kubernetes? Helm and Helm Charts explained | Kubernetes Tutorial 23&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>helmchart</category>
      <category>devops</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Vagrant for begginers</title>
      <dc:creator>adhanaAshu </dc:creator>
      <pubDate>Tue, 06 Dec 2022 12:33:31 +0000</pubDate>
      <link>https://forem.com/ashkamrip/vagrant-for-begginers-532g</link>
      <guid>https://forem.com/ashkamrip/vagrant-for-begginers-532g</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Vagrant, a open source project to create and maintain VMs, was supposedly a side project by &lt;a href="https://twitter.com/mitchellh"&gt;Mitchell Hashimoto&lt;/a&gt; and the company name Hashicorp was found around it. It is mainly used to create portable development environments. Vagrant cloud containes these ready-to-run vagrant boxes, which can be setup within minutes, provided, you have installed Vagrant and other utilities required along with it. &lt;/p&gt;

&lt;p&gt;Vagrant can create VMs through configuration files or bootstrapped scripts, which can be easily automated using tools like bash, ansible, chef, puppet etc. &lt;/p&gt;

&lt;h3&gt;
  
  
  What are we going to do ?
&lt;/h3&gt;

&lt;p&gt;The Idea here is to learn about the basic capabilities of vagrant, this can help the readers take up medium or maybe advanced topics to further their expertise. &lt;/p&gt;

&lt;p&gt;For simplicity's stake we assume everyone has installed vagrant , if not &lt;a href="https://developer.hashicorp.com/vagrant/tutorials/getting-started/getting-started-install"&gt;there you go!&lt;/a&gt;. We are going to start up a VM, inside which apache server would be serving up a site. &lt;/p&gt;

&lt;p&gt;Just to be clear, we are going to start up not just a VM with some basic configurations but then we are going to install apache2 ; a web server and then host a simple website on it, we are going to make the site available inside your network, meaning it can be easily accessed through not just the host machine but also your mobiles or other laptops if they're connected to your wifi or router. At the end, we are going to see how all of this can be automated .Good deal ! read up ahead.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Note: *&lt;/em&gt; Although we are hosting a website to learn vagrant, It's actually used to setup devlopment environments and shouldn't be used to setup Production environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up the tools
&lt;/h2&gt;

&lt;p&gt;Well, the only tools you require is Vagrant and a VM provider, fun fact!  vagrant supports multiple VM providers vmware, virtualbox , docker etc.  So you can go ahead with this tutorial, if you have any of these VM providers installed already. Although i wouldn't prefer Docker, because of two reasons, reason 1 being, most of the config is done on dockerfiles and second we would deviate from the core lessons that vagrant has to offer. &lt;/p&gt;

&lt;p&gt;so our first command is going to be &lt;code&gt;vagrant init ubuntu/jammy64&lt;/code&gt; this creates a Vagrantfile that contain configurations for our VM, it's written in &lt;code&gt;ruby&lt;/code&gt;, but you wouldn't need to learn it. ubuntu/jammy64 is the &lt;code&gt;box&lt;/code&gt; name. *&lt;em&gt;Box *&lt;/em&gt; in vagrant are usually the name of the linux distros, or names people give their VMs and then upload it to &lt;code&gt;vagrant cloud&lt;/code&gt;. Where you can share and use these boxes. Similar to images in Docker.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;vagrant up&lt;/code&gt; downloads the box and then boots it up, &lt;code&gt;vagrant ssh&lt;/code&gt; would log you inside the box and &lt;code&gt;logout&lt;/code&gt; will simply log you out of the box. &lt;/p&gt;

&lt;h3&gt;
  
  
  Installing the web server
&lt;/h3&gt;

&lt;p&gt;Now that we are able to bring up the VM, next we will manually try to install the apache server on it. before that we are going to perform the below actions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We are going to update our system dependencies using &lt;code&gt;sudo apt update&lt;/code&gt; . This is standard practice to keep your system updated.&lt;/li&gt;
&lt;li&gt;The command to install apache from the apt repository for ubuntu is &lt;code&gt;sudo apt install apache2&lt;/code&gt; , you could easily get this from google, if you want to try installing something else.&lt;/li&gt;
&lt;li&gt;We can just type&lt;code&gt;systemctl status apache2&lt;/code&gt; in the terminal to check the status of the apache server. It should already be running &lt;/li&gt;
&lt;li&gt;You can try sending a request to the site, using &lt;code&gt;curl -v localhost:80&lt;/code&gt;. curl is a terminal based tool to check the status of websites. It will send some text back , what we're looking for is &lt;code&gt;200 OK&lt;/code&gt; this lets us know that site is up and running at port 80.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Networking.
&lt;/h3&gt;

&lt;p&gt;Well, both the VM and the web server are up and running but this site can't be accessed on the host machine. what's the point you may ask? and... you're right, a site that is only available on the local machine isn't useful at all. &lt;/p&gt;

&lt;p&gt;Now comes the networking, There are a number of ways to make this site available to local network or even the internet. you can go through this link for basic or even advanced usage of networking with vagrant &lt;a href="https://developer.hashicorp.com/vagrant/docs/networking"&gt;Networking Vagrant&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;We are going to make our site available on our local network through something called port-forwarding. We are going to map one of the ports on the host machine to port 80 of the VM i.e. ( host:4567 -&amp;gt; VM:80),&lt;br&gt;
 The traffic sent to host:4567 will be directed to port 80 of the VM.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;config.vm.network "forwarded_port", guest:80, host:4567
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this single line should do the trick inside the vagrant file. Do this change to the Vagrantfile, save it and do &lt;code&gt;vagrant reload&lt;/code&gt;. you can try visiting &lt;code&gt;localhost:4567&lt;/code&gt; , voila ! you will see the default page of apache server , now the only thing left is to replace apache default webpage to custom simple html and css based website. you can simply paste the content of your website inside the folder &lt;code&gt;/var/www/html/&lt;/code&gt;. how would you do this ? Your root directory, where Vagrantfile is created, is the directory that gets mounted as &lt;code&gt;/vagrant&lt;/code&gt; inside the VM so you can move files to this root directory and then move this files to &lt;code&gt;/var/www/html&lt;/code&gt; inside the VM.&lt;/p&gt;

&lt;h3&gt;
  
  
  TL;DR
&lt;/h3&gt;

&lt;p&gt;Now we are all set, you can &lt;code&gt;vagrant destroy&lt;/code&gt; which will delete the VM and all of its content. &lt;/p&gt;

&lt;p&gt;Vagrant will take a config file:&lt;code&gt;Vagrantfile&lt;/code&gt; and spin up a VM. Below you can view our Vagrant file to understand what all actions it will perform.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Vagrant.configure("2") do |config|

# Initial linux distro 
  config.vm.box = "ubuntu/jammy64"

# commands to be executed once the VM is provisioned
  config.vm.provision "shell" , inline: &amp;lt;&amp;lt;-END 

# update the system dependencies
  apt-get update

# Install the apache webserver
  apt-get install -y apache2

# copy over website content to where apache keeps the default site content.
  if ! [ -L /var/www ]; then
    rm -rf /var/www/html
    cp -r /vagrant/website/  /var/www/html
  fi
  echo "Container provisioned at $(date)! Welcome "
  END
# port forwarding to make the site accessible out of the VM
  config.vm.network "forwarded_port", guest:80, host:4567
end

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

&lt;/div&gt;



&lt;p&gt;if you run &lt;code&gt;vagrant up&lt;/code&gt; with &lt;code&gt;Vagrantfile&lt;/code&gt; same as the above code, you would be able to do achieve all the things that are discussed in this blog.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.tutorialworks.com/linux-vm-vagrant/"&gt;https://www.tutorialworks.com/linux-vm-vagrant/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vagrant</category>
      <category>automation</category>
      <category>devops</category>
      <category>virtualmachines</category>
    </item>
    <item>
      <title>Concurrency and Channels in Go</title>
      <dc:creator>adhanaAshu </dc:creator>
      <pubDate>Mon, 05 Dec 2022 10:17:29 +0000</pubDate>
      <link>https://forem.com/ashkamrip/concurrency-and-channels-in-go-546i</link>
      <guid>https://forem.com/ashkamrip/concurrency-and-channels-in-go-546i</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Concurrency essentially makes a go program run faster by improving the response time and improving the resource utilization. Goroutines and channels are the programming constructs used in go achieve concurrency, goroutines are cheap, lightweight threads whereas channels let goroutines talk to each other.&lt;/p&gt;

&lt;p&gt;while writing looping code you tell your computer to execute a few line of codes again and again, whereas while writing concurrent code you tell &lt;strong&gt;&lt;em&gt;your computer&lt;/em&gt;&lt;/strong&gt; to bring his friend, &lt;strong&gt;&lt;em&gt;another computer&lt;/em&gt;&lt;/strong&gt; , to execute this other piece of code while your computer keeps on doing his work. Goroutine is that other computer except that it's not a computer and well guess what it's not a thread either. One another thing to note here is that the other computer is running independently from your computer. If they wanted to talk to each other they would have to use something called a channel in go. Let us now see the nuances of goroutine and channel&lt;/p&gt;

&lt;h3&gt;
  
  
  goroutines
&lt;/h3&gt;

&lt;p&gt;The word "go" needs to be appended to any named or anonymous function and that function becomes the goroutine. simple demonstration below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func printhi() { fmt.Println("hi")} 

func main() {

  // named function 
  go printhi()
  // Anonymous function
  go printHello() { fmt.Prinln("Hello")}() 

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

&lt;/div&gt;



&lt;p&gt;Here &lt;strong&gt;printhi&lt;/strong&gt; and &lt;strong&gt;printHello&lt;/strong&gt; are supposed to run at the same time, while the main function is also running. If executed there's a high chance neither hi nor Hello is printed on the stdout because the program runs only till the main function is running i.e. here main doesn't wait for goroutines to end and simply ends.&lt;/p&gt;

&lt;p&gt;Features of goroutines&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They are lightweight and cheap , in comparison to threads&lt;/li&gt;
&lt;li&gt;Thousands of independent goroutines can be multiplexed onto a single thread&lt;/li&gt;
&lt;li&gt;Named or Anonymous functions can be made to run as goroutines&lt;/li&gt;
&lt;li&gt;If a single thread is blocked, the other goroutines on the thread are moved onto another unblocked thread, by the go runtime.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  channel
&lt;/h3&gt;

&lt;p&gt;Channels can be visualized as a &lt;strong&gt;box&lt;/strong&gt;, now if it's a unbuffered channel then it will only hold a single item, meaning if &lt;em&gt;A&lt;/em&gt; goroutine puts 1 inside the box, goroutine &lt;em&gt;B&lt;/em&gt; can not put anything inside it until the existing 1 is taken out of the box, this causes blocking. Unbuffered channels on the other hand can hold items until they're full, blocking for unbuffered channels occurs when either it's full or empty.&lt;/p&gt;

&lt;p&gt;Getting used to the &lt;strong&gt;blocking&lt;/strong&gt; mechanism is a lil bit tricky for beginners, in simpler terms the program sleeps and waits for something to wake it up.That something can be another goroutine or main function.&lt;/p&gt;

&lt;p&gt;Let us see in which cases blocking of program occurs ,we will take 2 goroutines ( send and receive ) and 1 channel (ch)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;ch&lt;/em&gt; contains 1 inside it and send wants to put 2 inside ch, it will cause a &lt;strong&gt;block&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;ch&lt;/em&gt; is empty and receive wants values from ch , it will cause a &lt;strong&gt;block&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A rookie mistake would be to just simply send and receive data from the channel from the main program. what happens is one of them causes blocking and since we don't have any other goroutine besides the main function running, nothing unblocks the main program itself and hence *&lt;em&gt;DEADLOCK *&lt;/em&gt; occurs. &lt;/p&gt;

&lt;p&gt;Let us know, see the code for creating a channel and sending, receiving values from it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// channel is created using "make" 
// this here is a unbuffered integer channel
// int can be replaced by bool, string or anything that the user wants.
ch := make(chan int) 

// this here is a buffered integer channel of size 2 
ch := make(chan int , 2 ) 

// this is how you can insert a value inside a channel
ch &amp;lt;- 1 

// this is how you can take values out of a channel
number := &amp;lt;- ch

// The direction of arrow indicates the flow of data.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The buffered channels are channels of a fixed size, items can be added until all the space gets occupied inside a channel and in the same way, items can be retrieved until the whole channel is empty, the data follows the first-in, first-out fashion.&lt;/p&gt;

&lt;p&gt;The concurrency concept of go is non exhaustive and as much as i want to write more about it , I'm afraid i don't want to clutter up everything in the same article&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;Go Web Programming by Sau Sheong Chang , Manning Publications&lt;/p&gt;

</description>
      <category>career</category>
      <category>productivity</category>
      <category>resources</category>
    </item>
    <item>
      <title>Swagger-as a documentation tool</title>
      <dc:creator>adhanaAshu </dc:creator>
      <pubDate>Fri, 11 Nov 2022 19:23:49 +0000</pubDate>
      <link>https://forem.com/ashkamrip/swagger-as-a-documentation-tool-mp0</link>
      <guid>https://forem.com/ashkamrip/swagger-as-a-documentation-tool-mp0</guid>
      <description>&lt;p&gt;Hi so this is my first post here on DEV. I've heard about Swagger so many times and everytime i want to use it, to contribute to Open source, i get so confused. Most of the blogs suggest how it is so great for lot of things development,testing,documentation and whatnot. i wish i can just explore swagger for say, one of it's feature maybe for writing api documentation. I get overwhelmed by the blogs that i get online and finally i just drop the idea . Please drop by and say hi,I would love to hear how other people learnt it or are learning it as self taught programmers.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5rkHGyie--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.makeameme.org/created/hi-5c5c41.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5rkHGyie--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.makeameme.org/created/hi-5c5c41.jpg" alt="Hi" width="600" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
      <category>api</category>
      <category>swagger</category>
      <category>help</category>
    </item>
  </channel>
</rss>
