<?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 Yogesh Sreedharan on Medium]]></title>
        <description><![CDATA[Stories by Yogesh Sreedharan on Medium]]></description>
        <link>https://medium.com/@yogeshsr?source=rss-bbb9e65cf8f4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*x528ggfwwno-1eeTNUOOGQ.jpeg</url>
            <title>Stories by Yogesh Sreedharan on Medium</title>
            <link>https://medium.com/@yogeshsr?source=rss-bbb9e65cf8f4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 01:35:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yogeshsr/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[Verifying Chief cookbook recipe with Test Kitchen]]></title>
            <link>https://medium.com/@yogeshsr/verifying-chief-cookbook-recipe-with-test-kitchen-eec65f3cd218?source=rss-bbb9e65cf8f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/eec65f3cd218</guid>
            <category><![CDATA[chef-software]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[automation-testing]]></category>
            <dc:creator><![CDATA[Yogesh Sreedharan]]></dc:creator>
            <pubDate>Sat, 03 Nov 2018 08:03:17 GMT</pubDate>
            <atom:updated>2019-05-04T11:33:45.048Z</atom:updated>
            <content:encoded><![CDATA[<h3>Verifying Chef cookbook recipe with Test Kitchen</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/224/1*6haqo2du13eT7sGeTuiQeA.png" /><figcaption><a href="https://kitchen.ci/">https://kitchen.ci/</a></figcaption></figure><p>I am assuming that you have some familiarity with infrastructure automation using Chef. In case you are new to this ecosystem, please go through the basics <a href="https://learn.chef.io/modules">here</a>.</p><p>My recent client uses Chef for infrastructure automation. For some deployments, my team also had made changes to cookbooks but, it was not a practice to verifying cookbook changes over developer box. The changes were pushed to the Chef server and were tested over integration box. To debug issues, we change the cached cookbook over the integration box and run chef-client with skip-cookbook-sync option. Once we started making frequent changes to cookbooks, we needed a better way to debug/verify the cookbooks.</p><p>We tried Test Kitchen which is packaged with Chef DK. It provides the required environment for testing of cookbooks across combination of platforms (Ubuntu, CentOS, etc) and test suites. Let’s go through our learnings with Test Kitchen -</p><p>After installing <a href="https://downloads.chef.io/chefdk/">Chef DK</a>, <a href="https://www.virtualbox.org/wiki/Downloads">VirtualBox</a> and <a href="https://www.vagrantup.com/downloads.html">Vagrant</a> for the developer box platform, the first step is to initialize the Test Kitchen for a cookbook.</p><pre>kitchen init</pre><p>Let’s clone a <a href="https://github.com/yogeshsr/simple_apache2_cookbook">cookbook</a> which has sample recipes and Test Kitchen initiated -</p><pre>git clone <a href="https://github.com/yogeshsr/simple_apache2_cookbook.git">https://github.com/yogeshsr/simple_apache2_cookbook.git</a></pre><p>Following changes are done to the generated .kitchen.yml file —</p><ul><li>Added port forwarding so as the service running over guest VM is accessible from host/developer machine</li><li>Changed provisioner to chef_zero which is lightweight in memory Chef server suitable for testing cookbooks</li><li>Added JSON file paths defining the environment, databag and nodes using JSON files</li><li>Added recipes to the run-list of a node and defined its attributes and tags</li><li>Added the test folder path</li></ul><p>Here’s the Test Kitchen configuration file .kitchen.yml —</p><pre>---<br>driver:<br>  name: vagrant<br>  network:<br>    # define the port forwarding to access service from host/developer machine<br>    - [&quot;forwarded_port&quot;, {guest: 80, host: 8080}]</pre><pre>provisioner:<br>  name: chef_zero<br>  # path to json files that will define the environments, databags and other nodes<br>  environments_path: test/integration/environments<br>  data_bags_path: test/integration/data_bags<br>  nodes_path: test/integration/nodes<br>  client_rb:<br>    environment: development</pre><pre>verifier:<br>  name: inspec</pre><pre>platforms:<br>  - name: ubuntu-16.04</pre><pre>suites:<br>  - name: default<br>    run_list:<br>      - recipe[simple_apache2_cookbook::default]<br>      - recipe[simple_apache2_cookbook::sample]<br>    # current node attributes accessible as node[&#39;foo&#39;]<br>    attributes:<br>      foo: bar<br>      tags:<br>        - tag_1:value_1<br>    verifier:<br>      inspec_tests:<br>        - test/integration/default</pre><p>Let’s run the cookbook with Test Kitchen. We need to create and converge kitchen to apply the cookbook recipe defined the .kitchen.yml</p><pre>cd simple_apache2_cookbook<br>Kitchen list<br>kitchen create<br>kitchen converge</pre><p>By now, kitchen would have provisioned a Ubuntu 16.04 VM using Vagrant.</p><p>Let’s take a moment to see the logs of <em>kitchen converge</em> command. One of the interesting bit here is the info log of <em>sample.rb</em> recipe. It logs the current node attributes. It also uses search query to find other nodes.</p><pre># see .kitchen.yml - attibutes</pre><pre>log &quot;Current node attribute foo is: #{node[&#39;foo&#39;]} &quot; do<br>  level :info<br>end</pre><pre>log &quot;Tags of current node: #{node[&#39;tags&#39;]}&quot; do<br>  level :info<br>end</pre><pre># see .kitchen.yml - nodes_path</pre><pre>customer_node = search(:node, &quot;tags:team\\:myteam AND tags:internal\\:true AND run_list:recipe\\[customer\\:\\:app\\] AND chef_environment:#{node.chef_environment}&quot;)</pre><pre>log &quot;knife search customer service node attribute is: #{customer_node.first()[&#39;customer_node_attribute_1&#39;]} &quot; do<br>  level :info<br>end</pre><p>Let’s SSH to the VM and verify apache2 installation—</p><pre>$ kitchen login</pre><pre># verify the apache service is up<br>vagrant@default-ubuntu-1604:~$ service apache2 status</pre><pre># see the home page has content updated from by the recipe<br>vagrant@default-ubuntu-1604:~$ curl localhost<br>&lt;html&gt;<br>  &lt;body&gt;<br>    &lt;h1&gt;hello world&lt;/h1&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><pre>vagrant@default-ubuntu-1604:~$ exit</pre><p>Since we have defined port forwarding in .kitchen.yml, we can access the service from host machine.</p><pre>$ curl localhost:8080<br>&lt;html&gt;<br>  &lt;body&gt;<br>    &lt;h1&gt;hello world&lt;/h1&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>Let’s run the default_test.rb integration test that will verify apache2 is installed by the default recipe.</p><pre>kitchen verify</pre><p>The verify command will run test on converged instance and change the state to verified. It will create and converge kitchen if the instance is not available. You should be able to see the output of the test over the console. Once we’r done, we can manually delete the setup by —</p><pre>$ kitchen destroy</pre><p>Please 👏 <a href="https://help.medium.com/hc/en-us/articles/115011350967-Claps">clap</a> if you want to appreciate this write-up.</p><p>References —</p><ul><li><a href="https://docs.chef.io/kitchen.html">Kitchen - Chef Docs</a></li><li><a href="https://kitchen.ci/">Welcome to Kitchen - KitchenCI</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eec65f3cd218" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Resilient approach for sending data to BI system]]></title>
            <link>https://medium.com/@yogeshsr/resilient-approach-for-sending-data-to-bi-system-2f862085c6eb?source=rss-bbb9e65cf8f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f862085c6eb</guid>
            <category><![CDATA[reporting]]></category>
            <category><![CDATA[fault-tolerance]]></category>
            <category><![CDATA[resilience]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[bi]]></category>
            <dc:creator><![CDATA[Yogesh Sreedharan]]></dc:creator>
            <pubDate>Fri, 26 Oct 2018 03:38:41 GMT</pubDate>
            <atom:updated>2020-10-02T03:29:20.371Z</atom:updated>
            <content:encoded><![CDATA[<p>I am working for a Voucher Market Place which is part of my client’s super app. This super app has 18+ products for daily user needs like transportation, food delivery, logistics, etc. The client is the fastest growing startup of South-East Asian.</p><p>There 3 million+ of voucher transactions (Purchase, redemption, etc.) handled by our system on a daily basis. Marketing campaigns for new user acquisition, product promotions, etc. multiples the daily rate of voucher transactions.</p><p>For analytics/reporting, we publish the voucher transactions to the BI system. With this write up I will try to explain how do we send voucher transitions to BI system with the following considerations-</p><ul><li>Guaranteed delivery of each transactional to the BI system.</li><li>No impact over the response time(Key to the user experience)</li></ul><h3>Guaranteed delivery of data</h3><p>To guarantee the delivery of transaction to BI system, we push each of the voucher transaction as a message to a Kafka cluster which is-</p><ul><li>performant</li><li>provides reliable durability of messages</li><li>has a flexible publish-subscribe/queue that scales well.</li></ul><p>Kafka provides reliable store for our transactions till it’s consumed by BI system (consumers) at their own pace.</p><p>But what if there are some failures when we’re trying to push voucher transaction message to Kafka topic? We don’t want rollback the transaction. Here’s how we handles this situation by using a fallback mechanism-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*nF-_ZrcEYYgPyOAFtROn4w.jpeg" /></figure><ul><li>The Voucher service uses Hystrix wrapped Kafka producer command to push transaction message to Kafka topic.</li><li>In case of a failure, the fallback of this Hystrix command adds the message to a Fallback Redis.</li><li>We have a Sidekiq worker which polls the messages from the Fallback Redis and tries to add back the original Kafka topic.</li><li>We are alerted for Sidekiq rolling retries errors, failures, etc.</li></ul><h3>Response time</h3><p>As mentioned above, the voucher service uses Hystrix wrapped Kafka producer command to offload delivery of voucher transaction details to Kafka cluster. We use Hystrix asynchronous command (queue) which uses a separate thread pool. This way the api response time is not impacted.</p><p>With the above fallback mechanism, we ensure that adding message to a topic is resilient to failures and does not impact the API response time. This fallback mechanism works without manual intervention. If there are irrecoverable errors, we are alerted by our monitoring systems which are build around Datadog, Spikes, NewRelic and PagerDuty.</p><p>Please 👏 <a href="https://help.medium.com/hc/en-us/articles/115011350967-Claps">clap</a> if you want to appreciate this write-up.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f862085c6eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install Postgres 11 beta over Ubuntu]]></title>
            <link>https://medium.com/@yogeshsr/install-postgres-11-beta-over-ubuntu-92b900a2e36?source=rss-bbb9e65cf8f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/92b900a2e36</guid>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[postgres]]></category>
            <dc:creator><![CDATA[Yogesh Sreedharan]]></dc:creator>
            <pubDate>Mon, 06 Aug 2018 17:58:51 GMT</pubDate>
            <atom:updated>2019-07-27T13:08:13.174Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Update: Postgres 11 is released, if you have landed over this write up, please consider installing the latest 11 than beta.</blockquote><p>I did not find a quick guide to install Postgres 11 beta over Ubuntu 16.04. So, I am sharing how I installed the beta.</p><p>This guide is to setup Postgres 11 beta over Ubuntu 16.04 virtual machine using Vagrant. You can skip the Vagrant commands in the below section if you already have Ubuntu 16.04.</p><pre>Install Vagrant for your operating system <a href="https://www.vagrantup.com/downloads.html">https://www.vagrantup.com/downloads.html</a><br>Create a folder for the virtual machine<br>$ mkdir ubuntu16.04 &amp;&amp; cd ubuntu16.04</pre><pre>$ vagrant init ubuntu/xenial64<br>$ vagrant up<br>$ vagrant ssh</pre><pre>vagrant@ubuntu-xenial:~$ sudo su -<br>root@ubuntu-xenial:~# vim /etc/apt/sources.list.d/apt.postgresql.org.list<br># Add the following<br>deb <a href="http://apt.postgresql.org/pub/repos/apt/">http://apt.postgresql.org/pub/repos/apt/</a> xenial-pgdg main 11</pre><pre>root@ubuntu-xenial:~# wget --quiet -O - <a href="https://www.postgresql.org/media/keys/ACCC4CF8.asc">https://www.postgresql.org/media/keys/ACCC4CF8.asc</a> | sudo apt-key add -<br>root@ubuntu-xenial:~# apt-get update<br>root@ubuntu-xenial:~# apt-get install postgresql-11</pre><pre>root@ubuntu-xenial:~# systemctl status postgresql</pre><p>Postgres 11 has major improvements to partitioning. Check out the the release notes <a href="https://www.postgresql.org/docs/11/static/release-11.html">https://www.postgresql.org/docs/11/static/release-11.html</a></p><p>Please 👏 <a href="https://help.medium.com/hc/en-us/articles/115011350967-Claps">clap</a> if you want to appreciate this write-up.</p><p>Following are some useful links</p><ul><li><a href="https://www.vagrantup.com/intro/getting-started/index.html">https://www.vagrantup.com/intro/getting-started/index.html</a></li><li><a href="https://www.postgresql.org/download/linux/ubuntu/">https://www.postgresql.org/download/linux/ubuntu/</a></li><li><a href="https://www.postgresql.org/download/">https://www.postgresql.org/download/</a></li><li><a href="https://wiki.postgresql.org/wiki/Apt">https://wiki.postgresql.org/wiki/Apt</a></li><li><a href="https://wiki.postgresql.org/wiki/Apt/FAQ#I_want_to_try_the_beta_version_of_the_next_PostgreSQL_release">https://wiki.postgresql.org/wiki/Apt/FAQ#I_want_to_try_the_beta_version_of_the_next_PostgreSQL_release</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92b900a2e36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop remembering or storing SSH details]]></title>
            <link>https://medium.com/@yogeshsr/stop-remembering-or-storing-ssh-details-345f50c60c03?source=rss-bbb9e65cf8f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/345f50c60c03</guid>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Yogesh Sreedharan]]></dc:creator>
            <pubDate>Wed, 21 Feb 2018 18:49:53 GMT</pubDate>
            <atom:updated>2018-11-04T03:34:13.757Z</atom:updated>
            <content:encoded><![CDATA[<p>In the era of micro services, there are so may remote login details one has to remember. Often each member in the team, has a different copy of login details. An online shared document is mostly a savior. But then one has to first find the details and take it to the terminal.</p><p>I build `yo ssh` to efficiently SSH to remote box. Once it’s setup, SSHing to a remote box become quite easy. You need to just key in few first few characters and press tab to see the list to available remote details.</p><p>Say if you want to login the staging customer service box and your alias is like s-customer-service-01, shell auto complete will let you zero down the exact alias very quickly. You need to just key in s-cus and tab to see the suggestion and pick one.</p><p>yossh is available over my github <a href="https://github.com/yogeshsr/yossh">https://github.com/yogeshsr/yossh</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-y_L0-6KTZ0r_5ICfxuHzA.gif" /><figcaption>yossh</figcaption></figure><p>You need to maintain you’r environment details file. I recommend to create an internal/private repository to keep the environment file. This way it will remain protected and can be shared with your team.</p><p>Please 👏 <a href="https://help.medium.com/hc/en-us/articles/115011350967-Claps">clap</a> if you want to appreciate this write-up.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=345f50c60c03" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>