<?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 Saurabh Palande on Medium]]></title>
        <description><![CDATA[Stories by Saurabh Palande on Medium]]></description>
        <link>https://medium.com/@saurabh6790?source=rss-fb1217957ef6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*c5etGkqzGVcqs-jj.jpg</url>
            <title>Stories by Saurabh Palande on Medium</title>
            <link>https://medium.com/@saurabh6790?source=rss-fb1217957ef6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 06:10:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saurabh6790/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[Generate Wildcard SSL certificate using Let’s Encrypt/Certbot]]></title>
            <link>https://medium.com/@saurabh6790/generate-wildcard-ssl-certificate-using-lets-encrypt-certbot-273e432794d7?source=rss-fb1217957ef6------2</link>
            <guid isPermaLink="false">https://medium.com/p/273e432794d7</guid>
            <category><![CDATA[lets-encrypt]]></category>
            <category><![CDATA[certbot]]></category>
            <category><![CDATA[free-ssl-certificate]]></category>
            <category><![CDATA[ssl-certificate]]></category>
            <category><![CDATA[wildcard-ssl]]></category>
            <dc:creator><![CDATA[Saurabh Palande]]></dc:creator>
            <pubDate>Tue, 29 May 2018 12:10:50 GMT</pubDate>
            <atom:updated>2020-09-18T10:20:10.050Z</atom:updated>
            <content:encoded><![CDATA[<p>From past few days or months, everyone on the World Wide Web is talking about SSL certificates and rushing to implement them. <strong>But Why?</strong> Cause recently <a href="https://blog.chromium.org/2017/04/next-steps-toward-more-connection.html">google has announced</a>, if your website, webpages or web-applications does not have SSL certificate then Chrome will label them as Non-Secured.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pFuY5Isg7EOGdYyHr0PZ1A.png" /></figure><p>In this blog will cover, how to generate a wildcard SSL certificate for your domain using Certbot. I am generating a certificate for the domain <strong>erpnext.xyz</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*u3H8gEJcWCqmcAGEUS6frA.png" /></figure><h3>Step 1: Setup Pre-requisites</h3><p>If you already have a droplet or a system then make sure your system has <strong>Python 2.7 or 3</strong> and <strong>git</strong> installed on it. As I am starting on fresh Ubuntu droplet, we have to set up the above pre-requisites.</p><pre>apt-get update<br>apt-get install python-minimal<br>python --version<br>apt-get install git-core<br>git --version</pre><h3>Step 2: Setup Certbot</h3><p>After setting up the pre-requisites, now will setup the Certbot via Github.</p><pre>cd /opt<br>git clone <a href="https://github.com/certbot/certbot.git">https://github.com/certbot/certbot.git</a><br>cd certbot &amp;&amp; ./certbot-auto</pre><p>While installing the Certbot, I came across the error</p><pre>Traceback (most recent call last):<br>  File &quot;/usr/lib/python3/dist-packages/virtualenv.py&quot;, line 2363, in &lt;module&gt;<br>    main()<br>  File &quot;/usr/lib/python3/dist-packages/virtualenv.py&quot;, line 719, in main<br>    symlink=options.symlink)<br>  File &quot;/usr/lib/python3/dist-packages/virtualenv.py&quot;, line 988, in create_environment<br>    download=download,<br>  File &quot;/usr/lib/python3/dist-packages/virtualenv.py&quot;, line 918, in install_wheel<br>    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)<br>  File &quot;/usr/lib/python3/dist-packages/virtualenv.py&quot;, line 812, in call_subprocess<br>    % (cmd_desc, proc.returncode))<br>OSError: Command /opt/eff.org/certbot/venv/bin/python2.7 - setuptools pkg_resources pip wheel failed with error code</pre><p>After googling, I came to know, the error triggered due to improper locale variables. Set the locale variables and re-run.</p><pre>export LC_ALL=&quot;en_US.UTF-8&quot;<br>export LC_CTYPE=&quot;en_US.UTF-8&quot;</pre><p>You can also install the Certbot via the apt installer.</p><pre>apt-get install letsencrypt</pre><h3>Step 3: Generate The Wildcard SSL Certificate</h3><p>Now with the help of Certbot will generate wildcard certificate for our test domain <strong>erpnext.xyz</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9vI0_g8LzgmsJffnfyIIDw.png" /><figcaption>./certbot-auto certonly — manual — preferred-challenges=dns — email <a href="/service/mailto:saurabh@erpnext.com">saurabh@erpnext.com</a> — server <a href="https://acme-v02.api.letsencrypt.org/directory">https://acme-v02.api.letsencrypt.org/directory</a> — agree-tos -d *.erpnext.xyz</figcaption></figure><p><strong>Note: As we are generating wildcard ssl certificate, mention domain with * i.e. *.erpnext.xyz</strong></p><h3>Step 4: Authenticate The Domain’s Ownership</h3><p>For wildcard certificates, the only challenge method Let’s Encrypt accepts is the DNS challenge, which we can invoke via the <strong>preferred-challenges=dns</strong> flag.</p><p>After executing the above command, the Certbot will share a text record to add to your DNS.</p><pre>Please deploy a DNS TXT record under the name<br>_acme-challenge.erpnext.xyz with the following value:</pre><pre>J50GNXkhGmKCfn-0LQJcknVGtPEAQ_U_WajcLXgqWqo</pre><p><strong>Record Name</strong>: _acme-challenge<br><strong>Record Value</strong>: J50GNXkhGmKCfn-0LQJcknVGtPEAQ_U_WajcLXgqWqo</p><p>Create TXT record via DNS console and setup key and value</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5RkAPwZnWoCbjGbmY2-u2w.png" /></figure><h3>Step 5: Get The Certificate</h3><p>Once you authenticate the domain ownership; by cleaning up dns challenges, Certbot generates the ssl certificate and required keys.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fQdFw-Tf-5rfERXBbJYgPA.png" /><figcaption>Congratulations!!! You have wildcard SSL certificate</figcaption></figure><p>Congratulations!!! You have successfully generated wildcard SSL certificate for your domain.</p><h3>Step 6: Cross Verify The Certificate</h3><p>To cross verify certificate’s validity via command line run</p><pre>./certbot-auto certificates</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CaHZSurriKEbcnco4bMHvA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=273e432794d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Find a Judo solution !]]></title>
            <link>https://medium.com/@saurabh6790/find-a-judo-solution-86884b0b5bb1?source=rss-fb1217957ef6------2</link>
            <guid isPermaLink="false">https://medium.com/p/86884b0b5bb1</guid>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[erpnext]]></category>
            <category><![CDATA[frappe]]></category>
            <dc:creator><![CDATA[Saurabh Palande]]></dc:creator>
            <pubDate>Tue, 03 Oct 2017 05:19:22 GMT</pubDate>
            <atom:updated>2017-10-05T05:52:17.255Z</atom:updated>
            <content:encoded><![CDATA[<p>A few days back, on our support portal, we received few issues regarding task failure due to deadlock or long query execution. As it was hampering performance and user experience, it became a priority to identify the cause and fix it as early as possible.</p><blockquote>We use mariadb(open source forked from mysql) as a backend for <a href="https://erpnext.com/">ERPNext</a>.</blockquote><h4>Logging a deadlock</h4><p>Generally, the first action against any issue is to try to reproduce it at local(test) environment. But unfortunately we could not do that due to lack of data..</p><p>Then we took help from InnoDB engine, <a href="https://www.percona.com/doc/percona-server/5.5/diagnostics/innodb_show_status.html"><strong>show engine innodb status</strong></a> to identify deadlock footprints. From this command, we were able to identify the deadlock but deadlock conditions were not matching with the one reported in issue. One thing was very sure, deadlock can only be captured when it occurs.</p><p>How to log a deadlock, was the main question now. One basic way for logging the deadlock was; schedule a periodic job, to parse the output of InnoDB status. But was that efficient enough?</p><h4>Analyzing Slow Queries</h4><p>The next ToDo was, identify the slow queries, analyze them and then optimize them.. By configuring MySQL, you can easily log the slow queries,</p><pre># LOGGING #</pre><pre>log-error                      = /var/lib/mysql/mysql-error.log<br>log-queries-not-using-indexes  = 0<br>slow-query-log                 = 1<br>slow-query-log-file            = /var/lib/mysql/mysql-slow.log</pre><p>Fortunately, the logger was already configured and now only the analysis was needed to done. But nightmare was yet to begine! The file was completely text-based, having redundant queries. So to analyze the log, again text parsing is needed and again raised the question of efficiency and resource consumption.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r9qdW44U-929T5ohS528hQ.png" /><figcaption>mysql-slow.log</figcaption></figure><p>We use python as server side language. I started with identifying efficient text parsing modules, regular expression. Shortlisted and executed few them, but the results were not up to the mark. Each time a new method was adding a layer of complexity. And it became a complex and resource killer task.</p><p>Recently I started reading a book “<strong>REWORK</strong>” written by ‘Jason Fried’ &amp; ‘David Hansson’; after finishing dinner and routine activities, before going to bed, I started reading, where I had stopped yesterday. While reading, I came across the term <strong>Judo Solution, </strong>this motivated and drived me towards figuring out other possible solutions.</p><blockquote><strong>Judo Solution </strong>is getting the most out of doing the least, by analyzing all posible way outs.</blockquote><p>Next day, before diving into coding, I googled about deadlock logging and slow query analysis. After reading few blogs and posts, I was able to find a <strong>Judo</strong> solution, percona’s<a href="https://www.percona.com/doc/percona-toolkit/LATEST/pt-deadlock-logger.html"> <strong><em>pt-deadlock-logger</em></strong></a> and <a href="https://www.percona.com/blog/2014/03/14/mysql-slow-query-log-tools-and-tips/"><strong><em>pt-query-digest</em></strong></a><strong><em>.</em></strong></p><p><strong>pt-deadlock-logger: </strong>Demon process, continuously looks for deadlocks .</p><p><strong>pt-query-digest: </strong>Analyze MySQL queries from logs, processlist, and tcpdump.</p><p>In nutshell, it’s not at all necessary to have a complex solution to solve complex problems. Find a judo solutions to resolve the problem. And to find a judo solution, you just need strategies and mindset to identify what is good enough.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86884b0b5bb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setup monitoring for servers!]]></title>
            <link>https://medium.com/@saurabh6790/setup-monitoring-for-servers-16b31965f615?source=rss-fb1217957ef6------2</link>
            <guid isPermaLink="false">https://medium.com/p/16b31965f615</guid>
            <category><![CDATA[sensu-monitoring]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[server-monitoring]]></category>
            <dc:creator><![CDATA[Saurabh Palande]]></dc:creator>
            <pubDate>Sun, 02 Jul 2017 12:18:08 GMT</pubDate>
            <atom:updated>2018-05-12T13:24:01.790Z</atom:updated>
            <content:encoded><![CDATA[<p>I work in DevOps team. DevOps job includes many different activities like setting up servers, manage release, deployment, monitor servers, automation etc. <br>Managing these activities manually is only possible when your server stack is limited to few servers. But when servers stack starts increasing, you need a strong robust system, to handle these activities.</p><p>Few weeks before, I started work on implementing a tool for server monitoring. As we expand our servers parallel, we are searching for the tool which is easy to setup and supports distributed environment. This search lands us to Open Source tool Sensu.</p><h4>What is Sensu?</h4><p>Sensu is ruby based server monitoring tool, which uses RabbitMQ as communication channel and Redis as a data store.</p><h4>Sensu Components</h4><p>Sensu has three components, Sensu-Server, Sensu-API and Sensu-Client.</p><p><strong><em>Sensu-Server</em></strong>: Generate a check request for specified time interval.<br><strong><em>Sensu-Client</em></strong>: Executes checks requested by the server and return output.<br><strong><em>Sensu-API:</em></strong> provides access to monitoring data.</p><h4>How Sensu works?</h4><p>Sensu works on producer-consumer principle.</p><ol><li>Sensu-Server generates check request at a specified time interval and populate this request over RabbitMQ communication channel.</li><li>Sensu-Client executes the checks and returns check results to a server over a communication channel.</li><li>The Sensu Server processes check results, persisting a copy of the latest result in the Data Store and creating a corresponding to Event. While processing events sensu-server executes one or more Handlers by applying Filters and Data mutators (if any)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*ZxV363jVs3Mgr4ORa3OdeA.gif" /><figcaption><a href="https://sensuapp.org/docs/0.29/overview/how-sensu-works.html">https://sensuapp.org/docs/0.29/overview/how-sensu-works.html</a></figcaption></figure><h4>Steps to Setup Sensu-Server (centos 7)</h4><ol><li><strong>Install Sensu-Serve and Sensu-API</strong></li></ol><pre>1. sudo yum install epel-release -y<br>2. echo &#39;[sensu]<br>name=sensu<br>baseurl=<a href="https://sensu.global.ssl.fastly.net/yum/$releasever/$basearch/">https://sensu.global.ssl.fastly.net/yum/$releasever/$basearch/</a><br>gpgcheck=0<br>enabled=1&#39; | sudo tee /etc/yum.repos.d/sensu.repo<br>3. sudo yum install sensu -y<br>4. sudo yum install redis -y<br>5. sudo systemctl start redis.service<br>6. sudo chown -R sensu:sensu /etc/sensu<br>7. yum install curl jq -y<br>8. sudo systemctl start sensu-server.service<br>   sudo systemctl start sensu-api.service</pre><p><strong>2. Install RabbitMQ</strong></p><pre>1. sudo wget <a href="https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm">https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm</a><br>2. sudo rpm -Uvh erlang-solutions-1.0-1.noarch.rpm<br>3. sudo yum install -y erlang-19.3<br>4. sudo yum install -y socat<br>5. sudo rpm --import <a href="https://www.rabbitmq.com/rabbitmq-signing-key-public.asc">https://www.rabbitmq.com/rabbitmq-signing-key-public.asc</a><br>6. sudo rpm -Uvh <a href="https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.9/rabbitmq-server-3.6.9-1.el6.noarch.rpm">https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.9/rabbitmq-server-3.6.9-1.el6.noarch.rpm</a><br>7. sudo chkconfig rabbitmq-server on<br>8. sudo service rabbitmq-server start<br>9. sudo service rabbitmq-server stop<br>10.sudo rabbitmqctl add_vhost /sensu<br>11.sudo rabbitmqctl add_user sensu secret<br>12.sudo rabbitmqctl set_permissions -p /sensu sensu &quot;.*&quot; &quot;.*&quot; &quot;.*&quot;<br>13.create /etc/rabbitmq/rabbitmq.config and add <br>[<br>  {rabbit, [<br>    {tcp_listeners, [{&quot;0.0.0.0&quot;, 5672}]}<br>  ]}<br>].</pre><p><strong>3. Setup Server config file, /etc/sensu/config.json</strong></p><pre>{<br>  &quot;transport&quot;: {<br>    &quot;name&quot;: &quot;rabbitmq&quot;,<br>    &quot;reconnect_on_error&quot;: true<br>  },<br>  &quot;rabbitmq&quot;: {<br>    &quot;host&quot;: &quot;127.0.0.1&quot;,<br>    &quot;vhost&quot;: &quot;/sensu&quot;,<br>    &quot;user&quot;: &quot;sensu&quot;,<br>    &quot;password&quot;: &quot;secret&quot;<br>  },<br>  &quot;redis&quot;: {<br>    &quot;host&quot;: &quot;127.0.0.1&quot;,<br>    &quot;port&quot;: 6379<br>  },<br>  &quot;api&quot;: {<br>    &quot;host&quot;: &quot;127.0.0.1&quot;,<br>    &quot;port&quot;: 4567<br>  }<br>}</pre><p><strong>4. Setup Checks</strong></p><pre>1. create a JSON file in /etc/sensu/conf.d named as “check_load.json”</pre><pre>{<br>  &quot;checks&quot;: {<br>    &quot;check_load&quot;: {<br>      &quot;command&quot;: &quot;/opt/sensu/embedded/bin/check-load.rb -c 1,5,15&quot;,<br>      &quot;interval&quot;: 3600,<br>      &quot;occurrences&quot;: 5,<br>      &quot;subscribers&quot;: [&quot;avgload&quot;],<br>      &quot;enable_deprecated_filtering&quot;: false<br>    }<br>  }<br>}</pre><pre>2.sudo systemctl restart sensu-{server,api}</pre><p><strong>5. Setup Handler</strong></p><pre>1. yum group install &quot;Development Tools&quot;<br>2. sudo sensu-install -p mailer<br>3. create /etc/sensu/conf.d/handler_default.json<br>{<br>  &quot;handlers&quot;: {<br>    &quot;default&quot;: {<br>      &quot;command&quot;: &quot;/opt/sensu/embedded/bin/handler-mailer.rb&quot;,<br>      &quot;type&quot;: &quot;pipe&quot;<br>    }<br>  }<br>}</pre><pre>4. create /etc/sensu/conf.d/mailer.json<br>{<br>    &quot;mailer&quot;: {<br>        &quot;mail_from&quot;: &quot;<a href="/service/mailto:alerts@example.com">alerts@example.com</a>&quot;,<br>        &quot;mail_to&quot;: &quot;<a href="/service/mailto:operators@example.com">operators@example.com</a>&quot;,<br>        &quot;smtp_address&quot;: &quot;smtp.gmail.com&quot;,<br>        &quot;smtp_username&quot;: &quot;<a href="/service/mailto:alerts@example.com">alerts@example.com</a>&quot;,<br>        &quot;smtp_password&quot;: &quot;your_password_here&quot;,<br>        &quot;smtp_use_tls&quot;: true,<br>        &quot;smtp_port&quot;: 465<br>    }<br>}</pre><pre>5. sudo systemctl restart sensu-{server,api}</pre><h4>Steps to Setup Sensu-Client (centos 7)</h4><ol><li><strong>Install Sensu Client</strong></li></ol><pre>1. sudo yum install epel-release -y</pre><pre>2. echo &#39;[sensu]<br>name=sensu<br>baseurl=<a href="https://sensu.global.ssl.fastly.net/yum/$releasever/$basearch/">https://sensu.global.ssl.fastly.net/yum/$releasever/$basearch/</a><br>gpgcheck=0<br>enabled=1&#39; | sudo tee /etc/yum.repos.d/sensu.repo</pre><pre>3. sudo yum install sensu -y</pre><pre>4. sudo chown -R sensu:sensu /etc/sensu</pre><pre>5. create /etc/sensu/config.json<br>{<br>  &quot;transport&quot;: {<br>    &quot;name&quot;: &quot;rabbitmq&quot;,<br>    &quot;reconnect_on_error&quot;: true<br>  },<br>  &quot;api&quot;: {<br>    &quot;host&quot;: &quot;sensu_server_ip&quot;,<br>    &quot;port&quot;: 4567<br>  }<br>}</pre><p><strong>2. configure sensu client, <em>/etc/sensu/conf.d/client.json</em></strong></p><p>The sensu client will execute all listed subscriptions checks and returns check result.</p><pre>{<br>  &quot;client&quot;: {<br>    &quot;name&quot;: &quot;client1.domain.com&quot;,<br>    &quot;address&quot;: &quot;client_ip_address&quot;,<br>    &quot;environment&quot;: &quot;production&quot;,<br>    &quot;subscriptions&quot;: [<br>      &quot;webserver&quot;,<br>      &quot;avgload&quot;,<br>      &quot;cpucheck&quot;<br>    ]<br>  }<br>}</pre><p><strong>3. Setup transport config</strong></p><pre>{<br>  &quot;rabbitmq&quot;: {<br>    &quot;host&quot;: &quot;sensu_server_ip&quot;,<br>    &quot;port&quot;: 5672,<br>    &quot;vhost&quot;: &quot;/sensu&quot;,<br>    &quot;user&quot;: &quot;sensu&quot;,<br>    &quot;password&quot;: &quot;secret&quot;,<br>    &quot;heartbeat&quot;: 30,<br>    &quot;prefetch&quot;: 50<br>  }<br>}</pre><p><strong>4. Install sensu plugins to execute checks on client</strong></p><pre>sudo sensu-install -P sensu-plugins-load-checks</pre><p><strong>5. Start sensu client</strong></p><pre>sudo systemctl start sensu-client.service</pre><h4><strong>Setup Uchiwa</strong></h4><p>Open Source Sensu version won’t come with dashboard, thus you need to setup Uchiwa.</p><pre>a. yum install uchiwa<br>b. edit uchiwa conf, vi /etc/sensu/uchiwa.json<br> {<br>   &quot;sensu&quot;: [<br>     {<br>       &quot;name&quot;: &quot;DataCenter&quot;,<br>       &quot;host&quot;: &quot;127.0.0.1&quot;,<br>       &quot;port&quot;: 4567,<br>       &quot;timeout&quot;: 10<br>     }<br>   ],<br>   &quot;uchiwa&quot;: {<br>     &quot;host&quot;: &quot;0.0.0.0&quot;,<br>     &quot;port&quot;: 3000,<br>     &quot;refresh&quot;: 10<br>   }<br> }<br>c. sudo service uchiwa restart</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e3Gq6IL-NGyiidIZmAB-NA.png" /><figcaption>Uchiwa Dashboard</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16b31965f615" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debugging !!!]]></title>
            <link>https://medium.com/@saurabh6790/debugging-2a6c22342e67?source=rss-fb1217957ef6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a6c22342e67</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[Saurabh Palande]]></dc:creator>
            <pubDate>Fri, 17 Feb 2017 17:48:28 GMT</pubDate>
            <atom:updated>2017-02-17T18:15:51.131Z</atom:updated>
            <content:encoded><![CDATA[<p>As a software developer, in past four years, I have written plenty of code. In these years, every time coding did not start from scratch, many times I had to dive into the pre-written code, to identify the flow or the issue.</p><p>For diving into the code, you should have two skills: the first one is code reading. It’s pretty much similar to book reading. As in book reading, you need to know the language and its forming, similarly, in code reading, you need to know basics of a programming language and programming concepts.</p><p>The second skill you need is, DEBUGGING SKILL!!! For debugging you need code reading skills, compiler in your mind and the most important thing, “patience”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*c_Kw5Ad3J_4ZQ6loK11UGw.gif" /></figure><p>Generally, debugging is “<strong>investigation</strong>” i.e. you try to identify the root cause of the issue, by following its footprints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*qxVpssJ2g_S8U87UfvSntA.jpeg" /></figure><p>But many times (for me at least), debugging converts from “<strong>investigation</strong>” to “<strong>interrogation”. </strong>The recent one was a week back.</p><p>In our server management tool, we have a routine, which manages the version upgradations.</p><p>For this routine, the ideal behaviour should be: check whether or not the system is ready for upgradations. If ready then set necessary flags and proceed to upgrade. But if the system is not ready then the program sets a delayed flag which delays the upgradation. But due to some reason, even though the delayed flag was set, the routine would set the task as failed and not as delayed.. So, I started the investigation.</p><p>Generally, while debugging we place debug statements between logical blocks, which works as footprints in the investigation. But as routine is A<a href="https://www.ansible.com/">nsible</a> based, it is not possible to debug it, by using python debug statements. So now only one option is open, interrogate with the program’s output.</p><p>After fighting for long, finally, interrogation succeeded.</p><p>The Ansible uses two exit methods, <strong>exit_json</strong> and <strong>fail_json. </strong>In our case, the system was returning ready status as exit_json. Hence ready status is false, the routine returning failure message via fail_json. As both methods were executing back to back, the AnsibleModule class concatenated common parameters. Due to this concatenation, main routine handler was not able to fetch delayed flag and was resulting in upgrade failure.</p><p>So developers, be prepared before settings debug mode. Believe me, you never know when an investigation will turn into interrogation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a6c22342e67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Teaching is the best learning !!!]]></title>
            <link>https://medium.com/@saurabh6790/teaching-is-the-best-learning-38b535414248?source=rss-fb1217957ef6------2</link>
            <guid isPermaLink="false">https://medium.com/p/38b535414248</guid>
            <category><![CDATA[webinar]]></category>
            <category><![CDATA[webinar-tips]]></category>
            <dc:creator><![CDATA[Saurabh Palande]]></dc:creator>
            <pubDate>Fri, 27 Jan 2017 11:17:57 GMT</pubDate>
            <atom:updated>2017-01-27T11:49:05.479Z</atom:updated>
            <content:encoded><![CDATA[<p>“<em>While we teach, we learn</em>” said the Roman philosopher Seneca.</p><p>Being an average in my academics, this phrase puts me in a confusing state of mind. How can an average person like teach anything to anyone. But few days back at my work I got few opportunities which gave me true insight into this phrase.</p><p>Sharing those experiences with you all, may be it will boast up your spirits as well:</p><p>Couple of weeks back, one morning, I had a call with Rushabh, in which we organized a session with a new web designer. The agenda of the session was how to apply new designs to our website. As I had done some projects related to web portals, I was pretty much comfortable with this call.</p><p>As per the discussion, we started a call at 3 pm, in this call, I demonstrated basic concepts of the framework that we used to build our website. The first session was good and we signed off with a note, if they have any queries then we will connect again.</p><p>The next morning, the designer called and asked something, to which I didn’t have proper answers. As a developer, I always worked inside existing design boundaries but new design tends to push these boundaries. As I am the bridge between framework and designer, it’s my responsibility to give proper and correct guidance to a designer. This brought a great opportunity to <strong>learn</strong>, I borrowed some time and started POC. While developing POC, I wrote some .less files (thanks to Faris), did some trials on template overriding. After few retakes and tweaks, I managed to achieve expected result. We had a call again and discussed each aspect in detail, the designer got answers for his queries and we signed off.</p><p>After few days, I got another opportunity, to <strong>learn</strong>. I conducted a developer session with Stavros (Software Developer at ESO Electronic Germany). He had some queries regarding, JS side templating, JS side new doc creation by mapping fields from previous forms and some other small queries.</p><p>We started with small queries, then JS templating and then went on to new doc creation. With framework method, new doc creation is quite easy, just a API <strong><em>call frappe.modal.get_new_doc(DocType Name)</em></strong>. But the system did not like it !!! The system threw error “<em>None type of object has no attribute field_name</em>”.</p><p>As as experienced developer, getting stuck at such simple task was embarrassing. Going through this embarrassment, we both started debugging and found that the system is not getting new doctype object. We made provisions to bring the object and fixed the issue. We took a sigh of relief and concluded our call !!</p><p>At Frappe for past few months, we have been conducting webinars, which elaborates ERPNext’s functionalities. Recently we also started webinars for developers. First developer webinar was conducted by Rohit (my colleague) in which he showed how to develop custom app over frappe. The next week, I conducted the developer webinar on how to to build a web portal.</p><p>As its a community event, you need to do your preparations in detail. In the morning, Umair put some focus on issues he faced in the last implementation of web forms. By keeping all these points into consideration, I prepared for a webinar. Though I found a need to work on my narration, the webinar was conducted successfully.</p><p>As the title says, “Teaching is the best way of learning”, I learned that I need to work on my narrative skills.</p><p>These are my three experiences where I was the teacher and also the student. I learned from my experiences, I learned from my mistakes!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38b535414248" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Reseller Platform for ERPNext]]></title>
            <link>https://medium.com/@saurabh6790/erpnext-reseller-16a91b874951?source=rss-fb1217957ef6------2</link>
            <guid isPermaLink="false">https://medium.com/p/16a91b874951</guid>
            <category><![CDATA[reseller]]></category>
            <category><![CDATA[sales]]></category>
            <category><![CDATA[erpnext]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[marketing]]></category>
            <dc:creator><![CDATA[Saurabh Palande]]></dc:creator>
            <pubDate>Tue, 13 Dec 2016 08:50:35 GMT</pubDate>
            <atom:updated>2016-12-16T06:33:53.552Z</atom:updated>
            <content:encoded><![CDATA[<p>At Frappe, we host ERPNext on our cloud for our customers (Software as a Service). SAAS is our revenue model, which helps us build awesome features. Traction for the cloud comes via <em>word of mouth, </em>or by users searching for a cloud ERP.</p><p>Revenue is generated from two source, one is new customers and second is maintaining them.</p><p>We are happy that we are maintaining existing customers very successfully, thanks to our awesome support team 😊, but we are not focussed on getting new customers. In order to drive more traction to the ERPNext Cloud, we started brain storming for ideas and starting building on one of them, building a <em>Reseller Platform</em>.</p><p>Here is how it looks.</p><h3><strong>How to Become a Reseller</strong></h3><p>To become a reseller, just fill-up the signup form, read and accept terms &amp; conditions, verify your email address and it’s you are set. Congratulations now you are ERPNext Reseller!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pq0AK7JSyDl0uWkmHrRNRw.png" /><figcaption>Signup URL</figcaption></figure><h3>Bring Users to Cloud</h3><p>After signing up as a reseller, you will get a unique referral link. Send this referral URL among potential customers, which they will use for signing up on ERPNext cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dekmkeZP-_yDeb_79Mp6aA.png" /><figcaption>Referral URL for customer signup</figcaption></figure><h3>Your Job as a Reseller</h3><p>Resellers are basically community-based sales representatives. As a reseller, your main job is to bring users to the cloud. Once user signed up to the cloud, help them in on boarding process and manage their subscriptions. <br>Benefits being a reseller are directly proportional to your services and relationship with customers. So it is important to maintain healthy relationships.</p><h3>Reseller Portal</h3><p>Portal is designed to help resellers do their job better.</p><ul><li><strong>Customer listing: </strong>Customers who signed up via referral URL are shown under this list. Customer’s domain, expiry, plan etc can be viewed here. By visiting individual customer from a list you can manage their subscriptions renewals or upgrades.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RZGG3EiyPfpZh8c7HTbtWQ.jpeg" /></figure><ul><li><strong>Commission History: </strong>As a reseller, you are entitled to a commission on each successful conversion to a paid customer. You can view your commissions here.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eomNjOtHUZtAAQoaSpT4Nw.png" /></figure><ul><li><strong>Summary Page: </strong>This will provide a glance view to all reseller activities. Summary includes information related to: <br>- <strong>No of accounts</strong>: Count of customers, signed up via referral URL<br>- <strong>Total commission earned</strong>: Predefined percent of signup amount <br>- <strong>Current Balance</strong>: Current balance will define as earned commissions -payout amount<br>- <strong>Total discount</strong>: Total of discount on customers subscription renewal or upgrades</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eucdrzlXAenCAc1wEjKB3w.png" /></figure><h3>Benefits of Becoming a Reseller</h3><ul><li>When customer sign up with your reference and pays for subscription, you will receive share of 30% of that subscription plan cost. Payout for commission amount will take place once there are three signups against your reference.</li><li>If you renews subscription for customers then you will get 20% discount on subscription amount of plan.</li></ul><p>The discount and commission percentage charges are not fixed. That may be get changed in future. To get these benefits, hurry up and do sign up at erpnext.com to become a re-seller</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16a91b874951" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integration Broker]]></title>
            <link>https://medium.com/@saurabh6790/integration-broker-f7aa4f2256ab?source=rss-fb1217957ef6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7aa4f2256ab</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[erpnext]]></category>
            <category><![CDATA[frappe]]></category>
            <dc:creator><![CDATA[Saurabh Palande]]></dc:creator>
            <pubDate>Fri, 25 Nov 2016 05:41:24 GMT</pubDate>
            <atom:updated>2016-11-25T05:41:24.757Z</atom:updated>
            <content:encoded><![CDATA[<p>We build many 3rd party integration to enhance ERPNext and frappe functionalities. Integrations were designed as separate applications. These applications were listed under App Installer. Via App Installer user able to install the application to their site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fMiWmNSzqwiL3utKglowdw.png" /><figcaption>App Installer</figcaption></figure><p>With the time, a number of integrations also increase. With this increase in number, the bottlenecks of the application system start knocking the door.</p><p><strong>Some Bottlenecks of the Application system:</strong></p><p>1. <strong>One Problem Many Applications</strong>: In many app stores, we have seen that for one problem statement there were multiple applications. Ya, its good to have choices, but choices also put the user in the confused state.</p><p>2. <strong>Application Maintenance</strong>: In some cases, we have seen, the community develops the application, but won’t maintain it. Maintenance in terms of compatibility with newer versions, bug fixes, enhancements.</p><p>3. <strong>Redundancy</strong>: Each application has its own code base. But all code is not unique or not only made for that application. Thus rewriting a common code for each application separately creates code redundancy.</p><h4>Integration Broker</h4><p>To avoid these bottleneck situations, we planned to move to the monolithic structure. With version 7.1, we introduced <strong>Integration Broker</strong>. Integration Broker is the centralised system, which will keep control to all 3rd party app integration. In Integration Broker, we merged 3rd party integrations into core framework and put Integration Service on top of these integration services. Here Integration Service is a broker who will control all 3rd party service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4erBH5OnGHkL1kapQ827mQ.jpeg" /><figcaption>monolithic structure for integrations</figcaption></figure><p><strong>How to integrate service with Integration Broker ?</strong></p><p>Let’s create an integration for Razorpay payment gateway with Integration Broker</p><p><strong>Step 1:</strong> Add service name in integration_services in frappe’s hooks.py</p><pre>integration_services = [ “Razorpay”]</pre><p><strong>Step 2:</strong> Create a service controller.</p><p>Explore &gt; Setup &gt; Customize &gt; DocType</p><p>Create new doctype for your service. While naming service controller, follow naming convention <strong>service_name + “Settings”</strong>. eg: `Razorpay Settings`</p><p><strong>Step 3:</strong> Write business logic in controllers .py file</p><ul><li>Extend controller to Integration Service class</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rapkk_c2DDYgJFIE.png" /></figure><ul><li>Override <strong>enable</strong> method. Enable method should contain login, which will setup environment for service. In our case, we need to setup an account head and gateway entry in ERPNext. To do this, we will hook ERPNext method and pass gateway name as an argument to it. Then we will validate credentials.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RBH_v_271n2KwdFQ.png" /></figure><ul><li>Setup Scheduler events: If service needs to run background processes, then add an event and its handler in a controller.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u07_Baiy0LYGNlkB.png" /></figure><p><strong>Step 4:</strong> Setup JavaScript</p><p>Via JS you can handle client side validations and operations like manage field dependencies etc. In Integration service we specifically use JS to set up client-side help.</p><ul><li>Import Namespace: frappe.provide(“frappe.integration_service”)</li><li>Define Service controller class</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z4pNPszS6JA2GGlv.png" /></figure><ul><li>Override <strong>get_scheduler_job_info</strong> and <strong>get_service_info</strong> methods.</li><li><strong>get_scheduler_job_info</strong> : Provide details about scheduler job events and actions they are going to perform</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ww3fgeHxz9fxulaN_LSzhA.png" /></figure><ul><li><strong>get_service_info</strong> : Guidelines on how to setup service</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4TnO8N19s5JJoou3jvihSQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7aa4f2256ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>