<?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[cmthakur - Medium]]></title>
        <description><![CDATA[Hinderance I faced while playing with technology - Medium]]></description>
        <link>https://medium.com/cmthakur?source=rss----cad145364015---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>cmthakur - Medium</title>
            <link>https://medium.com/cmthakur?source=rss----cad145364015---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 03:42:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/cmthakur" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Setup service supervision with runit]]></title>
            <link>https://medium.com/cmthakur/setup-service-supervision-with-runit-99c58d85c136?source=rss----cad145364015---4</link>
            <guid isPermaLink="false">https://medium.com/p/99c58d85c136</guid>
            <category><![CDATA[runit]]></category>
            <category><![CDATA[configuration-management]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[sidekiq]]></category>
            <dc:creator><![CDATA[Chandra Mohan Thakur]]></dc:creator>
            <pubDate>Wed, 14 Jun 2017 07:41:07 GMT</pubDate>
            <atom:updated>2017-06-14T06:51:47.920Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://mysteps4learning.wordpress.com/2017/06/14/setup-service-supervision-with-runit/"><strong>14</strong> <em>Wednesday</em> Jun 2017</a></p><p>When an application has live traffic then the application is marked critical. Downtime incident to that service is not tolerable by users. So as an engineer we should design the application infrastructure more reliable and resilient. Among lots, one of the ways is to add service supervision.</p><p>Out of many supervisors, we have chosen runit as our best suitable service supervisor. Runit provides us following benefits:</p><ol><li>Runit guarantees each service a clean process state</li><li>The runsv program provides a reliable logging facility for the service daemon</li><li>Fast system boot up and shutdown</li><li>Small code size</li></ol><p><strong>Installation</strong></p><p><em>Install runit</em></p><pre>sudo apt-get install runit</pre><p><em>Let’s check whether runit is installed properly or not</em></p><pre>ps -ef | grep runsvdir</pre><p><em>Now, runit has been installed. Since the instance/machine has a different user to perform different activities. So let’s say runit will be supervising each user assigned service/server. For example, assume a deploy user which takes care of background worker named ‘</em><strong><em>Sidekiq</em></strong><em>‘.</em></p><p><strong><em>Note</em></strong><em>: You don’t need to create nested directories if you want to be simple.</em></p><p><em>So, as a root user create a required directory based on username:</em></p><pre>sudo mkdir -p /etc/sv/user sudo mkdir -p /etc/sv/user/deploy</pre><p><em>Runit supervisor looks for a run file to execute, so let’s create a run file.</em></p><pre>sudo vi /etc/sv/user/deploy/run</pre><p><em>and add this content:</em></p><pre>#!/bin/sh -e exec 2&gt;&amp;1 exec chpst -udeploy runsvdir /home/deploy/service</pre><p><em>Next, change the permission of run script so that its executable.</em></p><pre>sudo chmod +x run</pre><p><em>Since runit search run file under folder</em><em>/etc/service. So let’s symlink</em></p><pre>sudo ln -sf /etc/sv/user/deploy/ /etc/service/deploy</pre><p><em>So, as a deploy user let’s, create required directory as mentioned in /etc/</em>sv<em>/user/deploy/run script</em></p><pre>mkdir /home/deploy/service</pre><p><em>As deploy user task is to run background worker, let’s create directory for that</em></p><pre>mkdir /home/deploy/service/sidekiq</pre><p><em>and add this content to run the script inside the </em><em>/home/deploy/service/sidekiq directory</em></p><pre>#!/bin/bash<br>exec 2&gt;&amp;1 &gt; /tmp/runit_sidekiq.log<br>NUM=0<br>APP= path/to/app_folder <br>source ~/.rvm/scripts/rvm <br>rvm use 2.3.1 <br>SIDEKIQ_CONFIG=&#39;-C config/sidekiq.yml -c 6&#39; <br>RAILS_ENV=production <br>cd $APP/current <br>RAILS_ENV=$RAILS_ENV bundle exec sidekiq \ <br>          $SIDEKIQ_CONFIG \<br>          --index $NUM \<br>          --pidfile $APP/shared/tmp/pids/sidekiq-$NUM.pid \ <br>          --environment $RAILS_ENV \<br>          --logfile $APP/shared/log/sidekiq-$NUM.log</pre><p><em>Now, change the permission of run script so that its executable.</em></p><pre>sudo chmod +x run</pre><p>Now when you check process list, you should be able to view sidekiq running under runsv sidekiq.</p><pre>&gt; ps aux | grep sidekiq</pre><pre>deploy 1255 0.0 0.0 168 32 ? Ss Jan22 0:00 runsv sidekiq-0</pre><pre>deploy 11188 36.5 13.6 1076644 525272 ? Sl 05:10 1:15 sidekiq 4.2.10 applicationme [4 of 6 busy] </pre><pre>deploy 11775 0.0 0.0 10460 916 pts/0 S+ 05:13 0:00 grep sidekiq</pre><p>Woo, now sidekiq service is resilient.<br> Happy learning!!</p><p><em>Originally published at </em><a href="http://wp.me/p20bCz-7g"><em>mysteps4learning.wordpress.com</em></a><em> on June 14, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99c58d85c136" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cmthakur/setup-service-supervision-with-runit-99c58d85c136">Setup service supervision with runit</a> was originally published in <a href="https://medium.com/cmthakur">cmthakur</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fix RVM and OpenSSL Issue]]></title>
            <link>https://medium.com/cmthakur/fix-rvm-and-openssl-issue-2ef6ed47ebc2?source=rss----cad145364015---4</link>
            <guid isPermaLink="false">https://medium.com/p/2ef6ed47ebc2</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[openssl]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Chandra Mohan Thakur]]></dc:creator>
            <pubDate>Fri, 17 Mar 2017 09:30:38 GMT</pubDate>
            <atom:updated>2017-03-17T08:32:48.177Z</atom:updated>
            <content:encoded><![CDATA[<p>Today while running rails console, I got a weird error.</p><blockquote>/Users/chandra/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require’: dlopen(/Users/chandra/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)<br>Referenced from: /Users/chandra/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle<br>Reason: image not found — /Users/chandra/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle</blockquote><p>While debugging and performing a google search, I came through a solution to reinstall the ruby version. I followed the same.</p><p><em>Oops, I have to face another glitch</em></p><blockquote>Error running ‘__rvm_make -j 1’,<br>showing last 15 lines of /Users/chandra/.rvm/log/1472071369_ruby-2.3.1/make.log<br>^~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>ossl_ssl.c:18:35: note: expanded from macro ‘numberof’<br>#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))<br>^~~~~<br>ossl_ssl.c:2267:21: error: invalid application of ‘sizeof’ to an incomplete type ‘const struct (anonymous struct at ossl_ssl.c:85:14) []’<br>for (i = 0; i &lt; numberof(ossl_ssl_method_tab); i++) {<br>^~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>ossl_ssl.c:18:35: note: expanded from macro ‘numberof’<br>#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))<br>^~~~~<br>6 warnings and 9 errors generated.<br>make[2]: *** [ossl_ssl.o] Error 1<br>make[1]: *** [ext/openssl/all] Error 2<br>make: *** [build-ext] Error 2<br>++ return 2</blockquote><p>There has been an error while running make. Halting the installation.<br>I got freaked up(what’s happening?). What changes I have made recently to the system? I try to remember hard but didn’t remember anything except fixing some SSL CERT issue.</p><p>Again I research on ossl_ssl and found that it’s OpenSSL issue. And now I start debugging the system and found that it’s OpenSSL symlink issue. I stopped here and to get proper remedy I follow these steps</p><p><strong>Brew update</strong></p><blockquote>cd $(brew — repo); git fetch; git reset — hard origin/master; brew update</blockquote><p><strong>Uninstall OpenSSL(ignoring dependencies)</strong></p><blockquote>brew uninstall — ignore-dependencies openssl<br>brew install openssl<br>brew link — overwrite openssl — force<br><br>export LDFLAGS=-L/usr/local/opt/openssl/lib<br>export CPPFLAGS=-I/usr/local/opt/openssl/include</blockquote><p><strong>Cleanup and get RVM master</strong><br><a href="https://github.com/rvm/rvm/issues/3748">There was an issue with RVM</a></p><blockquote>rvm cleanup all<br>rvm get head</blockquote><p><strong>ReInstall Ruby and bundler</strong></p><blockquote>rvm install 2.3.1<br>gem install bundler</blockquote><blockquote>~/c/t/issue git⭠master ❯❯❯ rails c ✭<br>Running via Spring preloader in process 26404<br>Loading development environment (Rails 5.0.0.1)<br>gem install awesome_print # ← highly recommended<br>2.3.1 (main):0 &gt;</blockquote><p>Now, everything is working as expected, it’s time for coffee.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ef6ed47ebc2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cmthakur/fix-rvm-and-openssl-issue-2ef6ed47ebc2">Fix RVM and OpenSSL Issue</a> was originally published in <a href="https://medium.com/cmthakur">cmthakur</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>