Skip to content

Swap Puma out in favour of Falcon#1083

Open
ayushn21 wants to merge 3 commits intobridgetownrb:mainfrom
ayushn21:falcon
Open

Swap Puma out in favour of Falcon#1083
ayushn21 wants to merge 3 commits intobridgetownrb:mainfrom
ayushn21:falcon

Conversation

@ayushn21
Copy link
Member

@ayushn21 ayushn21 commented Feb 27, 2026

An initial stab at swapping Puma out for Falcon.

At first look, everything seems to be working. We removed all hard dependencies on Puma last year so we might be mostly good to go here. @jaredcwhite @fpsvogel could you please give it a try on some of your websites and see how you get on? Make the following changes to your Gemfile:

-gem "puma"

+gem "bridgetown-core", github: "ayushn21/bridgetown", branch: "falcon"
+gem "falcon"

Then run bundle and you should be able to start your server with bin/bt start.

Further steps / unknowns

  • Remove references to Puma in code comments.
  • Update site template to use Falcon.
  • Swap out puma.rb for falcon.rb (if needed).
  • Figure out a production deployment setup using Falcon and Falcon Virtual where we can serve static and dynamic content simultaneously.
  • Update docs as necessary.

Resolves #4567

Notes

Can we run HTTPS locally? falcon serve serves the website over HTTPS, but doesn't run the Bridgetown build so can't be used in development.

We can't with Rackup. In a subsequent PR, I'll investigate a way to invoke the web server directly in the start command alongside the Bridgetown build. This will benefit Puma users as well because bundle exec puma offers more flexibility than Rackup.

@ayushn21
Copy link
Member Author

ayushn21 commented Feb 27, 2026

Hey @ioquatix, when you have a moment I'd really appreciate some guidance with running HTTPS locally via our bin/bt start command.

We have a Bridgetown::Server class which subclasses Rackup::Server and that's what we're starting up with bin/bt start.

Bridgetown::Server.new({
  Host: bt_options.bind,
  Port: port,
  config: rack_config_file
}).tap do |server|
  if server.serveable?
    # ...
  
    server.start(after_stop_callback)
  else
    say "Unable to find a Rack server."
  end
end

Is there a way to setup SSL here in a generic way that wouldn't break if the user was using another server like Puma, or is it too much of a hassle best left as is?

Thanks :D

@ayushn21
Copy link
Member Author

After some further research, I don't think SSL via the Rackup::Server class is possible, or a good idea. The Falcon docs say:

You can invoke Falcon via rackup:

$ rackup --server falcon
This will run a single-threaded instance of Falcon using http/1. While it works fine, it's not recommended to use rackup with falcon, because performance will be limited.

Perhaps there's another approach to explore, I'll have a think.

@ioquatix
Copy link

Rackup needs an overhaul. Other than that, the best advice is just to use config.ru and advise users to pick a server.

Regarding SSL, falcon has great support for it, using the localhost gem for self-signed local TLS, it mostly just works out of the box. https://socketry.github.io/localhost/guides/getting-started/index

I wish there was a better answer.

@ayushn21
Copy link
Member Author

ayushn21 commented Mar 2, 2026

Thanks so much @ioquatix ... thought that might be the case :).

@ayushn21 ayushn21 force-pushed the falcon branch 2 times, most recently from b7b35bb to 12c13f1 Compare March 10, 2026 23:48
@jaredcwhite
Copy link
Member

I think saying we now offer "beta" status for folks to try out Falcon is a good idea, but I'm very hesitant to change any behavior for existing & new sites which are using Puma. I'm wondering how we could modify this PR so essentially nothing has changed in the context of using Puma, but still also support the Falcon use case.

@ayushn21
Copy link
Member Author

nothing has changed in the context of using Puma, but still also support the Falcon use case.

Nothing will change for existing sites. Unless you explicitly add Falcon to your Gemfile and remove Puma, your site will keep working as it was.

Since we removed our hard dependency on Puma last year, this was actually a pretty straightforward change. All new sites will be created with falcon, but I'll add a --puma option or something like that to use Puma.

Nothing changes for existing sites unless you manually switch over to Falcon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swap Puma in favour of Falcon as the default web server

3 participants