Deploy a Ruby on Rails App
Deploy a Rails application to Vardo using Railpacks or a custom Dockerfile.
This tutorial covers deploying a Ruby on Rails app from GitHub to Vardo. You've got two build options — Railpacks (zero-config) or a custom Dockerfile.
Prerequisites
- A running Vardo instance (installation guide)
- GitHub connected to Vardo (setup instructions)
- A GitHub repo containing a Rails app
1. Create a project
- Go to Projects in the sidebar
- Click New Project
- Name it — e.g.,
my-rails-app - Click Create
2. Create the app
- Inside your project, click New App
- Choose GitHub as the source
- Search for and select your repository
- Pick the branch to deploy from (usually
main) - Choose a build method:
Option A: Railpacks (recommended)
Select Railpacks as the build template. Railpacks detects your Ruby version, installs dependencies, precompiles assets and starts your app automatically. No config files needed.
It handles:
- Ruby version detection from
.ruby-versionorGemfile bundle installwith proper cachingrails assets:precompilerails db:migrateon deploy- Starting Puma on port 3000
Option B: Dockerfile
If your repo has a Dockerfile, Vardo uses it directly. A typical Rails Dockerfile looks like:
FROM ruby:3.3-slim
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
WORKDIR /app
COPY Gemfile Gemfile.lock ./
RUN bundle install
COPY . .
RUN bundle exec rails assets:precompile
EXPOSE 3000
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]- Click Create App
3. Set environment variables
Rails apps typically need a few env vars to run in production:
- Open the app detail page
- Click the Environment tab
- Add your variables:
RAILS_ENV=production SECRET_KEY_BASE=your-secret-key-here DATABASE_URL=postgresql://user:pass@db-host:5432/myapp_production RAILS_SERVE_STATIC_FILES=true - Click Save
Generate a SECRET_KEY_BASE with rails secret locally if you don't have one.
4. Set up the database
If your Rails app uses PostgreSQL, you've got two options:
Option A: Add a Postgres app in the same project. Create a new app using the Postgres template, then reference it via DATABASE_URL in your Rails app's environment.
Option B: Use an external database. Point DATABASE_URL at your managed database (RDS, Neon, Supabase, etc.).
Either way, Vardo runs rails db:migrate automatically during Railpacks deploys. If you're using a Dockerfile, add a release command or run migrations in your entrypoint.
5. Deploy
- Click Deploy on the app detail page
- Watch the build log — Railpacks installs dependencies, precompiles assets and starts Puma
- When the status changes to Running, you're live
Subsequent pushes to your configured branch trigger deploys automatically.
6. Add a custom domain
- Go to the app's Domains tab
- Click Add Domain
- Enter your domain — e.g.,
app.mycompany.com - Add a DNS record:
CNAME app.mycompany.com → vardo.example.com - Click Verify — Vardo provisions a TLS certificate automatically
Troubleshooting
Build fails: Your Ruby version is X, but your Gemfile specified Y
Railpacks reads .ruby-version or the ruby directive in your Gemfile. Make sure one of them matches what you actually want.
Assets not loading in production
Set RAILS_SERVE_STATIC_FILES=true in your environment variables. Without it, Rails expects a reverse proxy to serve static files — Vardo handles routing but the app container needs to serve its own assets.
Migrations fail on deploy
Check the deploy logs. Common issues:
DATABASE_URLnot set or pointing at the wrong host- Database doesn't exist yet — create it first via
rails db:createor your database provider's dashboard - Pending migrations with syntax errors — test locally first with
rails db:migrate
Next steps
- Set up automatic backups for your database
- Add a custom domain with automatic TLS
- Set up preview environments for PR-based deploys