Skip to content

Latest commit

 

History

History
56 lines (51 loc) · 2.61 KB

heroku.md

File metadata and controls

56 lines (51 loc) · 2.61 KB

#Pre-requisites

  • Homebrew is installed. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" , it's in PATH, sudo apt-get install build-essential, and brew install gcc.

  • virtualenvwrapper is installed(pip install virtualenvwrapper) and in PATH. vim ~/.profile add export PATH="/home/alison/.local/bin:$PATH". Variables below in ~/.bashrc. (Tested under Python 3.8-3.11.)

    export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
    export WORKON_HOME=~/Envs
    export PROJECT_HOME=~/Sites
    source /usr/local/bin/virtualenvwrapper.sh

    source ~/.bashrc

  • Heroku account

  • Heroku CLI is installed brew tap heroku/brew && brew install heroku. You've logged in with heroku login

Steps

  1. Create Repo on Github and pull to local. Open terminal and cd to the directory of the repo. cd ~/Sites/PROJECT_NAME
  2. Create a virtual environment. mkvirtualenv PROJECT_NAME Make sure the environment is activated with (PROJECT_NAME) at the beginning of prompt lines.
  3. Add Heroku files and git commit
    • .Procfile
    • requiremnts.txt
    • .gitignore add or update
    • manage.py
    • runtime.txt states Python version. Alison local 3.10.12. Heroku default for 3.10 is 3.10.14 as of 5/1/2024. Using 3.10 re: AWS issues/lambda support.
    • app.json
  4. pip install -r requirements.txt
  5. In Heroku, create a Heroku pipeline.
  6. Enable Review Apps(development)
  7. Under Review Apps, create app for development from add an app button (sv-dbt-examp-developmen-r5jfty)
  8. Under Staging, create app for staging from add an app button (sv-dbt-examples-staging)
  9. Under Production, create app for production from add an app button (sv-dbt-examples-production)
  10. In Terminal, make local repo have git remotes to Heroku git repos for each app.
heroku git:remote -a sv-dbt-examp-developmen-r5jfty
git remote rename heroku heroku-development
heroku git:remote -a sv-dbt-examples-staging
git remote rename heroku heroku-staging
heroku git:remote -a sv-dbt-examples-production
git remote rename heroku heroku-production
git remote -v
  1. Set environment varialbes(Config Vars) in each App(aka environment).
    heroku config:set DBT_ENVIRONMENT=dvelopmnt
    remote

Helpful

heroku logs --tail --remote heroku-development then Control+C to close heroku local --port 5001 then http://localhost:5001/ heroku run python manage.py shell heroku run bash

Postgres Provisioning

  1. heroku addons:create --remote heroku-development heroku-postgresql:essential-0