Skip to content

Instantly share code, notes, and snippets.

@luisjunco
Last active April 13, 2023 19:37
Show Gist options
  • Save luisjunco/daa2962d30075bbdcf407090b1ce5f26 to your computer and use it in GitHub Desktop.
Save luisjunco/daa2962d30075bbdcf407090b1ce5f26 to your computer and use it in GitHub Desktop.
Heroku Cheatsheet

Heroku commands

  • Authenticate

    • heroku login
  • Open the app in the browser (from terminal)

    • heroku open
  • See logs

    • heroku logs
    • heroku logs -n 200
    • heroku logs --tail (display logs real-time)
  • Open a command line terminal in our Heroku server

    • heroku run bash
    • Note: this can be helpful, for example, if we want to run our seed file (once you're there, you can execute the seed file on the heroku server, ex: node bin/seed.js)

Deploy

  • Option 1: manual deploy

    • Setup: we need to install heroku CLI + configure heroku as a remote repository (details here)
    • To deploy on production (push our code to the remote repository on heroku): git push heroku main
  • Option 2: automatic deploys from GitHub

    • Setup: configure automatic deploys (details here)
    • To deploy on production: push your code to github (ex. git push origin main)
@luisjunco
Copy link
Author

luisjunco commented Jul 20, 2022

Extra: Setup to work in pairs (so that all members can push to Heroku)

Student 1 = the one that deployed the project on heroku
Student 2 = any other student/s in a team

Steps:

  • Student 1: share with your team mate the name of the heroku app
  • Student 2: shares with your team mate the email address that you used to create the account on heroku (if you don't remember which email address you used, check screenshot)
  • Student 1: heroku > Access > Add collaborator > Add email address of collaborator/s
  • Student 2:
    • in the command line, go to the root directory of m2-project
    • heroku login (browser will open)
    • add remote repository: heroku git:remote -a nameOfOurProject
    • now you should be able to push to heroku, see logs, etc




image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment