Skip to content

9. Deployment info

Armando Fox edited this page Apr 27, 2024 · 1 revision

Audience1st is deployed on Heroku and uses Heroku Postgres with multi-tenancy and the Apartment gem.

The first subdomain is the theater name, database name, and value of Option.venue_shortname, so altarena.audience1st.com uses database altarena and has Option.venue_shortname == 'altarena'.

Heroku Postgres Backup runs daily and maintains up to 10 daily snapshots; they can be viewed with heroku pg:backups -a audience1st and any given one can be restored using heroku pg:restore.

In addition, once a week on Sundays at about 3AM Pacific, the database is also backed up to S3 by the script bin/backup_postgres_to_s3, which is run daily by Heroku Scheduler. The script exits immediately unless it's Sunday. Otherwise, it dumps and encrypts the database backup, signs it with an MD5 hash as required for S3 upload, and uploads to the S3 bucket a1-database-backups. These backups are kept basically forever.

In production (not development), static content is served from the asset server static.audience1st.com, which actually resolves to the Heroku Edge CDN. Config variables hold the keys/secrets needed to enable Edge, including EDGE_URL, the endpoint from which static assets should be served; config.action_controller.static_asset_host should be set to that URL as well. RAILS_SERVE_STATIC_ASSETS should be set to true in config variables, since the CDN works by intercepting URIs directed to the static asset host (and not, e.g., as a Webserver-level cache).

The Rack::Timeout gem is used in production to abort requests that take longer than 15 seconds. These usually indicate a bona fide bug or catastrophic failure, but timing them out at least prevents further damage/backpressure. Config variables control the timeout.

The Mailgun add-on is used for mail delivery via regular secure SMTP for sending transactional emails.