Skip to content

Deploy to Heroku

One Heroku app builds the whole repository and runs each component as its own process type, as defined in the root Procfile:

Process Runs
release db:migrate before each release goes live
web Puma: the API, plus the admin console for admin.* hosts
worker Resque. Off by default; scale it with heroku ps:scale worker=1.

The build uses two buildpacks. heroku/nodejs builds the admin console into admin/dist from the root package.json, then heroku/ruby installs the API’s gems through the root Gemfile, which links into api/.

Terminal window
heroku buildpacks:clear -a audience-kit
heroku buildpacks:add -a audience-kit heroku/nodejs
heroku buildpacks:add -a audience-kit heroku/ruby
heroku config:set -a audience-kit RAILS_MASTER_KEY="$(cat api/config/master.key)" \
VITE_API_URL=https://<api host>
heroku addons:create -a audience-kit heroku-postgresql:essential-0
heroku addons:create -a audience-kit heroku-redis:mini
Setting Purpose
RAILS_MASTER_KEY Decrypts the credentials file used by the Facebook, Google, AWS, Eventbrite and Ticketmaster integrations.
SECRET_KEY_BASE Signs every JWT. Keep it stable, or every user and service JWT stops working.
FACEBOOK_SECRET, FACEBOOK_CALLBACK_SECRET, GOOGLE_API_KEY, AWS_SECRET_KEY, CDN_STORAGE_KEY, TWILIO_KEY Runtime secrets, read from config vars in production.
VITE_API_URL The API URL baked into the admin console at build time.
VITE_FACEBOOK_APP_ID Optional. The Facebook app the admin console signs in with.
ADMIN_HOSTS Optional. Extra hosts that serve the admin console.
ADMIN_ORIGINS Optional. Extra browser origins allowed to call the API.

VITE_* values are compiled into the console, so changing one needs a rebuild.

To build the encrypted credentials from config/secrets.yml, run this in api/:

Terminal window
SOURCE=production FORCE=1 FACEBOOK_SECRET=... GOOGLE_API_KEY=... bin/rails credentials:import_secrets

It creates config/master.key if there is none (set it as RAILS_MASTER_KEY) and lists any keys that are still blank.

Deploy from the Heroku dashboard’s Deploy tab (GitHub, branch master), or with git push heroku master. GET /up is the health check.

To serve an audience’s admin console, add admin.<audience domain> as a custom domain on the app. See Connect a domain.