OurBigBook logoOurBigBook Docs OurBigBook logoOurBigBook.comSite Source code
Initial setup for a Heroku project called ourbigbook:
sudo snap install --classic heroku
heroku login
./heroku git:remote
git remote rename heroku prod
# Automatically sets DATABASE_URL.
./heroku addons:create heroku-postgresql:hobby-dev
# We need this to be able to require("ourbigbook")
./heroku config:set SECRET="$(tr -dc A-Za-z0-9 </dev/urandom | head -c 256)"
# Password of users generated with ./web/bin/generate-demo-data
./heroku config:set OURBIGBOOK_DEMO_USER_PASSWORD="$(tr -dc A-Za-z0-9 </dev/urandom | head -c 20)"
# You can get it later to login with the demo users from the Heroku web interface
For the background build one-off dynos:
./heroku config:set OURBIGBOOK_HEROKU_APP=ourbigbook
./heroku authorizations:create --description "OurBigBook rebuild worker"
This outputs something like:
Creating OAuth Authorization... done
Client:      <none>
ID:          96a32534-a330-4d72-8bc5-e49351caf220
Description: OurBigBook rebuild worker
Scope:       global
Token:       HRKU-.......
Updated at:  Sat Sep 26 2026 05:22:31 GMT+0100 (British Summer Time) (less than a minute ago)
and then you will copy the token to:
./heroku config:set OURBIGBOOK_HEROKU_TOKEN=HRKU-.......
To finish things off, you must now:
Additionally, you also need to setup the PostgreSQL test database for both OurBigBook CLI and OurBigBook Web as documented at Section "OurBigBook Web PostgreSQL setup":
web/bin/pg-setup ourbigbook-cli
Then deploy with:
cd web
npm run deploy-prod
Get an interactive shell on the production server:
./heroku run bash
From there you could then for example update the demo data with:
cd web
bin/generate-demo-data.js --force-production
This should in theory not affect any real user data, only the demo articles and users, so it might be safe. In theory!
Alternatively, we could do this at once with;
./heroku run web/bin/generate-demo-data.js --force-production
Drop into a PostgreSQL shell on production:
./heroku psql
Of course, any writes could mean loss of user data!
Run a query directly from your terminal:
./heroku psql -c 'SELECT username,email FROM "User" ORDER BY "createdAt" DESC LIMIT 50'
If some spurious bugs crashes the server, you might want to restart it with:
./heroku restart

Ancestors (4)

  1. OurBigBook Web deployment
  2. OurBigBook Web development
  3. OurBigBook Web
  4. Home