This is my production-ready Rails 8 template optimized for Railway. It ships with:
- ⚙️ Solid Stack:
solid_cache,solid_queue,solid_cable - 📦 Four separate PostgreSQL services (no Redis)
- 📫 Postmark for production email & Letter Opener in development
- 🔐 Devise for authentication (I usually need more advanced flows than what Rails 8 provides out of the box)
- 🐳 Dockerfile build without Thruster
If you’re tired of copy-pasting the same setup every time you spin up a new project, or just want to see how Rails 8 works with Railway and Solid Stack, this template saves you the headache.
CREDITS:
- Thank you to this video tutorial on How to Configure Multiple Databases with Rails 8 by GoRails
- See me troubleshooting the Docker / Thruster issue here in Railway Station
Want everything done for you?
Then just:
- Add your
RAILS_MASTER_KEYto Railway (fromconfig/master.key) - Generate a domain in the App Service settings
- Update your production
action_mailer.default_url_optionswith that domain - (Optional) Add your Postmark API token
- (Optional) Change storage to S3 instead
Boom. You’re deployed.
Scroll down if you want to understand what’s under the hood, or how to do this all from scratch.
If you’d rather understand each moving piece (or use this in an existing app), here’s the build-your-own-guide:
rails new myapp --css=tailwind --database=postgresql
cd myappIn your Gemfile, add:
# Auth
gem 'devise'
# Job Monitoring
gem 'mission_control-jobs'
# Email
gem 'postmark-rails'
# Dev
group :development do
gem 'letter_opener'
endThen run:
bundle installSet up your models/routes accordingly.
Create 4 databases on Railway:
PRIMARY_DATABASE_URLCACHE_DATABASE_URLQUEUE_DATABASE_URLCABLE_DATABASE_URL
Update your config/database.yml to map them properly (template shows how).
Make sure to double check that these files match the template:
application.rb- adds MissionControl auth, you can set this to use credentials or environment variables insteadcable.yml- sets up solid cable in devdatabase.yml- sets up development & production databases for solid stackdevelopment.rb- adds letter_opener and solid stackpuma.rb- sets up solid queue in developmentroutes.rb- adds /jobs routeDockerfile- replaces defaultCMD ["./bin/thrust", "./bin/rails", "server"]withCMD bin/rails server -b 0.0.0.0 -p ${PORT}to work with Railwaydocker-entrepoint- sets up the databases for solid stackGemfile- adds Mission Control, Letter Opener, Devise, and Postmark gems
You can focus on just production changes and ignore the development changes, but I recommend setting it up like the template so it's easy to catch issues before pushing to production
Default: Volume-mounted local storage
Optional: Switch to S3 in production
To keep it simple, on Railway, add a persistent volume to the App service and mount it to /rails/storage. This ensures uploaded files persist between deploys when using local disk Active Storage.
For dev, letter_opener is already set up. Emails open in your browser.
(Optional) Use Postmark by following instructions in your Postmark Dashboard.
You can generate a public domain in Railway under App Service → Settings → Networking.
Run everything with:
bin/devThis runs Rails + Tailwind in parallel.
Visit /up to check your app’s health (Rails 8 ships with this endpoint by default for uptime checks).
Don’t forget:
- Set up your credentials:
EDITOR="code --wait" bin/rails credentials:edit - Add a
master.keyif you didn’t already - Check
/jobsto monitor queues in dev
Minimum required:
RAILS_ENV = productionRAILS_MASTER_KEY = your_local_key_herePRIMARY_DATABASE_URL = created_by_templateCACHE_DATABASE_URL = created_by_templateQUEUE_DATABASE_URL = created_by_templateCABLE_DATABASE_URL = created_by_template
Optional:
POSTMARK_API_TOKEN
Any questions, feel free to email me at ADHDCoder.com