<?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>Forem: Rabin Dhamala</title>
    <description>The latest articles on Forem by Rabin Dhamala (@rabincodedev).</description>
    <link>https://forem.com/rabincodedev</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%2F1065397%2Fa7e23c8c-a9c5-46af-9ace-321e7331f31f.jpeg</url>
      <title>Forem: Rabin Dhamala</title>
      <link>https://forem.com/rabincodedev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/rabincodedev"/>
    <language>en</language>
    <item>
      <title>Social media, "Brave New World", freedom, human agency and attention as commodity.</title>
      <dc:creator>Rabin Dhamala</dc:creator>
      <pubDate>Tue, 10 Feb 2026 02:44:01 +0000</pubDate>
      <link>https://forem.com/rabincodedev/social-media-brave-new-world-freedom-human-agency-and-attention-as-commodity-32fg</link>
      <guid>https://forem.com/rabincodedev/social-media-brave-new-world-freedom-human-agency-and-attention-as-commodity-32fg</guid>
      <description>&lt;h2&gt;
  
  
  Social media, "Brave New World", freedom, human agency and attention as commodity.
&lt;/h2&gt;




&lt;h2&gt;
  
  
  A small device for music, a big question about freedom
&lt;/h2&gt;

&lt;p&gt;Sorry if the title is vague, but this started as a prompt and then into my journal and now at this little corner of the internet.&lt;br&gt;
(All these subsection heading were written by Chatgpt)&lt;/p&gt;

&lt;p&gt;So, I started this chain of thought trying to ask ChatGPT:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"I just wanted to know if there are devices like iPod currently.&lt;br&gt;
Not iPod specific but a small handheld device dedicated to just music."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But, I just wrote my thoughts out.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why this question even came up
&lt;/h2&gt;

&lt;p&gt;The rationale is I want to eliminate the usage of unintentional activity, especially avoiding the usage of social media and YouTube.&lt;/p&gt;

&lt;p&gt;Also, I haven't found the solution for payments — maybe just having an ATM card and having some money by yourself at all time is the way to go.&lt;/p&gt;

&lt;p&gt;I don't struggle communicating without social media, and I just value real physical social connection more. So, I make it a priority to be social to people around me, however limited I am by my own insecurities and understanding of the world.&lt;/p&gt;

&lt;p&gt;(All this came while I was conversing with ChatGPT.)&lt;/p&gt;

&lt;p&gt;I had started this prompt specifically for music, but I think I just allowed my train of thought to continue.&lt;/p&gt;

&lt;p&gt;Hope you understand my question, and help me distance myself as much as possible from not technology, but social media — and especially the unintentionality of it, like we are being constantly manipulated by the emotional and social disposition we have.&lt;/p&gt;




&lt;h2&gt;
  
  
  The irony of social media
&lt;/h2&gt;

&lt;p&gt;There is such irony in the fact that social media was designed with a very noble pursuit of increasing human connection, probably the most noblest of all pursuits in the history of mankind.&lt;/p&gt;

&lt;p&gt;But I feel, with all its advantages, there is a lingering sensation in all of us that we are living in slavery to these devices — and especially in slavery of the interest of these “big corporations”, which I do feel have neglected their social responsibilities to a great extent.&lt;/p&gt;

&lt;p&gt;The freedom that we cherish today was probably the greatest gift of our ancestors, and this freedom in our comfort and luxury shouldn't be so easily lost on us.&lt;/p&gt;

&lt;p&gt;Freedom is a great virtue, and I think we should do our utmost to preserve this.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Freedom is easiest to lose when you feel there is no need to defend it.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;(This last sentence was ChatGPT, man! oh man! the irony of it.)&lt;/p&gt;




&lt;h2&gt;
  
  
  Brave New World, revisited
&lt;/h2&gt;

&lt;p&gt;Okay, let’s keep on going.&lt;/p&gt;

&lt;p&gt;I read &lt;em&gt;Brave New World&lt;/em&gt; probably a year ago. I just realized I think it is very useful if I keep track of my reading — when I read that particular book, what stage I was in, and what I had read coming into that book.&lt;/p&gt;

&lt;p&gt;Coming back.&lt;/p&gt;

&lt;p&gt;In Huxley's world, no one is chained, no one is screaming, and people absolutely love their condition.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;In Huxley’s world, no one is chained. No one is screaming. People love their condition.&lt;/em&gt;&lt;br&gt;
That’s the key line people miss:&lt;br&gt;
&lt;strong&gt;“People are happy; what right have you to interfere?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Freedom disappears not because it’s crushed,&lt;br&gt;
but because it’s made to seem unnecessary, even inconvenient.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Why think deeply when pleasure is cheap?&lt;br&gt;
Why struggle when soma exists?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Why risk real connection when shallow, endless stimulation is always available?&lt;/em&gt;&lt;br&gt;
&lt;em&gt;(ChatGPT)&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In a &lt;em&gt;Brave New World&lt;/em&gt;, people aren't chained. In fact, on the contrary, they are intoxicated with joy that we all deeply long for — sex, stress-free states, music (probably there is a mention of it too).&lt;/p&gt;

&lt;p&gt;In hindsight, I just now realized how true &lt;em&gt;Brave New World&lt;/em&gt; is.&lt;/p&gt;

&lt;p&gt;Nobody is coercing. We are simply surrendering.&lt;/p&gt;

&lt;p&gt;Probably “surrendering” isn't even the right word, because I am not sure we even have agency.&lt;/p&gt;




&lt;h2&gt;
  
  
  Attention as the commodity
&lt;/h2&gt;

&lt;p&gt;Social conditioning in &lt;em&gt;Brave New World&lt;/em&gt; is very similar to present day. Today, from birth, people are shaped to desire exactly what the “big corporations that are running the world” intended to.&lt;/p&gt;

&lt;p&gt;The sad reality is the fact that human attention — probably the corest (I don't know if the usage of this is correct) resource to have deep meaningful human connection and work — is now the commodity.&lt;/p&gt;

&lt;p&gt;Our attention span is the driver of this new capital market.&lt;/p&gt;

&lt;p&gt;Fetched from ChatGPT and paraphrased, the sad reality of today's world is:&lt;/p&gt;

&lt;p&gt;If someone controls someone's attention, they control:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;what people value&lt;/li&gt;
&lt;li&gt;who they dislike&lt;/li&gt;
&lt;li&gt;what values they should strive for&lt;/li&gt;
&lt;li&gt;who they should hate and ignore&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;…and probably I can go on and on, because I just realized attention is everything.&lt;/p&gt;

&lt;p&gt;(I don't even know if I am high, man. I am taking medications for pan-gastritis so take this information with a pinch of salt.)&lt;/p&gt;




&lt;h2&gt;
  
  
  Writing, unexpectedly
&lt;/h2&gt;

&lt;p&gt;I have always refrained from writing because I always felt I lacked in that department.&lt;/p&gt;

&lt;p&gt;But now I don't know how — for the last 2–3 days — my brain is constantly having thoughts (the stupidity of my thought is I feel they are profound), and I just cannot stop writing my thoughts down.&lt;/p&gt;

&lt;p&gt;And I just realized: when you start writing, one thought leads to another. You go back and edit your thoughts and wow — it is one of the greatest devices to the human soul and mental clarity.&lt;/p&gt;

&lt;p&gt;Just strange is the fact that after 28 years of my life, just reading and writing — probably the only thing I know — I now realize their power and utility.&lt;/p&gt;

&lt;p&gt;I am grateful that at least I realize this now.&lt;/p&gt;




</description>
      <category>sociamedia</category>
      <category>freedom</category>
      <category>writing</category>
    </item>
    <item>
      <title>Building A Scalable Laravel Application</title>
      <dc:creator>Rabin Dhamala</dc:creator>
      <pubDate>Wed, 31 May 2023 05:21:30 +0000</pubDate>
      <link>https://forem.com/rabincodedev/building-a-scalable-laravel-application-194c</link>
      <guid>https://forem.com/rabincodedev/building-a-scalable-laravel-application-194c</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In scenarios where independent developers are working on an initial project that begins small and gradually scales over time, it is common practice to deploy applications on a single server. This means that all components of the application,such as the main application, database, queue, and others, are hosted on a single server.&lt;/p&gt;

&lt;p&gt;Deploying on a single server is cost-effective for smaller projects and indie hackers who may have budget constraints as it eliminates the need for additional infrastructure, making it a cost-efficient solution during initial stages. Additionally, deploying on a single server simplifies the development and debugging process since having all components within a single environment makes it easier to monitor and troubleshoot issues during.&lt;/p&gt;

&lt;p&gt;However, as the user base grows, this approach can impose a heavy load on the server, leading to application slowdowns, increased risks like single point of failure, maintenance and upgrade challenges, and potential security vulnerabilities.&lt;/p&gt;

&lt;p&gt;To address these challenges, developers recognize the need for a multi-server architecture. By distributing the application across multiple servers, the workload can be balanced, ensuring better performance and availability.&lt;/p&gt;

&lt;p&gt;Overall, the multi-server architecture provides scalability, performance optimization,fault isolation, flexibility, security, and easier maintenance. It is a proven approach for building complex applications that need to handle high loads, store large amounts of data, and provide a reliable user experience.&lt;/p&gt;

&lt;p&gt;By the end of this blog, you will have a solid understanding of how to deploy a multi-server architecture in &lt;a href="https://cleavr.io" rel="noopener noreferrer"&gt;Cleavr&lt;/a&gt;. So, let's dive in and explore multi-server architecture deployment in Cleavr.&lt;/p&gt;

&lt;p&gt;For demonstration purposes, I will be using &lt;a href="https://feedmas.com" rel="noopener noreferrer"&gt;Feedmas&lt;/a&gt;, a platform we built at LittleBets to manage our customer support requests. We wanted Feedmas to have a dedicated database and queue server so we could provide&lt;br&gt;
a scalable and reliable solution. To accomplish this, we deployed Feedmas using Cleavr to setup and manage the multi-server architecture.&lt;/p&gt;

&lt;p&gt;Feedmas consists of a main application server, a &lt;a href="https://www.postgresql.org/" rel="noopener noreferrer"&gt;PostgreSQL&lt;/a&gt; database server, and a &lt;a href="https://redis.io" rel="noopener noreferrer"&gt;Redis&lt;/a&gt; queue server. The main application server will host the primary application logic, while the PostgreSQL database server will be responsible for storing and managing the application's data. The Redis queue server will be used for task management, message queues, and other related functions.&lt;/p&gt;

&lt;p&gt;Here is a summary of what I will be covering in this blog:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;Provisioning servers&lt;/li&gt;
&lt;li&gt;Create a site&lt;/li&gt;
&lt;li&gt;Link Servers&lt;/li&gt;
&lt;li&gt;Sync Environment Variable&lt;/li&gt;
&lt;li&gt;Add deployment hooks and deploy&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Provisioning servers
&lt;/h2&gt;

&lt;p&gt;First, I will provision three &lt;a href="https://docs.cleavr.io/provision" rel="noopener noreferrer"&gt;servers&lt;/a&gt;,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;App Server ( Rabin Feedmas )&lt;/li&gt;
&lt;li&gt;Queue Server (Rabin Feedmas Queue)&lt;/li&gt;
&lt;li&gt;Database Server (Rabin Feedmas Database)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9569s96wf0skb4e18cus.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9569s96wf0skb4e18cus.png" alt="Servers" width="767" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a site
&lt;/h2&gt;

&lt;p&gt;Once the servers are provisioned, I will head back to the &lt;strong&gt;App Server&lt;/strong&gt; and create a &lt;a href="https://docs.cleavr.io/guides/laravel/" rel="noopener noreferrer"&gt;Laravel site&lt;/a&gt;. For this, I will go to the &lt;strong&gt;Servers&lt;/strong&gt; page and click on the &lt;strong&gt;Feedmas&lt;/strong&gt; server and then click on the &lt;strong&gt;Add site&lt;/strong&gt; button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzfdsi3dd9svd6wqo7uyl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzfdsi3dd9svd6wqo7uyl.png" alt="Site" width="800" height="918"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Link Servers
&lt;/h2&gt;

&lt;p&gt;To organize &amp;amp; maintain all three servers, I will go to &lt;strong&gt;Deployments &amp;gt; Networks&lt;/strong&gt; and click on &lt;strong&gt;Link Servers&lt;/strong&gt;. Once the servers are linked we can organize the respective hooks for each server and we don't have to worry about triggering individual deployments in each server. Also, it allows us to sync environment variables between multiple servers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc2c7v62h8hq8mwy5a1sv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc2c7v62h8hq8mwy5a1sv.png" alt="Link Servers Page" width="800" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxape8d8dfewzcf3o5zip.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxape8d8dfewzcf3o5zip.png" alt="Link Servers" width="800" height="712"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq5hqhpxkoquqbse20cwq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq5hqhpxkoquqbse20cwq.png" alt="Servers Network" width="743" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sync Environment Variable
&lt;/h2&gt;

&lt;p&gt;It might be the case that multiple servers may share the same environment variable. So, to link those environment variables, Cleavr allows syncing environment variables between multiple servers. In our case, &lt;strong&gt;App&lt;/strong&gt; server and &lt;strong&gt;Queue&lt;/strong&gt; server share the same environment variable so I will sync them.&lt;/p&gt;

&lt;p&gt;To sync them, I will go to &lt;strong&gt;Deployments &amp;gt; Environments&lt;/strong&gt; and after updating the environment file, I will click on the &lt;strong&gt;Sync&lt;/strong&gt; button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3yrfpnctu87f9kqfa42.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3yrfpnctu87f9kqfa42.png" alt="Sync environment" width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, environment variables for both &lt;strong&gt;Feedmas&lt;/strong&gt; and &lt;strong&gt;Queue&lt;/strong&gt; Server are synced.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add deployment hooks and deploy
&lt;/h2&gt;

&lt;p&gt;Deployments hooks are located in &lt;strong&gt;Deployments &amp;gt; Deployment hooks&lt;/strong&gt;. Make sure your deployment hooks are linked to the correct servers. For example, to update the &lt;strong&gt;Copy Project&lt;/strong&gt; hook, click on the ellipsis icon and click on the &lt;strong&gt;Edit hook&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foyyzkk4lpl132jcgjlpx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foyyzkk4lpl132jcgjlpx.png" alt="Copy hook" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am going to copy projects on two servers, &lt;strong&gt;App&lt;/strong&gt; server and &lt;strong&gt;Queue&lt;/strong&gt; server.&lt;/p&gt;

&lt;p&gt;Also, you can add your own custom hook. For example, in our application we need to restart the queue in our Queue server. To do so, I will go to &lt;strong&gt;Deployments &amp;gt; Deployment hooks&lt;/strong&gt; and click on &lt;strong&gt;Add Hook&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgyxpvc89zxruppkb0ydn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgyxpvc89zxruppkb0ydn.png" alt="Add hook" width="747" height="712"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also select the servers where you want the hook to be triggered. Similarly, you can edit other hooks accordingly. Make sure your hooks are placed in the correct order and assigned correctly to the right servers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7dhbxna6q4lkpi9c1xi6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7dhbxna6q4lkpi9c1xi6.png" alt="Deployment hooks" width="730" height="801"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ok,so now deployment hooks are all in place. It’s finally time to deploy the application. To do so, I will go &lt;strong&gt;Deployment &amp;gt; Recent Deployments&lt;/strong&gt; and click on &lt;strong&gt;Deploy&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6jzi4tgebtqvgbf9k0k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6jzi4tgebtqvgbf9k0k.png" alt="Final Site" width="800" height="823"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hurrah! Now, our Feedmas app with multiple servers is finally deployed. If you have a multi server architecture or you are trying to scale your application,Cleavr makes it a breeze in managing these servers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/rabinkmc" rel="noopener noreferrer"&gt;Rabin Dhamala&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>laravel</category>
      <category>howto</category>
    </item>
    <item>
      <title>How to install a Discourse Forum</title>
      <dc:creator>Rabin Dhamala</dc:creator>
      <pubDate>Wed, 26 Apr 2023 05:11:51 +0000</pubDate>
      <link>https://forem.com/rabincodedev/how-to-install-a-discourse-forum-1pjm</link>
      <guid>https://forem.com/rabincodedev/how-to-install-a-discourse-forum-1pjm</guid>
      <description>&lt;p&gt;If you're looking for a versatile and feature-rich community forum software, then &lt;a href="https://www.discourse.org/" rel="noopener noreferrer"&gt;Discourse&lt;/a&gt; is a top choice. As an open-source platform, Discourse offers modern and responsive forum functionality that allows you to engage with your community or customers effectively. In this step-by-step guide, we will walk youthrough the process of installing Discourse for production use, so you can create a powerful and interactive community platform.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before installing Discourse, make sure you have the following&lt;br&gt;
prerequisites in place:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;A server or virtual machine running a compatible operating system,&lt;br&gt;
such as Ubuntu 22.04 or later, with sufficient resources (CPU,&lt;br&gt;
RAM, storage) to support a production-grade forum.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A domain name registered and configured to point to the IP address&lt;br&gt;
of your server. This is necessary for accessing your Discourse&lt;br&gt;
forum over the internet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ports 80 and 443 open on your server's firewall. Port 80 is used&lt;br&gt;
for HTTP traffic, while port 443 is used for HTTPS traffic. These&lt;br&gt;
ports need to be open to allow incoming web traffic to your&lt;br&gt;
Discourse instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An email server set up and configured to send emails for Discourse&lt;br&gt;
to function properly. Discourse relies on email notifications for&lt;br&gt;
user registration, password reset, and other important&lt;br&gt;
functionalities. So, having a functional email server is a&lt;br&gt;
prerequisite for installing Discourse.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, let's get started with the installation process.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 1: Provision Your Server
&lt;/h2&gt;

&lt;p&gt;The recommended server specs for running Discourse may vary depending on&lt;br&gt;
the size of your community and the expected usage patterns. However, as&lt;br&gt;
a general guideline, the Discourse team recommends the following minimum&lt;br&gt;
server specifications for a production Discourse installation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CPU: Dual-core or higher, clocked at 2.0 GHz or higher&lt;/li&gt;
&lt;li&gt;RAM: 2 GB or higher&lt;/li&gt;
&lt;li&gt;Storage: 10 GB or higher of free disk space&lt;/li&gt;
&lt;li&gt;Operating System: Ubuntu 22.04 LTS or later, or another officially
supported Linux distribution&lt;/li&gt;
&lt;li&gt;Database: PostgreSQL 13 or later&lt;/li&gt;
&lt;li&gt;Web Server: Nginx&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In my case, I have used &lt;a href="https://cleavr.io/" rel="noopener noreferrer"&gt;Cleavr&lt;/a&gt; to provision a plain &lt;a href="https://docs.cleavr.io/provision/" rel="noopener noreferrer"&gt;server&lt;/a&gt;. With &lt;a href="https://cleavr.io/" rel="noopener noreferrer"&gt;Cleavr&lt;/a&gt;, you can easily deploy and manage web applications, including Discourse, on your own server or a cloud provider of your choice. &lt;a href="https://cleavr.io/" rel="noopener noreferrer"&gt;Cleavr&lt;/a&gt; provides a user-friendly interface, advanced server management features, and seamless integration with popular web servers, databases, and email services, making it an excellent choice for installing and managing Discourse for production use.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 2: Install Discourse
&lt;/h2&gt;

&lt;p&gt;Login to your server using &lt;a href="https://docs.cleavr.io/ssh-keys" rel="noopener noreferrer"&gt;SSH&lt;/a&gt; and pull the official &lt;a href="https://github.com/discourse/discourse_docker" rel="noopener noreferrer"&gt;Discourse github repository&lt;/a&gt; and start discourse setup. Run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mkdir /var/discourse
sudo git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
sudo ./discourse-setup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Configure Email
&lt;/h2&gt;

&lt;p&gt;To enable notifications, password resets, and system alerts on&lt;br&gt;
Discourse, configuring an email SMTP server is necessary. It is recommended to use established email service providers like SendGrid, Mailgun, or Amazon SES. Detailed setup instructions are available from the service providers or seek help from a professional.&lt;/p&gt;

&lt;p&gt;Once you have obtained the API keys or SMTP credentials from your email service provider, you can proceed with the Discourse installation process and input the necessary information when prompted. This will allow your Discourse forum to send emails and provide a smooth experience for your forum users.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjndwzyygn7fxs8j91xi3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjndwzyygn7fxs8j91xi3.png" alt="email setup" width="800" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please note that using personal SMTP servers, such as those provided by Gmail, is not recommended for Discourse installations. It is against Gmail's terms of service to use their SMTP servers for mass mailing, which includes sending automated emails from a forum.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Access Discourse
&lt;/h2&gt;

&lt;p&gt;Once the installation is complete, you can access your&lt;br&gt;
Discourse forum by navigating to your domain name in your web browser. Discourse provides a web-based setup wizard to further configure your forum, including setting up categories, creating an admin account, and customizing your forum's appearance.&lt;/p&gt;

&lt;p&gt;Upon successfully setting up your Discourse domain, you will be greeted with a congratulatory message to acknowledge the successful installation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fne7o9eexdwhhxs383h99.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fne7o9eexdwhhxs383h99.png" alt="Installation" width="800" height="532"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Once you have completed the registration process and confirmed your admin email, you will receive a notification that your forum is now ready for use.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fumyh45ualuhfwjuiflcw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fumyh45ualuhfwjuiflcw.png" alt="Forum" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Secure Your Discourse Instance
&lt;/h2&gt;

&lt;p&gt;After installation, it's important to secure your Discourse instance to protect against potential security risks. Some recommended security&lt;br&gt;
measures include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enable HTTPS using a valid SSL certificate.&lt;/li&gt;
&lt;li&gt;Regularly update Discourse and its plugins to the latest versions.&lt;/li&gt;
&lt;li&gt;Configure strong and unique passwords for all user accounts.&lt;/li&gt;
&lt;li&gt;Set up firewall rules to allow only necessary incoming and outgoing
traffic.&lt;/li&gt;
&lt;li&gt;Disable unnecessary services and features in Discourse that you don't use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In conclusion, installing Discourse for production use&lt;br&gt;
involves setting up a &lt;a href="https://www.docker.com/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt; container(handled automatically during discourse setup), configuring email, and securing your instance. By following the steps outlined in this guide, you can have a powerful and customizable community forum up and running in no time. Happy forum-ing!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/rabinkmc" rel="noopener noreferrer"&gt;Rabin Dhamala&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>discourse</category>
    </item>
    <item>
      <title>Deploying a Django Rest Framework app using PM2</title>
      <dc:creator>Rabin Dhamala</dc:creator>
      <pubDate>Sat, 22 Apr 2023 16:42:10 +0000</pubDate>
      <link>https://forem.com/rabincodedev/deploying-a-django-rest-framework-app-using-pm2-2p1o</link>
      <guid>https://forem.com/rabincodedev/deploying-a-django-rest-framework-app-using-pm2-2p1o</guid>
      <description>&lt;p&gt;In this blog, I will show you how to deploy a simple Django Rest Framework (DRF) app using/Servers &amp;gt;  &lt;a href="https://pm2.keymetrics.io/" rel="noopener noreferrer"&gt;PM2&lt;/a&gt;. I will be using Postgres for a database, though you can use any other database that is supported by Django with very minimal changes.&lt;/p&gt;

&lt;p&gt;We'll also be using &lt;a href="https://pm2.keymetrics.io/" rel="noopener noreferrer"&gt;PM2&lt;/a&gt; as a process manager for running the app.&lt;a href="https://pm2.io" rel="noopener noreferrer"&gt;PM2&lt;/a&gt; is a production-grade process manager that makes management of background processes easy. In the Python world we could compare &lt;a href="https://pm2.keymetrics.io/" rel="noopener noreferrer"&gt;PM2&lt;/a&gt; to &lt;a href="http://supervisord.org/" rel="noopener noreferrer"&gt;Supervisord&lt;/a&gt; or &lt;a href="https://circus.readthedocs.io/en/latest/" rel="noopener noreferrer"&gt;Circus&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you are coming from the NodeJS world, you probably already know about PM2 - it is the de facto runner for NodeJS apps. However, &lt;a href="https://pm2.keymetrics.io/" rel="noopener noreferrer"&gt;PM2&lt;/a&gt; is language agnostic and is equally capable of deploying other kinds of apps including Ruby and Python. The only caveat is that it needs NodeJS to be installed on the server. Our app might also have some JS assets that need to be built, so having NodeJS could be one less dependency to worry about.&lt;/p&gt;

&lt;p&gt;We will perform the following tasks as we move along this process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ensure that prerequisites are fulfilled.&lt;/li&gt;
&lt;li&gt;Add a Postgres database.&lt;/li&gt;
&lt;li&gt;Create a site that would be your actual app.&lt;/li&gt;
&lt;li&gt;Configure repository and build settings.&lt;/li&gt;
&lt;li&gt;Add deployment hooks.&lt;/li&gt;
&lt;li&gt;Deploy.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;In order to continue, it is necessary to create a &lt;a href="https://cleavr.io" rel="noopener noreferrer"&gt;Cleavr account&lt;/a&gt; and set up a &lt;a href="https://docs.cleavr.io/provision" rel="noopener noreferrer"&gt;server&lt;/a&gt;. To illustrate the process, I will be utilizing the Postgres &lt;a href="https://docs.cleavr.io/databases/" rel="noopener noreferrer"&gt;database server&lt;/a&gt; but feel free to select any database (compatible with Django) that you prefer, or none at all if it's not necessary.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add a database
&lt;/h2&gt;

&lt;p&gt;If your app depends on a &lt;a href="https://docs.cleavr.io/databases/" rel="noopener noreferrer"&gt;database&lt;/a&gt;, in my case a Postgres database, you need to add the database first:&lt;/p&gt;

&lt;p&gt;Before adding a database, we need to add the database service first. For this example, I will be installing PostgreSQL 13. Similarly, you can install a database service of your choice.&lt;/p&gt;

&lt;p&gt;To do so, we need to go to &lt;strong&gt;Servers &amp;gt; Databases&lt;/strong&gt; and then click on &lt;strong&gt;Install Service&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe320x7bmua6wc2abba33.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe320x7bmua6wc2abba33.png" alt="install postgres" width="800" height="620"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, to add a new database to our system:&lt;/p&gt;

&lt;p&gt;Lets go to &lt;strong&gt;Servers &amp;gt; Databases&lt;/strong&gt; and then click on &lt;strong&gt;Add new Database button&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foecw2kje5frxw2t4prb3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foecw2kje5frxw2t4prb3.png" alt="add database" width="800" height="660"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Add a Site
&lt;/h2&gt;

&lt;p&gt;It's time to create a site now. &lt;a href="https://cleavr.io/" rel="noopener noreferrer"&gt;Cleavr&lt;/a&gt; doesn't support deploying a Python app right out of the box. You can start by creating a generic port app and then install a few dependencies manually.&lt;/p&gt;

&lt;p&gt;However, if you don't want to do that manually, you can start by creating a NodeJS app and then start from there. This will ensure all the dependencies and configurations are installed and generated so we don't have to spend time manually doing this. Also, since we will be using &lt;a href="https://pm2.keymetrics.io/" rel="noopener noreferrer"&gt;PM2&lt;/a&gt; as a process manager, and as I mentioned before, we need to install NodeJS anyway.&lt;/p&gt;

&lt;p&gt;Now, to &lt;a href="https://docs.cleavr.io/new-sites/" rel="noopener noreferrer"&gt;add a site&lt;/a&gt;, &lt;br&gt;
Let's go to &lt;strong&gt;Servers &amp;gt; Sites&lt;/strong&gt; and then click on &lt;strong&gt;Add Site&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ggwnzji4azpahbxtgqg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ggwnzji4azpahbxtgqg.png" alt="add a NodeJS site" width="800" height="705"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Connect your GitHub repository
&lt;/h2&gt;

&lt;p&gt;Now, we have configured our database and site. After this, we need to connect our repository with our site. So, whenever we push to our main branch, our deployment workflow automatically gets triggered.&lt;/p&gt;

&lt;p&gt;For this project, I am deploying a simple &lt;a href="https://github.com/rabinkmc/django-test" rel="noopener noreferrer"&gt;django-test&lt;/a&gt; project that has just one endpoint. You can find the source code for this app on GitHub.&lt;/p&gt;

&lt;p&gt;First, we need to configure our &lt;a href="https://docs.cleavr.io/workflow-settings/" rel="noopener noreferrer"&gt;deployment workflow setting&lt;/a&gt;. We are first going to connect to our repository and then configure our &lt;a href="https://pm2.keymetrics.io/" rel="noopener noreferrer"&gt;PM2&lt;/a&gt; ecosystem .config.js file via &lt;a href="https://cleavr.io/" rel="noopener noreferrer"&gt;Cleavr&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let's now go to&lt;br&gt;
&lt;strong&gt;Deployments &amp;gt; Settings&lt;/strong&gt; and click on &lt;strong&gt;Code Repository tab.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwb81nkzzpfzipezx15qt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwb81nkzzpfzipezx15qt.png" alt="Connect to github repository" width="770" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After, you configure your repository and select the branch to deploy,&lt;br&gt;
click on &lt;strong&gt;Update.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Configure your build settings
&lt;/h2&gt;

&lt;p&gt;Now, comes our build settings. This is where we will configure &lt;a href="https://pm2.keymetrics.io/" rel="noopener noreferrer"&gt;PM2's&lt;/a&gt; ecosystem.config.js to run our python web application ( In our case, django application).&lt;/p&gt;

&lt;p&gt;To update our build settings, go to &lt;strong&gt;Deployments &amp;gt; Settings&lt;/strong&gt; and click on &lt;strong&gt;Build tab.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By default, &lt;a href="https://pm2.keymetrics.io/" rel="noopener noreferrer"&gt;PM2'&lt;/a&gt;s default interpreter is Node. But since we are deploying a python project, we have changed our interpreter as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;interpreter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/usr/bin/python3&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I am running my python web application in port &lt;strong&gt;7488&lt;/strong&gt;, so, I am using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;scripts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;manage.py runserver&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;7488&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My domain is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;e8ky5n0mrmghaqff7351.cleaver.rocks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;e8ky5n0mrmghaqff7351.cleaver.rocks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;manage.py runserver&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;7488&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="na"&gt;_type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;cwd&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/home/cleavr/e8ky5n0mrmghaqff7351.cleaver.rocks/current&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;interpreter&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/usr/bin/python3&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;PORT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;7488&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;CI&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update your domain, port, scripts, and args depending on your project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure your environment settings
&lt;/h2&gt;

&lt;p&gt;We need to pass some environment variables to our app. And &lt;a href="https://cleavr.io/" rel="noopener noreferrer"&gt;Cleavr&lt;/a&gt; provides an easy way to update the .env file right from within the app.&lt;/p&gt;

&lt;p&gt;Let's add environment variables via &lt;a href="https://cleavr.io/" rel="noopener noreferrer"&gt;Cleavr&lt;/a&gt;. To do so,&lt;/p&gt;

&lt;p&gt;Let's go to &lt;strong&gt;Deployment &amp;gt; Environment&lt;/strong&gt;&lt;br&gt;
and add the following environment variable in the editor section.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SECRET_KEY='lkjshdlkjhsdf788fgkjsdfg8s9d8fg7s0d8fgsdfhgsdf87gs0f78dgs08f7dg6'
ENVIRONMENT='production'
DEBUG=False
ALLOWED_HOSTS=['127.0.0.1','localhost','e8ky5n0mrmghaqff7351.cleaver.rocks']
DATABASE_NAME='django'
DATABASE_USER='rabin'
DATABASE_PASSWORD='test123'
DATABASE_HOST='localhost'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnkhl6uuuus2nxzm5fdtu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnkhl6uuuus2nxzm5fdtu.png" alt="Environment variables" width="800" height="575"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my case, I am using a .env file to connect to my postgres database. You can add your environment variable according to your needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add Deployment Hooks
&lt;/h2&gt;

&lt;p&gt;We are almost there. One last thing we need to do before we can deploy and check that our site is working or not, is to add a custom hook that would install our app requirements.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cleavr.io/" rel="noopener noreferrer"&gt;Cleavr&lt;/a&gt; doesn't know what your requirements are, so we need to do this manually but it is really easy to create a custom hook where you could add your own scripts. We'll add 2 hooks, one for installing our project dependencies and another for migrating the database.&lt;/p&gt;

&lt;p&gt;Let's go to &lt;strong&gt;Deployment &amp;gt; Deployment Hooks&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;First thing, we don't need to install npm packages since we don't have any, so let's disable both &lt;strong&gt;Install NPM packages&lt;/strong&gt; and &lt;strong&gt;Build Assets&lt;/strong&gt; hooks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbt0o2ba5n3zq03xc2lcd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbt0o2ba5n3zq03xc2lcd.png" alt="Disable hooks" width="734" height="468"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://docs.cleavr.io/deployment-hooks/" rel="noopener noreferrer"&gt;Add a hook&lt;/a&gt; to install your project requirements. To do so, click on the &lt;strong&gt;Add Hook&lt;/strong&gt; button.&lt;/p&gt;

&lt;p&gt;Install your project requirements.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; pip install -r requirements.txt
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1grr32udqbxaqeonm45.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1grr32udqbxaqeonm45.png" alt="Requirements" width="800" height="620"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have used pip and installed project dependencies from requirements.txt.In your case, if you are using &lt;a href="https://pipenv.pypa.io/en/latest/" rel="noopener noreferrer"&gt;Pipenv&lt;/a&gt; and &lt;a href="https://python-poetry.org/" rel="noopener noreferrer"&gt;Poetry&lt;/a&gt;, you can install project requirements accordingly.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;My project depends on the Postgres database. So, to make database migrations, we need to add another hook.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; python3 manage.py migrate
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsj0pd23755svv5hd8vd2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsj0pd23755svv5hd8vd2.png" alt="Migrate" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just a reminder, deployment hooks are executed in the order they are placed. So, make sure your hooks are in the correct order. In my case, I need to make sure I install project dependencies before migrating my database.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Deploy your site
&lt;/h2&gt;

&lt;p&gt;Now, we are finally ready to deploy our app. To do so, let's go to &lt;br&gt;
&lt;strong&gt;Deployment&lt;/strong&gt; and click on &lt;strong&gt;Deploy Now&lt;/strong&gt; 🚀.&lt;/p&gt;

&lt;p&gt;You can now browse the free temporary domain provided by&lt;br&gt;
&lt;a href="https://cleavr.io/" rel="noopener noreferrer"&gt;Cleavr&lt;/a&gt; to check the result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feo9cez8dwpzlpsy3dqie.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feo9cez8dwpzlpsy3dqie.png" alt="index" width="642" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To get more information about your recent deployments, you can go to&lt;br&gt;
&lt;strong&gt;Deployments &amp;gt; Recent Deployments&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuo4kv7wafr4hn0nw0q1r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuo4kv7wafr4hn0nw0q1r.png" alt="Recent Deployments" width="800" height="555"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Remarks
&lt;/h2&gt;

&lt;p&gt;While deploying the API server, we haven't used a virtual &lt;a href="https://dev.toenvironment"&gt;environment&lt;/a&gt; and we are directly using &lt;strong&gt;runserver&lt;/strong&gt; instead of using &lt;a href="https://gunicorn.org/" rel="noopener noreferrer"&gt;Gunicorn&lt;/a&gt;(&lt;a href="https://www.uvicorn.org/" rel="noopener noreferrer"&gt;Uvicorn&lt;/a&gt;) to run the server.&lt;/p&gt;

&lt;p&gt;Although we were able to run our python web application, it's not yet production ready. I will soon come up with a blog stating all the issues with this approach and at the same providing a better python deployment workflow. Stay tuned for my next blog.&lt;/p&gt;

</description>
      <category>python</category>
      <category>django</category>
    </item>
  </channel>
</rss>
