# Ruby on Rails hosting in 2026: how to deploy a Rails app, and where

> A Rails app in production needs its secret_key_base, precompiled assets, migrations before each start, Puma on the port it is given, and a real database. On Livops a repository with a Gemfile and config/application.rb gets all of that from a push, for 39 credits a month (39,000 so'm). Here is how Heroku, Render, Fly.io, Railway and a VPS with Kamal compare.

Source: https://livops.dev/en/hosting/rails-hosting

By Livops team, the people who build and run Livops. Updated 20 November 2026.

Rails runs anywhere that runs Ruby, but production asks for five things development never did: the secret that signs cookies, compiled assets, migrations before the new code serves, Puma on the port the platform chose, and a database that outlives the container. This page covers each with Rails' own documentation, compares Heroku, Render, Fly.io, Railway and a VPS with Kamal with each provider's own numbers, and ends with exactly what Livops builds and starts.

## What does a Rails app need in production?

### secret_key_base, and the master key

Rails keeps secrets in `config/credentials.yml.enc`, encrypted, and decrypts it with `config/master.key` or the `RAILS_MASTER_KEY` environment variable; the master key must never be committed[1]. By default that file holds the app's `secret_key_base`[1]. Rails looks for `secret_key_base` first in the `SECRET_KEY_BASE` environment variable, then in the credentials[2] — so a platform can give the app its key without the master key, as long as nothing else in the credentials is needed. Changing it signs every user out[1].

### Precompiled assets

`RAILS_ENV=production rails assets:precompile` writes the assets to `public/assets`, and Propshaft is the default pipeline in new apps since Rails 8; before that it was Sprockets[3]. A build step has no business holding production secrets: with `SECRET_KEY_BASE_DUMMY` set, Rails generates a throwaway key for it[3][2].

### Migrations before the new code serves

`bin/rails db:prepare` is the one command that is safe on every start: on a database that does not exist yet it runs as `db:setup` does, and on one with no tables it loads the schema, runs pending migrations and loads the seeds[4]. Run it, or `db:migrate`, before the new version takes traffic, not after.

### Puma on the platform's port

The generated `config/puma.rb` reads `PORT` (3000 if unset) and `RAILS_MAX_THREADS` (3 threads)[7][6]. Workers are processes, set with `WEB_CONCURRENCY`; each one costs more memory than a thread[6]. On a small container, keep one or two.

### A database that is not a file in the container

Rails merges `DATABASE_URL` into `config/database.yml`, and the variable wins where both name a key[5]. Rails 8's generated PostgreSQL configuration names four production databases: the primary, and one each for Solid Cache, Solid Queue and Solid Cable[9]. A platform's database is usually one. Decide before the first deploy where the other three live: Solid Queue documents running in the app's single database[11]; for the others, do the same or give each entry a `url` of its own.

### HTTPS behind a proxy, and a health check

`config.assume_ssl` makes Rails believe every request arrived over SSL, and `config.force_ssl` serves everything over HTTPS and makes `https://` the default for generated URLs[5]. Behind a platform that terminates TLS and forwards `X-Forwarded-Proto: https`, both do what you want. New apps also get `/up`, which answers 200 when the app booted and 500 when it did not[10]: the path to give a platform's health check.

## The options at a glance

| Option | What it is | Smallest paid always-on web process | PostgreSQL | What you still maintain |
| --- | --- | --- | --- | --- |
| Livops | A platform; servers in Uzbekistan | 39 credits (39,000 so'm) a month | 500 MB free, one per team; 1 GB for 9 credits a month | Your code |
| Heroku | A platform of dynos and add-ons | Basic: $7 a month, 0.5 GB, always on[15] | Essential-0 from $5 a month[15] | Your code |
| Render | A platform with a native Ruby runtime | $7 a month: 0.5 CPU, 512 MB[17] | From $6 a month: 256 MB[17] | Your code |
| Fly.io | Virtual machines billed by the second | $3.69 a month for shared-cpu-1x with 512 MB; $6.70 with 1 GB[20] | Managed Postgres from $38 a month[20] | Your code and its Docker image |
| Railway | A platform billed by usage | Hobby: $5 a month including that much usage; then about $10 per GB of RAM and $20 per vCPU a month[21] | A service billed by the same usage[21] | Your code |
| A VPS with Kamal | Your own server; Rails' bundled deploy tool | 82,000 so'm a month: 1 vCPU, 2 GB, 30 GB HDD (SmartCloud)[22] | Whatever you run beside it | The server, Docker, a registry, backups, updates |

Other providers' prices are from each provider's own page, read on 20 November 2026; the dates are in Sources below. Livops prices are the ones the cabinet bills today.

## Each option

### Livops

A Rails repository is recognised and set up without a form to fill in: Bundler, the asset build, `SECRET_KEY_BASE`, `db:prepare` and Puma on `PORT` (details below). Every `git push` ships a new version. Payment is in so'm through Payme or Click, with no card, and the servers are in Uzbekistan — close to users there, farther from users elsewhere. You get no root, Ruby is 3.3 whatever the Gemfile names, and one app's memory stops at 2 GB.

### Heroku

Where Heroku is better: it has run Rails for longer than anyone, and its guide is short. Without a `Procfile` a Rails app's web process is `rails server`, which is Puma in Rails 8; assets are precompiled during the build; `DATABASE_URL` is set by the Postgres add-on, and Rails reads it by convention[16]. Migrations are a one-off `heroku run rake db:migrate`[16]. Basic is $7 a month for 0.5 GB and always on; Eco is $5 and sleeps after 30 minutes without traffic[15][16]. Essential-0 Postgres is $5 a month[15].

### Render

Ruby is one of Render's native runtimes[17]. Its Rails 8 guide uses a build script, `bin/rails server` as the start, `bin/rails db:migrate` as a pre-deploy command (paid instances only), `RAILS_MASTER_KEY` from `config/master.key`, and `WEB_CONCURRENCY=2` so Rails does not start a worker per CPU and run out of memory[18]. It also says why SQLite is out: the filesystem is ephemeral and is erased on each deploy[18]. A web service is $7 a month for 512 MB, $25 for 2 GB; Postgres starts at $6[17]. Render takes credit and debit cards[17].

### Fly.io

The lowest dollar price for the app itself: $3.69 a month for 512 MB, $6.70 for 1 GB, billed by the second[20]. Managed Postgres starts at $38 a month[20]. A card is needed once the trial ends[20].

### Railway

Every process is billed by its usage: memory about $10 per GB a month and CPU about $20 per vCPU, after the $5 Hobby plan's included usage[21]. It is paid by credit card[21].

### A VPS with Kamal

Rails ships with Kamal, which deploys the app straight to a server in Docker containers with zero downtime, and has Let's Encrypt issue the certificate; Rails' own guide asks for an Ubuntu LTS server with 1 GB of RAM or more[12]. Kamal connects over SSH (as root by default), installs Docker if it is missing, pushes the image through a registry, and has kamal-proxy route traffic to the new container once `GET /up` answers 200[13]. On a 82,000 so'm SmartCloud machine[22] that is the cheapest way to run Rails with its database, its jobs and room to spare. What Kamal does not do is look after the server: its updates, its disk, the database's backups and the registry are yours.

## Kamal or a platform: what do you maintain?

Kamal took most of the work out of running your own Rails server: one `kamal deploy` builds, ships and switches over. It did not take the server away. With Kamal you choose the machine and pay its price, and you are still the one who notices a full disk or a database without a backup. On a platform you push code and the platform runs it, its database included; you give up root and the choice of machine. If you already run servers, Kamal on a VPS is hard to beat on price. If you would rather not, use a platform.

## Where can you host Rails for free?

- **Livops** has no free tier for apps. On an account that has not paid yet, the first bot or app runs for 15 minutes on a zero balance, once, so you can watch it answer. One 500 MB database per team is free, and starts once the account has credits.
- **Render** gives free instances to web services and PostgreSQL. A free web service spins down after 15 minutes without inbound traffic and takes about a minute to start again, within 750 free instance hours a month per workspace; a free database holds 1 GB and expires 30 days after it is created[19]. Render's pre-deploy command is not available on free instances[18].
- **Heroku** lists no free dyno; Eco at $5 a month is the cheapest, and it sleeps[15].
- **Railway** has a Free plan with $1 of usage a month and up to 0.5 GB per service, whose services sleep after 5 to 10 minutes without outbound traffic; a trial gives $5 of credit for 30 days, with no card[21].
- **Fly.io** has no free tier for new organizations; a trial gives $1 of credit for 7 days[20].

## Deploy Rails on Livops

1. Push the repository. In the cabinet, click **New project** and choose it, or upload the folder as a `.zip`.
2. Under **Databases**, add PostgreSQL, and put the `pg` gem in the Gemfile. `DATABASE_URL` and the `PG*` variables are written into the service by themselves.
3. If your credentials file holds anything besides `secret_key_base`, add `RAILS_MASTER_KEY` under **Variables** and mark it as secret: its value is never shown again.
4. Deploy. The log shows Bundler, `assets:precompile`, `db:prepare` and Puma starting.

Livops makes it a Rails project when there is a `Gemfile` and `config/application.rb`, and no `Dockerfile`. What it does:

- **Install:** `bundle install` into `vendor/bundle`, inside the release. Ruby is 3.3; the `ruby` line of the Gemfile is taken out of the build's copy so Bundler does not refuse to run on a Ruby other than the one it names, and `Gemfile.lock` gets the build machine's platform added (a lock made on a Mac or with glibc only). The repository is not changed. Downloaded gems are kept between builds.
- **Build:** `rails assets:precompile` with `RAILS_ENV=production` and `SECRET_KEY_BASE_DUMMY=1`, when `Gemfile.lock` has Propshaft or Sprockets. Node and Yarn are in the build image for jsbundling. An API-only app skips this.
- **`SECRET_KEY_BASE`** is generated when the project is created and saved as a secret variable, unless you gave a value.
- **Start:**

```sh
export BUNDLE_PATH=vendor/bundle RAILS_ENV=${RAILS_ENV:-production} RAILS_LOG_TO_STDOUT=${RAILS_LOG_TO_STDOUT:-1} RAILS_SERVE_STATIC_FILES=${RAILS_SERVE_STATIC_FILES:-1}; bundle exec rails db:prepare; exec bundle exec puma -b tcp://0.0.0.0:${PORT:-3000}
```

- **The defaults** — production, logs to the **Logs** tab, static files served by the app — apply only to variables you have not set.
- **`db:prepare`** runs before every start; if it fails, Puma starts anyway and the log above it says why.
- **If the new version does not answer** within a minute, the deploy fails and the version that worked keeps serving; if the build fails, the running version is left alone. Recent versions stay in **Deploys** for a one-click rollback.
- **Memory:** the tier is 256, 512, 1024 or 2048 MiB, set with `memory` in `livops.json` when the project is created and in the settings afterwards. Each Puma worker is another copy of the app in memory; if the log says `Killed` or exit code 137, raise the tier or lower `WEB_CONCURRENCY`.
- **Files** written next to the code are gone after a restart or a deploy, the SQLite file of a default Rails 8 app included. `/app/data` (the `DATA_DIR` variable) is kept; for uploads, a storage bucket also works, its `S3_*` and `AWS_*` variables written into the service for you.

To use Rails' health route, put `livops.json` in the repository root:

```json
{
  "kind": "web",
  "healthPath": "/up",
  "memory": 512
}
```

A start command you write replaces the whole line above, `db:prepare` included; then put `bundle exec rails db:migrate` in the **Pre-deploy command** in the settings, which runs once before each new version and keeps the old one serving if it fails.

**Background jobs.** The generated `config/puma.rb` starts Solid Queue inside Puma when `SOLID_QUEUE_IN_PUMA` is set[7]: add `SOLID_QUEUE_IN_PUMA=1` under **Variables** and the jobs run in the web app, at no extra price. A separate worker process, such as `bin/jobs` or Sidekiq, is a service of its own, of type `worker`, at 19 credits a month; see [Cron and workers](https://livops.dev/en/docs/cron-workers).

**A Rack app that is not Rails** — Sinatra, Roda, Hanami — with a `Gemfile` and `config.ru` is run too: with Puma or Thin when the Gemfile has one, `rackup` otherwise, on `PORT`.

**With a `Dockerfile`** in the repository, Livops builds from it and starts its `CMD` instead; see [Docker hosting](https://livops.dev/en/hosting/docker-hosting). The one `rails new` writes runs as uid 1000, and with Thruster it exposes port 80 and starts `./bin/thrust ./bin/rails server`; without Thruster it exposes 3000 and starts `./bin/rails server`[8]. Thruster listens on `HTTP_PORT`, 80 by default[14], and on Livops a container gets no Linux capabilities, so a port below 1024 is out of reach. Remove the `Dockerfile` from the branch Livops deploys to use the build above, or make it start `./bin/rails server`, which listens on `PORT`.

A Rails app is **39 credits a month (39,000 so'm)**. One credit is 1,000 so'm, and bought credits never expire. See [Pricing](https://livops.dev/en/docs/pricing) for plans, which give more credits than they cost, and [Frameworks](https://livops.dev/en/docs/frameworks) for everything `livops.json` accepts.

## Questions

**Do I need RAILS_MASTER_KEY on Livops?**

Not to boot. When a Rails project is created, Livops generates SECRET_KEY_BASE and saves it as a secret variable, unless you gave one, and Rails reads that variable before the credentials file. If your app keeps other values in config/credentials.yml.enc, such as API keys, add RAILS_MASTER_KEY under Variables with the contents of config/master.key and mark it as secret.

**Does Livops run my migrations?**

Yes. The start command runs bin/rails db:prepare before Puma, so a new database is created and an existing one is migrated. If it fails, the server still starts and the log shows the error. To stop a deploy on a failed migration instead, write your own start command and put the migration in the Pre-deploy command.

**Are assets precompiled?**

Yes, during the build, when Gemfile.lock has Propshaft or Sprockets. It runs with RAILS_ENV=production and SECRET_KEY_BASE_DUMMY=1, so no production secret is needed at build time. An API-only app has no asset pipeline and skips the step.

**Can I keep SQLite?**

Not as your production database. Files written next to the code are gone after a restart or a deploy. Add PostgreSQL under Databases, add the pg gem, and Rails picks up DATABASE_URL by itself.

**My repository has the Dockerfile that rails new made. What happens?**

Livops builds from it and starts its CMD. That Dockerfile runs Thruster on port 80, which a container on Livops cannot open: it runs as uid 1000 with no Linux capabilities. Remove the Dockerfile from the branch Livops deploys to use the built-in Rails build, or change the Dockerfile to start rails server on PORT.

**How much does a Rails app cost on Livops?**

39 credits a month, which is 39,000 so'm at 1,000 so'm a credit. One 500 MB PostgreSQL database per team is free. There is no free tier for apps; on an account that has not paid yet, the first app runs for 15 minutes on a zero balance, once. Credits are bought in so'm through Payme or Click, with no card.

**Who wrote this comparison?**

The Livops team. Every price and limit of another provider on this page links to that provider's own page, with the day we read it.

## Sources

1. [Rails Guides — Securing Rails Applications (custom credentials)](https://guides.rubyonrails.org/security.html). Checked 20 November 2026.
2. [Rails API — Rails::Application#secret_key_base](https://api.rubyonrails.org/classes/Rails/Application.html). Checked 20 November 2026.
3. [Rails Guides — The Asset Pipeline](https://guides.rubyonrails.org/asset_pipeline.html). Checked 20 November 2026.
4. [Rails Guides — Active Record Migrations](https://guides.rubyonrails.org/active_record_migrations.html). Checked 20 November 2026.
5. [Rails Guides — Configuring Rails Applications](https://guides.rubyonrails.org/configuring.html). Checked 20 November 2026.
6. [Rails Guides — Tuning Performance for Deployment](https://guides.rubyonrails.org/tuning_performance_for_deployment.html). Checked 20 November 2026.
7. [Rails — generated config/puma.rb](https://github.com/rails/rails/blob/main/railties/lib/rails/generators/rails/app/templates/config/puma.rb.tt). Checked 20 November 2026.
8. [Rails — generated Dockerfile](https://github.com/rails/rails/blob/main/railties/lib/rails/generators/rails/app/templates/Dockerfile.tt). Checked 20 November 2026.
9. [Rails — generated config/database.yml for PostgreSQL](https://github.com/rails/rails/blob/main/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt). Checked 20 November 2026.
10. [Rails — generated config/routes.rb](https://github.com/rails/rails/blob/main/railties/lib/rails/generators/rails/app/templates/config/routes.rb.tt). Checked 20 November 2026.
11. [Solid Queue — README](https://github.com/rails/solid_queue). Checked 20 November 2026.
12. [Rails Guides — Getting Started with Rails (Deploying to Production)](https://guides.rubyonrails.org/getting_started.html). Checked 20 November 2026.
13. [Kamal — Installation](https://kamal-deploy.org/docs/installation/). Checked 20 November 2026.
14. [Thruster — README](https://github.com/basecamp/thruster). Checked 20 November 2026.
15. [Heroku — Pricing](https://www.heroku.com/pricing). Checked 20 November 2026.
16. [Heroku — Getting Started on Heroku with Rails 8.x](https://devcenter.heroku.com/articles/getting-started-with-rails8). Checked 20 November 2026.
17. [Render — Pricing](https://render.com/pricing). Checked 20 November 2026.
18. [Render — Deploy Ruby on Rails 8](https://render.com/docs/deploy-rails-8). Checked 20 November 2026.
19. [Render — Deploy for free](https://render.com/docs/free). Checked 20 November 2026.
20. [Fly.io — Pricing](https://docs.fly.io/about/pricing). Checked 20 November 2026.
21. [Railway — Pricing](https://railway.com/pricing). Checked 20 November 2026.
22. [SmartCloud — VDS plans](https://smartcloud.uz/cloud-services/vds/). Checked 20 November 2026.
