DEV Community

lughjw
lughjw

Posted on

Deploying to heroku

This will be a basic intro into deploying a heroku. I will try to make this as general as possible.

I'm going to start off by listing the steps/commands and then going into detail for each one.

  1. Create something you want to deploy
  2. Create heroku account and install heroku CLI
  3. Install git
  4. heroku login
  5. heroku create
  6. git add .
  7. git commit -m "initial commit"
  8. git push heroku master
  9. Enjoy!

Alright, let's get started!

  1. Create something you want to deploy

    From How Heroku Works: "Heroku lets you deploy, run and manage applications written in Ruby, Node.js, Java, Python, Clojure, Scala, Go and PHP." Create a basic skeleton of an application in one of those and lets get started.

  2. Create heroku account and install heroku CLI

    Navigate to heroku's signup page and create an account. While you're there also install the heroku CLI.

  3. Install git

    Follow the instructions for your system here.

  4. Heroku login

    Navigate back to the top folder of your project. Lets say that it's called myApp, I would do cd myApp. Now that I'm there I would do heroku login. This will give a prompt saying "heroku: Press any key to open up the browser to login or q to exit: ". Press any key and a page will pop up asking you to confirm login. Click the "Log In" button and you're ready to move on.

  5. Create heroku repository

    Note: If you have a front end and a back end using separate languages (i.e. React frontend with Rails backend) then you will need to create a heroku repository for each one!!! Navigate to the top folder of your app. In your terminal enter heroku create. The previous command also has an optional argument which is what you want to name your heroku repository, this will fail if it's not a unique name to heroku. That's it. You can verify this with git remote -v which will return the url of your heroku repository.

  6. Put your code up to heroku

    In your terminal enter

    git add.
    git commit -m "initial commit"
    git push heroku master
    
    Now sit back and wait. Go get a snack,coffee,etc. It takes a while for it to upload.

Congratulations! You did it! Now go enjoy writing your new app!

Top comments (0)