How to: Deploy your Side Projects to Heroku

aliciachao
2 min readMay 18, 2020

Using Git and the Heroku CLI for macOS, including continuous delivery with pipelines.

The most exciting part of a project by far is seeing it come to life, live, online, for the world to see. That feeling of accomplishment after weeks on end of frustration as each new feature breaks and wrestling with debugging day after day finally comes to a close (..for the time being). But most importantly, being able to share and interact virtually in times like these is a gift, and the new way of life. So, let’s jump right in to the fastest and free way of deploying your app!

Deploying Code

  1. First install Heroku’s CLI so you can directly create and manage your Heroku apps from the terminal.
brew tap heroku/brew && brew install heroku 

2. A new Heroku app is created by creating a remote of your Git repository that will live on Heroku’s server. From the root of your app, create and confirm that your remote was properly setup with the following commands.

heroku create 
git remote -v

3. To deploy your app, push your code to the Heroku remote that’s associated with your app. (For future updates, use this same command to deploy the latest version of your project to Heroku —they must be pushed to the master branch to be deployed.)

git push heroku master 

For more detailed information, please reference the documentation on Heroku: https://devcenter.heroku.com/articles/git#deploying-code

Continuous Delivery

Add new features to your project recently? Fixed some bugs? Changed the UI? Heroku provides an easy way to help you deploy updated code effortlessly. Pipelines make it easy to maintain separate stages (Development, Review, Staging, Production) for continuous delivery. It’s similar to the git flow of having separate git branches for features, creating pull requests for review and approval, then pushing to the master branch.

You can create a pipeline from Heroku’s CLI to handle your app’s workflow using pipelines:create. It will then prompt you to name the pipeline and the stage you’re adding to it (development, staging, or production).

heroku pipelines:create -a example-app
? Pipeline name: example-pipeline
? Stage of example-app: production
Creating example-pipeline pipeline... done
Adding example-app to example-pipeline pipeline as production... done

Pipelines clearly define how your code will flow from one environment to the next. You can test and promote in each stage to ensure that the final production ready code contains the exact same code that worked in previous stages and deployment will be a breeze.

Reference: https://devcenter.heroku.com/articles/pipelines

--

--