-
-
Notifications
You must be signed in to change notification settings - Fork 135
Deploy backend to heroku
vivekweb2013 edited this page Jun 12, 2022
·
14 revisions
brew install heroku/brew/heroku
heroku login
heroku create batnoter-staging
heroku git:remote -a batnoter-staging
heroku config:set GOVERSION=1.17
heroku config:set SECRETKEY='secret'
heroku config:set DATABASE_HOST='<postgres-container-ip>'
heroku config:set DATABASE_PORT='5432'
heroku config:set DATABASE_DBNAME='gn_db'
heroku config:set DATABASE_USERNAME='root'
heroku config:set DATABASE_PASSWORD='secret'
heroku config:set DATABASE_SSLMODE='require'
heroku config:set DATABASE_DEBUG='true'
heroku config:set HTTPSERVER_DEBUG='true'
heroku config:set OAUTH2_GITHUB_CLIENTID='<github_client_id>'
heroku config:set OAUTH2_GITHUB_CLIENTSECRET='<github_client_secret>'
heroku config:set OAUTH2_GITHUB_REDIRECTURL='http://localhost:3000/api/v1/oauth2/github/callback'
NOTE: Replace the sample values with the actual values before executing the above commands
git subtree push --prefix sub-folder heroku main
cd ..
heroku git:clone -a batnoter-staging
cd batnoter-staging
Create a file named Procfile
with below content
web: bin/batnoter serve
Push the changes
git add Procfile
git commit -m "Add Procfile"
git push heroku main
Heroku initialises PORT
env variable with the port that needs to be used with the app. We can not use our own ports. The problem here is we do not read port from PORT
env variable instead we user HTTPSERVER_PORT
env variable. The solution is to use .profile
file which is sourced after the app’s config vars.
Create the .profile
file with below content
export HTTPSERVER_PORT=$PORT
Push the changes
git add .profile
git commit -m "Add .profile"
git push heroku main