____ ___ __
/ __ )/ (_) /_____ ___ ____
/ __ / / / __/_ / / _ \/ __ \
/ /_/ / / / /_ / /_/ __/ / / /
/_______/_/\__/ /___/\___/_/ /_/
/_ __/________ _____ ____ ___ _____
/ / / ___/ __ `/ __ \/ __ \/ _ \/ ___/
/ / / / / /_/ / /_/ / /_/ / __/ /
/_/ /_/ \__,_/ .___/ .___/\___/_/
/_/ /_/
This is the code that makes up the official Blitzen Trapper band site.
If you see a bug, please feel free to submit a fix, or file an issue.
Thanks for trapping!
The app runs on Railway using Railpack, which auto-detects the Ruby/Node stack and reads the Procfile for start and release commands. Postgres is also hosted on Railway as a managed service.
production— the only persistent environment. Auto-deploys frommaster. Includes the Postgres database service. Hostsforum.blitzentrapper.net.- PR environments — temporary, spun up by Railway when a pull request is opened against
masterand torn down (including their Postgres volume) when the PR is merged or closed. Each PR env is duplicated fromproduction, so it gets its own Postgres service whose data is auto-seeded from the production database on first deploy.
-
Create a new project on Railway and connect this GitHub repo.
-
Railway auto-detects the Gemfile and package.json, installs dependencies, and precompiles assets.
-
Add a Postgres service from Railway's database templates. Wire the app's
DATABASE_URLto${{Postgres.DATABASE_PUBLIC_URL}}(the public TCP-proxy URL — required because Railway runs the Procfilerelease:command during the Docker build, which doesn't have access to the private network). -
In the Railway dashboard, go to Variables and add the following:
Required platform vars (per service):
Variable Value RAILS_ENVproductionRACK_ENVproductionRAILS_SERVE_STATIC_FILEStrueRAILS_LOG_TO_STDOUTtrueNODE_ENVproductionLANGen_US.UTF-8DATABASE_URL${{Postgres.DATABASE_PUBLIC_URL}}SEED_SOURCE_DATABASE_URL${{shared.SEED_SOURCE_DATABASE_URL}}Required secrets (copy from your previous host):
COOKIE_SECRET_TOKEN/SECRET_KEY_BASE— Rails session secretAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION,AWS_BUCKET— S3 storageBUGSNAG_API_KEY,BUGSNAG_RELEASE_STAGE— Error trackingTUMBLR_API_KEY— Tumblr integrationRECAPTCHA_SITE_KEY,RECAPTCHA_SECRET_KEY— reCAPTCHA
Shared variables (project-level, for PR-env auto-seeding):
SEED_SOURCE_DATABASE_URL— production Postgres' public URL. PR environments inherit this when duplicated from production, and the release-phasedb:ensure_seededtask uses it to copy production data into the empty PR database on first deploy.
-
Enable PR Environments in Project Settings → Environments. Set Base Environment to
productionso PR envs are duplicated from prod (services, variables, and Postgres-with-an-empty-volume).
Each push to the deployed branch triggers a deploy:
- Build — Railpack detects Ruby + Node, runs
bundle install,yarn install,rake assets:precompile, andrake db:migrate(Railway runs the Procfilerelease:line as a build step). - Release —
bundle exec rake db:ensure_seeded db:migrate. In production,db:ensure_seededis a no-op. In PR envs, itpg_dumps production andpg_restores into the new PR Postgres on first deploy only. - Start —
bundle exec puma -C config/puma.rblaunches the web server.
The release-phase seeding requires pg_dump/pg_restore in the deploy image; this is configured in railpack.json via deploy.aptPackages.
railway run bundle exec rails console
railway run bundle exec rake db:seedProduction uses a Railway-managed Postgres service in the production environment. The app expects DATABASE_URL to be set; when present, it overrides the default database config.
Run a local Postgres (Postgres.app, Homebrew, Docker — your call) and you'll get a local blitzen_db_development database when you run bin/rails db:setup. The test env always uses a local blitzen_db_test.
If you'd like local dev to mirror production data, dump the production database via Railway's TCP proxy and restore it into your local Postgres:
# Get the production Postgres public URL from Railway
PROD_URL=$(railway variables --service Postgres --json --environment production | jq -r .DATABASE_PUBLIC_URL)
pg_dump --no-owner --no-acl -Fc -f /tmp/blitzen.dump "$PROD_URL"
dropdb blitzen_db_development
createdb blitzen_db_development
pg_restore --no-owner --no-acl -d blitzen_db_development /tmp/blitzen.dumpWithout DATABASE_URL set, development falls back to local Postgres (blitzen_db_development) configured in config/database.yml.