โฌ†๏ธHeroku Deploy

We currently use Heroku for deploying to production but LightningRails works with other popular options as well. We will add a guide to other ones very soon.

To install Heroku CLI in your terminal, follow these instructions:

macOS installation

brew tap heroku/brew && brew install heroku
heroku --version # It should display heroku/x.x.x

โš ๏ธ If you get this error:

Bad CPU type in executable

Execute this command:

softwareupdate --install-rosetta --agree-to-license
heroku --version # Now it should display heroku/x.x.x

Ubuntu installation

curl https://cli-assets.heroku.com/install.sh | sh
heroku --version # It should display heroku/x.x.x

Login

Signin from the terminal to be able to push directly from the terminal

Create your heroku app

To create an app and automatically connect it to your current directory of code through the GitHub remotes:

It's important to set the correct region, otherwise your methods like Time.now will have the wrong time zone, plus you might get in trouble down the line with cookies and users data storage ๐Ÿช

Push to production

After committing your last line of code, you can now push to production with a simple command

Migrate your database

Remember that your development database is only in your computer and stored locally, heroku in turn is in the cloud, which means it will have a different database, that you must migrate and seed.

Credential variables

Along the same lines as we set our API keys in our credentials file and .env file, you must set it to your production environment

Stripe credentials

You will need to go to your stripe dashboard and toggle the "Live" button, to access the live api keys "developers" > API. Once done, copy the keys in your terminal with the following command to

You will also need to create a webhook under "Webhooks":

  1. Click on "add an endpoint"

  2. Add the endpoint url: "https://example.org/pay/webhooks/stripe"

  3. Select events: Charge + checkout

  4. Copy the key and paste it in your terminal with the following command

Error Handling in Heroku

If you run into an error when opening your app in the browser with

You will need to investigate by looking at the logs

Last updated

Was this helpful?