<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shashwat Tripathi on Medium]]></title>
        <description><![CDATA[Stories by Shashwat Tripathi on Medium]]></description>
        <link>https://medium.com/@I_M_Harsh?source=rss-db0b938d57b9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*b4ame678V9riMNebo6ojlg.jpeg</url>
            <title>Stories by Shashwat Tripathi on Medium</title>
            <link>https://medium.com/@I_M_Harsh?source=rss-db0b938d57b9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 05:11:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@I_M_Harsh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Goals Motivated by Strong Emotions]]></title>
            <link>https://medium.com/@I_M_Harsh/goals-motivated-by-strong-emotions-9070f82ed28f?source=rss-db0b938d57b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/9070f82ed28f</guid>
            <category><![CDATA[giving-up]]></category>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[goals]]></category>
            <category><![CDATA[self-improvement]]></category>
            <dc:creator><![CDATA[Shashwat Tripathi]]></dc:creator>
            <pubDate>Thu, 17 Jun 2021 23:32:51 GMT</pubDate>
            <atom:updated>2021-06-17T23:32:51.158Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aMIBWiSGSGiPYE50" /><figcaption>Photo by <a href="https://unsplash.com/@avirichards?utm_source=medium&amp;utm_medium=referral">Avi Richards</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Ever decided on a goal like waking up at 5 AM but couldn&#39;t do it or continue it if somehow managed it for a few days? Why it becomes too difficult to continue doing what we want to do?</p><p>I believe, we often (for me it is just too often) make some commitments to ourselves like ‘<em>I will read daily’</em>, ‘<em>I will workout daily’</em>, ‘<em>I will do yoga daily’</em>, ‘<em>I will spend time on learning something to get a higher pay’</em>. We start working towards these goals and fall prey to distractions in a very short period. We don’t even start working on some of these goals and keep delaying them.</p><p>I experienced that we often fail to put continuous efforts into our goals if we do not attach our emotions to the level which can motivate us for working towards our goals.</p><h3>The Importance of Why</h3><p>So what it is that keeps us from giving up? If we don’t know why exactly we want to do something, all the efforts we put into that thing will soon start to feel like a burden and eventually become boredom pulling us away from our goals. We must know that why we want to whatever we want to do.</p><p>And the answer to <em>why </em>cannot be with something like ‘<em>I will start reading a book daily.</em>’ and if someone asks <em>why?</em> I tell him ‘<em>hmmm… I think it is a good habit to do so</em>’.</p><p>No, you must know what values this is going to bring to your life. For me, the answer is ‘<em>I am struggling to focus on work and get distracted easily. I know reading books increases our ability to focus which will help me do my work faster so I will remain on schedule and will be able to spend quality time with my family and loved ones. Plus, I gain more knowledge as a side effect </em>😉’.</p><h3>A Little Exercise</h3><p>Do this little exercise thinking about why we must do what we want to do. In the end, you will either feel more motivated and making continuous efforts for these goals will not be difficult anymore, or you will find that the thing you are trying to do isn’t really that important to you and that’s okay because it will save your energy for your other important goals.</p><ol><li>Take a deep breath. Be honest and don’t be judgy to yourself.</li><li>Tell yourself why you must do what you want to do. Dive a bit deeper by asking <em>Why </em>recursively until you reach a point where the answer is really something meaningful, valuable, or maybe gives you <em>goosebumps</em>. Think about what solid impact this is going to make in yours or maybe in other’s life.</li></ol><p>A truly meaningful answer to your <em>Why </em>will attach strong emotions to your goals which will help you keep fueled up and motivated enough so you don’t feel like giving up and enjoy putting efforts because you know the importance of your efforts.</p><h3>Booster Shots</h3><p>You may need to remind yourself from time to time about why it is important to you whenever you feel driven away or not motivated enough. Just give yourself a booster shot by quickly doing the exercise above. This will save you from giving up in a very healthy manner.</p><p>Thanks for reading this article. Please put your thoughts using comments or private message whatever suits you best.</p><p><em>References:<br>My own learnings<br></em><a href="https://amzn.to/3vwtUyB"><em>Start With Why</em></a><em> by Simon Sinek<br></em><a href="https://amzn.to/3q5mAc0"><em>Atomic Habits</em></a><em> by James Clear</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9070f82ed28f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build and Deploy using Jenkins, Packer and Terraform]]></title>
            <link>https://medium.com/@I_M_Harsh/build-and-deploy-using-jenkins-packer-and-terraform-40b2aafedaec?source=rss-db0b938d57b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/40b2aafedaec</guid>
            <category><![CDATA[continuous-delivery]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Shashwat Tripathi]]></dc:creator>
            <pubDate>Thu, 11 Jan 2018 05:00:11 GMT</pubDate>
            <atom:updated>2020-07-21T07:52:39.207Z</atom:updated>
            <content:encoded><![CDATA[<p>Dear users, it is my first story on Medium. I wanted to share my experience for how I managed to completely automate deployments for one my project to a Load Balanced, Auto Scalable infrastructure with Immutable Servers.</p><h3>What is an Immutable Server?</h3><p>An immutable server doesn’t accept any change once it is launched and provisioned. Which means you can’t update your code or deploy new files to rollout an update for your application. To rollout an update, new servers group with the updated code will be created while destroying the old ones. This way, it becomes easier to auto scale your application with one true source (an AWS AMI) to launch new instances to meet your workload.</p><h3>Requirements</h3><p>To perform this exercise or setup, you need a Jenkins server, GitHub account and AWS account. Most of the resources will fit into AWS free tier, so you should not be charged if you destroy everything after we complete the exercise.</p><p>So, how we do it?</p><p>We do it with the help of modern DevOps tools. I will show you the step by step process for a complete setup, right from the sample ExpressJs (Nodejs web app) setup to the deployment.</p><h3>Your Web Server Code (ExpressJs)</h3><p>We will use default template generated by <a href="https://expressjs.com/en/starter/generator.html">express generator</a> for our Nodejs web application.</p><ol><li>Install NodeJs on your system (please note version which you are installing, as we will use the same version in further configuration. As of now we’ve installed 8.9.4 LTS)</li><li>Generate template using express node-app. This will create a project skeleton. Check <a href="https://expressjs.com/en/starter/generator.html">express generator</a> docs for help.</li><li>Push your code to a GitHub repository. You can use other central repository if you wish so. (Note: make sure you’ve ignored node_modules through your .gitignore file.</li></ol><h3>Docker Container</h3><p>We will create a custom image with Packer, Terraform and latest Git installed already setup. Please find Dockerfile below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c14350be924fad0bfa2ec1845a0d36d5/href">https://medium.com/media/c14350be924fad0bfa2ec1845a0d36d5/href</a></iframe><p>You can save yourself from creating your custom image as I’ve already built it and published it for <a href="https://hub.docker.com/r/goforgold/build-container/">public use on Docker Hub</a>. I will also use <a href="https://hub.docker.com/r/goforgold/build-container/">my public image</a> from Docker Hub in this setup.</p><h3>Generate AWS Key and Secret Key</h3><p><a href="https://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html">Generate AWS Key and Secret Key</a> for your AWS account for your root account or an IAM user with permission to manage resources like EC2, Elastic Load Balancer (ELB), Auto Scaling Group (ASG), Security Group (SG) and Launch Configuration (LC). You will need this key and secret to manage resource using Packer and Terraform.</p><h3>Packer Configurations</h3><p>We are using Packer to create native AWS AMI which will be used in the Launch Configuration for our Auto Scaling Group which is attached to the Load Balancer.</p><p>We will configure our machine by installing applications like NodeJs, copy our project code and configuring auto startup of web server. We will use <a href="https://www.packer.io/docs/provisioners/ansible-local.html">Ansbile Local</a> provisioner to configure everything so our application will start when the machine boots up.</p><p>Packer is used to bake everything into the native AWS AMI. Below is the complete packer configuration.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6e3905c31429ede174054876c1ae9cbb/href">https://medium.com/media/6e3905c31429ede174054876c1ae9cbb/href</a></iframe><p>We are using three provisioners here,</p><ol><li>Shell provisioner to install Ansible and create project directory home/ubuntu/node-app.</li><li>File provisioner to copy project code.</li><li>Ansible provisioner to configure our machine.</li></ol><p>Our Ansible playbook file looks like below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0929a5355c5097b089276ad41821b487/href">https://medium.com/media/0929a5355c5097b089276ad41821b487/href</a></iframe><p>We’ve used AWS <a href="https://www.packer.io/docs/builders/amazon-ebs.html">amazon-ebs</a> builder to create a builder. You should be able to understand configuration by reading out. Or you can put a comment if you do not understand something.</p><p>Create a new folder in your project folder with name packer and store these files with name packer.json and ansible-playbook.yml and push to the repository.</p><h3>Terraform Configurations</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/49dae558003896b48112024b2dbdf54f/href">https://medium.com/media/49dae558003896b48112024b2dbdf54f/href</a></iframe><p>When you apply these configurations, Terraform will use latest AMI (notice most_recent = true) and will modify AWS resources to use new AMI. Executing terraform apply will modify and recreate some of the resources in a way so create happens before destroy (notice create_before_destroy). You can also extract AMI id from Packer</p><p>Some important points to note here are:</p><ul><li>Both LC and ASG have creaet_before_destroyset to true</li><li>The LC omits the name attribute to allow Terraform to auto-generate a random one, which prevent collisions</li><li>The ASG interpolates the launch configuration name into its name, so LC changes always force replacement of the ASG (and not just an ASG update).</li><li>The ASG sets min_elb_capicity which means Terraform will wait for instances in the new ASG to show up as InService in the ELB before considering the ASG successfully created.</li></ul><p>The behavior when AMI changes is:</p><ol><li>New LC is created with the fresh AMI</li><li>New ASG is created with the fresh LC</li><li>Terraform waits for the new ASG’s instances to spin up and attach to the ELB</li><li>Once all new instances are InService, Terraform begins destroy of old ASG</li><li>Once old ASG is destroyed, Terraform destroys old LC</li></ol><p><strong>Note: </strong>Terraform uses a file terraform.tfstate to store all the mappings and states of AWS resources it manages. We need to get this file before we run terraform apply again. Using Jenkins, we will be updating this file to our repository (a separate GitHub repository) to preserve the states created by Terraform.</p><h3>Jenkins Configuration</h3><p>Aah ha! finally we go for automating everything using Jenkins. Create a new pipeline for your GitHub project in Jenkins which you created for NodeJs express. Try doing it using new Blue Ocean interface, it is much simpler that way.</p><p>Our `Jenkinsfile` looks like below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/92264bace92ab4f835aecd577893e94d/href">https://medium.com/media/92264bace92ab4f835aecd577893e94d/href</a></iframe><p>We’ve divided whole process into 3 simple stages</p><ul><li>Build</li><li>Create Packer AMI (packer part)</li><li>AWS Deployment (terraform part)</li></ul><p>We are using our custom docker image goforgold/build-container from Docker Hub.</p><p>Also note that, we are pushing back our terraform.tfstate each time after successful terraform apply run. It is important because Terraform stores mappings it has created in this file and need it while applying changes.</p><h3>Result</h3><p>If you’ve connected all the wires correctly. You should be able to access your web server using your ELB DNS on 3000 port.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7DrbfUQ8yNPPH1JnQXHjPA.png" /></figure><h3>Complete Code</h3><ul><li>NodeJs (Web sever code) which includes Packer and Ansbile configuration under packer folder.<br><a href="https://github.com/goforgold/node-app">https://github.com/goforgold/node-app</a></li><li>Terraform Repository<br><a href="https://github.com/goforgold/node-app-terraform">https://github.com/goforgold/node-app-terraform</a></li></ul><p>Hope above setup will help you in understanding of how we can put Packer, Ansible and Terraform altogether.</p><p>It is my first setup like this, hope you will find it valuable. I appreciate any suggestions and comments for any kind of improvement we can put here.</p><h4>Thanks for reading. If you enjoyed this article, feel free to hit that clap button 👏 to help others find it.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40b2aafedaec" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>