The Heroku CLI requires Git, the popular version control system. If you donโt already have Git installed, complete the following before proceeding: Git installation & First-time Git setup
Once you have an account and the Heroku CLI installed you have to login from the terminal
> heroku login
These are the instructions to deploy a Frontity project on Heroku, once you are ready to deploy your project:
Heroku will automatically execute your build script before starting your app. You should have this one already defined in your project.
Notice how we're using $PORT to read this value from an environment variable. It is because Heroku will set a different port for each process and that port will be stored in a PORT environment variable
Deploy
The way to deploy to Heroku by is pushing to the heroku git remote, so we can do
โฌข my-frontity-project ๎ master โฆพ heroku domains:add www.variables-demo.com
โบ Warning: heroku update available from 7.25.0 to 7.38.2.
Adding www.variables-demo.com to โฌข shielded-gorge-51896... done
โธ Configure your app's DNS provider to point to the DNS Target damp-whale-rln632baq4jdhcj5aw495bst.herokudns.com.
โธ For help, see https://devcenter.heroku.com/articles/custom-domains
The domain www.variables-demo.com has been enqueued for addition
โธ Run heroku domains:wait 'www.variables-demo.com' to wait for completion
Add a CNAME in your domain provider's DNS settings
Once you have added your domain to your Heroku app, you can use the command heroku domains to see the value for the CNAME record that you have to set in your domain settings.
โฌข my-frontity-project ๎ master โฆพ heroku domains
โบ Warning: heroku update available from 7.25.0 to 7.38.2.
=== shielded-gorge-51896 Heroku Domain
shielded-gorge-51896.herokuapp.com
=== shielded-gorge-51896 Custom Domains
Domain Name DNS Record Type DNS Target
โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
www.variables-demo.com CNAME damp-whale-rln632baq4jdhcj5aw495bst.herokudns.com
With this info you can add a CNAME in your domain provider's DNS settings.
If you don't know how to do this, contact your domain provider (GoDaddy, CloudFlare, etc)
Deploy
Then, deploy Frontity using this command (from the root of your project):
> git push heroku master
If no changes are detected you may have to do: npx frontity build โ to generate a new build git commit --allow-empty โ to force a empty commit git push heroku master โ to push this lateste build into heroku and launch its deploy process
Still have questions? Ask the community! We are here to help ๐