<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Devarsh's Blog]]></title><description><![CDATA[Devarsh's Blog]]></description><link>https://devarshshah.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 23 Jun 2026 04:01:37 GMT</lastBuildDate><atom:link href="https://devarshshah.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[My Experience at OpenSearchCon 2025 - Bengaluru]]></title><description><![CDATA[Hello Everyone,
This is my second event, where I am travelling to Bengaluru to attend OpenSearchCon.
First and foremost, the weather in Bangalore is amazing and very appealing. Now, regarding the event, I have met around 20 to 30 people so far, and I...]]></description><link>https://devarshshah.hashnode.dev/my-experience-at-opensearchcon-2025-bengaluru</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/my-experience-at-opensearchcon-2025-bengaluru</guid><category><![CDATA[opensearch]]></category><category><![CDATA[DSA]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Wed, 04 Jun 2025 13:26:39 GMT</pubDate><content:encoded><![CDATA[<p>Hello Everyone,</p>
<p>This is my second event, where I am travelling to Bengaluru to attend OpenSearchCon.</p>
<p>First and foremost, the weather in Bangalore is amazing and very appealing. Now, regarding the event, I have met around 20 to 30 people so far, and I have learned a lot from them.</p>
<p>I asked questions around Kubernetes clusters and nodes. I learned how nodes are created and how code is deployed to production environments.</p>
<p>First effective chat was with Engineers at Amazon, who got placed from on-campus placements, and I got to know that, right now, I am on the right path to building a Startup. Right now, I can learn from the challenges and if nothing goes as planned. We will discover the other way.</p>
<p>I had an inspiring chat with a girl my age who works at Uber. The depth of her questions showed how much she's grown by working with top engineers. It gave me another reason to attend such meetups—people like her inspire me.</p>
<p>Another talk I had with a sir from Atlassian. We had a chat about how things work in real life. He kindly introduced me to the concept of identifying problems. As I reached out to multiple people, he kindly encouraged me to ask about their problems instead of just pitching our product. He guided me to ask questions like, How do you store the data? How do you get the useful data?<br />Because everyone who collects the data, how do they filters out the necessary data from the dataset and adds the value.</p>
<p>After that, I had a chat with the engineers at AWS. We brainstormed a lot about the startup I am working for and tried to understand how we are adding value to the client’s organisation.</p>
<p>And then I had a chat with an architect at Apple. Very kind person. He told me how things worked at Apple, how environments work at Apple. The answer is dynamic. We can’t tell how things work in one static answer. I have to read about how the pre-prod environments for the devs work.</p>
<p>I asked almost everyone who got into an MNC whether they studied Data Structures and Algorithms. The answer was a unanimous and resounding 'YES.'</p>
<p>Not for the sake of grinding. But this will help us to write code and gradually write code as a senior developer.</p>
<p>Also, I connected with the engineer at IBM. He had given me the advice about DSA that practice DSA like you start getting the patterns that which pattern is actually being used.</p>
<p>Malleshwaram, Bengaluru — felt like home. A rickshaw driver treated me like his youger brother, showing me around the city with warmth.</p>
<p>Thank you, Bengaluru, for the warm welcome. The weather, the people and the perfect time.</p>
<p>Yeah everyone, that’s it. Love what you do. You don’t need to do all the things which are buzz right now. First, do learn the stuff which are required and then learn the things to enhance your knowledge.</p>
]]></content:encoded></item><item><title><![CDATA[O11y with Grafana Tempo and OpenTelemetry]]></title><description><![CDATA[Intro
In this blog, we would like to share the experience of attending Grafana’s recent Meetup, where Devarsh gave an insightful talk about how Grafana Tempo is being used at his firm. He spoke about why they chose Tempo over other observability tool...]]></description><link>https://devarshshah.hashnode.dev/o11y-with-grafana-tempo-and-opentelemetry</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/o11y-with-grafana-tempo-and-opentelemetry</guid><category><![CDATA[observability]]></category><category><![CDATA[Grafana]]></category><category><![CDATA[Grafana Monitoring]]></category><category><![CDATA[Tempo]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Sat, 03 May 2025 10:27:20 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1746035710790/784a9bbf-6be8-4445-8c66-2d82de28ddb2.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-intro">Intro</h2>
<p>In this blog, we would like to share the experience of attending Grafana’s recent Meetup, where Devarsh gave an insightful talk about how Grafana Tempo is being used at his firm. He spoke about why they chose Tempo over other observability tools and what made it stand out in their setup. Let's dive into what made this session so interesting!</p>
<h2 id="heading-what-is-observability">What is Observability?</h2>
<ul>
<li><p>O11y means the output which we will get from the API Calls, database, or they can can be received by Kubernetes or Docker containers.</p>
</li>
<li><p>The output(or the three pillars of o11y) can be in the form of Metrics, Logs and Traces.</p>
</li>
<li><p>Understanding each,</p>
<ul>
<li><p><strong>Metrics</strong> help us monitor the performance and resource usage—like CPU and memory—of the underlying infrastructure.</p>
</li>
<li><p>The <strong>Logs</strong>, the logs are, the real-time messages from the services, that what’s internal process are going internally. Like if we see the logs of the Node.js server, we know that we see the message → “Server is running on port 3000” or so on.</p>
</li>
<li><p>The <strong>Traces</strong>, this is something interesting, which we’re going to witness today. The traces take you through the path the request travels. Whereas, logs tell you this request was sent, and this request was received. The traces show you how many milliseconds (the latency) it took to reach that route.</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-why-o11y">Why O11y?</h2>
<ul>
<li><p>If we go back a decade, we will see that companies used to use monolithic architecture. So, if something goes wrong, they will just check the logs and see which part is breaking and remediate it.</p>
</li>
<li><p>But today, things are different. Microservices have an attraction, and companies are leveraging it, and here the need for o11y arises.</p>
</li>
<li><p>The o11y follows this cycle → Detect → Investigate → and Remediate</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1746036017511/9f900d48-c605-4107-95f4-5a0fe3e954a7.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>Detect → If we do not use O11y, the customer will call us or raise the issue that the particular microservice is misbehaving. But, using o11y, we will detect the issue beforehand can investigate and remediate the issue.</p>
</li>
<li><p>What do I mean when I speak of investigating? → We will see what status code we’re seeing and which request is misbehaving, and ultimately, we can remediate the issue.</p>
</li>
</ul>
<h2 id="heading-what-is-opentelemetry">What is OpenTelemetry?</h2>
<ul>
<li>Using OTel, we examine the internal state of o11y → otel o11y pipeline can be broken down into three main stages: the generation → the collection and → the export of the three pillars that we saw.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1746036165524/88287c3b-7fd4-4e2d-8e4b-2e4f94d77588.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-what-is-the-need-for-opentelemetry">What is the need for OpenTelemetry?</h2>
<ul>
<li><p>It generalises the way. There exist multiple tools which achieve this in their way. Tools, like Nagios, Jaeger, Zipkin, AWS X-ray, Grafana, Prometheus. But with multiple choices, there comes misery in selecting one. Hence, OTel.</p>
</li>
<li><p>OTel will instrument our microservice to measure the changes. In our case, instrumenting Node.js.</p>
</li>
</ul>
<h2 id="heading-why-did-we-choose-grafana-tempo">Why did we choose Grafana Tempo?</h2>
<ul>
<li><p>Simplified Documentation on What and How</p>
</li>
<li><p>Integrate it with the Grafana ecosystem.</p>
</li>
<li><p>Native support for OpenTelemetry</p>
</li>
<li><p>Helped us to find out the root cause analysis and find Slow Traces</p>
</li>
<li><p>Database support and accurate service graph</p>
</li>
<li><p>Which eventually boosted our productivity and saved our costs, as it’s an open-source project</p>
</li>
</ul>
<h3 id="heading-why-not-jaeger">Why not Jaeger?</h3>
<ul>
<li>For sure Jaeger will provide us Traces and Monitoring whereas Tempo has the Native support of Grafana alongwith the service graph and long term storage support.</li>
</ul>
<h3 id="heading-why-not-zipkin">Why not Zipkin?</h3>
<ul>
<li>No doubt, Zipkin is reliable and lightweight. But, it doesn’t support Grafana and OpenTelemetry natively and have limited capabilities in terms of Service Graphs and Long-Term storage option.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1746036105058/42a586ef-0fdf-47b0-933d-0325750a8c3e.jpeg" alt class="image--center mx-auto" /></p>
<p>Please refer to this GitHub repository. I have made changes to it and made it lightweight for my machine.<br /><a target="_blank" href="https://github.com/devarsh10/opentelemetry-demo/tree/lightweight">https://github.com/devarsh10/opentelemetry-demo/tree/lightweight</a></p>
<p>Finally, we will be able to see something like this,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1746036957229/523d70ec-31a2-4f1b-bfb0-16b2ba190f19.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-key-takeaways">Key Takeaways</h2>
<ul>
<li><p>Metrics, logs, and traces are the 3 pillars of observability, all viewable in a unified Grafana dashboard experience.</p>
</li>
<li><p>OpenTelemetry provides a vendor-neutral pipeline to generate, collect, and export telemetry data directly to Grafana's ecosystem.</p>
</li>
<li><p>Grafana Tempo offers a distributed tracing backend that integrates with OpenTelemetry and Prometheus.</p>
</li>
</ul>
<h2 id="heading-references">References</h2>
<ul>
<li>Why O11y Image → <a target="_blank" href="https://aws-observability.github.io/observability-best-practices/assets/images/Why_is_Observability_Important-88ac959abe0712c1a548537e274501f4.png">https://aws-observability.github.io/observability-best-practices/assets/images/Why_is_Observability_Important-88ac959abe0712c1a548537e274501f4.png</a></li>
</ul>
<h2 id="heading-conclusion">Conclusion</h2>
<ul>
<li><p>Now, we know what is the use of Grafana Tempo. How can it be useful when we integrate it with our microservice.</p>
</li>
<li><p>Let me know, how you guys are handling observability and what tools you’re using?</p>
</li>
<li><p>Lastly, I would like to express my sincere gratitude to <a class="user-mention" href="https://hashnode.com/@iamrushabhshah">Rushabh Shah</a>. Without his support, this blog would not have been possible. Thank you very much.</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[I passed my AWS Solutions Architect Associate (SAA - C03) Exam]]></title><description><![CDATA[Intro
Hello Everyone,I am Devarsh Shah and I am writing this blog to give a proper direction to ace the SAA - C03 Exam with free resources I follow.
First of all, here’s my credly badge which I received after approximately 16 hours of taking the exam...]]></description><link>https://devarshshah.hashnode.dev/saa-certified</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/saa-certified</guid><category><![CDATA[AWS]]></category><category><![CDATA[SAA-C03]]></category><category><![CDATA[AWS Solution Architect]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Sat, 14 Dec 2024 04:55:54 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-intro">Intro</h2>
<p>Hello Everyone,<br />I am Devarsh Shah and I am writing this blog to give a proper direction to ace the SAA - C03 Exam with free resources I follow.</p>
<p>First of all, here’s my <a target="_blank" href="https://www.credly.com/badges/2511747a-8ab8-4cf9-a0a3-049d0ada8646/public_url">credly badge</a> which I received after approximately 16 hours of taking the exam.<br />I took the exam at 12:30 AM on 8th December. 12:30 AM to 3:30 AM</p>
<h2 id="heading-mistakes">Mistakes</h2>
<h3 id="heading-booking-the-exam-time-slot">Booking the exam time slot</h3>
<p>I have booked the exam time slot for 7th December at noon, which is not good. I must have booked the exam a week or a month ago.<br />Also, I have faced issues while making payments. The Pearson website does not support UPI payments or the Debit we use in India. We must make the payment using an International Credit Card or Debit Card. I think an International Debit Card will also not do because I was not able to make payment using my virtual international Debit Card.<br /><strong>So, go for a Credit Card with International payment enabled.</strong></p>
<p><strong>My experience (please ignore if not interested in knowing)</strong></p>
<p>Trying to make payments recurrently from a Visa credit card with no International transaction support has blocked my Pearson’s account. So, I had to contact Pearson’s support team and it took me more than 24 hours to unblock my account and book the time slot.</p>
<h3 id="heading-booking-time-slot">Booking Time Slot</h3>
<p>Before scheduling, decide when you want to give the exam, with a fixed Date and Time. Because, once you click on the particular time slot, and will click on reschedule the exam. You won’t be able to book the exam at that time again.<br /><strong>So, decide when you want to take the exam.</strong></p>
<h2 id="heading-tldr">TL;DR</h2>
<p>- Book the exam for a week or a month<br />- First, decide when you want to take the exam and then book the date &amp; time slot.</p>
<h2 id="heading-how-much-did-the-exam-cost-me">How much did the exam cost me?</h2>
<p>I received the 50% off voucher after watching <a target="_blank" href="https://youtu.be/ctmSiR_cO9w?si=aXAdIrTRfL1c9DS2">this</a> video. Where I have to book the exam before 12th December and take the exam before 31st December.</p>
<h2 id="heading-preparation">Preparation</h2>
<ul>
<li><p>I have prepared it completely for free. I haven’t paid for any course or taken any mock exams.</p>
</li>
<li><p>I just have followed the following YouTube channels,</p>
<ul>
<li><p><a target="_blank" href="https://www.youtube.com/@peaceofcode">Peace Of Code by Aakash Kumar Nanda Sir</a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/@sthithapragnakk">Stithapragnya</a></p>
</li>
</ul>
</li>
<li><p>I have started preparing for my exam on 15 October 2024</p>
</li>
<li><p>So, it took me 1.5 months to prepare for the exam and get aware of all the AWS services.</p>
</li>
<li><p>Also, I have shared my learning journey on YouTube, you can refer to my learnings <a target="_blank" href="https://youtube.com/@rawdevops10">here</a>.</p>
</li>
<li><p>In the final week of my exam. I had completely devoted myself to the exam and was only referring to the YouTube channel Sthithpragnya for practicing questions. Till the last minute.</p>
</li>
<li><p>Yeah, that’s all that it took to achieve the certification.</p>
</li>
</ul>
<h2 id="heading-the-twist">The twist</h2>
<p>Everyone, I have given this exam on 8th December at night. Why? What’s so hurry? Because, I want to present myself as SAA certified when I was at CloudNativeCon + KubeCon 2024 Delhi, India.</p>
<p>Because, one of my seniors told me that, there are so many “Jr. Solution Architects exist nowadays”. Meaning, <strong>that must build a project</strong> to prove our capability.</p>
<h2 id="heading-outro">Outro</h2>
<p>I have built the blog short and crisp mentioning the required key points to crack the exam. Go now and crack the exam, with projects :)</p>
]]></content:encoded></item><item><title><![CDATA[My Experience at KubeCon + CloudNativeCon 2024 Delhi, India]]></title><description><![CDATA[Intro
Hello Everyone,This is my first blog where I will be telling you about my experience at the event which I attended after traveling from Gujarat to Delhi.Everyone, I was in Delhi attending KubeCon + CloudNativeCon. I have met around 100 people a...]]></description><link>https://devarshshah.hashnode.dev/kccnc-exp</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/kccnc-exp</guid><category><![CDATA[Kubecon]]></category><category><![CDATA[#cloudnativecon]]></category><category><![CDATA[Experience ]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Fri, 13 Dec 2024 19:51:52 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-intro">Intro</h2>
<p>Hello Everyone,<br />This is my first blog where I will be telling you about my experience at the event which I attended after traveling from Gujarat to Delhi.<br />Everyone, I was in Delhi attending KubeCon + CloudNativeCon. I have met around 100 people and learned a lot. Everyone, who has achieved success(according to me) has different roadmaps.</p>
<h2 id="heading-what-did-i-do">What did I do?</h2>
<p>\=&gt; How do I reach out to them, and pitch them?</p>
<ul>
<li><p>Hello/Hi, I am Devarsh, I am a Cloud and DevOps Enthusiast, and I am a recent graduate…and a little bit about myself.</p>
</li>
<li><p>I met people from different firms, CTOs, CEOs, and all.</p>
</li>
<li><p>On the day - 01, the knowledge and the confidence of the people overwhelmed me a bit.</p>
</li>
<li><p>But, when I met Akshay Sir he taught me how to bring confidence in your voice by just manipulating your posture. Keep your knees strong.</p>
</li>
</ul>
<p>\=&gt; How did I pitch myself?</p>
<ul>
<li><p>Tell about yourself (your enthusiasm must be in your eyes, not only in your script/pitch).</p>
</li>
<li><p>Tell, about your achievements.</p>
</li>
<li><p>Tell, what your goal is. (What do you want to become?)</p>
</li>
<li><p>Whom do you admire? (optional) It will help the person you’re talking to.</p>
</li>
<li><p>Additionally, I am looking for opportunities. OR Are you guys hiring?</p>
</li>
<li><p>And I am looking for this role &amp; responsibilities.</p>
</li>
<li><p>Cover all 6 points in around 30 - 40 seconds.</p>
</li>
</ul>
<p>Before this,<br />Suppose, you want to know about them and take inspiration from their all-day routine. Ask following,<br />- How does your day look like?<br />If you admire him or her the most, ask,<br />- What would be your steps if you were in my shoes?</p>
<p>Like,<br />I asked <a target="_blank" href="https://www.linkedin.com/in/bamulligan/">Bill Mulligan</a>, after the cilium session (this one - I will attach the link to the YT video here) &amp; he told me, that, if I was I haven’t jumped directly to learn &amp; understand eBPF.</p>
<p>Insights I took from that 2 minute conversation,<br />join yourself in a community → make contributions → become a maintainer (like he is now) →, and yeah. It’s not that straightforward everyone. But it’s achievable.  </p>
<p>The following parameters do matter for sure.<br />- What’s your niche? → Do you want to contribute to Golang, bash, and Python or Do you want to contribute to creating architectures? → OR do you want to contribute to docs?<br />- Everyone, the community needs contributors, and seniors are ready to mentor too. Sometimes, we leave the enthusiasm and get demotivated and leave open source contributions.</p>
<p>So is it?</p>
<p>Let me take you on the second day when I met <a target="_blank" href="https://www.linkedin.com/in/atulpriyasharma/">Atulpriya Sharma</a>.</p>
<ul>
<li><p>He told me to get involved in the projects which are in their initial state and just starting. Not the mature ones.</p>
</li>
<li><p>So that, you can learn a lot and there will be some work. Join their weekly or Bi-weekly meetings &amp; yeah get involved.</p>
</li>
<li><p>Here, I was able to see the path to reach my goal. I hope you all are able to see maybe.</p>
</li>
</ul>
<p>Yeah, that’s all about the learning part. Now, below I am writing my personal insights which I experienced.</p>
<h2 id="heading-insights">Insights</h2>
<p>Being a recent graduate managing this might be a little bit hectic. But, it feels exciting, wild &amp; “Yeh dil maange more”(My heart asks for more).<br />However, on the day - 02, I got more learning, confidence, and a few cool swags too :)<br />These 2 days felt very little to me to meet so many enthusiasts.</p>
<h3 id="heading-different-thoughts-but-one-common-thing">Different thoughts but one common thing</h3>
<p>- Everyone, I met so many people, and among them, I met few people who felt like how they become successful?<br />- Few aren’t kind enough, and few lack confidence. Then how means, how?<br />- The answer is everyone, which I got to know after meeting <a target="_blank" href="https://www.linkedin.com/in/prerit-munjal/">Prerit Munjal</a> on SOSS Community Day.<br />- The hunger to learn that tool or technology. Only, hunger will give you success, which I remembered that Shubham Sir said too in his one of the YT videos. Answer → The Hunger.</p>
<p>- That was the one purpose, the other purpose can be → ADDING VALUE TO THE COMMUNITY or GIVING THE COMMUNITY BACK.<br />- Means with hunger you are learning new tools and tech and with the above point you’re adding value too.</p>
<h2 id="heading-what-preparations-i-must-have-made">What preparations I must have made?</h2>
<ul>
<li><p>Booking a hotel at end time, before a week or so. I got the Dan Kohn scholarship message a few months before the event. But still, I sat late to book the tickets. I must have booked earlier.</p>
</li>
<li><p>I must have prepared my latest resume with my all achievements and certifications.</p>
</li>
<li><p>I must have created a proper list of questions to ask Abhishek Sir Veeramalla, and Prerit Bhaiya.</p>
</li>
<li><p>I covered all the questions though which I wanted to ask.</p>
</li>
<li><p>But preparing saves time and we’ll not go off topic.</p>
</li>
<li><p>Also, be ready with the sessions you want to attend before the day starts. I learned these from Abhishek Sir’s YT video. <a target="_blank" href="https://youtu.be/-7L6ZGQ4RVk?si=2c3wPvpKGNRV2yjz&amp;t=495">This one</a> (I have provided the link with a timestamp which will save you time)</p>
</li>
</ul>
<h2 id="heading-perspective">Perspective</h2>
<ul>
<li><p>Right now, as a student, we have the perspective of,</p>
</li>
<li><p>Watch a tutorial video, clone it, add it to the resume, and get the job. Which enhances our resume too &amp; we got familiar with the tools also.</p>
</li>
<li><p>But the perspective of the people, I met was,</p>
<ul>
<li><p>What is the optimistic solution?</p>
</li>
<li><p>What architecture can we follow to save cost?</p>
</li>
</ul>
</li>
<li><p>This means we must master the skill or tools. So that, we can help the community to save costs and use resources efficiently.</p>
</li>
</ul>
<h2 id="heading-does-anyone-care-about-you">Does anyone care about you?</h2>
<ul>
<li><p>Yes, if and only if you want to take a deep dive and learn things.</p>
</li>
<li><p>No, if you want shortcuts to achieve your goal.</p>
</li>
</ul>
<h2 id="heading-tldr">TL;DR</h2>
<ul>
<li><p>Be enthusiastic</p>
</li>
<li><p>Pick up the CNCF sandbox project which is not mature yet and in its initial phase.</p>
</li>
<li><p>Pick up the project which excites &amp; interests you the most &amp; enter the cycle.</p>
</li>
<li><p>Bas, go now. Contribute.</p>
</li>
</ul>
<h2 id="heading-outro">Outro</h2>
<p>Congratulations Everyone, you’ve just traveled to Delhi and learned a lot. Yeah, you didn’t get the swags though right?</p>
<p>Here you go.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734116138626/cbef2210-4ade-4712-8f11-bcf07947989e.jpeg" alt class="image--center mx-auto" /></p>
<p>So sorry, for the joke. But my main purpose in writing this Blog was to motivate you to attend all the events (whether it is a local event happening at your place or another event for which you’re paying) with full enthusiasm and a learning attitude.</p>
<p>Everyone is on your side not your rival or competitor here. That’s the part that keeps me attached to this community. Everyone wants to see me grow.</p>
]]></content:encoded></item><item><title><![CDATA[My Experience at Mojaloop Foundation during C4GT DMP 2024]]></title><description><![CDATA[Intro
Hello Everyone,
In this Blog, I will tell you about my experience at C4GT's Dedicated Mentoring Program 2024. So, let us get started with the first question,
What is C4GT?
C4GT stands for Code for GovTech. It provides an opportunity for undergr...]]></description><link>https://devarshshah.hashnode.dev/my-exp-at-mojaloop</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/my-exp-at-mojaloop</guid><category><![CDATA[Devops]]></category><category><![CDATA[opportunity]]></category><category><![CDATA[TrainWithShubham]]></category><category><![CDATA[BlogsWithCC]]></category><category><![CDATA[Cloud Computing]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Mon, 30 Sep 2024 13:07:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1725563013273/0c8c865f-1440-4c42-aa9a-378b3062314f.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-intro">Intro</h2>
<p>Hello Everyone,</p>
<p>In this Blog, I will tell you about my experience at C4GT's Dedicated Mentoring Program 2024. So, let us get started with the first question,</p>
<h2 id="heading-what-is-c4gt">What is C4GT?</h2>
<p>C4GT stands for Code for GovTech. It provides an opportunity for undergraduate students to work on a real Digital Public Goods project, which is in production. Not the dummy one. To know more about what is DPG? Please follow <a target="_blank" href="https://proteantech.in/articles/Everything-About-Digital-Public-Goods/"><em>this</em></a> link. The public goods can now be accessed digitally.</p>
<p>Now, let us understand What is Mojaloop Foundation. What's the mission and vision of this company? And What problems is it solving? And Who are its target users?</p>
<h3 id="heading-what-is-the-mojaloop-foundation"><strong>What is the Mojaloop Foundation?</strong></h3>
<p>To make it short, in Swahili language Moja means One and the meaning of loop is...google it. So, yeah, mojaloop creates a loop that connects DFSP(Banks), Mobile Money Operators, and much more. Why loop? Because, if there's no loop the mesh architecture will get created and ultimately the complexity will rise, which no one wants to witness. For another question use LLM models or google it. If you're curious.</p>
<h3 id="heading-what-problem-is-being-solved-by-mojaloop">What problem is being solved by Mojaloop?</h3>
<p>Mojaloop targets unbanked individuals. The goal is Financial Inclusion. I hope this answers some other questions too.</p>
<p>Now, let us dive into the projects I worked on. Contributors, Assemble. If you're interested in the concept of Mojaloop and want to contribute to Mojaloop docs, architectures, or code. Pay Attention.</p>
<p>Following are my tasks and my experience with them. If you want to go in-depth What I learned from that task? I also have documented them <a target="_blank" href="https://github.com/mojaloop/ml-core-test-harness/issues/61">here</a>.</p>
<h2 id="heading-my-first-task">My First Task</h2>
<p>My first task was to bring down the time to generate the final report, which was 150s earlier in <a target="_blank" href="https://github.com/mojaloop/ml-core-test-harness">core-test-harness the repository</a>(What is Core-Test-Harness Repo?) and I successfully brought it down to 20 to 50 seconds after making the following changes.</p>
<ul>
<li><p>Everyone, I manipulated a few files in, the directory.</p>
</li>
<li><p>And a few changes in the Dockerfile.</p>
</li>
</ul>
<p>The changes were minimal but the efforts to reach the root cause were time-consuming. But, with the help of my Mentor, I successfully did this task.</p>
<p>A question might arise in your mind, Devarsh, What is Core-Test-Harness?</p>
<p>Everyone, Core-Test-Harness is a tool that can be used by the DFSPs(say Banks for now) and developers. <strong>DFSP</strong> deploys this core-test-harness repository to know how the transfers are being done and how the APIs are playing a major role during the transactions. <strong>Developers</strong> use CTH if a new feature is introduced or a new API is introduced. So, for the cross-checking purpose also. The CTH is used. Because, in CTH we have TTK(Testing Toolkit).</p>
<p>Watch this video to see, what changes I have made: Drive Link</p>
<h2 id="heading-my-second-task">My Second Task</h2>
<p>Everyone, during the tenure of my internship I explored a lot of repositories at mojaloop which deepened my understanding of mojaloop and its vision to add value to society. Talking about the second task,</p>
<p>I was responsible for adding the test coverage to the Mojaloop Repository and I have added it to a few repositories like <a target="_blank" href="https://github.com/devarsh10/mojaloop-payment-manager-management-api/">management-api</a>, <a target="_blank" href="https://github.com/pm4ml/mojaloop-payment-manager-experience-api/">experience-api</a>, and mcm-client. I was supposed to add the coverage summary to the management and experience API only. Because, this coverage part was essential and I learned how to add the test coverage using the jest framework, with the guidance of my other mentor I added coverage to the mcm-client repo too.</p>
<p>What was this contribution was all about?</p>
<p>Everyone, this coverage I have added just increases the code quality. So that, the code will be leveraged in the production if it passes the 90% coverage-summary threshold.</p>
<p>What is this Management and Experience API repository all about?</p>
<p>Everyone, these repositories are the subsets of a project called Payment Manager.</p>
<p>Simply, if I speak in language A and you speak in Language B, we both will need a mediator, right? All, that mediator/translator is “Payment Manager” and this Management-API manages the security aspect, whereas the Experience-API manages the enhancement of user experience I was responsible for introducing the test-coverage-summary using a jest framework and making the code quality good, so that, it will pass the 90% threshold. Refer to the following.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1727621036065/ff2b6791-f6c0-4073-b764-730b6907caac.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-my-third-task">My Third Task</h2>
<p>My third task is a little bit challenging for me. Here, I am responsible for configuring the Kubernetes in such a way that all the requests will reach the API endpoint. The whole project is in here, a miniloop (the name of the repository).</p>
<p>Miniloop is the same as the Core-Test-Harness repository. Here, everything is deployed on a Kubernetes environment.</p>
<h2 id="heading-my-fourth-task">My Fourth Task</h2>
<p>My fourth Task is to work on the IaC section of the Mojaloop. We didn’t have more conversations on this but. I am excited to start working on this section.</p>
<h2 id="heading-my-fifth-task">My Fifth Task</h2>
<p>My fifth task is to add the new API in the core test harness itself. Yes, that’s it. But it’s not as easy as it sounds. Refer this diagram(<a target="_blank" href="https://docs.mojaloop.io/technical/transaction-requests-service/">https://docs.mojaloop.io/technical/transaction-requests-service/</a>)</p>
<p>As mentioned in the diagram. I was responsible for adding the Transaction-Request-Service to the current architecture, which is configured for payer and payee transfers. So, I am responsible for adding this new section named Transaction-Request-Service.</p>
<p>If you are interested in understanding What is Transaction Request Service, please go through the above link itself.</p>
<h2 id="heading-my-sixth-task">My Sixth Task</h2>
<p>My Sixth Task is to integrate the Finance Portal with the Core Test Harness.</p>
<p>What is a Finance Portal(FP)?</p>
<p>Everyone, the FP shows the clients a few this on their screen like, What was the last transaction done? What is the TransactionId of that transaction? What is the Payee-id, and Payer-id associated with that TransactionID? and more other information.</p>
<p>And as discussed earlier we know what is Core-Test-Harness.</p>
<p>Why Integrate it, Core-Test Harness?</p>
<p>If the FP portal is attached to CTH, we can see the complete simulation by just running a command or two. Let us try to understand, suppose, we had done the transaction in the TTK simulation, and the money is transferred from one bank(DFSP) to another, and on the other side, we’ll be seeing the update on the finance portal. That’s why we need to integrate the Finance Portal into the Core-Test-Harness.</p>
<p>Follow this Video to understand, how CTH and FP work after Integration: <a target="_blank" href="https://drive.google.com/file/d/1nImVn-8lcJxdI8jpZxOIV-AUo_nPgUSE/view?usp=sharing">Drive Link</a>.</p>
<h2 id="heading-why-i-am-sharing-all-this-with-you">Why I am sharing all this with you?</h2>
<p>Everyone, I consider myself very fortunate that we 100(approx.) students got selected among 2600(approx.) Students and I got the chance to work with very wonderful organisation Mojaloop, where DevOps Tools and Technologies are used in depth.</p>
<p>Also, most of my connections are in the DevOps Field. I thought I to share this blog with you all. I have made this blog very in-depth so that you get a thorough idea of what mojaloop is by reading this Blog only and can contribute to Mojaloop Foundation GitHub Repositories and Enhance your profile. All the best with your contributions.</p>
<h2 id="heading-outro">Outro</h2>
<p>Bas! Bye Bye..</p>
]]></content:encoded></item><item><title><![CDATA[Deploying React App on K8s]]></title><description><![CDATA[Introduction
Hello Everyone,
To give a little context we've been working on the series and till now we've dockerized the react application using multi-stage Dockerfiles and Docker-Compose.
Today, we're going to deploy this react website on Kubernetes...]]></description><link>https://devarshshah.hashnode.dev/deployment-on-k8s</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/deployment-on-k8s</guid><category><![CDATA[Kubernetes]]></category><category><![CDATA[Docker]]></category><category><![CDATA[React]]></category><category><![CDATA[nodemailer]]></category><category><![CDATA[TrainWithShubham]]></category><category><![CDATA[BlogsWithCC]]></category><category><![CDATA[minikube]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[Three-Tier Architecture]]></category><category><![CDATA[Devops]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Wed, 29 May 2024 08:34:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1716971519732/94847ff3-d91e-444f-864b-52425a0d7a5a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>Hello Everyone,</p>
<p>To give a little context we've been working on the series and till now we've dockerized the react application using multi-stage Dockerfiles and Docker-Compose.</p>
<p>Today, we're going to deploy this react website on Kubernetes. So, if fortunately in production, the traffic increases then we can Kubernetes will upscale the react application by increasing the number of pods.</p>
<h3 id="heading-what-you-should-expect-from-this-blog">What you should expect from this blog?</h3>
<ol>
<li><p>You'll get your hands dirty on Pod, Deployment, and Services.</p>
</li>
<li><p>In this Blog, we're using ClusterIP and NodePort services of Kubernetes.</p>
</li>
<li><p>We will be leveraging AWS EKS in the next blog and at that time we will use Load Balancer Service and access our application from anywhere we want.</p>
</li>
</ol>
<p>Let's start</p>
<h2 id="heading-creating-manifest-files">Creating Manifest files</h2>
<p>We will be directly creating Deployment files which will ultimately create the pod.</p>
<p><strong>Why we're not creating the pod? OR Why we're creating Deployment?</strong></p>
<ul>
<li><p>Suppose the pod crashed due to heavy traffic or got deleted by human error. The react application will go down.</p>
</li>
<li><p>So, to prevent this from happening we'll be creating Deployment, which comes with so many benefits like we can scale it if the traffic increases on our website.</p>
</li>
<li><p>If any pod goes down, the deployment will auto-heal the pod, recreate the pod, and ultimately keep the desired number of pods alive.</p>
</li>
</ul>
<p>As we have a three-tier architecture i.e. frontend, backend, and database. We'll be creating three separate deployment and service files.</p>
<h3 id="heading-configuring-frontend">Configuring Frontend</h3>
<h3 id="heading-using-clusterip-service">Using ClusterIP Service</h3>
<p>Let's create a Deployment file for Frontend using the Docker Image (which is public): <code>devarsh10/ocean-web</code></p>
<pre><code class="lang-yaml"><span class="hljs-attr">apiVersion:</span> <span class="hljs-string">apps/v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Deployment</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">ocean-web-deployment</span>
<span class="hljs-attr">spec:</span>
  <span class="hljs-attr">replicas:</span> <span class="hljs-number">1</span>
  <span class="hljs-attr">selector:</span>
    <span class="hljs-attr">matchLabels:</span>
      <span class="hljs-attr">app:</span> <span class="hljs-string">ocean-web</span>
  <span class="hljs-attr">template:</span>
    <span class="hljs-attr">metadata:</span>
      <span class="hljs-attr">labels:</span>
        <span class="hljs-attr">app:</span> <span class="hljs-string">ocean-web</span>
    <span class="hljs-attr">spec:</span>
      <span class="hljs-attr">containers:</span>
        <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">ocean-web</span>
          <span class="hljs-attr">image:</span> <span class="hljs-string">devarsh10/ocean-web:0.1</span>
          <span class="hljs-attr">ports:</span>
            <span class="hljs-bullet">-</span> <span class="hljs-attr">containerPort:</span> <span class="hljs-number">3000</span>
          <span class="hljs-attr">command:</span> [<span class="hljs-string">"npm"</span>,<span class="hljs-string">"start"</span>]
<span class="hljs-meta">---</span>
<span class="hljs-attr">apiVersion:</span> <span class="hljs-string">v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Service</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">ocean-web-service</span>
<span class="hljs-attr">spec:</span>
  <span class="hljs-attr">selector:</span>
    <span class="hljs-attr">app:</span> <span class="hljs-string">ocean-web</span>
  <span class="hljs-attr">ports:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">protocol:</span> <span class="hljs-string">TCP</span>
      <span class="hljs-attr">port:</span> <span class="hljs-number">3000</span>
      <span class="hljs-attr">targetPort:</span> <span class="hljs-number">3000</span>
</code></pre>
<p>Here, we're using the service ClusterIP. As this react application is running on the minikube cluster we have to forward the port to access the react app from our PC.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716925457899/a199b2a7-49cd-4345-b875-5843abd966d5.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716925529649/ca4a3425-c503-4e38-8fc2-27e76798a0a0.png" alt class="image--center mx-auto" /></p>
<p>But now when we try to access the react app from the minikube, we will not able to access it because we're not using NodePort.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716960138258/47efc238-77e8-41d2-adbb-4ba3b5a59824.png" alt class="image--center mx-auto" /></p>
<p>NodePort forwards the external traffic to the Service. In the case of Cluster IP, the service is accessible within the cluster.</p>
<p>So, we'll be using NodePort. So that, we can access it from the minikube.</p>
<p>Changer in code,</p>
<pre><code class="lang-yaml"><span class="hljs-meta">---</span>
<span class="hljs-attr">apiVersion:</span> <span class="hljs-string">v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Service</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">ocean-web-service</span>
<span class="hljs-attr">spec:</span>
  <span class="hljs-attr">selector:</span>
    <span class="hljs-attr">app:</span> <span class="hljs-string">ocean-web</span>
  <span class="hljs-attr">ports:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">protocol:</span> <span class="hljs-string">TCP</span>
      <span class="hljs-attr">port:</span> <span class="hljs-number">3000</span>
      <span class="hljs-attr">targetPort:</span> <span class="hljs-number">3000</span>
      <span class="hljs-attr">nodePort:</span> <span class="hljs-number">30007</span> <span class="hljs-comment"># we're just adding this two lines </span>
  <span class="hljs-attr">type:</span> <span class="hljs-string">NodePort</span> <span class="hljs-comment"># This one too.</span>
</code></pre>
<p>Let's try.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716959551605/8e3e046d-f10c-4bb7-b7cf-cb70f6c46c39.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>As you all can notice, when we try to access the React web app using port 3000, it fails to connect.</p>
</li>
<li><p>But when we try to connect on port 30007 we get a response. That's the use case of NodePort.</p>
</li>
</ul>
<h3 id="heading-checkpoint">Checkpoint</h3>
<ul>
<li><p>Everyone, till now we've leveraged the <strong>services</strong> and made the React app accessible using NodePort.</p>
</li>
<li><p>Now, what we're going to do is,</p>
<ul>
<li><p>We will create the deployment files of the Database.</p>
</li>
<li><p>And the Backend, where the Nodemailer is configured. So, that we can send the OTP to reset the password.</p>
</li>
</ul>
</li>
<li><p>Let's continue</p>
</li>
</ul>
<h3 id="heading-configuring-database">Configuring Database.</h3>
<p>Here, the challenge is, that we've multiple databases running on different ports. So, let's create a Deployment manifest keeping that in mind.</p>
<pre><code class="lang-yaml"><span class="hljs-attr">apiVersion:</span> <span class="hljs-string">apps/v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Deployment</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">creationTimestamp:</span> <span class="hljs-literal">null</span>
  <span class="hljs-attr">labels:</span>
    <span class="hljs-attr">app:</span> <span class="hljs-string">db-deploy</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">db-deploy</span>
<span class="hljs-attr">spec:</span>
  <span class="hljs-attr">replicas:</span> <span class="hljs-number">1</span>
  <span class="hljs-attr">selector:</span>
    <span class="hljs-attr">matchLabels:</span>
      <span class="hljs-attr">app:</span> <span class="hljs-string">db-deploy</span>
  <span class="hljs-attr">strategy:</span> {}
  <span class="hljs-attr">template:</span>
    <span class="hljs-attr">metadata:</span>
      <span class="hljs-attr">creationTimestamp:</span> <span class="hljs-literal">null</span>
      <span class="hljs-attr">labels:</span>
        <span class="hljs-attr">app:</span> <span class="hljs-string">db-deploy</span>
    <span class="hljs-attr">spec:</span>
      <span class="hljs-attr">containers:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">image:</span> <span class="hljs-string">devarsh10/ocean-json:0.1</span>
        <span class="hljs-attr">name:</span> <span class="hljs-string">ocean-json</span>
        <span class="hljs-attr">ports:</span>
        <span class="hljs-bullet">-</span> <span class="hljs-attr">containerPort:</span> <span class="hljs-number">3000</span>
        <span class="hljs-attr">resources:</span> {}
        <span class="hljs-attr">command:</span> [<span class="hljs-string">"/bin/sh"</span>]
        <span class="hljs-attr">args:</span> [<span class="hljs-string">"-c"</span>,<span class="hljs-string">"json-server --watch db.json --port 8000 --host 0.0.0.0 &amp; json-server --watch db2.json --port 8001 --host 0.0.0.0 &amp; json-server --watch 
db3.json --port 8002 --host 0.0.0.0"</span>]
<span class="hljs-attr">status:</span> {}
<span class="hljs-meta">---</span>
<span class="hljs-attr">apiVersion:</span> <span class="hljs-string">v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Service</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">ocean-json-service</span>
<span class="hljs-attr">spec:</span>
  <span class="hljs-attr">selector:</span>
    <span class="hljs-attr">app:</span> <span class="hljs-string">db-deploy</span>
  <span class="hljs-attr">ports:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">port-8000</span>
      <span class="hljs-attr">protocol:</span> <span class="hljs-string">TCP</span>
      <span class="hljs-attr">port:</span> <span class="hljs-number">8000</span>
      <span class="hljs-attr">targetPort:</span> <span class="hljs-number">8000</span>
      <span class="hljs-attr">nodePort:</span> <span class="hljs-number">31008</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">port-8001</span>
      <span class="hljs-attr">protocol:</span> <span class="hljs-string">TCP</span>
      <span class="hljs-attr">port:</span> <span class="hljs-number">8001</span>
      <span class="hljs-attr">targetPort:</span> <span class="hljs-number">8001</span>
      <span class="hljs-attr">nodePort:</span> <span class="hljs-number">31009</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">port-8002</span>
      <span class="hljs-attr">protocol:</span> <span class="hljs-string">TCP</span>
      <span class="hljs-attr">port:</span> <span class="hljs-number">8002</span>
      <span class="hljs-attr">targetPort:</span> <span class="hljs-number">8002</span>
      <span class="hljs-attr">nodePort:</span> <span class="hljs-number">31010</span>
  <span class="hljs-attr">type:</span> <span class="hljs-string">NodePort</span>
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716962884352/3eca20d9-9aae-4086-9cab-f5985d9fc119.png" alt class="image--center mx-auto" /></p>
<p>Similarly, we can access the port 31009 and 31010.</p>
<p>Now, configuring the Backend where the Nodemailer is configured.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716969827955/8fd84b69-1be7-47e7-af2f-d6e220368c85.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-checkpoint-1">Checkpoint</h3>
<p>Till now, all three tiers are configured. Now it's time to access them from a PC.</p>
<p>Which is possible using port-forward. As of now we're neither using Load Balancer nor Ingress. So we've to use port-forward for now.</p>
<p>We will surely write a blog on Ingress and Load Balancer on Cloud(AWS most probably).</p>
<h3 id="heading-port-forwarding">Port Forwarding</h3>
<p>I have written a shell script, so that, we do not have to use write same command multiple times.</p>
<pre><code class="lang-bash"><span class="hljs-meta">#!/bin/bash</span>

<span class="hljs-comment"># Port forward for ocean-web-service</span>
kubectl port-forward svc/ocean-web-service 3000:3000 &amp;
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Port forwarding for svc/ocean-web-service on port 3000"</span>

<span class="hljs-comment"># Port forward for ocean-json-service on multiple ports</span>
kubectl port-forward svc/ocean-json-service 8000:8000 8001:8001 8002:8002 &amp;
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Port forwarding for svc/ocean-json-service on ports 8000, 8001, 8002"</span>

<span class="hljs-comment"># Port forward for ocean-nodemailer-svc</span>
kubectl port-forward svc/ocean-nodemailer-svc 5000:5000 &amp;
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Port forwarding for svc/ocean-nodemailer-svc on port 5000"</span>

<span class="hljs-comment"># Wait for all background processes to finish</span>
<span class="hljs-built_in">wait</span>
</code></pre>
<ol>
<li><p>To execute it, first, give the execute permission to it by using the command,</p>
<p> <code>chmod +x shell.sh</code> and then execute it using <code>./shell.sh</code> .</p>
</li>
</ol>
<h3 id="heading-moment-of-truth-execution">Moment of Truth (Execution)</h3>
<ul>
<li>http://localhost:3000</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716970403508/474af29c-2146-4534-85d4-874639aea429.png" alt class="image--center mx-auto" /></p>
<ul>
<li>localhost:8000</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716970509090/2fa93ce4-e7a9-4ff3-bf4a-82d3a3b1287b.png" alt class="image--center mx-auto" /></p>
<ul>
<li>localhost:5000</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716970543110/ae232812-6602-4a55-8c7f-d9c2401c5f2f.png" alt class="image--center mx-auto" /></p>
<p>Let's try resetting the password and see if the OTP is getting sent or not.</p>
<ol>
<li>Yes, OTP was sent.</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716970621145/e40ea43c-28cf-4cd8-96ae-97a50b4c68fc.png" alt class="image--center mx-auto" /></p>
<ol start="2">
<li>Let's check the mail</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716970809823/7d4f490a-b56b-4499-859c-8d830b992620.png" alt class="image--center mx-auto" /></p>
<p>Success.</p>
<p>Terminal</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716970972443/caf4e95f-6ed1-4356-8f34-2a1e21686c5d.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-outro">Outro</h2>
<p>So, that's it for the day everyone.</p>
<p>Now, you have hands-on experience in how to deploy a complex three-tier application on Kubernetes.</p>
<p>Next: We will be using a Load Balancer and Ingress. So that we can access our application from anywhere. Stay Tuned. Happy Coding.</p>
]]></content:encoded></item><item><title><![CDATA[How to install Warp in WSL]]></title><description><![CDATA[Intro
Hello everyone, I hope you all are pink of health. Today, I am writing this Blog on "How to install Warp in WSL" and being a Windows user, how can we enhance our experience using the wonderful terminal Warp.Also, at the end of the video I will ...]]></description><link>https://devarshshah.hashnode.dev/warp-in-wsl</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/warp-in-wsl</guid><category><![CDATA[WSL]]></category><category><![CDATA[Warp]]></category><category><![CDATA[Linux]]></category><category><![CDATA[TrainWithShubham]]></category><category><![CDATA[BlogsWithCC]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Sat, 18 May 2024 19:57:37 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1716062128056/70462b00-7666-4ce1-a0c0-733b011cd6fb.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-intro">Intro</h2>
<p>Hello everyone, I hope you all are pink of health. Today, I am writing this Blog on "<strong>How to install Warp in WSL"</strong> and being a Windows user, how can we enhance our experience using the wonderful terminal Warp.<br />Also, at the end of the video I will share with you one Bonus tip that will help you increase your typing speed in the warp Terminal.</p>
<h2 id="heading-installation">Installation</h2>
<ol>
<li>Visit the warp website using my referral link -&gt; <a target="_blank" href="https://app.warp.dev/referral/X9K3EV">https://app.warp.dev/referral/X9K3EV</a> (Here is the original link if you <strong>don't</strong> want to use the referral link: <a target="_blank" href="https://app.warp.dev/get_warp">https://app.warp.dev/get_warp</a>). Install the Debian package. We will "dpkg" it.</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716057411643/fb0ca948-0049-40b6-8173-2088e8931068.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716058157072/a4788f98-d79e-43a9-bd2e-30dd6fefa210.png" alt class="image--center mx-auto" /></p>
<ol start="2">
<li><p>Open the WSL in Windows. Go to the path where you've installed the Deb Package. Let's say "Desktop".</p>
<ul>
<li><p>Run <code>sudo dpkg -i &lt;the_debian_package&gt;</code></p>
</li>
<li><p>I had to install these dependencies of warp in my case.</p>
<ul>
<li><p><code>libegl1</code> <code>libxkbcommon-x11-0</code>. So if you also face this issue, use this command,</p>
<ul>
<li><p><code>sudo apt-get --fix-broken install -y</code></p>
</li>
<li><p><code>sudo apt install libegl1 libxkbcommon-x11-0</code></p>
</li>
</ul>
</li>
</ul>
</li>
<li><p>In my case, <code>sudo dpkg -i warp-terminal_0.2024.05.14.08.01.stable.04_amd64.deb</code></p>
</li>
</ul>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716059892609/3af71e06-8196-4ac7-90b6-4298b6659926.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716060052838/5ec503ab-b646-4783-bcba-a58c444fe63d.png" alt class="image--center mx-auto" /></p>
<ol start="3">
<li><p>Now, open the bash_profile file to add the following lines. Using command,</p>
<p> <code>nano ~/.bash_profile</code> paste the following and Ctrl+X and then Y.</p>
<pre><code class="lang-bash"> <span class="hljs-built_in">export</span> WARP_ENABLE_WAYLAND=1
 <span class="hljs-built_in">export</span> MESA_D3D12_DEFAULT_ADAPTER_NAME=NVIDIA
 <span class="hljs-built_in">export</span> BROWSER=google-chrome
</code></pre>
<p> The changes will be saved. Here we're adding Google Chrome because we need to open Google Chrome from Warp to get the Authentication Token.</p>
</li>
<li><p>Now, let us install Google-Chrome-Stable in WSL</p>
<pre><code class="lang-bash"> wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
 sudo apt -y install ./google-chrome-stable_current_amd64.deb
</code></pre>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716060141775/2eef3506-5fd0-4e07-9d54-afa222908752.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Now, Sign Up (Sign Up Link: <a target="_blank" href="https://app.warp.dev/signup">https://app.warp.dev/signup</a>) and log in (Link to Log In: <a target="_blank" href="https://app.warp.dev/signup">https://app.warp.dev/</a>login/remote).</p>
</li>
<li><p>Follow the fifth step in the WSL's Google Chrome, which we just installed. Once you successfully log in. You'll land on this kind of screen</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716060991186/ff51e5eb-cf3e-4bed-9ceb-a4a122f33b72.png" alt class="image--center mx-auto" /></p>
<p> Enjoy Using Warp....</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716061058637/1f4df013-110e-44d1-a427-f9b0b33a8882.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<h2 id="heading-bonus-improve-your-typing-speed-in-warp">Bonus. Improve your Typing Speed in Warp</h2>
<p>I just watched the YouTube Short posted by Hitesh Sir Choudhary on his YouTube channel. Where he introduced ttyper.</p>
<p>To install it, we need "cargo". To install "cargo" run the command, <code>sudo apt install cargo</code></p>
<p>Followed by it, install "ttyper" using the command <code>cargo install ttyper</code></p>
<p>Now, just write "ttyper" and start practicing</p>
<p>And Enjoy...</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716061449894/fc1b9d8b-cf2d-4313-80e0-9944b204e9f1.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-outro">Outro</h3>
<p>That's all for now Everyone. Happy Coding.</p>
]]></content:encoded></item><item><title><![CDATA[Dockerising React Application using Docker-Compose (Part-II)]]></title><description><![CDATA[Intro
Hello Everyone, welcome to part two of Dockerizing the React Application.
Quick Recap
In the last blog, we've Dockerised the React Application using multi-stage Docker Build and saved around 1.5 GB of space.
Getting Started
In this Blog, we wil...]]></description><link>https://devarshshah.hashnode.dev/dockerising-react-app-2</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/dockerising-react-app-2</guid><category><![CDATA[Docker compose]]></category><category><![CDATA[Docker]]></category><category><![CDATA[TrainWithShubham]]></category><category><![CDATA[ Abhishek Veeramalla ]]></category><category><![CDATA[#shubhamLondhe]]></category><category><![CDATA[BlogsWithCC]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Mon, 13 May 2024 18:50:59 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1715626250645/53bd2a16-44cf-455d-a44d-f617a2c0c8c6.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-intro">Intro</h3>
<p>Hello Everyone, welcome to part two of Dockerizing the React Application.</p>
<h3 id="heading-quick-recap">Quick Recap</h3>
<p>In the last blog, we've Dockerised the React Application using multi-stage Docker Build and saved around 1.5 GB of space.</p>
<h3 id="heading-getting-started">Getting Started</h3>
<p>In this Blog, we will dockerize the same react application, just using the Docker-Compose file. So that we can increase our grip on writing docker-compose files and all.</p>
<p>Here's the structure we're going to follow.  </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1715623973525/614eaf4a-2ff5-497c-ba21-975c5c060134.png" alt class="image--center mx-auto" /></p>
<p>It is the same structure we've used earlier. Just here we've got a docker-compose file.</p>
<p>Here's the docker-compose file.</p>
<pre><code class="lang-dockerfile">version: <span class="hljs-string">'3'</span>
services:
  web:
    <span class="hljs-comment"># build:</span>
    <span class="hljs-comment">#   context: .</span>
    <span class="hljs-comment">#   dockerfile: Dockerfile</span>
    image: devarsh10/ocean-web:<span class="hljs-number">0.1</span>
    restart: always
    container_name: ocean-app
    ports:
      - <span class="hljs-string">"3000:3000"</span>
    command: npm start
  json:
    <span class="hljs-comment"># build:</span>
    <span class="hljs-comment">#   context: .</span>
    <span class="hljs-comment">#   dockerfile: Dockerfile-json-server</span>
    image: devarsh10/ocean-json:<span class="hljs-number">0.1</span>
    restart: always
    container_name: json-server
    ports:
      - <span class="hljs-string">"8000:8000"</span>
      - <span class="hljs-string">"8001:8001"</span>
      - <span class="hljs-string">"8002:8002"</span>
    command: bash -c <span class="hljs-string">"json-server --watch db.json --port 8000 --host 0.0.0.0 &amp; json-server --watch db2.json --port 8001 --host 0.0.0.0 &amp; json-server --watch db3.json --port 8002 --host 0.0.0.0"</span>

  nodemailer:
    <span class="hljs-comment"># build:</span>
    <span class="hljs-comment">#   context: ./server</span>
    <span class="hljs-comment">#   dockerfile: Dockerfile</span>
    image: devarsh10/ocean-nodemailer:<span class="hljs-number">0.1</span>
    container_name: backend-nodemailer
    ports:
      - <span class="hljs-string">"5000:5000"</span>
</code></pre>
<p>Let us traverse line by line to understand the Code.</p>
<ul>
<li><p>Version: We're using the latest version of Docker-compose here.</p>
</li>
<li><p>Services: Services are the way we can tell Docker that we've to run three Docker Containers.</p>
<ul>
<li>Web: Here and in every service we are using a few parameters. So let us understand one by one.</li>
</ul>
</li>
<li><p>Build: If we've got a Dockerfile present with us then we can also avoid pulling the image from DockerHub. Using the Build parameter using <strong><em>context</em></strong> i.e. path and name of the <strong><em>dockerfile</em></strong>.</p>
</li>
<li><p>Image: The reference to the image</p>
</li>
<li><p>restart: If you keep restart: always, it'll start the container when you open Docker Desktop. If you have not used restart:always. After opening Docker Desktop the container will not be running. (I have written in the easiest way possible)</p>
</li>
<li><p>container_name: The name we want. If we do not specify this parameter, it'll take the name of the service as a container name.</p>
</li>
<li><p>ports: The port we are mapping from our host machine to the container.</p>
<ul>
<li>command: The command we'll be using is like, 'npm start'.</li>
</ul>
</li>
<li><p>Now, use to command docker-compose up and the container will start running and the app will be accessible.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1715625739972/a573855c-aaa9-4c1a-a652-f26fa2550029.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1715625786190/856d6440-dcaf-453c-9c97-ee8aea624447.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-thank-you">Thank You</h3>
<p>Yeah, so that's all for this blog if I learn some new parameters I will add them. If you want to contribute willingly. Do let me know in the comment section. I'll reach out to you.</p>
]]></content:encoded></item><item><title><![CDATA[Dockerising React Application using MultiStage Dockerfile]]></title><description><![CDATA[Namaskaaram,I hope you all are doing well. Today I am writing this blog to show the step-by-step guide on how I dockerized the React website I created during my 3 months of React(Frontend) Internship.This series of Dockerizing the application is divi...]]></description><link>https://devarshshah.hashnode.dev/multistage-dockerfile</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/multistage-dockerfile</guid><category><![CDATA[multi stage docker file]]></category><category><![CDATA[Devops]]></category><category><![CDATA[TrainWithShubham]]></category><category><![CDATA[React]]></category><category><![CDATA[nodemailer]]></category><category><![CDATA[debugging]]></category><category><![CDATA[DevOps Interview Questions and Answers]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Thu, 02 May 2024 10:24:56 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1714645202882/bdcd3cb3-535a-4fb1-b239-2e0c82652e01.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Namaskaaram,<br />I hope you all are doing well. Today I am writing this blog to show the step-by-step guide on how I dockerized the React website I created during my 3 months of React(Frontend) Internship.<br />This series of Dockerizing the application is divided into 3 parts.</p>
<ul>
<li><p>In this blog, I am going to show you, how to dockerize the application in different containers on the same network</p>
</li>
<li><p>In the second one, I will demonstrate how to dockerize the React application using docker-compose.</p>
</li>
<li><p>Finally, we'll be deploying it on Kubernetes and if time permits I will create a fourth blog on troubleshooting and a fifth blog on deploying the app on AWS EKS.</p>
</li>
<li><p>So, I hope I can show you the clear-cut architecture and agenda.</p>
</li>
<li><p>So now, without any further ado let's get started.</p>
</li>
</ul>
<h2 id="heading-what-should-you-expect-from-this">What should you expect from this?</h2>
<ul>
<li><p>After reading this blog, you'll get to know where to see how to debug the Dockerfile.</p>
</li>
<li><p>How to write multi-stage Dockerfile.</p>
</li>
</ul>
<h2 id="heading-getting-started">Getting Started</h2>
<p>Firstly, let me show you what the registration page looks like when I run the command <code>npm start</code>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714627411476/3a8e6fd6-bbac-4544-b19d-d6e86feb1b06.png" alt /></p>
<p>Now, let me give you some context.</p>
<ul>
<li><p>Here we have our react app which is running on port 3000.</p>
</li>
<li><p>Besides we've 3 different databases, which are supposed to run on 3 different ports.</p>
</li>
<li><p>Following that, we have a Nodemailer in the backend which is responsible for sending the email to the user who forgot the password.</p>
</li>
</ul>
<p>Hence, 3 containers are required.</p>
<h3 id="heading-my-file-structure">My file structure</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714644027756/f5f7505a-150d-4c37-b548-62a8dd9a7cee.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714644051342/42b79d91-e8a6-44a4-b56e-a4eafde6408d.png" alt class="image--center mx-auto" /></p>
<p><strong>Note: Here, I have kept the Dockerfile of the frontend and the Dockerfile of the Database in the root directory, and the Dockerfile of Node.js is in the server directory. That is why I have written two ".dockerignore" files.</strong></p>
<h3 id="heading-dockerizing-frontend">Dockerizing Frontend</h3>
<p>Here, we're going to create a multi-stage dockerfile. Using the Single-stage Dockerfile may reach a GB of space which is not at all space-efficient.</p>
<p>Also, keep in mind one thing. Create a '.dockerignore' file and add the directories or files that you do not want to copy to the Docker container. In our case, it is "node_modules". It looks something like this,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714631067776/75370326-1828-4fef-a209-a10db8d2ff62.png" alt class="image--center mx-auto" /></p>
<p>As you can see in the following when we use the single-stage Dockerfile. The size of the image will reach more than 1 GB. In our case, it's almost 2 GB.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714630388229/aa3bbf3a-63cf-4f1d-b6a2-2e59f89cd772.png" alt class="image--center mx-auto" /></p>
<p>Dockerfile used,</p>
<pre><code class="lang-dockerfile"><span class="hljs-keyword">FROM</span> node:<span class="hljs-number">20</span> AS builder

<span class="hljs-keyword">WORKDIR</span><span class="bash"> /app</span>

<span class="hljs-keyword">COPY</span><span class="bash"> package.json .</span>

<span class="hljs-keyword">RUN</span><span class="bash"> npm i</span>

<span class="hljs-keyword">COPY</span><span class="bash"> . .</span>
</code></pre>
<p>Now, see the following change,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714631145175/a88d42b2-7041-4771-b607-3f259642ec65.png" alt class="image--center mx-auto" /></p>
<p>Changes made,</p>
<pre><code class="lang-dockerfile"><span class="hljs-keyword">FROM</span> node:<span class="hljs-number">20</span> AS builder

<span class="hljs-keyword">WORKDIR</span><span class="bash"> /app</span>

<span class="hljs-keyword">COPY</span><span class="bash"> package.json .</span>

<span class="hljs-keyword">RUN</span><span class="bash"> npm i</span>

<span class="hljs-keyword">COPY</span><span class="bash"> . . </span>

<span class="hljs-keyword">FROM</span> node:alpine

<span class="hljs-comment"># Creating a new directory named app</span>
<span class="hljs-keyword">WORKDIR</span><span class="bash"> /app</span>

<span class="hljs-comment">#Copying all the content copied in app to current directory</span>
<span class="hljs-keyword">COPY</span><span class="bash"> --from=builder /app .</span>

<span class="hljs-comment"># Exposing port which will be mapped with the host's port.</span>
<span class="hljs-keyword">EXPOSE</span> <span class="hljs-number">3000</span>

<span class="hljs-comment"># This will start the development server.</span>
<span class="hljs-keyword">CMD</span><span class="bash"> [ <span class="hljs-string">"npm"</span>, <span class="hljs-string">"start"</span> ]</span>
</code></pre>
<p>Hence, we've saved something around 1.5 GB of Space which matters a lot when dockerizing an app in production.</p>
<p>Now, let us run our app in a container in a separate network.</p>
<p>First, create a network using the command <code>docker network create react-net.</code></p>
<p>Now, run the establish a Docker container using the command,</p>
<p><code>docker run -d -p 3001:3000 --network react-net --name react-app &lt;image-id&gt;</code></p>
<p>In my case, it looks something like this,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714632277401/257de9e0-a9c9-416f-9470-d7042659d6a7.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714632764546/e9187840-ff80-46ed-bf10-f085b4da4c52.png" alt class="image--center mx-auto" /></p>
<p>Also, all the routes configured are giving responses. That means our app is Dockerized.</p>
<h3 id="heading-dockerizing-database">Dockerizing Database</h3>
<p>For the database, we're going to use node-slim Image. Because the slim comes with minimal packages to run a node, which is sufficient for us to run the JSON server.</p>
<p>As discussed earlier, we've three databases. Here's the Dockerfile we're going to use.</p>
<pre><code class="lang-dockerfile"><span class="hljs-comment"># Use the official Node.js image as a base</span>
<span class="hljs-keyword">FROM</span> node:slim

<span class="hljs-comment"># Set a working directory</span>
<span class="hljs-keyword">WORKDIR</span><span class="bash"> /app</span>

<span class="hljs-comment"># Install json-server</span>
<span class="hljs-keyword">RUN</span><span class="bash"> npm install -g json-server</span>

<span class="hljs-comment"># Copy your JSON files to the working directory</span>
<span class="hljs-keyword">COPY</span><span class="bash"> ./src/db.json .</span>
<span class="hljs-keyword">COPY</span><span class="bash"> ./src/Components/Admin/ReferralList/db2.json .</span>
<span class="hljs-keyword">COPY</span><span class="bash"> ./src/Components/Agent/Dashboard_Com/Product/db3.json .</span>
<span class="hljs-keyword">RUN</span><span class="bash"> ls</span>

<span class="hljs-comment"># Expose the ports for each json-server instance</span>
<span class="hljs-keyword">EXPOSE</span> <span class="hljs-number">8000</span>
<span class="hljs-keyword">EXPOSE</span> <span class="hljs-number">8001</span>
<span class="hljs-keyword">EXPOSE</span> <span class="hljs-number">8002</span>

<span class="hljs-comment"># Command to run each json-server instance when the container starts</span>
<span class="hljs-keyword">CMD</span><span class="bash"> json-server --watch db.json --port 8000 --host 0.0.0.0 &amp; json-server --watch db2.json --port 8001 --host 0.0.0.0 &amp; json-server --watch db3.json --port 8002 --host 0.0.0.0</span>
</code></pre>
<p>Here, there's a catch. We have two Dockerfiles in the same directory. So, here's the command we're going to use to build the Dockerfile.</p>
<p>There's nothing we just have to use the '-f' tag. The command will be like <code>docker build -f Dockerfile-json-server -t json-dbs .</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714634645413/0dacee7e-5fe5-4478-83a9-cef7fa85aff7.png" alt class="image--center mx-auto" /></p>
<p>Now, let us run the database in a container.</p>
<p>Here's another catch. What command will you write if you've exposed multiple ports? The command will be</p>
<p><code>docker run -d -p 8000:8000 -p 8001:8001 -p 8002:8002 --name json-servers &lt;image-id&gt;</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714640843671/7040d643-d858-46a2-8a9f-7a6452b8a01a.png" alt class="image--center mx-auto" /></p>
<p>Okay. So, now we've react app and json database is running on the individual container.</p>
<h3 id="heading-dockerizing-backend-which-contains-nodemailer">Dockerizing Backend which contains Nodemailer.</h3>
<p>Now, dockerizing Node.js' "app.js" is pretty simple.</p>
<p>To give the context of the code, this code consists of a Nodemailer configuration HTML, and CSS template which will be sent to send the OTP to the user who forgot the password.</p>
<p>Now, what will we need to run the node.js application? node or nodemon, right?</p>
<p>So, our Dockerfile will look something like,</p>
<pre><code class="lang-dockerfile"><span class="hljs-keyword">FROM</span> node:slim

<span class="hljs-keyword">WORKDIR</span><span class="bash"> /app</span>

<span class="hljs-keyword">COPY</span><span class="bash"> package.json .</span>

<span class="hljs-keyword">RUN</span><span class="bash"> npm install &amp;&amp; \
    npm install -g nodemon</span>

<span class="hljs-keyword">COPY</span><span class="bash"> . /app</span>

<span class="hljs-keyword">EXPOSE</span> <span class="hljs-number">5000</span>

<span class="hljs-keyword">CMD</span><span class="bash"> [ <span class="hljs-string">"node"</span>, <span class="hljs-string">"app.js"</span> ]</span>
</code></pre>
<p>Now, build the Docker Image by running the command <code>docker build -t nodemailer:v1 .</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714642027874/2991f921-7c30-4b64-9395-cceb0efaa1da.png" alt class="image--center mx-auto" /></p>
<p>Now, running the nodemailer image in a container using the command, <code>docker run -d -p 5001:5000 --network react-net --name nodemailer-cont &lt;image-id&gt;</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714642435060/0b56c046-fef5-4286-a3e5-96e45022f74a.png" alt class="image--center mx-auto" /></p>
<p>Here, the OTP is sent to the user which means the node.js is working perfectly.</p>
<p>Note: Here I have mapped port 3001 of the host and 3000 port of the container &amp; in the backend, I have mapped 5001 of a host to 5000 of the container (which is not at all recommended. Because the API running in backend interacts with each other based on the ports only.)</p>
<p>Okay then everyone. Now, you all know how to write a multistage Dockerfile and add multiple containers in the same network.</p>
<h3 id="heading-to-debug">To Debug</h3>
<p>If your Dockerfile build fails. Then to debug what can you do is, in Docker Desktop, we've a new section named "Build".</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714643289479/14741f57-e7b9-421a-bc3b-a68598490a61.png" alt class="image--center mx-auto" /></p>
<p>We can just click on the build that is failing,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714643397538/52a6c40d-d452-4042-8098-092fedda265b.png" alt class="image--center mx-auto" /></p>
<p>In the error section, it'll tell us what's the exact error we're facing. Though, we'll see this error when the docker build command fails. But, the build feature comes with a lot of pros.</p>
<h3 id="heading-bonus-want-to-get-your-hands-dirty">Bonus (Want to get your hands dirty?)</h3>
<p>Let us jump into the networking part.</p>
<p>When we run the command <code>docker network ls</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1714633230711/6fa0e89f-c863-4578-ba4f-409dba5e79dc.png" alt class="image--center mx-auto" /></p>
<p>Let us inspect <code>react-net</code> using the command, <code>docker inspect &lt;network-id&gt;</code>.</p>
<p>Now, when we use, docker inspect react-net, we'll see the following output.</p>
<pre><code class="lang-bash">[
    {
        <span class="hljs-string">"Name"</span>: <span class="hljs-string">"react-net"</span>,
        <span class="hljs-string">"Id"</span>: <span class="hljs-string">"75db8f96dcd8e483d5af7758f7227f22ffd023abc4e636ff0b683733d052e151"</span>,
        <span class="hljs-string">"Created"</span>: <span class="hljs-string">"2024-05-02T06:41:04.575805992Z"</span>,
        <span class="hljs-string">"Scope"</span>: <span class="hljs-string">"local"</span>,
        <span class="hljs-string">"Driver"</span>: <span class="hljs-string">"bridge"</span>,
        <span class="hljs-string">"EnableIPv6"</span>: <span class="hljs-literal">false</span>,
        <span class="hljs-string">"IPAM"</span>: {
            <span class="hljs-string">"Driver"</span>: <span class="hljs-string">"default"</span>,
            <span class="hljs-string">"Options"</span>: {},
            <span class="hljs-string">"Config"</span>: [
                {
                    <span class="hljs-string">"Subnet"</span>: <span class="hljs-string">"172.20.0.0/16"</span>,
                    <span class="hljs-string">"Gateway"</span>: <span class="hljs-string">"172.20.0.1"</span>
                }
            ]
        },
        <span class="hljs-string">"Internal"</span>: <span class="hljs-literal">false</span>,
        <span class="hljs-string">"Attachable"</span>: <span class="hljs-literal">false</span>,
        <span class="hljs-string">"Ingress"</span>: <span class="hljs-literal">false</span>,
        <span class="hljs-string">"ConfigFrom"</span>: {
            <span class="hljs-string">"Network"</span>: <span class="hljs-string">""</span>
        },
        <span class="hljs-string">"ConfigOnly"</span>: <span class="hljs-literal">false</span>,
        <span class="hljs-string">"Containers"</span>: {
            <span class="hljs-string">"45bad3687dc8e953188ec4ee6555e5a1503cc92263ceaecb4959bef7d57900a0"</span>: {
                <span class="hljs-string">"Name"</span>: <span class="hljs-string">"json-servers"</span>,
                <span class="hljs-string">"EndpointID"</span>: <span class="hljs-string">"8e0f23511fefc8b389e4e6baca9d06035e30cf05cce9af42a8d36f5aff31dc08"</span>,
                <span class="hljs-string">"MacAddress"</span>: <span class="hljs-string">"02:42:ac:14:00:04"</span>,
                <span class="hljs-string">"IPv4Address"</span>: <span class="hljs-string">"172.20.0.4/16"</span>,
                <span class="hljs-string">"IPv6Address"</span>: <span class="hljs-string">""</span>
            },
            <span class="hljs-string">"8231a9d3ff3d74f0e06709936bfb0cc143127f51f652e47ac25bbe129a9365b0"</span>: {
                <span class="hljs-string">"Name"</span>: <span class="hljs-string">"react-app"</span>,
                <span class="hljs-string">"EndpointID"</span>: <span class="hljs-string">"2ee55bc4302fe72bfdb1541abd4123c1255a1174285e9e166e4d8e4d38791e45"</span>,
                <span class="hljs-string">"MacAddress"</span>: <span class="hljs-string">"02:42:ac:14:00:03"</span>,
                <span class="hljs-string">"IPv4Address"</span>: <span class="hljs-string">"172.20.0.3/16"</span>,
                <span class="hljs-string">"IPv6Address"</span>: <span class="hljs-string">""</span>
            },
            <span class="hljs-string">"a05e90ce75eb5bf23bfde0a1af8c8af70892e48a49aafd55009914fdfa12d490"</span>: {
                <span class="hljs-string">"Name"</span>: <span class="hljs-string">"nodemailer-cont"</span>,
                <span class="hljs-string">"EndpointID"</span>: <span class="hljs-string">"fb097380d1d385253d686d4cc3d222f0fa5ed46d48b4ae3ac58d69ecf833f8d8"</span>,
                <span class="hljs-string">"MacAddress"</span>: <span class="hljs-string">"02:42:ac:14:00:02"</span>,
                <span class="hljs-string">"IPv4Address"</span>: <span class="hljs-string">"172.20.0.2/16"</span>,
                <span class="hljs-string">"IPv6Address"</span>: <span class="hljs-string">""</span>
            }
        },
        <span class="hljs-string">"Options"</span>: {},
        <span class="hljs-string">"Labels"</span>: {}
    }
]
</code></pre>
<p>Here, in the container section, we can see, the three containers we added in the same network.</p>
<h3 id="heading-interview-questions">Interview Questions</h3>
<ol>
<li><p>Can we write "from" instead of "FROM" and "copy" instead of "COPY"? and you get the idea.</p>
<ol>
<li>Answer: Yes we can write. We are just following the convention to differentiate our command from the Dockerfile Keywords. We write FROM, COPY, CMD, ENTRYPOINT, and many other keywords in caps.</li>
</ol>
</li>
<li><p>How to build the Docker Image, if there exists two different Dockerfile in the same directory?</p>
<ol>
<li>Using the '-f' flag.</li>
</ol>
</li>
<li><p>Command to inspect the network?</p>
<ol>
<li>docker inspect &lt;network-name/id&gt;</li>
</ol>
</li>
</ol>
<p>Thank You for reading this blog till here. Happy Coding.</p>
]]></content:encoded></item><item><title><![CDATA[Experience and Learnings of AWS Community Day]]></title><description><![CDATA[Hello All,
I attended an AWS community day in Ahmedabad, Gujarat on 20/01/2024. I have learned many things, and content is rarely available on social media. I earned so many goodies and swags too.Now, let me directly jump to the knowledge I learned i...]]></description><link>https://devarshshah.hashnode.dev/experience-and-learnings-of-aws-community</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/experience-and-learnings-of-aws-community</guid><category><![CDATA[AWS]]></category><category><![CDATA[AWS Community Builder]]></category><category><![CDATA[TrainWithShubham]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Sun, 21 Jan 2024 19:27:42 GMT</pubDate><content:encoded><![CDATA[<p>Hello All,</p>
<p>I attended an AWS community day in Ahmedabad, Gujarat on 20/01/2024. I have learned many things, and content is rarely available on social media. I earned so many goodies and swags too.<br />Now, let me directly jump to the knowledge I learned in the sessions.</p>
<p>1. In the morning, followed by breakfast, the opening keynote session was taken by Suman Debunath Sir and Karan Sir Desai.<br />I have learned about vector databases and vector graphs.</p>
<ul>
<li><p>Learned about the Large Language model and its limitations of it like Hallucination and Knowledge cutoff.</p>
</li>
<li><p>Learned about Deep learning’s fine tuning and Information Retrieval.</p>
</li>
<li><p>The talk was an Information Retrieval Oriented.</p>
</li>
<li><p>Also, learned about LangChain and its use.</p>
</li>
<li><p>Then we learned about Visual Search.</p>
</li>
<li><p>In which we learned about Resume Screening by Amazon Bedrock.</p>
</li>
<li><p>Resource provided by Suman Sir: <a target="_blank" href="https://community.aws/concepts/vector-embeddings-and-rag-demystified">https://community.aws/concepts/vector-embeddings-and-rag-demystified</a></p>
</li>
</ul>
<p>2. In Karan Sir's Session we learned about Frugality and Cost Optimization.</p>
<ul>
<li>One resource he provided was: <a target="_blank" href="https://community.aws/concepts/vector-embeddings-and-rag-demystified">https://www.thefrugalarchitect.com/</a></li>
</ul>
<p>After these, keynote sessions we attended the session by the sponsors &amp; partners and got to know more about their products. Like Affinidi, Trainocate, DevRepublic and Rezoomax.</p>
<p>After these sessions and lunch, we started going into the Tracks we were more interested in.</p>
<p>3. First of all we attended a <strong>Lighting Talk on Application Modernization</strong> by Ms. Bhuvaneswari Ma’am Subramani who has more than 20 years of Experience in tech and which I witnessed. In the session, we learned about,</p>
<ul>
<li><p>Best ways to build a modern application</p>
<ul>
<li><p>In which I learned about the Operational Model and understood the graph of Level of Abstraction vs. Focus on Business Logic.</p>
</li>
<li><p>After that learned about Developer Agility.</p>
</li>
</ul>
</li>
<li><p>Benefits of Application Modernization</p>
</li>
<li><p>Best Practices of it.</p>
</li>
</ul>
<p>4. Following the Lightning talk we attended the session on <strong>Serice Mesh: ISTIO on Amazon EKS</strong> by Dharmang Sir Makwana. In which I got to know that,</p>
<ul>
<li><p>Service Mesh is a tool.</p>
</li>
<li><p>Also, witnessed new terms like Envoy, Citadel, Istio, and Ingress Gateway.</p>
</li>
</ul>
<p>5. After this session we attended the Session <strong>Demystifying GitOps with ArgoCD tool on EKS</strong> by Nasiullha Chaudhari aka Cloud Champ(YT).</p>
<ul>
<li>In this session, he taught us how to Deploy our application, Tetris Game(In our case) using the GitOps Strategy and tools like ArgoCD.</li>
</ul>
<p>6. Then after we attended the session by Krutarth Sir Rindani on <strong>The Art of Continuous Operation: Zero Downtime Upgrades in EKS Production Environments</strong></p>
<ul>
<li><p>In this session, we learned about Types of Workers.</p>
</li>
<li><p>Among these, we take a look at AWS Managed Node Group.</p>
</li>
<li><p>Followed by learning about Rolling Update.</p>
</li>
<li><p>Learned about Canary deployment and Blue-Green Deployment.</p>
</li>
<li><p>Then the Pros and Cons of each of them.</p>
</li>
</ul>
<ol>
<li><p>Finally, attended the last session by <strong>Supercharge Your Productivity with GenAI on AWS</strong> by Vivek Raja P S. In this session, we learned about,</p>
</li>
<li><p>Learned about AWS CodeWhisperer and how to use it.</p>
</li>
<li><p>Also, do the hands on the <a target="_blank" href="https://community.aws/concepts/vector-embeddings-and-rag-demystified">https://partyrock.aws/</a> which is a very great tool for picture presentation.</p>
</li>
<li><p>Finally, learned about Amazon Q.</p>
</li>
</ol>
<p>8. After all this we played a very entertaining quiz and got to know how much we learned.</p>
<p>After all these sessions, swags and goodies. Concluded the session, by getting a bag from aws community in Ahmedabad which made our day.</p>
<p>The AWS services that I was introduced to were, Amazon Q, Amazon CodeWhisperer, and Amazon Bedrock.</p>
]]></content:encoded></item><item><title><![CDATA[Deploying 3-Tier Application on AWS EC2 using Docker Networking Concept.]]></title><description><![CDATA[Introduction of Project
Hey Everyone, in this project we will understand Docker Networking by deploying a three-tier application on a custom Docker network.
So, Let's get started.
Kickstart Your AWS EC2 Instance
Step 1 -> First of all, launch an EC2 ...]]></description><link>https://devarshshah.hashnode.dev/deploying-3-tier-application-on-aws-ec2-using-docker-networking-concept</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/deploying-3-tier-application-on-aws-ec2-using-docker-networking-concept</guid><category><![CDATA[TrainWithShubham]]></category><category><![CDATA[aws ec2]]></category><category><![CDATA[Docker]]></category><category><![CDATA[Cloud]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Sun, 06 Aug 2023 17:38:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1691343175492/bf48bdb3-1d6a-42f8-af9d-1f484b93fed3.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction-of-project">Introduction of Project</h2>
<p>Hey Everyone, in this project we will understand Docker Networking by deploying a three-tier application on a custom Docker network.</p>
<p>So, Let's get started.</p>
<h2 id="heading-kickstart-your-aws-ec2-instance">Kickstart Your AWS EC2 Instance</h2>
<p>Step 1 -&gt; First of all, launch an EC2 Instance by keeping all the settings by default.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691176703114/33cc49fe-817f-46fc-a811-628e07da9ce9.png" alt class="image--center mx-auto" /></p>
<p>Step 2 -&gt; Keep the HTTP and HTTPS Protocols checked. So, that we do not have to add it while working with HTTP port 80.</p>
<p>Note: The default port of HTTP is 80 and the nginx's default port is also 80.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691176808895/0544019f-bb1b-4ae4-bc2e-f3946624a5eb.png" alt class="image--center mx-auto" /></p>
<p>Step 3 -&gt; SSH into the instance from your local device.</p>
<pre><code class="lang-bash">ssh path/to/pem/file ubuntu@&lt;public-ip-addr&gt;
<span class="hljs-comment"># OR if you want to connect from ec2 instance, just click connect and connect</span>
<span class="hljs-comment"># to EC2 Instance.</span>
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691177164680/7e0996f9-8284-4e95-8f36-0bc1080d833c.png" alt class="image--center mx-auto" /></p>
<p>Step 4 -&gt; Right now, we have only two kinds of networks in our ec2 instance. Loopback and eth0. Loopback is useful to test network connectivity. It is also known as localhost. Whereas, eth0 helps us to connect to the internet i.e. outside world</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691177372262/25f0b370-b230-4ee4-8b9e-91cb81e4d1d7.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-docker-installation">Docker Installation</h2>
<p>Step 5 -&gt; Let us install Docker on our machine and get started with the project.</p>
<pre><code class="lang-bash">sudo apt install docker.io -y
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691177422622/004c687b-f214-4831-8403-9ba8095b306c.png" alt class="image--center mx-auto" /></p>
<p>Step 6 -&gt; Now, let us run the command, <code>ip addr show</code> You'll notice that the docker network is added to the networks group and as we create containers the veth network will be added to this group of networks.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691177706259/f73cfed1-f2e3-4cb7-aa4b-5bc1b0974ce0.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-giving-superuser-access-to-docker">Giving superuser access to Docker</h3>
<p>Step 7 -&gt; Now, let us check for the containers running on Docker.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691177750251/e72b1a0a-8823-4590-9b1b-e66ba395fc77.png" alt class="image--center mx-auto" /></p>
<p>Damn!, we faced an error.</p>
<p>Now, to watch the container running we can use sudo before using our command. But, how many times we will use sudo. Better, we can add us(i.e. ubuntu in my case) to Docker Group.</p>
<p>We can use the command,</p>
<pre><code class="lang-bash">sudo usermod -aG docker <span class="hljs-variable">$USER</span>
<span class="hljs-comment">#we can use ubuntu instead of user. But, this command will run in all machines.</span>
</code></pre>
<p>Step 8 -&gt; After adding the user (ubuntu) to the Docker group. We must have to reboot our system. Using the command, <code>sudo reboot</code></p>
<p>Step 9 -&gt; Now, if we use <code>docker ps</code> we should not face any error and this should be our output.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691178169232/194779af-5bcf-4dec-b74e-fe543739d3ca.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-docker-networking">Docker Networking</h2>
<p>Step 10 -&gt; Actually, there exist 7 types of Docker Networks. But, when we use the command <code>docker network ls</code> three types of networks can be seen.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691178374826/04c85aa7-891a-4f40-a270-f575b2bf7fd7.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-type-of-network-default-bridge">Type of Network: Default Bridge</h3>
<p>Definition: Whenever we create our container, it is created in the bridge network. That is why the bridge network is also known as the default bridge network.</p>
<p>Step 11 -&gt; Let us create a nginx container and see where it is getting created. Run the command to pull the nginx image,</p>
<pre><code class="lang-bash">docker run -d --name nginx nginx
<span class="hljs-comment">#Here,</span>
<span class="hljs-comment"># -d is specifying that the container will run in detatched mode.</span>
<span class="hljs-comment"># and --name is used to specify the name of the container.</span>
</code></pre>
<p>Here, we are using <code>--name nginx</code> to name our container and the last keyword nginx is the image name, which is nginx in our case.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691178824765/3a0dab1c-9972-497b-9054-6c69b3672135.png" alt class="image--center mx-auto" /></p>
<p>Step 12 -&gt; Now, let us go inside the container and check if we can ping the outside world or not.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691179246499/1467d4be-7010-4e68-8c35-a855f3d286aa.png" alt class="image--center mx-auto" /></p>
<p>Oh! we can connect to the outside world. Right now we are in the Container we created. But this container can ping the internet outside the container, but unable to listen.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691179351046/04172c69-c950-4fd4-bc60-d5fd2709c30d.png" alt class="image--center mx-auto" /></p>
<p>So, let us delete this container and create a container, which can listen to the outside internet.</p>
<p>Step 13 -&gt; To delete the container, we can use the command,</p>
<p><code>docker kill &lt;container id&gt;</code> followed by <code>docker rm &lt;container id&gt;</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691179789566/963871d0-a581-4dbd-9f97-4545ee7a006e.png" alt class="image--center mx-auto" /></p>
<p>Step 14 -&gt; Now, we will create a container by specifying the port number on which nginx listens. We can use the command,</p>
<pre><code class="lang-bash"><span class="hljs-comment">#Try writing the command by yourself.</span>
docker run -d --name nginx-cont -p 80:80 nginx
</code></pre>
<p>Here, we are <strong>mapping</strong> our host to our container (host:container) on port 80. So, the network is going through the host to the outside world and listening on port 80.</p>
<p>Now, if you check on the browser. The nginx message will be reflected. Which means our container is listening on port 80.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691180157178/458f19b4-5fe9-4e4d-9cd0-1b18a65c3c37.png" alt class="image--center mx-auto" /></p>
<p>Okay, so till now we have covered the default type of network which is the Bridge network.</p>
<p>Step 15 -&gt; Now, if you want to verify that the container lies in the default network. Run the command, <code>docker inspect bridge</code> . You'll get the output like,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691180557544/fbd34d1b-223e-4384-8c42-a80d57c43b4f.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-type-of-network-custom">Type of Network: Custom</h3>
<p>Let us move ahead with the second type of network, the Custom Network.</p>
<p>Definition: It is the network created by the developer which is used to create an isolated environment. In which the running container can interact with each other. But cannot interact with a container that lies in the default network OR a container that lies outside the custom network.</p>
<p>Step 16 -&gt; In this section, we will create our own network named "my-net". Using command, <code>docker network create &lt;network-name&gt;</code> .</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691304532858/80826324-60c8-4dab-a069-b95f4c81691f.png" alt class="image--center mx-auto" /></p>
<p>Step 17 -&gt; Our purpose here is will create two containers and keep them in the "my-net" custom network and on the other hand we will create an nginx container on the default bridge network. And then we will try to ping the container that exists in the default bridge from the container in the custom bridge. That's it. Let's do it.</p>
<p>Right Now, we have one container running which is mapped with the host at port number 80. Now, we will remove this container. And create another container that will not be listening.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691305270771/38e53555-7691-49a3-aa5d-0173ac9fa752.png" alt class="image--center mx-auto" /></p>
<p>The commands required are as follows,</p>
<pre><code class="lang-bash">docker ps
</code></pre>
<pre><code class="lang-bash">docker <span class="hljs-built_in">kill</span> &lt;container-id&gt;
docker rm &lt;container-id&gt;
</code></pre>
<pre><code class="lang-bash">docker ps
</code></pre>
<pre><code class="lang-bash">docker run -d --name &lt;container-name&gt; &lt;image&gt;
docker run -d --name nginx-in-default-net nginx
</code></pre>
<p>Till now, we have just deleted our container and created a new one.</p>
<p>Step 18 -&gt; Now, let us create two nginx containers in our custom network.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691305679916/eda995f8-826d-4ad1-a75d-3d21e5498149.png" alt class="image--center mx-auto" /></p>
<p>As earlier, we have created our network named "my-net" We will create and run two nginx containers in this network.</p>
<p>To verify that the nginx containers are created in our custom network, we can simply use the command <code>docker inspect &lt;network-name&gt;</code> in our case, <code>docker inspect my-net</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691305905709/2bdd91d0-a418-4eb0-9357-79a03cf5bbcd.png" alt class="image--center mx-auto" /></p>
<p>And here, we can see that the two containers are added to our custom network.</p>
<p>Let us now do a microservice project and implement a 2 or 3-tier application in our created network.</p>
<p>Clone this repository, <code>git clone https://github.com/LondheShubham153/microservices-k8s.git</code> in the EC2 instance.</p>
<p>Here, we will create a Dockerfile (which is created by Shubham Sir already). Followed by build it, then run it in the container. After cloning the repo, change your directory to flask-api dir. And build the image. Using command <code>docker build -t my-app:v1 .</code> Note: the <code>.</code> is not a full stop here. It shows the path of Dockerfile to Docker.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691306736703/b35120ac-0654-4f8d-9954-145f9ba16f26.png" alt class="image--center mx-auto" /></p>
<p>The success message will look like this.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691306739517/2a0b090f-e852-46e6-869a-076f308e74f4.png" alt class="image--center mx-auto" /></p>
<p>Now, let us boot up the container, using the command</p>
<p><code>docker run -d -p 5000:5000 --name microsvc-app-ctr --network my-net myapp:v1</code></p>
<p>Step 19 -&gt; Now, our app is listening on port 5000. But, we didn't have added the rule to allow traffic on port 5000 on our ec2 instance -&gt; security group -&gt; inbound rules. So, let us set up that.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691311661402/a5072d82-42a3-4e3d-be74-4629636652a9.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691311710130/10a0ae11-d04d-471a-9791-d157db67405f.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691311717298/5372b32e-10c2-4744-a7d6-9756bbb558ab.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691311726959/7dd70efa-3491-4549-bfb2-3925273e85cf.png" alt class="image--center mx-auto" /></p>
<p>After, creating the rule, our app must be up. And it may look like the following picture.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691311790752/e7fc9df3-4a07-4b12-88a7-b91778fa6a09.png" alt class="image--center mx-auto" /></p>
<p>Now, it is a moment of truth. Our app is running on port 5000 from the container that lies in our custom network.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691312315000/3afa6906-3f29-458b-94e8-3518bc7f7867.png" alt class="image--center mx-auto" /></p>
<p>And Boomm! Our container are isolated successfully.</p>
<p>Okay, so right now, in our custom network we have nginx-custom-1, nginx-custom-2 and python app running. Now, let us add a Database Container of MongoDB to make it a 2-tier application. By using command, <code>docker run --name mongo-custom --network my-net mongo</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691312925156/15683f3b-c693-4bb5-bcb1-fcdb57007776.png" alt class="image--center mx-auto" /></p>
<p>Now, as our mongo is added to the custom network. This link should be working. <code>http://&lt;ec2-instance-public-ip&gt;:5000/tasks</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691313081582/507e70d1-aef4-4942-81a9-0982d55b2ba8.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-type-of-network-host">Type of Network: Host</h3>
<p>Step 20 -&gt; Now, let us move ahead with the another kind of network which is host network. Here, we do not have to map our container port with the host port. Docker, by default uses the host IP address to listen at port we specified. If we were in Bridge(default) network our nginx container can ping to the data lies in outside world like google.com or so. But, the outside world cannot reach to our container.</p>
<p>Whereas in host network without mapping i.e. without "this -&gt; -p 80:80", outside world can reach to our nginx container.</p>
<p>To boot up host container use command, <code>docker run -d --name nginx-host --network host nginx</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691313746923/125d8876-8db5-4e02-8656-e9c4d33dbf88.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691313753600/fde67508-f65a-4e10-9a43-96b85d5803b6.png" alt class="image--center mx-auto" /></p>
<p>And this is how Host Network Works.</p>
<h3 id="heading-type-of-network-none">Type of Network: None</h3>
<p>The last type of network of this blog is, None.</p>
<p>When we create a container in the "None" network mode, it doesn't have network connectivity. It is effectively isolated from external network communication.</p>
<p>Let us create a container and try to ping the contents outside the container.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691314931785/958eebbe-9b79-4f1c-aa1b-b7b0db11254d.png" alt class="image--center mx-auto" /></p>
<p>Here, as you can see we are not able to establish the connection.</p>
<p>Similarly, when we want to access this container from the outside world.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691315059737/83485dcf-b0b8-45a8-90f5-45ce407eb40a.png" alt class="image--center mx-auto" /></p>
<p>Port 3000 is not assigned to the container because the container is in a None type of network.</p>
<p>That's all about Docker Networking from my side. Once I learn the further concepts of Docker Networking I will make Part-2 of this Blog.</p>
<p>Thank you for reading the Blog here.</p>
<p>Reference:</p>
<p>A Huge Thanks to Shubham Sir for providing us the in-depth knowledge of DevOps for free.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=UNew_BBNVPk">https://www.youtube.com/watch?v=UNew_BBNVPk</a></div>
]]></content:encoded></item><item><title><![CDATA[CI/CD Project using GitHub Actions and ArgoCD]]></title><description><![CDATA[Objective
Hey folks, here's another blog. In this, we are going to make our app up and running. And whenever we make changes in our GitHub file the change will update automatically.
OUTPUT:

Let's Get Started.
Install ArgoCD
Do check this blog on "Ge...]]></description><link>https://devarshshah.hashnode.dev/cicd-project</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/cicd-project</guid><category><![CDATA[BlogsWithCC]]></category><category><![CDATA[WeMakeDevs]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Sat, 11 Mar 2023 20:12:46 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-objective">Objective</h2>
<p>Hey folks, here's another blog. In this, we are going to make our app up and running. And whenever we make changes in our GitHub file the change will update automatically.</p>
<p><strong>OUTPUT:</strong></p>
<p><img src="https://pbs.twimg.com/media/FqtwwtfWAAUaDgv?format=jpg&amp;name=large" alt="Glimpse of success after a lot of failure.
" /></p>
<p>Let's Get Started.</p>
<h2 id="heading-install-argocd">Install ArgoCD</h2>
<p>Do check this blog on "<a target="_blank" href="https://hashnode.com/post/clev9smyc000909l81xybf6pb">Getting Started with ArgoCD</a>" without facing errors.</p>
<p>Now, after installing ArgoCD, enter this command:</p>
<p><code>kubectl port-forward svc/argocd-server -n argocd 8080:443</code> now the ArgoCD must be running on port 8080. As specified in the Blog, change the password and enter it with the user name "admin".</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678512726908/97e69ca3-1137-45ad-96f9-f66189a1a4eb.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-open-github">Open Github</h2>
<p>i.) Go to GitHub and fork two of <a target="_blank" href="https://github.com/imrishav">Rishav Sir's</a> repositories. One is named "gitops-01" and another is named "gitops-infra".</p>
<p>NOTE: Fork "gitops-infra" in master branch. Though it will be created in master branch by default. But verify once.</p>
<p>ii.) At this location <a target="_blank" href="https://github.com/imrishav/gitops-01/tree/master/.github"><code>.github</code></a><code>/</code><a target="_blank" href="https://github.com/imrishav/gitops-01/tree/master/.github/workflows"><code>workflows</code></a><code>/ci-action.yaml</code> in gitops-01 directory, we have to make some changes.</p>
<ul>
<li><p>In <code>build-and-push-docker-image:</code> section, there's one parameter -&gt;</p>
<p>  <code>- name: Build image and push to Docker Hub and GitHub Container Registry</code></p>
</li>
<li><p>Make changes in the "tags" parameter.</p>
<pre><code class="lang-yaml">  <span class="hljs-attr">tags:</span> <span class="hljs-string">|
              DockerHubUserName/gitops01:${{ github.sha }} 
              ghcr.io/DockerHubUserName/gitops01:${{ github.sha }}</span>
</code></pre>
<p>  Below, in <code>update-manifest-stage:</code></p>
<pre><code class="lang-yaml">        <span class="hljs-bullet">-</span> <span class="hljs-attr">uses:</span> <span class="hljs-string">actions/checkout@v3</span>
          <span class="hljs-attr">with:</span>
            <span class="hljs-attr">repository:</span> <span class="hljs-string">Github_Username/gitops-infra</span> <span class="hljs-comment">#CHANGES</span>
            <span class="hljs-attr">ref:</span> <span class="hljs-string">'master'</span>
            <span class="hljs-attr">token:</span> <span class="hljs-string">${{</span> <span class="hljs-string">secrets.G_TOKEN</span> <span class="hljs-string">}}</span>
        <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">setup</span> <span class="hljs-string">git</span> <span class="hljs-string">config</span>
          <span class="hljs-attr">run:</span> <span class="hljs-string">|
            git config --global user.email "YOUR_EMAIL_ID" #CHANGES
            git config --global user.name "GITHUB_USERNAME" #CHANGES
            echo ${{ github.sha }}
            .......
            .......
            .......</span>
</code></pre>
<p>  iii.) Now, in gitops-infra directory, in the "deployment.yaml" file.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678533564277/c7412ccd-a2fa-49e5-83f4-36e076e7aaa2.png" alt class="image--center mx-auto" /></p>
<p>  Here, in "containers:" section remove the id. and replace the username with your DockerHub Username.</p>
<p>  And in "service.yaml" file change the nodePort from 31000 -&gt; 32000. To avoid this error.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678562982396/f1dfdce9-62a7-462d-a9cc-42cbf3d92de6.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>iv.) Now, go to settings, in the "gitops-01" repository. Once you fork it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678534096602/c3fad22b-3673-44d6-9912-199c7dbcab8d.png" alt class="image--center mx-auto" /></p>
<p>Go to Action as shown in the picture. Then click "New repository secret" and create the secrets.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678534233361/8b7b4a3a-c514-47b2-8d0d-bf4118f68f7a.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678534280307/53660fae-59be-42d8-aa13-af4e68219edb.png" alt class="image--center mx-auto" /></p>
<p>Add these three secrets accordingly.</p>
<h2 id="heading-create-github-token">Create Github Token</h2>
<p>If you know how to generate a GitHub token. You can skip this part.</p>
<ol>
<li><p>Go to your Profile settings -&gt;</p>
</li>
<li><p>Then go to Developer Settings.</p>
</li>
<li><p>Then click on, "Tokens(classic)" within "Personal Access token".</p>
</li>
<li><p>Click on Generate new Token. And Enter a password.</p>
</li>
<li><p>Enter note. Select some parameters. Set the date when you want to expire the Token.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678561903487/77fca511-7870-4b21-823f-6b3b0e35d72e.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Click Generate Token</p>
</li>
<li><p>Copy the Code.</p>
</li>
<li><p>That's all.</p>
</li>
</ol>
<h2 id="heading-cont">Cont.</h2>
<p>Now, in Secrets add one more parameter named G_TOKEN. And paste the new Generated token into it.</p>
<h2 id="heading-interacting-with-argocd">Interacting with ArgoCD.</h2>
<h3 id="heading-connect-gitops-infra-forked-repo">Connect gitops-infra forked repo.</h3>
<ol>
<li><p>Now login into ArgoCD with Username: admin and your password.</p>
</li>
<li><p>Then go to settings -&gt; Repositories -&gt; Click connect repo.</p>
</li>
<li><p>Name: gitopsinfra(or anything you wish), Project: default,</p>
<p> Repository URL: gitops-infra, forked repo URL.</p>
</li>
<li><p>CONNECT.</p>
</li>
<li><p>Connection Status must be successful.</p>
</li>
</ol>
<h3 id="heading-create-application">Create application.</h3>
<ol>
<li><p>Go to Applications -&gt; Click New App.</p>
</li>
<li><p>In General,</p>
<p> Application Name -&gt; gitopstutorial(any you want)</p>
<p> Project Name -&gt; default</p>
<p> SYNC POLICY -&gt; Automatic</p>
<p> Select Auto Create Namespace</p>
</li>
<li><p>In Source,</p>
<p> Repository URL: gitops-infra repo URL itself.</p>
<p> Revision: HEAD</p>
<p> Path: ./ (which shows the path to deployment &amp; service file.)</p>
<p> Cluster URL: Select the default one.</p>
<p> Namespace: gitopstutorial(give the name you want)</p>
</li>
<li><p>CREATE.</p>
</li>
<li><p>Here, if it does not get synced. Synchronize it manually.</p>
</li>
<li><p>It must look like this.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678537009715/59e4b0aa-5dcd-4214-bb0e-79285d93fb97.png" alt class="image--center mx-auto" /></p>
<p> Note: Here, in your case, the number of pods must be 3. As I had changed the replica sets. In deployment.yaml file</p>
</li>
</ol>
<h2 id="heading-github-actions-part">Github Actions Part</h2>
<p>Firstly, Enable action by going to the action section in GitHub "gitops-01" repo.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678562409265/8fd18f29-f7ce-43cf-8074-2f80437f4cc8.png" alt class="image--center mx-auto" /></p>
<p>Here, you just need to make some changes, in the App.js file. That is in the frontend part and the GitHub actions will automatically get started. Once you commit changes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678539038741/5734105b-d018-4f48-9347-23243c42eec4.png" alt class="image--center mx-auto" /></p>
<p>In gitops-01 forked repo. Go to actions and see this. You may not face error.</p>
<h3 id="heading-the-error-you-may-face">The error you may face.</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678563292924/aec696a1-85b3-40a3-ae80-5676b588ea4f.png" alt class="image--center mx-auto" /></p>
<p>If you face this kind of error while re-running the job. Just,</p>
<ul>
<li><p>Go to the deployment.yaml file in gitops-infra repo.</p>
</li>
<li><p>And delete the id which is added when you ran the job first.</p>
</li>
<li><p>And re-run the update-manifest-stage job again. You'll not face this error.</p>
</li>
</ul>
<h2 id="heading-cli-part">CLI Part</h2>
<ol>
<li><p>Run command <code>kubectl get ns</code>(namespace). Here you'll see the namespace name <code>gitopstutorial</code> or whatever the name you put while creating the Application in ArgoCD.</p>
</li>
<li><p>Now, run the command <code>kubectl get all -n gitopstutorial</code>. You'll see everything about the pod, deployment and services.</p>
</li>
<li><p>Here, our main goal is to see the front end of our app. So, we'll port-forward our service to port 3001. Using command: <code>kubectl port-forward service/react-app 3001:80 -n gitopstutorial</code></p>
</li>
<li><p>Now, make some changes again in App.js from First Commit -&gt; Second Commit or anything. And commit the changes.</p>
</li>
<li><p>The action will start working. Now, go to ArgoCD to sync the app(if it is not automatically synced).</p>
</li>
<li><p>In CLI, kill the port-forwarding and re-run the command, <code>kubectl port-forward service/react-app 3001:80 -n gitopstutorial</code> .</p>
</li>
<li><p>Now, the changes must be reflected on the port <code>localhost:3001</code></p>
</li>
<li><p>That's all. Our app is up &amp; running. With GitHub actions.</p>
</li>
</ol>
<h2 id="heading-creating-webhook">Creating Webhook</h2>
<p>Here, we'll create a webhook so that the ArgoCD will be triggered automatically whenever we make and commit changes.</p>
<ol>
<li><p>Go to the settings of gitops-infra repo. And go to the webhook section. Here we will create the new webhook which will trigger "ArgoCD".</p>
</li>
<li><p>Now, In CLI run command <code>kubectl get svc -n argocd</code> . Here's notice that we're watching the services of "argocd" not the application in argocd.</p>
</li>
<li><p>Now, to expose our port we'll need ngrok. <a target="_blank" href="https://ngrok.com/download"><strong>Ngrok Installation Guide</strong></a><strong>.</strong></p>
<p> After installing, run the command <code>ngrok http 8080</code>.</p>
</li>
<li><p>After running the command you'll see this kind of interface.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678541865998/abe67e06-4ab2-4653-8317-5b740353a9bb.png" alt class="image--center mx-auto" /></p>
<p> Copy the https... link. And paste it into the Webhook's payload section followed by the "/api/webhook" part.</p>
</li>
<li><p>Content type: application/json.</p>
<p> SSL verification: Disable (for now).</p>
<p> Do not make any other changes and add webhook.</p>
<p> You may see, this kind of change in CLI.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678542213724/4faea682-41ee-482f-9524-894747f5ad0c.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>Now, made some changes in the deployment file this time(by changing the replicas). And the ArgoCD will be triggered automatically. And synchronized as we had enabled AutoSync.</p>
<h2 id="heading-final-touch">Final Touch</h2>
<ul>
<li><p>Now, to see that all the things are working perfectly. Make changes in App.js.</p>
</li>
<li><p>From Second Commit -&gt; Third Commit.</p>
</li>
<li><p>And commit the changes.</p>
</li>
<li><p>The action should start working -&gt; The AutoSync in ArgoCD must be done.</p>
<p>  And on localhost:3001 where our app is running should reflect the changes we made. i.e. Second Commit -&gt; Third Commit.</p>
</li>
</ul>
<h2 id="heading-references">References</h2>
<p>Rishav Sir's YouTube CI/CD video:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/mkz2V1Tl2H0">https://youtu.be/mkz2V1Tl2H0</a></div>
<p> </p>
<p><a target="_blank" href="https://github.com/imrishav/">Rishav Sir's GitHub:</a></p>
<p>Gitops Infra(consists deployment and service files): <a target="_blank" href="https://github.com/imrishav/gitops-infra">https://github.com/imrishav/gitops-infra</a></p>
<p>Gitops workflow: <a target="_blank" href="https://github.com/imrishav/gitops-01">https://github.com/imrishav/gitops-01</a></p>
]]></content:encoded></item><item><title><![CDATA[Getting Started with  ArgoCD]]></title><description><![CDATA[Output

Hey all, I'm writing this Blog because I faced 3 to 4 errors while getting argoCD up & running which took me lots of time. So, to save yours I'm writing this Blog.
Here, I mentioned the challenges I faced when I was getting started with ArgoC...]]></description><link>https://devarshshah.hashnode.dev/getting-started-with-argocd</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/getting-started-with-argocd</guid><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[BlogsWithCC]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Sun, 05 Mar 2023 10:48:22 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-output">Output</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678009695224/0a39717b-ce0f-4a53-ac99-8b435144745f.png" alt class="image--center mx-auto" /></p>
<p>Hey all, I'm writing this Blog because I faced 3 to 4 errors while getting argoCD up &amp; running which took me lots of time. So, to save yours I'm writing this Blog.</p>
<p>Here, I mentioned the challenges I faced when I was getting started with ArgoCD which you might face too. So, go through this Blog first then get started.</p>
<p>Note: Please refer to the <a target="_blank" href="https://argo-cd.readthedocs.io/en/stable/getting_started/#getting-started">Getting Started documentation</a> of ArgoCD simultaneously.</p>
<p>Let's get started.</p>
<p><a target="_blank" href="https://argo-cd.readthedocs.io/en/stable/getting_started/#getting-started">Getting Started</a></p>
<p><a target="_blank" href="https://argo-cd.readthedocs.io/en/stable/getting_started/#requirements">Requirements</a></p>
<h2 id="heading-install-argo-cdhttpsargo-cdreadthedocsioenstablegettingstartedrequirements"><a target="_blank" href="https://argo-cd.readthedocs.io/en/stable/getting_started/#requirements">Install Argo CD</a></h2>
<p><code>kubectl create namespace argocd</code></p>
<p><code>kubectl apply -n argocd -f</code> <a target="_blank" href="https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml"><code>https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml</code></a></p>
<p>Here, you might face the error like: <code>Unable to connect to the server: read tcp [2405:204:8088:9680:8862:5d4a:a1a8:dcb5]:54021-&gt;[2606:50c0:8000::154]:443: wsarecv: An existing connection was forcibly closed by the remote host.</code></p>
<p>So, to avoid this, follow these steps:</p>
<p>i.) Go to the YAML file link itself: <a target="_blank" href="https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml"><mark>Link</mark></a> <a target="_blank" href="https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml"><code>https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml</code></a></p>
<p>ii.) Copy the file.</p>
<p>iii.) Create a new folder named argocd on your Desktop or any place you wish.</p>
<p>iv.) Then paste the content in the file name <code>install.yaml</code></p>
<p>v.) Finally, run the command <code>kubectl apply -n argocd -f install.yaml</code> in your WSL terminal or Hyper terminal. (After starting, Docker Desktop and running <code>minikube start</code> command)</p>
<p>Note: Follow these same steps if you want core-install.yaml too. In the fourth step name the file core-install.yaml and run the command</p>
<p><code>kubectl apply -n argocd -f core-install.yaml</code></p>
<p>The output you will be like:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678010374385/123beee5-6f73-43e1-aed4-6bfc31999e71.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-install-in-cli">Install in CLI</h2>
<p>If you are using Windows OS. Install ArgoCD CLI via WindowsPowershell:</p>
<p><a target="_blank" href="https://argo-cd.readthedocs.io/en/stable/cli_installation/#windows"><mark>Link</mark>: https://argo-cd.readthedocs.io/en/stable/cli_installation/#windows</a></p>
<h2 id="heading-access-the-argocd-api-serverhttpsargo-cdreadthedocsioenstablegettingstarted3-access-the-argo-cd-api-server"><a target="_blank" href="https://argo-cd.readthedocs.io/en/stable/getting_started/#3-access-the-argo-cd-api-server">Access the ArgoCD API Server.</a></h2>
<p>ArgoCD must be running on port <a target="_blank" href="https://localhost:8080">https://localhost:8080</a></p>
<h2 id="heading-login-using-clihttpsargo-cdreadthedocsioenstablegettingstarted4-login-using-the-cli"><a target="_blank" href="https://argo-cd.readthedocs.io/en/stable/getting_started/#4-login-using-the-cli">Login Using CLI</a></h2>
<p>Here, you might face error like,</p>
<p><code>$ argocd admin initial-password</code></p>
<p><code>time="2023-03-05T12:47:25+05:30" level=fatal msg="secrets "argocd-initial-admin-secret" not found"</code></p>
<p>To avoid this, use the command <code>$ argocd admin initial-password -n argocd</code></p>
<p>Now, you may see your password.</p>
<h2 id="heading-now-to-update-your-password-you-have-to-log-in-through-your-terminal">Now, to update your password you have to log in through your terminal.</h2>
<p><code>argocd login &lt;ARGOCD_SERVER&gt;</code></p>
<p>In my case <code>&lt;ARGOCD_SERVER&gt;</code> = <code>localhost:8080</code></p>
<p>Now, go ahead &amp; update your password.</p>
<p>Now, go and play around with ArgoCD. And do some great projects.</p>
]]></content:encoded></item><item><title><![CDATA[Docker & Kubernetes Project]]></title><description><![CDATA[Hello Everyone, let us make a project from which we can get practical knowledge of all Docker and Kubernetes concepts and their commands.
So, let's get started.
Final Result

Reference: https://github.com/himanshurajofficials/Drum-Kit
Note: If you fo...]]></description><link>https://devarshshah.hashnode.dev/docker-kubernetes-project</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/docker-kubernetes-project</guid><category><![CDATA[BlogsWithCC]]></category><category><![CDATA[Docker]]></category><category><![CDATA[Kubernetes]]></category><category><![CDATA[WeMakeDevs]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Wed, 08 Feb 2023 09:00:27 GMT</pubDate><content:encoded><![CDATA[<p>Hello Everyone, let us make a project from which we can get practical knowledge of all Docker and Kubernetes concepts and their commands.</p>
<p>So, let's get started.</p>
<h2 id="heading-final-result">Final Result</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675752238771/89230281-e634-449f-815e-8fbd10c884f0.png" alt class="image--center mx-auto" /></p>
<p>Reference: <a target="_blank" href="https://github.com/himanshurajofficials/Drum-Kit">https://github.com/himanshurajofficials/Drum-Kit</a></p>
<p>Note: If you found this blog lengthy on doing this hands-on. Just Divide the topics into two parts: 1.) Deploying app using Docker 2.) Deploying using Kubernetes.</p>
<h2 id="heading-deploying-app-using-docker">Deploying app using Docker</h2>
<p><strong>Create a Dockerfile</strong></p>
<p>Using this we can give a script to Docker when we want to run our app.</p>
<ol>
<li><p>Create Dockerfile using <code>vim Dockerfile</code> or <code>nano Dockerfile</code> (vim &amp; nano will create the file if it does not exist).</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675752141987/5fb0a228-e468-4451-ab35-0d4104a06548.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>Then write the following script in the Dockerfile.</strong></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675752436666/ba0f31ed-3890-4fcd-8529-214c16aa636a.png" alt class="image--center mx-auto" /></p>
<pre><code class="lang-bash"> FROM python
 COPY index.html index.html
 EXPOSE 3000
 CMD [<span class="hljs-string">"python"</span>,<span class="hljs-string">"-m"</span>,<span class="hljs-string">"http.server"</span>,<span class="hljs-string">"3000"</span>]
</code></pre>
</li>
<li><p>Then, <strong>exit</strong> vim using -&gt; escape -&gt; :wq</p>
<p> If in nano -&gt; Ctrl + X -&gt; Y -&gt; Enter</p>
</li>
<li><p>Then <strong>build the Docker Image</strong> using <code>docker build .</code> command.</p>
<p> Here, docker build . will build the docker image. But to name the image and add the version to the image we have to run the command</p>
<p> <code>docker build . -t ImageName:ImageVersion</code></p>
<p> Here, prefer to write <code>dockerhubAccountName/ImageName:ImageVersion</code> . This will help you when you will push the Image to the docker hub.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675752924258/5436d1be-738a-48dc-8a4a-91641ed96244.png" alt class="image--center mx-auto" /></p>
<p> To check the images run the command <code>docker images</code> and you will see the image we just built.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675753184681/26ae47c7-f3a9-459b-bf33-0eed66a7bd96.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Finally, let us <strong>run the command to run our app.</strong></p>
<p> <code>docker run -d -p 3000:3000 &lt;ImageId&gt;</code> || <code>docker run -dp 3000:3000 &lt;ImageId&gt;</code></p>
<p> Here, we can also write -dp.</p>
<p> Here, -d means Detached mode which means the app will run in the background.</p>
<p> Here, -p means the port, on which our app will be running.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675753519656/e9417a76-036f-47fa-885a-c9215e338ef7.png" alt class="image--center mx-auto" /></p>
<p> Now, in the browser's search tab run port 3000. <code>http://localhost:3000</code> .</p>
</li>
<li><p>The app must be up and running.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675753693965/c09998ee-5790-4003-beb8-eca1a4122852.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>Now, our app is up and running. So, you might be thinking, that</p>
<p>Q: What is the use of K8s if we can run our app using docker only?</p>
<p>Ans: Because, if we stop our container our app will be down. So, for availability &amp; scalability, we need K8s. There are other reasons too of using K8s. But let us consider this for now.</p>
<h2 id="heading-deploy-using-k8s">Deploy using K8s</h2>
<p>First of all, <strong>start minikube cluster</strong>. If not installed install it. Otherwise, you will not be able to use the command kubectl.</p>
<p>Now as I said to name the image in the format <code>DockerHubUserName/ImageName:ImageVersion</code> we will use this to push our docker image to the docker hub.</p>
<ul>
<li><p>Push Image to Docker Hub. Using Cmd:</p>
<p>  <code>docker push &lt;ImageName:ImageVersion&gt;</code> .</p>
<p>  If it throws some error, run cmd: <code>docker login</code></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675759310027/b2566032-cbbc-4d3d-b1c8-792d4664e670.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>After the push, in the Drum-Kit library create a folder and name it "k8s-data" or "k8s"(using the command: <code>mkdir k8s</code>) which describes that this folder contains only k8s elements like pod or deployment file.</p>
<h3 id="heading-deploy-using-pods">Deploy using Pods.</h3>
<ol>
<li><p>Then, <code>cd k8s</code> -&gt; create a pod.yaml file in the k8s directory.</p>
</li>
<li><p>And write this code snippet in it.</p>
<pre><code class="lang-yaml"> <span class="hljs-comment">#This file is available on Kubernetes pod manifests files. Just copy paste it.</span>
 <span class="hljs-attr">apiVersion:</span> <span class="hljs-string">v1</span>
 <span class="hljs-attr">kind:</span> <span class="hljs-string">Pod</span>
 <span class="hljs-attr">metadata:</span>
   <span class="hljs-attr">name:</span> <span class="hljs-string">d-k-p</span> <span class="hljs-comment">#Keep name as you wish.</span>
 <span class="hljs-attr">spec:</span>
   <span class="hljs-attr">containers:</span>
   <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">d-k-p</span> <span class="hljs-comment">#Keep name as in metadata.</span>
     <span class="hljs-attr">image:</span> <span class="hljs-string">devarsh10/d-k-p:v1</span> <span class="hljs-comment">#Here write image name with the name you push your image to Docker hub</span>
     <span class="hljs-attr">ports:</span>
     <span class="hljs-bullet">-</span> <span class="hljs-attr">containerPort:</span> <span class="hljs-number">3000</span>
</code></pre>
</li>
<li><p>Now, using the command kubectl apply <code>-f pod.yaml</code> create a pod. The output will be like this:</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675838185483/c49475a1-ee0f-4cf9-b0a2-1aaf8271b6de.png" alt="Output" class="image--center mx-auto" /></p>
<p> Then, check whether it's running or not. Maybe you get some error named "ErrImagePull" or "ImagePullBackOff" Error. Then, check your internet connection. Or delete the pushed image from the docker hub. And again push it.</p>
</li>
<li><p>To check, that pod is running or not? Run this command:</p>
<p> <code>kubectl get pods --watch</code> or <code>kubectl get pods</code> . The output will be like this:</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675838640147/af6804dc-0cd0-4e82-92d9-d0dffd40c107.png" alt class="image--center mx-auto" /></p>
<p> (Note: Here, ignore the Status: Failure. It occurred because my laptop screen got turned off.)</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675839089541/6d968f31-7907-4019-9f1c-e9b7ea0c5b8b.png" alt class="image--center mx-auto" /></p>
<p> Now, here as you can see, <strong>Pod is running -&gt; Drum-Kit is running.</strong></p>
<p> The docker image is not running. Meaning, this app ran by our pod manifest file. <strong>Not</strong> by the command <code>docker run -dp 3000:3000 &lt;ImageId&gt;</code> .</p>
<p> Hence, this is how we can deploy our app on production.</p>
</li>
</ol>
<h3 id="heading-deploy-using-the-deployment-file">Deploy using the Deployment file.</h3>
<ol>
<li><p>Now, we just deploy our app using the pod. But what if, our pod gets deleted by someone using the command: <code>kubectl delete pod &lt;podName&gt;</code> . Then, it'll be a reason to worry.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675840699086/3eed9b01-81c9-4996-95aa-83693b070595.png" alt class="image--center mx-auto" /></p>
<p> This will happen. If the pod gets deleted.</p>
</li>
<li><p>So, to keep our pod up and running, we will need a controller which constantly monitors our pod. So, that's where we need deployment. So, we'll be needed a deployment file.</p>
</li>
<li><p>So, let's back to our terminal and create a deployment file.</p>
<p> Just run the command in the K8s directory: <code>nano deploy.yaml</code></p>
<p> And paste this deployment file:</p>
<pre><code class="lang-yaml"> <span class="hljs-comment"># This file is also available on: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/</span>
 <span class="hljs-attr">apiVersion:</span> <span class="hljs-string">apps/v1</span>
 <span class="hljs-attr">kind:</span> <span class="hljs-string">Deployment</span>
 <span class="hljs-attr">metadata:</span>
   <span class="hljs-attr">name:</span> <span class="hljs-string">d-k-p-deployment</span>
   <span class="hljs-attr">labels:</span>
     <span class="hljs-attr">app:</span> <span class="hljs-string">d-k-p</span>
 <span class="hljs-attr">spec:</span>
   <span class="hljs-attr">replicas:</span> <span class="hljs-number">1</span>
   <span class="hljs-attr">selector:</span>
     <span class="hljs-attr">matchLabels:</span>
       <span class="hljs-attr">app:</span> <span class="hljs-string">d-k-p-sl</span> <span class="hljs-comment">#Keep in mind to keep this name same. This one.</span>
   <span class="hljs-attr">template:</span>
     <span class="hljs-attr">metadata:</span>
       <span class="hljs-attr">labels:</span>
         <span class="hljs-attr">app:</span> <span class="hljs-string">d-k-p-sl</span> <span class="hljs-comment">#And this one.</span>
     <span class="hljs-attr">spec:</span>
       <span class="hljs-attr">containers:</span>
       <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">d-k-p</span>
         <span class="hljs-attr">image:</span> <span class="hljs-string">devarsh10/d-k-p:v1</span>
         <span class="hljs-attr">ports:</span>
         <span class="hljs-bullet">-</span> <span class="hljs-attr">containerPort:</span> <span class="hljs-number">3000</span>
</code></pre>
<p> Further, run the command <code>kubectl apply -f deploy.yaml</code> and check it's running or not using the command kubectl get <code>deployments</code> .</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675840827672/0481ae33-c70f-4086-9ca5-e9c7e3844b8c.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Now, our app must be running on port 3000. Like,</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675841403030/c97f30b5-1a65-448d-8116-ee4735d67ca5.png" alt class="image--center mx-auto" /></p>
<p> Now, if you delete the pod. The controller(deployment) will monitor this. And using <strong>Auto-Healing</strong>, it'll restart the port.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675841661032/0690d911-9887-4f7c-a935-b14180d043e7.png" alt /></p>
</li>
</ol>
<h2 id="heading-conclusion">Conclusion</h2>
<p>We ran up the app using docker, then using pod and deployment manifest in minikube cluster. Now, further, we can make our app externally available using <strong>Port type = NodePort.</strong></p>
<p>That's all.</p>
<p><strong>Reference:</strong></p>
<p>I would like to give a huge shoutout to <strong>Abhishek Sir</strong> and <strong>Shubham Sir</strong> as they both started this great hands-on project series.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/6Kax3ZvMOQU">https://youtu.be/6Kax3ZvMOQU</a></div>
]]></content:encoded></item><item><title><![CDATA[Ansible Tutorial Without AWS]]></title><description><![CDATA[Question:
You must be wondering, how can I do the Ansible hands-on project without going to AWS? And control multiple servers from one master server.
Solution:
So, I come up with the solution, we can create multiple Vagrant boxes with different IP ad...]]></description><link>https://devarshshah.hashnode.dev/ansible-tutorial-without-aws</link><guid isPermaLink="true">https://devarshshah.hashnode.dev/ansible-tutorial-without-aws</guid><category><![CDATA[ansible-playbook]]></category><category><![CDATA[ansible-without-aws]]></category><category><![CDATA[ansible-using-vagrant]]></category><category><![CDATA[BlogsWithCC]]></category><category><![CDATA[WeMakeDevs]]></category><dc:creator><![CDATA[Devarsh]]></dc:creator><pubDate>Fri, 03 Feb 2023 11:49:59 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-question">Question:</h2>
<p>You must be wondering, how can I do the Ansible hands-on project without going to AWS? And control multiple servers from one master server.</p>
<h2 id="heading-solution">Solution:</h2>
<p>So, I come up with the solution, we can create multiple Vagrant boxes with different IP addresses in a virtual machine of the Ubuntu operating system.</p>
<p>So, we can ssh into another Vagrant Box from one Vagrant Box.</p>
<p>So, get your vagrant file and virtual machine ready. And let's get started.</p>
<hr />
<h2 id="heading-how-to-create-2-vagrant-files">How to create 2 vagrant files?</h2>
<ul>
<li><p>If you have one vagrant file. Copy it and Paste it into another directory by changing its IP address.</p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675422863680/bf9b35e5-f937-4f78-8cb4-c91eb757ef90.png" alt class="image--center mx-auto" /></p>
<p>  Just change the IP address.</p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675422998183/79c5520a-470c-4940-a29c-1cd8ddbc372c.png" alt /></p>
</li>
<li><p>Create two Vagrant files with different IP</p>
</li>
<li><p>In Hyper Terminal(recommended) or WSL Terminal open both vagrant files simultaneously</p>
</li>
<li><p>From one terminal tab ssh to another Vagrantfile using another IP address. Use <code>sudo ssh vagrant@IPaddress</code> command.</p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675423410220/b31ef4fa-15b0-41b4-8adb-9eefa0dc868d.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Here, as you can see I ssh into <code>192.168.33.11</code> IP address from <code>192.168.33.10</code> server.</p>
</li>
<li><p>Now, exit the 192.168.33.11 server and come back to the first vagrant file.</p>
</li>
</ul>
<h2 id="heading-how-to-create-an-inventory">How to create an Inventory?</h2>
<ul>
<li><p>Create a file named "hosts" in the "ansible" named directory. Using <code>mkdir ansible</code></p>
</li>
<li><p>In the hosts file put the IP address of the 2nd Vagrantfile</p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675423584920/318a2f78-2892-45ab-ae1b-99b82532f79a.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<pre><code class="lang-yaml">[<span class="hljs-string">servers</span>]
<span class="hljs-string">server1</span> <span class="hljs-string">ansible_host=192.168.33.11</span>

[<span class="hljs-string">all:vars</span>]
<span class="hljs-string">ansible_python_interpreter=/usr/bin/python3</span>
</code></pre>
<ul>
<li><p>Use the command, to list the 2nd Vagrantfile IP</p>
<p>  address in the ansible inventory</p>
<ul>
<li><code>ansible-inventory --list -y -i /home/vagrant/ansible/hosts</code></li>
</ul>
</li>
<li><p>Now check whether the connection between the 1st Vagrantfile and the 2nd Vagrantfile is established or not.</p>
<ul>
<li><p>By using the command:</p>
</li>
<li><p><code>ansible all -i /home/vagrant/ansible/hosts -m ping --ask-pass</code></p>
</li>
<li><p>Here, maybe you need to install sshpass. Use the command: sudo apt install sshpass</p>
</li>
<li><p>Now, enter the password: vagrant. If you didn't change it.</p>
</li>
</ul>
</li>
</ul>
<p>Now, we have established the connection between both the Vagrantfiles.</p>
<h2 id="heading-let-us-create-a-playbook">Let us create a playbook</h2>
<p><strong>Aim: Create a file in the 2nd Vagrantfile from the 1st Vagrantfile.</strong></p>
<ul>
<li><p>Come to /home/vagrant/ansible directory from whichever directory you are in.</p>
</li>
<li><p>And create a directory named "playbooks". Using the command: mkdir playbooks</p>
</li>
<li><p>Now, go to the playbook directory. Using cd playbooks</p>
</li>
<li><p>Now, create a YAML file named create_file.yaml</p>
</li>
<li><p>Using the command: <code>vim create_file.yaml</code> | <code>nano create_file.yaml</code> | <code>touch create_file.yaml</code></p>
<pre><code class="lang-yaml">  <span class="hljs-string">---</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">This</span> <span class="hljs-string">will</span> <span class="hljs-string">create</span> <span class="hljs-string">a</span> <span class="hljs-string">file</span>
    <span class="hljs-attr">hosts:</span> <span class="hljs-string">all</span>
    <span class="hljs-attr">become:</span> <span class="hljs-literal">true</span> <span class="hljs-comment">#meaning, it will become a root user</span>
    <span class="hljs-attr">tasks:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Create</span> <span class="hljs-string">a</span> <span class="hljs-string">file</span>
      <span class="hljs-attr">file:</span>
       <span class="hljs-attr">path:</span> <span class="hljs-string">/home/vagrant/example.txt</span>
       <span class="hljs-attr">state:</span> <span class="hljs-string">touch</span>
</code></pre>
</li>
<li><p>Now run this command. And then the txt file will be created in the 2nd Vagrantfile.</p>
</li>
<li><p><code>ansible-playbook create_file.yaml -i /home/vagrant/ansible/hosts --ask-pass</code></p>
</li>
<li><p>Now, a text file will be created in the 2nd Vagrantfile.</p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675424169452/4e2b2c93-cad1-4fe8-9d67-ddd90f4f2bd9.png" alt class="image--center mx-auto" /></p>
<p>  Here, as you can see, example.txt is created in the server 192.168.33.11</p>
</li>
<li><p>That's all</p>
</li>
</ul>
<h2 id="heading-references">References:</h2>
<p>Here, Shubham sir had done all things in AWS. And I used vagrant for the same.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/SGB7EdiP39E">https://youtu.be/SGB7EdiP39E</a></div>
<p> </p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/089mRKoJTzo">https://youtu.be/089mRKoJTzo</a></div>
]]></content:encoded></item></channel></rss>