On this page

Ruby

Guara Cloud fully supports Ruby applications, including frameworks like Ruby on Rails, Sinatra, Hanami, and any Rack-based application.

Supported versions

The following Ruby versions are auto-detected:

  • Ruby 3.1
  • Ruby 3.2
  • Ruby 3.3

The version is auto-detected from your Gemfile or .ruby-version file.

# Gemfile
ruby '3.3.0'

Deploy with Dockerfile

For full control over your build, provide a Dockerfile in the root of your repository.

FROM ruby:3.3-slim

WORKDIR /app

RUN apt-get update -qq && apt-get install -y build-essential libpq-dev

COPY Gemfile Gemfile.lock ./
RUN bundle install --without development test

COPY . .

RUN bundle exec rake assets:precompile

EXPOSE 3000

CMD ["bundle", "exec", "puma", "-p", "3000", "-e", "production"]

Deploy with Buildpack

If your repository does not contain a Dockerfile, Guara Cloud automatically detects your Ruby project by the presence of a Gemfile.

The auto-detection will:

  1. Detect the Ruby version from Gemfile or .ruby-version
  2. Run bundle install
  3. Detect Rails applications automatically, enabling jemalloc and bootsnap for optimized performance
  4. Precompile the asset pipeline if a Rails app is detected
  5. Auto-configure Puma as the application server

Port configuration

Your application must listen on the port configured in your service settings. The default is 3000, but you can change it at any time to match your application.

port = ENV['PORT'] || 3000

For Puma, configure it in config/puma.rb:

port ENV.fetch('PORT') { 3000 }

Example project structure

my-rails-app/
  Gemfile
  Gemfile.lock
  Procfile
  config.ru
  app/
    controllers/
    models/
    views/
  config/
    puma.rb
  Dockerfile          # optional — omit to use Buildpack

Environment variables

These environment variables are commonly used with Ruby deployments:

VariableRecommended valueDescription
RAILS_ENVproductionSets the Rails environment
RACK_ENVproductionSets the Rack environment for non-Rails apps
PORTSet by platformThe port your application must listen on
SECRET_KEY_BASEYour secretRequired by Rails for encrypted cookies and sessions
RAILS_LOG_TO_STDOUTenabledSends Rails logs to stdout for visibility

Common pitfalls