<?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: Kehinde Olawuwo.</title>
    <description>The latest articles on DEV Community by Kehinde Olawuwo. (@heavykenny).</description>
    <link>https://dev.to/heavykenny</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%2F129285%2F7a098160-1166-424b-97ae-8c320940c3e8.jpg</url>
      <title>DEV Community: Kehinde Olawuwo.</title>
      <link>https://dev.to/heavykenny</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/heavykenny"/>
    <language>en</language>
    <item>
      <title>How to Deploy A Golang App to Heroku.</title>
      <dc:creator>Kehinde Olawuwo.</dc:creator>
      <pubDate>Tue, 23 Jun 2020 00:20:22 +0000</pubDate>
      <link>https://dev.to/heavykenny/how-to-deploy-a-golang-app-to-heroku-5g1j</link>
      <guid>https://dev.to/heavykenny/how-to-deploy-a-golang-app-to-heroku-5g1j</guid>
      <description>&lt;p&gt;This is a step by step tutorial on how to deploy a Golang app on Heroku.&lt;/p&gt;

&lt;h2&gt;
  
  
  Requirements.
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Heroku Account&lt;/li&gt;
&lt;li&gt;Heroku CLI&lt;/li&gt;
&lt;li&gt;Golang v1.14 and above&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 1.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Create a Heroku account using your email and password or log in if you already have an account.&lt;/p&gt;

&lt;p&gt;Download the Heroku CLI by running the command below on Mac OS&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;brew tap heroku/brew &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; brew &lt;span class="nb"&gt;install &lt;/span&gt;heroku
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or go to &lt;a href="https://devcenter.heroku.com/articles/heroku-cli#download-and-install"&gt;https://devcenter.heroku.com/articles/heroku-cli#download-and-install&lt;/a&gt; to install on Windows.&lt;br&gt;
Login to Heroku from your terminal using the command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;heroku login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will open your web browser to complete the login flow.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 2.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Create Procfile by running&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;Procfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or just create it from the directory. Run &lt;code&gt;echo "web: [directory]" &amp;gt; Procfile replace [directory]&lt;/code&gt; e.g&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"web: currency"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; Procfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 3.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Generate a go.mod file using &lt;code&gt;go mod init github.com/[user_name]/[project_name]&lt;/code&gt; e.g.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;go mod init github.com/heavykenny/currency
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 4.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Set variable names in &lt;code&gt;.env&lt;/code&gt; file e.g. &lt;code&gt;PORT=8080&lt;/code&gt; using&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;heroku config:set &lt;span class="nv"&gt;PORT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also set other variables using this command.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 5.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Commit your code using the following commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git init
&lt;span class="nv"&gt;$ &lt;/span&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Deploying to Heroku"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 6.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Create a Heroku application using heroku create [project_name] e.g.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;heroku create go-currency
&lt;span class="nv"&gt;$ &lt;/span&gt;git push heroku master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can then proceed to test your app using &lt;code&gt;https://[project_name].herokuapp.com&lt;/code&gt; i.e.&lt;br&gt;
&lt;a href="https://go-currency.herokuapp.com"&gt;https://go-currency.herokuapp.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you encounter any error during any of these processes, do not hesitate to comment or reach out. Thank you.&lt;/p&gt;

</description>
      <category>go</category>
      <category>heroku</category>
      <category>deploy</category>
    </item>
  </channel>
</rss>
