Heroku is a could platform with the support of several programming languages. In other word it is a system that allows you to host your web applications online. Heroku supports the following programming languages:
In this article I will explain the two methods in which you can use to deploy your web app to Heroku; the first with GitHub and the second with the Heroku command line tool. I will also explain how to use a custom domain name.
Before beginning this article you should have git installed and on your PC and also have a GitHub account, you should also be familiar with both. I have blog post on Git and GitHub you can read those then come back here.
Important thing to note is that Heroku is a very limited hosting service and it is not recommended for large projects. It can be used for small projects or a project showcase or demo applications.
Heroku Deployment with GitHub Continuous Integration
This is by far the easiest and recommended way to deploy your project to Heroku. Firstly go to https://herkou.com and signup for a free account. After that at the top right click on the new dropdown and click on ‘create new app’.
Then you type in the app name you want and select a location. Keep in mind that the app name will be used to generated a custom subdomain where your website will be hosted. For example if your app name is ‘cooking-blog’ your website URL will be cooking-blog.heroku.com, the app name can always be changed later in the settings tab.
The next step after this is to go to the ‘Deploy’ tab in the navigation. There you will see a button which says connect to GitHub. click on it.
After That you will be prompted to connect your GitHub account to Heroku. All you have to do this is follow the prompts and give all the required permission. When this is done you will be able to select which of your GitHub repositories you want to host on Heroku. Ensure your project is already on GitHub.
You then select the branch which should be deployed and enable automatic deployment. When this is done any push made to the branch will be automatically updated on your website hosted on Heroku.
Heroku Deployment With Command Line
To deploy your application with this method you must have Git installed on your PC. The first step is download and install the Heroku command line tool which can be done here https://devcenter.heroku.com/articles/heroku-cli#download-and-install.
After the installation is complete run this command in your terminal, a window will pop telling you to login to Heroku.
After this is done navigate to your project folder in your terminal. Then create a new project on Heroku with the command below and a Git URL will be generated
To push your project to Heroku the first time run
git push <heroku-git-url> master
After the first time use
git push heroku master
Alternatively you could use the suggested commands recommend by Heroku displayed in the ‘Deploy’ tab which is only slightly different from the one above.
Using A Custom Domain Name With Heroku
This process is very fast and simple. Firstly buy a domain name from any domain registrar of your choice. Speaking from experience, I recommend using Name Cheap because of their low price and good customer service.
The process of buying a domain name is very simple despite what people may think. It is as simple as buying a product on amazon. When you have bought the domain name go to the ‘settings’ tab in your app’s dashboard on Heroku. There under the Domain section click on add a domain
Next you will prompted to typing in the domain name and after this a DNS target will generated. You will need to copy this DNS target and then updated the Name Server (NS) of your domain with the generated DNS target. If you need assistance with updating your Name Server contact your domain registrar for assistance. When this is done the custom domain should be working immediately or within a few hours.
I hope this blog post was helpful, ( An awesome catchphrase or closing line goes here 😉 ).