Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3498404
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:29:09+00:00 2026-05-18T12:29:09+00:00

I’m new to ruby, learning Sinatra. While creating a Sinatra site by requiring ‘sinatra’

  • 0

I’m new to ruby, learning Sinatra. While creating a Sinatra site by requiring 'sinatra' and setting up the routes directly under is pretty easy and rather well documented, creating an application by requiring 'sinatra/base' and writing a class that inherits from 'Sinatra::Base‘, while still relatively easy, is very poorly documented (maybe because it’s a pretty recent feature of Sinatra).

And that’s exactly what I am doing. I am not having too much trouble on the Sinatra part, however I am having a bit of trouble on the rackup/thin/server part. Apparently there are two ways to deploy the application: using Sinatra itself (using the run! method) and using a rackup file (typically config.ru).

Using Sinatra’s run! method is extremely intuitive and works like a charm, but apparently it doesn’t work if I want to deploy my app on heroku. As a matter of fact, almost all the Sinatra apps that I have encountered on GitHub use a config.ru file.

Using a rackup file might be equally intuitive, but I can’t manage to understand how to pass options from the Sinatra app to the server (ir: the port). I tried to merge options to rackup’s default options array:

MyApp::App.default_options.merge!(
  :run  => false,
  :env  => :production,
  :port => 4567
)

run MyApp::App

by adding options directly to the app:

MyApp::App.set :port, 4567
MyApp::App.set :run, false
MyApp::App.set :env, :production

run MyApp::App

by setting options from within the application class:

module MyApp
  class App < Sinatra::Base
    set :port, 4567
    set :run, false
    set :env, :production

    # ...

  # config.ru
  require 'app'

  run MyApp::App

All the methods above failed, either by showing error messages or by just not taking any of the options into consideration. So is there any way to pass options to rackup/thin/the sever via a Sinatra app when using a rackup file? Or the options in questions should be passed directly to rackup/thin/the sever via command-line options?

As a reference to the problem, here is the little Sinatra application I am building: https://github.com/AzizLight/Wiki/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:29:09+00:00Added an answer on May 18, 2026 at 12:29 pm

    You’re actully going to pass options to thin on the command line directly or via a configuration file. See all options:

    $ thin -h
    

    For production, use a configuration file:

    $ thin -C thin-production.yml -R config.ru start
    

    Here is an example thin-production.yml file:

    ---
    address: localhost
    port: 3020
    servers: 4
    max_conns: 1024
    max_persistent_conns: 512
    timeout: 30
    environment: production
    pid: tmp/pids/thin-production.pid
    log: log/thin-production.log
    daemonize: true 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.