Skip to content
Naomi I. Morduch Toubman edited this page Sep 23, 2021 · 7 revisions

Apps

  • LogDNA: error logging here
  • Heroku Postgres: database with nightly backups
  • Heroku Redis: memory storage, used for sitewide data (top nav about pages, programs, and meta data) that is accessed often with context_processors
  • Mailgun: email service for password reset
  • Heroku Scheduler: runs python manage.py publish_scheduled_pages every 10 minutes
  • Elasticsearch: search indexing. needs a lot of love. reindex with ./manage.py update_index. Upgrade instructions here
  • New Relic: app performance monitoring

Buildpacks

  • Node.js: for running webpack
  • Cairo: binary file, dependency for WeasyPrint
  • gdkpixbug: another WeasyPrint dependency
  • Python

Config Vars

variables that set manually and not by a Heroku app

  • AWS_ACCESS_KEY_ID: for boto3/django-storages connection to AWS s3
  • AWS_SECRET_ACCESS_KEY: or boto3/django-storages connection to AWS s3
  • S3_BUCKET_NAME: name of s3 bucket to upload media content (images)
  • SECRET_KEY: see docs
  • STATIC_S3_BUCKET_NAME: name of s3 for static assets (logos, fonts, js/css)
  • STATIC_URL: base url to use in front of /static. a cloudfront url. used in django templates and webpack to work out full url of static assets.
  • CREATESEND_API_KEY: for use in syncing campaign monitor lists
  • CREATESEND_CLIENTID: same as above
  • CREATESEND_LISTID: same as above
  • DEBUG: not used. always false in production.
  • DJANGO_SETTINGS_MODULE: specifies which settings module to use
  • JAZZ_API_KEY: retrieves jobs from jazzhr api at /api/jobs/
  • NPM_CONFIG_PRODUCTION: set to false so npm also install devDependencies docs
  • RECAPTCHA_SECRET_KEY: https://www.google.com/recaptcha/ keys for use in subscription forms and in /api/subscribe
  • RECAPTCHA_SITE_KEY: same as above
  • WEB_CONCURRENCY: read the docs

Handy Commands

  • heroku run "./manage.py shell" --app newamericadotorg: open a shell in production environment
  • heroku run "./manage.py sync_campaign_monitor": should probably just add this to heroku scheduler and run every night
  • heroku pg:pull PRODUCTION_DATABASE_NAME mylocaldb --app newamericadotorg: dump production database to local database read the docs
  • heroku pg:copy PRODUCTION_DATABASE_URL STAGING_DATABASE_NAME --app na-staging: copies data from production database to staging. read the docs. Use with caution.
    • After copying the database from production to staging, you may need to copy over images to the s3 staging bucket: aws s3 sync s3://newamericadotorg/images s3://na-staging/images
  • to export lists of wagtail users:
    • run heroku pg:psql --app YOUR-APP-HERE
    • in the postgres shell, run \copy public.auth_user (email, is_active) TO '/LOCAL/FILE/LOCATION.csv' CSV HEADER;