How To Deploy On Heroku
Deploying websites is a process that ought to be easy, yet is wrapped up in complicated procedures that take forever. Heroku is a tool that cuts through much of the complexity involved in deployments & gets you to your live website in a matter of minutes.
Once you have your website/webapp code ready, here’s what you need to do.
- Create a New App On Your Heroku Account
- Sign up on Heroku & set up your account as per on screen instructions.
- Head to your dashboard & find the “New” button on the top right.
- Choose to create a new app
- Give your app a name & hit “Create App”
- Heroku will automatically redirect you to the Deploy page.
2. Download the Heroku CLI
- On the deploy page, you will find a link to download the Heroku CLI & install the same.
- The instructions for this process are on the Heroku website.
3. Open up a BASH terminal
To open a BASH terminal, follow the steps for your OS
- Mac : Open the terminal app on MacOS. Change the directory to the one that contains the code you want to deploy. (
cd foldername
) - Windows : Open Command Prompt. Change the directory to the one that contains the code you want to deploy. (
cd foldername
) - Linux : Open terminal. Change the directory to the one that contains the code you want to deploy. (
cd foldername
)
4. Login to Heroku CLI
- On your terminal or command prompt, type in
heroku login
& press any key to open up the login page on your browser. - Follow the login procedure & return back to the terminal
5. Initialize your Git repository
- Type
git init
on your terminal & run the command. - Then initialise Heroku with the following command :
heroku git:remote -a projectname
6. Commit Your Code to the Git Repo
- Step one is to stage the changes you may have made to your repo or stage the repo as a whole on a new project
git add .
- Then commit your code using the following command
git commit -m "make it better"
- Once done, the next thing you will need to do is push your repo to the Heroku server.
- Use the following command
git push heroku master
- Wait for the command to run. At the end, you should receive a url where the app is hosted.
7. Visit the url to check if your app is live
- Copy the url from the command line interface & paste in your browser.
- Check that your application is live & working.
That’s it you’re done!
Now if you want to skip all those steps & want a graphical interface that will do all the work for you in the background, visit this link & check out Patr, the biggest, baddest, deployment tool in town.