<?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 Oğulcan Girginç on Medium]]></title>
        <description><![CDATA[Stories by Oğulcan Girginç on Medium]]></description>
        <link>https://medium.com/@ogirginc?source=rss-84e7f7a787cf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ioafEdvERkYMHzxrTIDUSQ.png</url>
            <title>Stories by Oğulcan Girginç on Medium</title>
            <link>https://medium.com/@ogirginc?source=rss-84e7f7a787cf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 21:03:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ogirginc/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[How to solve the SSL error for Redis 6 on Heroku?]]></title>
            <link>https://ogirginc.medium.com/how-to-solve-the-ssl-error-for-redis-6-on-heroku-b4b953d3dc5b?source=rss-84e7f7a787cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4b953d3dc5b</guid>
            <category><![CDATA[ssl]]></category>
            <category><![CDATA[sidekiq]]></category>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Oğulcan Girginç]]></dc:creator>
            <pubDate>Thu, 03 Feb 2022 08:32:28 GMT</pubDate>
            <atom:updated>2023-04-04T19:05:03.114Z</atom:updated>
            <content:encoded><![CDATA[<p>If you try to connect a Ruby on Rails app with a Heroku Redis add-on (excluding the Hobby Dev plan), there is a very high chance for you to get the error below:</p><pre>OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: <br>certificate verify failed (self signed certificate in certificate chain)</pre><h3>Reason</h3><p>From version 6 and above, Redis requires using TLS to connect. However, Heroku does not use SSL internally. They terminate SSL at the router level and <a href="https://devcenter.heroku.com/articles/http-routing#routing">forward</a> requests from there to your application via HTTP, which is safe as all these do happen behind Heroku’s firewall. Also, let’s face it, Heroku’s security measures –probably– are better than yours.</p><h3>Solution</h3><p>To fix this, you will need to use OpenSSL::SSL::VERIFY_NONE for your Redis client.</p><pre>Redis.<strong>new</strong>(<br>  url: &#39;url&#39;,<br>  driver: :ruby,<br>  ssl_params: { verify_mode: OpenSSL<strong>::</strong>SSL<strong>::</strong>VERIFY_NONE }<br>)</pre><p>If you do use Sidekiq, configuration should be done through the Sidekiq initializers:</p><pre><em># config/initializers/sidekiq.rb</em><br>Sidekiq.<strong>configure_server</strong> <strong>do</strong> <strong>|</strong>config<strong>|</strong><br>  config.<strong>redis</strong> <strong>=</strong> { ssl_params: { verify_mode: OpenSSL<strong>::</strong>SSL<strong>::</strong>VERIFY_NONE } }<br><strong>end</strong></pre><pre>Sidekiq.<strong>configure_client</strong> <strong>do</strong> <strong>|</strong>config<strong>|</strong><br>  config.<strong>redis</strong> <strong>=</strong> { ssl_params: { verify_mode: OpenSSL<strong>::</strong>SSL<strong>::</strong>VERIFY_NONE } }<br><strong>end</strong></pre><h3>Troubleshooting</h3><h3>No error with Redis 6!?</h3><h4>Why?</h4><p>Assuming you have double-checked the Redis version, the plan is probably on the Hobby Dev version, which does support both HTTP and HTTPS <a href="https://devcenter.heroku.com/articles/heroku-redis#create-a-new-instance">connections</a>.</p><h4>Solution</h4><p>For the Hobby Dev plan, you should see two environment variables set under the app’s “Config Vars” section. If you do plan to keep the add-on as Hobby Dev, no change is needed.</p><p>If you do plan to upgrade the add-on to Premium 0 or above, you need to use VERIFY_NONE as above.</p><h3>Links</h3><ul><li><a href="https://stackoverflow.com/questions/65834575/how-to-enable-tls-for-redis-6-on-sidekiq">https://stackoverflow.com/questions/65834575/how-to-enable-tls-for-redis-6-on-sidekiq</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4b953d3dc5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to install multiple Postgresql versions on macOS?]]></title>
            <link>https://ogirginc.medium.com/how-to-install-multiple-postgresql-versions-on-macos-7e06ae55c251?source=rss-84e7f7a787cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e06ae55c251</guid>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[cluster]]></category>
            <category><![CDATA[macos]]></category>
            <dc:creator><![CDATA[Oğulcan Girginç]]></dc:creator>
            <pubDate>Tue, 05 Jan 2021 06:37:46 GMT</pubDate>
            <atom:updated>2023-04-04T19:04:17.546Z</atom:updated>
            <content:encoded><![CDATA[<p>So, you have decided to have multiple Postgresql versions on your Mac. Lucky for you, I have tried all options I was able to find and decided <a href="https://github.com/petere">Peter Eisentraut</a>’s <a href="https://github.com/petere/postgresql-common">Postgresql Common package</a>, which is a Postgresql database cluster manager for Postgresql.</p><h3>What is a database cluster?</h3><p>A database cluster is a bit of an ambiguous term. Its definition varies depending on the context. In this article, I am not going to explain what it means in production. On local machines, it is a collection of databases that are managed by a single database server. Clusters allow us to install multiple versions of Postgresql on our macOS. To manage these clusters, we will be using a package called Postgresql Common.</p><h3>Postgresql Common with Homebrew</h3><p>First, we will install the Postgresql Common <a href="https://github.com/petere/homebrew-postgresql">formulae</a>:</p><pre>brew install petere/postgresql/postgresql-common</pre><p>With these formulae installed, we can have multiple versions of PostgreSQL in parallel. We should be able to install any version of Postgresql starting with version 8.3. If you do want to check the available versions, use the Homebrew’s search:</p><pre>brew search petere/postgresql</pre><p>Or you check the Github repo to see the available version on your browser: <a href="https://github.com/petere/homebrew-postgresql">https://github.com/petere/homebrew-postgresql</a>. If I wanted to install the version 12, this is how I would do it:</p><pre>brew install petere/postgresql/postgresql@12</pre><p>This command will fetch the latest minor version of the provided major version. For example, if there are 4 minor versions available, we would have version 12.4 installed automatically. Depending on your internet speed, it should not take more than a couple of minutes to download. Same goes for installing it with the make command, which depends on how fast the computer is.</p><h3>Creating a cluster for the first time</h3><p>To create a cluster, we will be using the pg_createcluster wrapper scripts. These scripts are just wrappers around pg_ctl and initdb to make managing easier. Now, let&#39;s create our first cluster. We will name this one as the main but you can choose whatever name you like.</p><pre>pg_createcluster 12 main</pre><p>We have created a new cluster named main which is version 12.4. If you like, we can check the status of the cluster with the pg_lsclusters wrapper script.</p><pre>pg_lsclusters</pre><p>This should list all the clusters, with some additional information, we have created in our machine.</p><pre>Ver Cluster Port Status Owner    Data directory                        Log file<br>12  main    5432 down   ogirginc /usr/local/var/lib/postgresql/12/main /usr/local/var/log/postgresql/postgresql-12-main.log</pre><p>Let&#39;s start our newly created cluster, we will be using pg_ctlcluster.</p><pre>pg_ctlcluster 12 main start</pre><p>Just to be sure, check the Status with pg_lsclusters. You should see the word down being replaced with online. Also, the output colour change might change depending on your theme. In my case, it was red turned to green.</p><pre>Ver Cluster Port Status Owner    Data directory                        Log file<br>12  main    5432 online ogirginc /usr/local/var/lib/postgresql/12/main /usr/local/var/log/postgresql/postgresql-12-main.log</pre><p>After starting your cluster, rest is the same with any Postgresql installation. Create a database with created command and list those with psql -c &#39;\l&#39; command to check if all is good. You should do something similar to this:</p><pre>List of databases<br>   Name    |  Owner   | Encoding |   Collate   | Ctype |   Access privileges<br>-----------+----------+----------+-------------+-------+-----------------------<br> ogirginc  | ogirginc | UTF8     | en_US.UTF-8 | UTF-8 |<br> postgres  | ogirginc | UTF8     | en_US.UTF-8 | UTF-8 |<br> template0 | ogirginc | UTF8     | en_US.UTF-8 | UTF-8 | <strong>=</strong>c/ogirginc          +<br>           |          |          |             |       | ogirginc<strong>=</strong>CTc/ogirginc<br> template1 | ogirginc | UTF8     | en_US.UTF-8 | UTF-8 | <strong>=</strong>c/ogirginc          +<br>           |          |          |             |       | ogirginc<strong>=</strong>CTc/ogirginc<br><strong>(</strong>4 rows<strong>)</strong></pre><p>That’s it! Now just repeat the process for each version you want to install, and it should work with a problem. If you do encounter any problems, check the Troubleshooting section below. If the problem still continues, feel free to open an issue and I would try my best to help!</p><h3>Troubleshooting</h3><h3>Authentication failed for user</h3><h4><strong>Why?</strong></h4><p>The default Postgres configuration sets the client authentication method to peer or md5, which can prevent connection to the database.</p><h4>Solution</h4><p>Run psql -c &#39;show hba_file;&#39; to get pg_hba.conf’s path. The output should look like this:</p><pre>hba_file<br>-----------------------------------------------<br> /usr/local/etc/postgresql/12/main/pg_hba.conf<br><strong>(</strong>1 row<strong>)</strong></pre><p>Open the pg_hba.conf file with your editor and go to the end of it, where we can see the preferred authentication methods. If you don’t have any sensitive data and your local database is not accessible through the internet, I would suggest changing the METHOD to trust for ease of use. This is how I use it:</p><pre><em># Database administrative login by Unix domain socket</em><br>local   all             ogirginc                                trust<br><br><em># TYPE  DATABASE        USER            ADDRESS                 METHOD</em><br><br><em># &quot;local&quot; is for Unix domain socket connections only</em><br>local   all             all                                     trust<br><em># IPv4 local connections:</em><br>host    all             all             127.0.0.1/32            trust<br><em># IPv6 local connections:</em><br>host    all             all             ::1/128                 trust<br><em># Allow replication connections from localhost, by a user with the</em><br><em># replication privilege.</em><br>local   replication     all                                     peer<br>host    replication     all             127.0.0.1/32            md5<br>host    replication     all             ::1/128                 md5</pre><h3>No such file or directory</h3><h4>Why?</h4><p>When creating a cluster, pg_ctl fails to find conf.d because it is missing. It’s a known bug. Check <a href="https://github.com/petere/homebrew-postgresql/issues/45">#45</a> and <a href="https://github.com/petere/homebrew-postgresql/issues/49">#49</a> for additional details.</p><p>Example output of pg_ctlcluster 12 main start:</p><pre>Error: /usr/local/opt/postgresql@12/bin/pg_ctl /usr/local/opt/postgresql@12/bin/pg_ctl start -D /usr/local/var/lib/postgresql/12/main -l /usr/local/var/log/postgresql/postgresql-12-main.log -s -o  -c config_file<strong>=</strong>&quot;/usr/local/etc/postgresql/12/main/postgresql.conf&quot; -c external_pid_file<strong>=</strong>&quot;/usr/local/var/run/postgresql/12-main.pid&quot;  exited with status 1:<br>2020-07-13 10:32:51.376 GMT <strong>[</strong>9841] LOG:  could not open configuration directory &quot;/usr/local/etc/postgresql/12/main/conf.d&quot;: No such file or directory<br>2020-07-13 10:32:51.376 GMT <strong>[</strong>9841] FATAL:  configuration file &quot;/usr/local/etc/postgresql/12/main/postgresql.conf&quot; contains errors<br>pg_ctl: could not start server<br>Examine the log output.</pre><h4>Solution</h4><p>Create the conf.d with the mkdir command.</p><pre>mkdir /usr/local/etc/postgresql/12/main/conf.d</pre><h3>Perl required</h3><h4>Why?</h4><p>You get the error below because the required Perl files could not be found. Check <a href="https://github.com/petere/homebrew-postgresql/issues/44#issuecomment-570881749">#44</a> for additional details.</p><pre>configure: error: header file &lt;perl.h&gt; is required <strong>for </strong>Perl</pre><h4>Solution</h4><p>Try installing Xcode, which should install all necessary Perl files and specify the Xcode that you wish to use for command line developer tools like this:</p><pre>sudo xcode-select --switch /Applications/Xcode.app/</pre><h3>LANG error</h3><h4>Why?</h4><p>For some unknown reasons, the operating system’s locales are messed up.</p><h4>Solution</h4><p>First export the desired language and then create the cluster. An example for en_US would be like this:</p><pre>export LANG<strong>=</strong>en_US.UTF-8<br>pg_createcluster 12 main</pre><p>However, I would highly recommend fixing the locales as it might cause additional non-database related problems.</p><h3>Different versions for `psql` and `server`</h3><h4>Why?</h4><p>You have installed multiple Postgresql versions with Homebrew and psql automatically picks the latest version.</p><h4>Solution</h4><p>When trying to use psql with an earlier version of a Postgresql, a warning will be presented.</p><pre>psql <strong>(</strong>13.0 <strong>(</strong>Homebrew petere/postgresql<strong>)</strong>, server 12.4 <strong>(</strong>Homebrew petere/postgresql<strong>))</strong></pre><p>First of all, this is just a warning. Secondly, most, if not all things, should work in psql. However, tools like pg_dump might fail. To fix when you get this warning, export the desired Postgresql version to the path.</p><pre>export PATH<strong>=</strong>&quot;/usr/local/opt/postgresql@12/bin:$PATH&quot;</pre><p>When retrying, there should not be any warning about version mismatch.</p><pre>❯ psql<br>psql <strong>(</strong>12.4 <strong>(</strong>Homebrew petere/postgresql<strong>))</strong><br>Type &quot;help&quot; <strong>for </strong>help.</pre><pre>ogirginc<strong>=</strong><em>#</em></pre><h3>Create a database with a different port</h3><h4>Why?</h4><p>When you create a new cluster, Postgresql assigns the next available port number to this new cluster, which results in not being able to connect to the default 5432 port. An example of an error, while trying to run psql for the newly created second cluster:</p><pre>psql: error: could not connect to server: could not connect to server: No such file or directory<br>	Is the server running locally and accepting<br>	connections on Unix domain socket &quot;/tmp/.s.PGSQL.5432&quot;?</pre><h4>Solution</h4><p>To fix this connection error, we have to specifically tell psql which port it should use to connect to the database by exporting the PGPORT environment variable. Check with the pg_lsclusters wrapper script to which port do you need to connect the database.</p><pre>Ver Cluster Port Status Owner    Data directory                        Log file<br>12  main    5433 online ogirginc /usr/local/var/lib/postgresql/12/main /usr/local/var/log/postgresql/postgresql-12-main.log<br>13  main    5432 down   ogirginc /usr/local/var/lib/postgresql/13/main /usr/local/var/log/postgresql/postgresql-13-main.log</pre><p>To use version 12, I need to set PGPORT to 5433:</p><pre>export PGPORT<strong>=</strong>5433</pre><p>With this explicit port setting, we can use psql or any other Postgresql utilities without any problems.</p><pre>psql <strong>(</strong>12.4 <strong>(</strong>Homebrew petere/postgresql<strong>))</strong><br>Type &quot;help&quot; <strong>for </strong>help.</pre><pre>ogirginc<strong>=</strong><em>#</em></pre><h3>You call this simple?</h3><h4>Why?</h4><p>I am fully aware it is not simple nor easy, but it gets the job done.</p><h4>Solution</h4><p>Try your luck with <a href="https://postgresapp.com/">Postgres.app</a>. Maybe, it will work for you. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e06ae55c251" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>