<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Akshay</title>
    <description>The latest articles on DEV Community by Akshay (@akshaydk).</description>
    <link>https://dev.to/akshaydk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F699050%2F10465ca0-2624-4961-a44c-fcae8927744c.jpeg</url>
      <title>DEV Community: Akshay</title>
      <link>https://dev.to/akshaydk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/akshaydk"/>
    <language>en</language>
    <item>
      <title>Rearranging application instances in Passenger.</title>
      <dc:creator>Akshay</dc:creator>
      <pubDate>Sat, 04 Sep 2021 10:12:47 +0000</pubDate>
      <link>https://dev.to/akshaydk/rearranging-application-instances-in-passenger-41g3</link>
      <guid>https://dev.to/akshaydk/rearranging-application-instances-in-passenger-41g3</guid>
      <description>&lt;p&gt;&lt;em&gt;Problem:&lt;/em&gt; We had three internal rails applications running in one physical serve. During some of the deployments, one of the applications was not booting up. Though occurrence of such an event was very low I looked into the issue as it stimulated me.&lt;/p&gt;

&lt;p&gt;We had a master passenger.conf and each application had their own application.conf, which looked something like this:&lt;/p&gt;

&lt;p&gt;Master&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PassengerRoot /usr/local/rvm/gems/ruby-2.6.0/gems/passenger-6.0.2
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.6.0/wrappers/ruby
PassengerMaxPoolSize 18
PassengerPoolIdleTime 300
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Application specific configs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PassengerAppEnv qa
PassengerRuby /usr/local/rvm/gems/gemset/wrappers/ruby
PassengerMinInstances 9
PassengerPreStart http://localhost:81/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we carefully look at the &lt;code&gt;PassengerMaxPoolSize&lt;/code&gt; and &lt;code&gt;PassengerMinInstances&lt;/code&gt; for three applications, they didn't add up. Forget request load balancing, passenger didn't even have space for booting the application because Max was set to 18 and each application's min was 9. This meant, at any given time there could be only two applications running.&lt;/p&gt;

&lt;p&gt;Fortunately, that wasn't the case. The deployment sequence decided the number of instances of each application that will occupy the 18 available slots. If all the three were deployed simultaneously then each occupied x,y,z number of instances based on the application's booting time.&lt;/p&gt;

&lt;p&gt;Some of the examples of numbers were:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;x&lt;/th&gt;
&lt;th&gt;y&lt;/th&gt;
&lt;th&gt;z&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Solution:&lt;/em&gt; We had to change &lt;code&gt;PassengerMinInstances&lt;/code&gt; to a number that was suitable for the application. It was also made sure that passenger get a couple of free instances for &lt;a href="https://www.phusionpassenger.com/library/indepth/ruby/request_load_balancing.html"&gt;Request load balancing&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Multiple Jenkins files in a single git repository</title>
      <dc:creator>Akshay</dc:creator>
      <pubDate>Sat, 04 Sep 2021 10:08:51 +0000</pubDate>
      <link>https://dev.to/akshaydk/multiple-jenkins-files-in-a-single-git-repository-4ljl</link>
      <guid>https://dev.to/akshaydk/multiple-jenkins-files-in-a-single-git-repository-4ljl</guid>
      <description>&lt;p&gt;We have a single git repository under which 2 applications run. To build a separate pipeline for both the projects using Jenkinsfile, under the application folders I created a Jenkinsfile and did the following in the UI&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Job configuration -&amp;gt; Build Configuration -&amp;gt; Script -&amp;gt; {ApplicationName}/Jenkinsfiles
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Installing MariaDB inside a container</title>
      <dc:creator>Akshay</dc:creator>
      <pubDate>Sat, 04 Sep 2021 10:07:46 +0000</pubDate>
      <link>https://dev.to/akshaydk/installing-mariadb-inside-a-container-390m</link>
      <guid>https://dev.to/akshaydk/installing-mariadb-inside-a-container-390m</guid>
      <description>&lt;p&gt;We had a requirement of installing MariaDB to an existing docker image because the test cases had to run within the same image and the rails framework needs a test database to run the tests.&lt;/p&gt;

&lt;p&gt;After installing the MariaDB using yum, we tried to start the sql server within the container, it threw&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ERROR 2002 &lt;span class="o"&gt;(&lt;/span&gt;HY000&lt;span class="o"&gt;)&lt;/span&gt;: Cant connect to &lt;span class="nb"&gt;local &lt;/span&gt;MySQL server through socket /var/lib/mysql/mysql.sock
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Excerpts of step from the &lt;a href="https://dba.stackexchange.com/questions/185498/centos-container-installing-mariadb-server"&gt;article&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;start the service manually and&lt;br&gt;
ensure that you have started it such that it will stay in the foreground (because a Docker container exits when the foreground process exits or puts itself into the background).&lt;br&gt;
Inside a docker container, nothing will run by default. The following code when executed within the container will start the server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/usr/libexec/mariadb-prepare-db-dir mariadb.service 

/usr/bin/mysqld_safe &lt;span class="nt"&gt;--basedir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr &amp;amp; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We added these lines to our Dockerfile and every time sql-server was started during the boot up.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
