Log inStart free
← Guides

Deploy Ruby on Rails

Deploy a Ruby on Rails app to Aloof in a few minutes. You need the CLI (curl -fsSL https://www.aloof.si/cli/aloof -o aloof && chmod +x aloof) and an account (aloof signup you@example.com, free tier, no card).

1. Generate config

aloof launch detects Ruby on Rails from Gemfile with rails and writes a Dockerfile (unless you have one), aloof.toml and .dockerignore.

$ aloof launch --name my-rails

2. Review aloof.toml

app = "my-rails"
primary_region = "eu-de"

[http_service]
  internal_port = 8080
  auto_stop_machines = true
  min_machines_running = 0

[processes]
  web = "bin/rails server -b 0.0.0.0 -p $PORT"

[deploy]
  release_command = "bin/rails db:migrate"

Aloof sets PORT=8080. With min_machines_running = 0 the app sleeps when idle and you pay per second only while it runs.

3. Database (optional)

$ aloof pg create my-rails-db --plan pg-dev
$ aloof pg attach my-rails-db my-rails     # sets DATABASE_URL over the private network

4. Deploy

$ aloof deploy
live: https://my-rails.aloof.si/

The directory is uploaded (respecting .dockerignore) and built remotely. The release command runs before new instances take traffic; if it fails, the previous release keeps serving.

Notes for Ruby on Rails

Set RAILS_MASTER_KEY with aloof secrets set. Add worker = "bundle exec sidekiq" (or bin/jobs for Solid Queue) under [processes].

Next