Skip to content

Quick Start — Ruby

Deploy a Ruby app (Sinatra, Rails, Roda, plain Rack) from git push to a live HTTPS URL in 5 minutes.

Prerequisites

  • A Ruby project with Gemfile
  • Ruby 3.2+ on your machine (ruby --version)
  • The paas CLI:
    curl -fsSL https://get.di2amp.com/install.sh | sh
    paas --version
    

Scaffold (if you don't have a project yet — Sinatra)

mkdir hello-paas && cd hello-paas
cat > Gemfile <<'EOF'
source 'https://rubygems.org'
ruby '~> 3.2'
gem 'sinatra', '~> 4.0'
gem 'puma', '~> 6.4'
gem 'rackup', '~> 2.1'
EOF
cat > app.rb <<'EOF'
require 'sinatra'

set :bind, '0.0.0.0'
set :port, ENV.fetch('PORT', 4567)

get '/' do
  "Hello from PaaS Runtime!\n"
end
EOF
cat > config.ru <<'EOF'
require './app'
run Sinatra::Application
EOF
bundle install
git init && git add -A && git commit -m "init"

Step 1 — Authenticate

paas login

Verify:

$ paas whoami
octave@paas.local (member of: paas-default)

Step 2 — Create the app

paas apps create hello-paas

Output:

✓ Created app hello-paas
  URL:    https://hello-paas.runtime.di2amp.com
  Region: eu-fr-1
  Plan:   free
  Git:    https://git.di2amp.com/octave/hello-paas.git

Step 3 — Add a Procfile

The Paketo Ruby buildpack reads Gemfile + Gemfile.lock and installs gems with bundler. Use Puma for production:

# Procfile
web: bundle exec puma -p $PORT config.ru

For Rails:

# Procfile
web: bundle exec puma -C config/puma.rb -p $PORT
release: bundle exec rails db:migrate

Commit:

git add Procfile && git commit -m "add Procfile"

Step 4 — Push to deploy

git push paas main

Live build logs:

remote: ─────── PaaS Build ───────
remote: → Detected: ruby (paketo-buildpacks/ruby)
remote: → Installing MRI Ruby 3.3.0
remote: → Installing bundler 2.5.6
remote: → Running: bundle install --without development:test
remote: → Image:    registry.di2amp.com/octave/hello-paas:abc1234
remote: → Image size: 78 MB
remote: → SBOM:     ✓ generated, 17 packages
remote: → CVE scan: ✓ 0 critical, 0 high
remote:
remote: ─────── PaaS Deploy ───────
remote: → Process types: web
remote: → Replicas:      1/1 ready
remote: → Rollout:       v1 → v2 (canary 10% → 100%)
remote: → Health:        / returns 200 OK
remote: → URL:           https://hello-paas.runtime.di2amp.com
remote:
remote: ✓ Deployed in 36s

Step 5 — Verify the app is live

$ curl https://hello-paas.runtime.di2amp.com/
Hello from PaaS Runtime!

Dashboard runtime status:

https://ma30.di2amp.com/runtime/dashboard/apps/hello-paas

Next steps

Add a managed PostgreSQL

paas addons create database --type postgres --plan free --name db

DATABASE_URL is injected:

require 'pg'
conn = PG.connect(ENV['DATABASE_URL'])

Or in Rails config/database.yml:

production:
  url: <%= ENV['DATABASE_URL'] %>

Tail logs

paas logs --tail

Run database migrations

The release process type runs once before each deploy:

# Procfile
web: bundle exec puma -p $PORT
release: bundle exec rails db:migrate

Add a Sidekiq worker

# Procfile
web: bundle exec puma -p $PORT
worker: bundle exec sidekiq

Then push:

git push paas main
paas ps:scale worker=2

Scale web

paas ps:scale web=3

See also