# Deploy Sinatra

Sinatra is detected from your `Gemfile` and runs as a Ruby container on port `3000`. No Dockerfile needed - one is [generated](/platform/deployments/builds#dockerfiles-generated-or-your-own) unless the repo has its own.

## Serve it

Run a real server (Puma via `config.ru` is the standard), bound to all interfaces on the routed [port](/create/build-settings#port):

```bash
bundle exec puma -b tcp://0.0.0.0:$PORT
```

Or inside a classic-style app:

```ruby
set :bind, '0.0.0.0'
set :port, ENV.fetch('PORT', 3000)
```

## Configuration and database

Read [environment variables](/platform/environment-variables#build-time-and-runtime) with `ENV` at startup. `DATABASE_URL` from the [Credentials tab](/platform/databases/connect) plugs into Sequel or ActiveRecord directly.

## Scaling

Sinatra apps are small and boot fast - a good fit for [scale to zero](/create/scaling#min-instances). Sync Ruby workers hold a request each, so keep [concurrency](/create/scaling#concurrency) near your Puma thread count rather than the default 80.

## Related

- [Ruby](/platform/frameworks/ruby): The runtime's defaults for any Rack app.
- [Connect an app](/platform/databases/connect): DATABASE_URL, TLS, per-environment databases.
- [Scaling](/create/scaling): Matching concurrency to server threads.
