<?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: MHMasuk</title>
    <description>The latest articles on DEV Community by MHMasuk (@mhmasuk).</description>
    <link>https://dev.to/mhmasuk</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%2F847569%2F0eb02b95-5a7d-4c7d-92b3-2e2548b6a41c.jpeg</url>
      <title>DEV Community: MHMasuk</title>
      <link>https://dev.to/mhmasuk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mhmasuk"/>
    <language>en</language>
    <item>
      <title>Step-by-Step Guide to Deploying a React/Nextjs/Static App on a Dokku Server in AWS EC2 Instance</title>
      <dc:creator>MHMasuk</dc:creator>
      <pubDate>Tue, 31 Jan 2023 11:39:04 +0000</pubDate>
      <link>https://dev.to/mhmasuk/step-by-step-guide-to-deploying-a-reactnextjsstatic-app-on-a-dokku-server-in-aws-ec2-instance-6d3</link>
      <guid>https://dev.to/mhmasuk/step-by-step-guide-to-deploying-a-reactnextjsstatic-app-on-a-dokku-server-in-aws-ec2-instance-6d3</guid>
      <description>&lt;h2&gt;
  
  
  Setting Up Dokku in AWS EC2
&lt;/h2&gt;




&lt;p&gt;Dokku is a popular open-source platform that simplifies the process of deploying and managing applications. In this guide, we'll show you how to set up Dokku in an Amazon Web Services (AWS) EC2 instance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Pass the Public SSH Key to the AWS Server&lt;/strong&gt;&lt;br&gt;
Use the following command to pass the public SSH key to the AWS server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="c1"&gt;# cat &amp;lt;public_key_dir&amp;gt; | ssh -i &amp;lt;aws_key_dir&amp;gt; &amp;lt;username&amp;gt;@&amp;lt;ip_add/domain&amp;gt; sudo dokku ssh-keys:add &amp;lt;KEY_NAME&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;cat&lt;/span&gt; ~/.ssh/id_rsa.pub | ssh -i "intelli_masuk.pem" ubuntu@example-address.compute.internal.compute.amazonaws.com sudo dokku ssh-keys:add admin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Remote Dokku Command in a Server from Local Machine&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To run a remote Dokku command in the server from your local machine, use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ssh dokku@&amp;lt;ip_add&amp;gt; &amp;lt;DOKKU_COMMAND&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;ssh&lt;/span&gt; dokku@10.10.10.10 apps:create hobby
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3: Setting Up the Global Domain for a Dokku Server&lt;br&gt;
To set up the global domain for a Dokku server, follow these steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remove the global domain:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt; &lt;span class="c1"&gt;# ssh dokku@&amp;lt;IP_ADD&amp;gt; domains:remove-global &amp;lt;SERVER_ADDRESS&amp;gt;  &lt;/span&gt;
   &lt;span class="k"&gt;ssh&lt;/span&gt; dokku@10.10.10.10 domains:remove-global example-address.compute.internal

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Add the global domain:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt; &lt;span class="c1"&gt;# ssh dokku@&amp;lt;IP_ADD&amp;gt; domains:add-global &amp;lt;DOMAIN_NAME&amp;gt;  &lt;/span&gt;
   &lt;span class="k"&gt;ssh&lt;/span&gt; dokku@10.10.10.10 domains:add-global example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Step 4: Setting Up the SSL Certificate Plugin for a New Dokku Server&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To set up the Dokku Let's Encrypt plugin for the first time, use the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt; &lt;span class="k"&gt;sudo&lt;/span&gt; dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
 &lt;span class="k"&gt;dokku&lt;/span&gt; config:set --global DOKKU_LETSENCRYPT_EMAIL=your-email@your.domain.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5: Deploying an Application in Dokku Server&lt;/strong&gt;&lt;br&gt;
To deploy an application in the Dokku server, follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add a Git repository in the Dokku server:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt; &lt;span class="c1"&gt;# git remote add &amp;lt;repo_name&amp;gt; dokku@&amp;lt;ip_add/domain&amp;gt;:&amp;lt;app_name&amp;gt;&lt;/span&gt;
   &lt;span class="k"&gt;git&lt;/span&gt; remote add dokku dokku@10.10.10.10:hobby
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create an app in the Dokku server from your local machine:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;  &lt;span class="c1"&gt;# ssh dokku@&amp;lt;ip_add&amp;gt; apps:create &amp;lt;app_name&amp;gt;&lt;/span&gt;
    &lt;span class="k"&gt;ssh&lt;/span&gt; dokku@10.10.10.10 apps:create hobby

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Deploy the Git repository in the Dokku server:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt; &lt;span class="c1"&gt;# git push &amp;lt;REPOSITORY_NAME&amp;gt; &amp;lt;BRANCH_NAME&amp;gt;&lt;/span&gt;
   &lt;span class="k"&gt;git&lt;/span&gt; push dokku main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 6: Setting Up a Domain for an App&lt;/strong&gt;&lt;br&gt;
To set up a domain for an app, follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Report the app's domains:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="k"&gt;ssh&lt;/span&gt; dokku@10.10.10.10 domains:report hobby
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Set the domain for the app:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt; &lt;span class="k"&gt;dokku&lt;/span&gt; domains:set hobby test-preview.intellidigital.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add the domain remotely:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="k"&gt;ssh&lt;/span&gt; dokku@10.10.10.10 domains:add hobby hobby.theme-preview.intellidigital.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 7: Enabling the SSL Certificate for an App&lt;/strong&gt;&lt;br&gt;
To enable the SSL certificate for an app, follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set the email to get the SSL certificate:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="k"&gt;ssh&lt;/span&gt; dokku@10.10.10.10 letsencrypt:set hobby email maskawat.masuk@intelli.global
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Enable the SSL for the app:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="k"&gt;ssh&lt;/span&gt; dokku@10.10.10.10 letsencrypt:enable hobby
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Automatically update the letsencrypt certificate
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="k"&gt;ssh&lt;/span&gt; dokku@10.10.10.10 letsencrypt:cron-job --add
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>crypto</category>
      <category>blockchain</category>
      <category>offers</category>
    </item>
    <item>
      <title>Python module in simple way</title>
      <dc:creator>MHMasuk</dc:creator>
      <pubDate>Wed, 07 Sep 2022 06:06:19 +0000</pubDate>
      <link>https://dev.to/mhmasuk/python-module-in-simple-way-4fk9</link>
      <guid>https://dev.to/mhmasuk/python-module-in-simple-way-4fk9</guid>
      <description>&lt;h2&gt;
  
  
  What is Module in python?
&lt;/h2&gt;

&lt;p&gt;Module is just a file with a &lt;strong&gt;.py&lt;/strong&gt; extension, which contain some Python code. The python code can be a a set of functions or variables.&lt;/p&gt;

&lt;h2&gt;
  
  
  When do we need to use modules ?
&lt;/h2&gt;

&lt;p&gt;Suppose, we are making an application to generate a diet chart. Based on some information about a person the application will generate a diet chart. So, Every time some set of specific function is calling, to make this simple we can make a module name &lt;strong&gt;chart.py&lt;/strong&gt; with a set of specific functions to reuse in different applications again and again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a Module.
&lt;/h2&gt;

&lt;p&gt;To create a module name chart, we just need to write some code in file and save the file with .py extensions. So, the name of the python file is the name of the module.&lt;/p&gt;

&lt;p&gt;To import a module&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import chart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Python from and import statement
&lt;/h2&gt;

&lt;p&gt;To import a specific function we can use from and import statement.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from chart import generate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Module renaming
&lt;/h2&gt;

&lt;p&gt;To change the import name of the module we can use &lt;strong&gt;as&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import chart as ch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
