Set up local deploy for staging and production envs

  • Create different version of apps on heroku via dashboard

  • Add buildpack to settings: https://buildpack-registry.s3.amazonaws.com/buildpacks/mars/create-react-app.tgz

  • Add the remote url of each env locally:

    • Prod:

      git remote add prod <heroku-git-url>
    • Staging:

      git remote add staging <heroku-git-url>
  • Add to scripts in package.json

    "deploy:staging": "git push staging",
    "deploy:prod": "git push prod"
  • View remotes with:

    git remote -v

GOTCHAS

  • Remove homepage if available in package.json

  • Add a start script that starts the server

DOMAIN ADDITION

  • Add domain to project:

    heroku domains:add <domain name>
  • Print available domains

    heroku domains
  • Add CNAME plus target to hosting provider

  • Confirm that domain has been enabled with

    host <domain name>

ref: https://support.cloudflare.com/hc/en-us/articles/205893698-Configure-Cloudflare-and-Heroku-over-HTTPS

https://devcenter.heroku.com/articles/custom-domains

Last updated

Was this helpful?