Deploy / Ruby on Rails

Deploy Ruby on Rails to Your Own Server

To deploy Ruby on Rails to your own server, install Temps on a Linux VPS and run up --preset nixpacks-ruby from the project root. Temps installs your gems, precompiles assets and starts Puma behind automatic HTTPS. You link PostgreSQL, point config/database.yml at POSTGRES_URL, and run rails db:migrate yourself after deploys that change the schema.

Last updated

Preset required

Choose the Autopack (Ruby) preset (nixpacks-ruby). Temps doesn't detect Ruby projects from a Gemfile.

How to deploy Ruby on Rails with Temps

Commands run on your machine unless they say otherwise. The CLI runs with bunx or npx.

  1. 1

    Install Temps on a Linux server

    On a VPS with at least 2 CPU cores and 4 GB of RAM, download the installer, read it, then run it. It installs Docker if needed, the Temps binary and its database, and asks how the console is reached: an sslip.io address or your own domain.

    curl -fsSL https://temps.sh/deploy.sh -o deploy.sh
    less deploy.sh
    bash deploy.sh
  2. 2

    Log in from your machine

    Point the CLI at your Temps console. It opens a browser to approve the login.

    bunx @temps-sdk/cli login https://console.example.com
  3. 3

    Point Rails at POSTGRES_URL

    Temps doesn't inject DATABASE_URL, so read the variable it does inject.

    config/database.yml
    production:
      adapter: postgresql
      url: <%= ENV["POSTGRES_URL"] %>
  4. 4

    Set the secret key base

    On apps generated before Rails 7.1, also set RAILS_SERVE_STATIC_FILES=1 on beta.56 and earlier so Puma serves the precompiled assets.

    bunx @temps-sdk/cli environments vars set SECRET_KEY_BASE "$(openssl rand -hex 64)" -e production
  5. 5

    Point the health check at a path that doesn't need the database

    Before switching traffic, Temps probes / until it answers. On the first deploy the tables don't exist yet, so if / queries the database the deploy fails before you can migrate. Set health.path to /up in .temps.yaml. Rails 7.1 and later generate the /up route.

    .temps.yaml
    health:
      path: /up
  6. 6

    Deploy Ruby on Rails

    From the project root, run up with the preset, or set it under Project → Settings → Build & deploy → Build → Framework. If the directory isn't linked to a project yet, up walks you through creating one first. For a project created from a Git repository, pushes to the tracked branch deploy automatically.

    bunx @temps-sdk/cli up --preset nixpacks-ruby
  7. 7

    Create and link a PostgreSQL database

    Temps doesn't create a database for you. Create one, then link it to the project (or use Databases → Create database in the dashboard). Linking injects POSTGRES_URL plus POSTGRES_HOST, POSTGRES_PORT, POSTGRES_DB, POSTGRES_USER and POSTGRES_PASSWORD into the next deployment. It doesn't inject DATABASE_URL.

    bunx @temps-sdk/cli services create -t postgres -n my-rails-app-db
    bunx @temps-sdk/cli services link --id <service-id> -p my-rails-app
  8. 8

    Run migrations after deploys that change the schema

    Temps doesn't run migrations and has no release phase. Find the running container, then run the migration in it over SSH, by hand or from CI right after the deploy step. Don't add it to the start command: restarts and replicas would run it more than once.

    bunx @temps-sdk/cli projects show -p my-rails-app --json   # note the numeric "id"
    bunx @temps-sdk/cli containers list -p <project-id>     # note the container_name
    ssh your-server 'docker exec <container_name> bundle exec rails db:migrate'

How Temps builds and runs Ruby on Rails

Every app runs in a Docker container on your server, behind the Temps proxy. Before traffic switches to a new deployment, Temps health-checks it; if the check fails, the deployment is marked failed and the current version keeps serving.

Installbundle install
Assetsrails assets:precompile when the app has app/assets or app/javascript
Startbundle exec rails server -b 0.0.0.0 -p $PORT (Puma); a Procfile web: line replaces it
RubyFrom .ruby-version or the ruby line in your Gemfile; defaults to 3.3
EnvironmentRAILS_ENV=production, RACK_ENV=production and RAILS_LOG_TO_STDOUT=1 are set for you

What works with Ruby on Rails on Temps

  • Puma via rails server, or your own Procfile web: line
  • Asset precompilation during the build
  • Action Cable WebSockets through the reverse proxy
  • Managed PostgreSQL and Redis you link
  • Health check before each cutover
  • Preview environments per branch (opt-in)

Managed services for Ruby on Rails

Temps runs these services on your server. Create one, link it to the project, and its connection variables reach the next deployment. Set up managed services.

PostgreSQL

Injects POSTGRES_URL once linked

Redis

Injects REDIS_URL for caching and Action Cable

Environment variables for Ruby on Rails

Set your own with environments vars set or in the project settings; values are encrypted at rest.

VariableWhat it does
SECRET_KEY_BASEGenerate with openssl rand -hex 64
POSTGRES_URLInjected when PostgreSQL is linked
REDIS_URLInjected when Redis is linked
RAILS_SERVE_STATIC_FILES1 for pre-7.1 apps on beta.56 and earlier

What it costs to self-host Ruby on Rails

Temps is free to self-host under MIT / Apache 2.0, with no per-seat fee and nothing metered, so hosting Ruby on Rails costs what the server costs. A Hetzner CX23 (2 shared vCPU, 4 GB RAM, 40 GB NVMe, 20 TB traffic) meets the minimum Temps needs and is €5.49/month excluding VAT, plus €0.50/month for an IPv4 address; Hetzner sells it in Germany and Finland only. Prices checked October 10, 2026.

TempsFree and open source (MIT / Apache 2.0)
ServerHetzner CX23: €5.49/month excluding VAT, plus €0.50/month for IPv4
What Ruby on Rails runsOne Puma container, plus the managed PostgreSQL and Redis you link, on the same server. Sidekiq needs its own service in a Docker Compose project.
ObservabilityWeb analytics, error tracking, session replay and uptime monitoring are included and run on the same server
Temps PremiumOptional: $399 per organisation per month for SAML SSO, SCIM, custom roles, approval gates and a tamper-evident audit log

For one to three production apps, the server guide recommends 4 vCPU and 8 GB RAM: a Hetzner CX33 is €8.49/month excluding VAT. Any Linux VPS that meets the minimum works; sizes and other providers are in Choosing a server. For what the same app costs on Heroku, see Temps vs Heroku.

Ruby on Rails on Temps: frequently asked questions

Does Temps run Rails migrations on deploy?

No. Run bundle exec rails db:migrate after a deploy that changes the schema, over SSH with docker exec or from CI. Point the health check at /up (Rails 7.1+) so the first deploy passes before the tables exist.

Can Temps run Sidekiq for my Rails app?

Not from a Procfile: Temps runs the web: process only and ignores worker: bundle exec sidekiq. Run Sidekiq as a service in a Docker Compose project, or outside Temps.

Why are my Rails assets returning 404?

Apps generated before Rails 7.1 serve public/ only when RAILS_SERVE_STATIC_FILES is set. Nightly builds set it for Rails apps; on beta.56 and earlier, set it to 1 yourself.

Included with every Temps project

Deployments, analytics, error tracking, session replay and uptime monitoring run in the same self-hosted platform, so your Ruby on Rails app doesn't need separate subscriptions for them.

Automatic HTTPS

Let's Encrypt certificates for every domain, issued and renewed for you.

Preview deployments

Turn on preview environments and each branch gets its own URL on your domain.

Web analytics

First-party analytics stored on your server. Add the React provider or a script tag.

Error tracking

Sentry-compatible: any Sentry SDK can report to the SENTRY_DSN Temps injects.

Session replay

Off by default. When on, it records the DOM with every input masked.

Uptime monitoring

HTTP monitors for your apps, with alerts through your notification channels.

Related guides

Deploy another framework

Deploy Ruby on Rails on a server you own

Temps is free and open source to self-host (MIT / Apache 2.0). You pay only for the server.