Ruby Framework
Ruby on Rails is a full-stack web framework written in Ruby. Alkimist provides complete support for Rails applications with automatic configuration, database migrations, and production optimizations.
A typical Rails application structure:
app/
controllers/
models/
views/
config/
routes.rb
database.yml
Gemfile
Rails applications must implement a /up endpoint that returns a simple health check response. Here's how to implement it:
Rails 7.1+ includes a built-in health check endpoint. Add this to your config/routes.rb:
# config/routes.rb
Rails.application.routes.draw do
# Your existing routes...
# Health check endpoint
get "up", to: "rails/health#show", as: :rails_health_check
end
This will automatically return 200 OK if the application boots successfully.
If you need a custom health check, create a controller:
# app/controllers/health_controller.rb
class HealthController < ApplicationController
skip_before_action :verify_authenticity_token
def show
render plain: "ok", status: :ok
end
end
And add the route:
# config/routes.rb
get "up", to: "health#show"
For the simplest implementation:
# config/routes.rb
get "up", to: proc { [200, {}, ["ok"]] }
Alkimist automatically detects your database from your Gemfile. Supported databases:
gem 'pg'
gem 'mysql2'
gem 'sqlite3'
Set your environment variables in the project settings. Common Rails environment variables:
RAILS_ENV=productionRAILS_MASTER_KEY (for encrypted credentials)DATABASE_URL (automatically configured)REDIS_URL (if using Redis)Alkimist automatically:
Gemfile
Dockerfile
A minimal Rails application with health check:
# config/routes.rb
Rails.application.routes.draw do
get "up", to: "rails/health#show", as: :rails_health_check
root "home#index"
end
That's it! The health check endpoint will be available at /up and return 200 OK when your application is running.