Skip to content
GigadriveDocs

Sinatra

What Gigadrive Network detects for a Sinatra application and how it runs one with or without a config.ru.

Gigadrive Network detects Sinatra when your Gemfile.lock, or your Gemfile without a lockfile, lists the sinatra gem. Padrino applications depend on Sinatra and are detected the same way.

Defaults

SettingValue
RuntimeThe Ruby version your project names, ruby-34 when it names none
Memory256 MB
Max duration30 seconds
Entrypointconfig.ru, or the application script without one
Route/* to the entrypoint
Assetspublic, when the directory exists

The entrypoint is your config.ru when there is one. Without it, the preset takes the first of app.rb, main.rb, server.rb and application.rb, and Gigadrive Network loads that script and serves Sinatra::Application, which is where a classic Sinatra application defines its routes. A modular application, one that subclasses Sinatra::Base, needs a config.ru that runs its class.

The preset writes APP_ENV=production and RACK_ENV=production, so Sinatra runs with its production settings.

How requests are served

Your application runs on Puma: the one in your Gemfile.lock when you added it, and otherwise a copy Gigadrive Network provides, so a Sinatra application needs no server gem of its own. Server-sent events written with stream, sent as text/event-stream, reach the client as your application writes them.

Sinatra signs its session cookie with a secret it generates when it starts, which differs between copies of your Function. Set set :session_secret, ENV.fetch("SESSION_SECRET") and store SESSION_SECRET under Environment variables once your application uses sessions.

The build

The build installs your gems with Bundler into vendor/bundle, leaving out the development and test groups, and runs a build script from package.json when there is one. Runtimes covers how the Ruby version is chosen.

Sinatra's own documentation lives at sinatrarb.com.